@amp-labs/react 1.17.5 → 1.17.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,30 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),g=require("react"),T=require("@chakra-ui/react");require("react-dom");function Fl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const $=Fl(g),Ml={primary:{bg:"black",color:"white",_hover:{bg:"gray.700",_disabled:{bg:"gray.600"}},_disabled:{bg:"gray.600",color:"gray.300",cursor:"not-allowed",opacity:1}},danger:{bg:"red.50",outline:"2px solid red.100",outlineOffset:"0",borderColor:"red.100",color:"red.800",_hover:{bg:"red.100"}}},Ll=T.extendTheme({components:{Tabs:{baseStyle:{tab:{width:"100%",borderRadius:"4px",_hover:{bg:"gray.200"},_selected:{color:"black",fontWeight:"500",bg:"gray.100",border:"none",_hover:{bg:"gray.200"}}},warningTab:{width:"100%",borderRadius:"4px",_hover:{bg:"red.100"},_selected:{color:"red.800",fontWeight:"500",bg:"red.50",border:"none",_hover:{bg:"red.100"}}}}},Button:{variants:Ml}}}),$l=T.extendTheme(Ll);function Kl({children:e}){return a.jsx(T.ChakraProvider,{theme:$l,children:e})}const Ms=g.createContext(null),Vl=Ms.Provider,Ve=()=>{const e=g.useContext(Ms);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var Se=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e))(Se||{});const Ls=g.createContext(void 0);function sn(){const e=g.useContext(Ls);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Hl=(()=>{const e={};return Object.values(Se).forEach(t=>{e[t]={}}),e})();function Bl({children:e}){const[t,n]=g.useState(Hl),r=g.useCallback((d,f,h=!0)=>{n(p=>{const m={...p};return m[d]=m[d]||{},m[d][f]=h,m})},[n]),i=g.useCallback((d,f)=>{var h;return!!((h=t[d])!=null&&h[f])},[t]),o=g.useCallback((d,f)=>{var h;return(h=t[d])==null?void 0:h[f]},[t]),s=g.useCallback((d,f)=>{n(h=>{var m;const p={...h};return(m=p[d])==null||delete m[f],p})},[n]),c=g.useCallback(d=>{n(f=>{const h={...f};return h[d]={},h})},[n]),l=g.useCallback((d,f)=>{n(h=>{const p={...h};return p[d]=p[d]||{},f.forEach(m=>{p[d][m]=!0}),p})},[n]),u=g.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:c,setErrors:l,getError:o}),[t,n,r,i,s,c,l,o]);return a.jsx(Ls.Provider,{value:u,children:e})}function Ui(){return a.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ul(e,t){try{return process.env[e]}catch{return t}}function Xn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function At(e,t){return(t==null?void 0:t.displayName)??Xn(e)}const Uo=e=>e.split(`
2
- `).filter(n=>n.trim()!==""),ql=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Pe=Ul("REACT_APP_ENABLE_CSS",!1)==="true",Wl="_box_1is6l_1",qi={box:Wl};function an({children:e,className:t,style:n}){return Pe?a.jsx("div",{className:t?`${qi.box} ${t}`:qi.box,style:n,children:e}):a.jsx(T.Box,{className:t,style:n,borderWidth:1,borderRadius:4,children:e})}const Jl="_container_1wvzr_1",Wi={container:Jl};function Mn({children:e,className:t,style:n}){return Pe?a.jsx("div",{className:t?`${Wi.container} ${t}`:Wi.container,style:n,children:e}):a.jsx(T.Container,{className:t,style:n,children:e})}const zl="_errorBoxContainer_1qhwq_1",Xl="_errorBox_1qhwq_1",Gl="_errorText_1qhwq_20",so={errorBoxContainer:zl,errorBox:Xl,errorText:Gl};function qt({message:e}){return Pe?a.jsxs(Mn,{className:so.errorBoxContainer,children:[a.jsx(Ui,{}),a.jsx(an,{className:so.errorBox,children:a.jsx("p",{className:so.errorText,children:e})})]}):a.jsxs(T.Box,{minHeight:"300px",padding:"30px",display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"center",children:[a.jsx(Ui,{}),a.jsx(T.Box,{boxSizing:"border-box",display:"flex",justifyContent:"center",alignItems:"center","align-self":"stretch",padding:"12px 50px 12px 50px",borderRadius:"8px",border:"2px solid #FECACA",background:"#FEF2F2",children:a.jsx(T.Text,{color:"#991B1B",fontSize:"md",children:e})})]})}const Yl="https://api.withampersand.com/v1".replace(/\/+$/,"");class $s{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Yl}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Vs}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Zl=new $s,Ur=class Ur{constructor(t=Zl){this.configuration=t,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let o;try{o=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const c of this.middleware)c.onError&&(o=await c.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new tu(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?Ur.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:i}=await this.createFetchParams(t,n),o=await this.fetchApi(r,i);if(o&&o.status>=200&&o.status<300)return o;throw new Ks(o,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(u=>i[u]===void 0?delete i[u]:{});const o=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},c={...s,...await o({init:s,context:t})},l={...c,body:eu(c.body)||c.body instanceof URLSearchParams||Ql(c.body)?c.body:JSON.stringify(c.body)};return{url:r,init:l}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Ur.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Pt=Ur;function Ql(e){return typeof Blob<"u"&&e instanceof Blob}function eu(e){return typeof FormData<"u"&&e instanceof FormData}class Ks extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class tu extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function K(e,t){const n=e[t];return n!=null}function Vs(e,t=""){return Object.keys(e).map(n=>Hs(n,e[n],t)).filter(n=>n.length>0).join("&")}function Hs(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${i}`}if(t instanceof Set){const i=Array.from(t);return Hs(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Vs(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function qo(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class De{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Nn{constructor(t){this.raw=t}async value(){}}class nu{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function ru(e){return ou(e)}function ou(e,t){return e==null?e:{fieldUsed:K(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:K(e,"keyFormat")?e.keyFormat:void 0}}function iu(e){return su(e)}function su(e,t){return e==null?e:{name:e.name,valuePrefix:K(e,"valuePrefix")?e.valuePrefix:void 0}}function au(e){return cu(e)}function cu(e,t){return e==null?e:{name:e.name}}function lu(e){return uu(e)}function uu(e,t){return e==null?e:{attachmentType:e.attachmentType,query:K(e,"query")?au(e.query):void 0,header:K(e,"header")?iu(e.header):void 0,docsURL:K(e,"docsURL")?e.docsURL:void 0}}function du(e){return pu(e)}function pu(e,t){return e}function fu(e){return mu(e)}function mu(e,t){return e==null?e:{days:K(e,"days")?e.days:void 0,fullHistory:K(e,"fullHistory")?e.fullHistory:void 0}}function hu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Bs(e){return gu(e)}function gu(e,t){return e==null?e:{defaultPeriod:fu(e.defaultPeriod)}}function yu(e){if(e!==void 0)return e===null?null:{defaultPeriod:hu(e.defaultPeriod)}}function vu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function wu(e){if(e!==void 0)return e===null?null:{defaultPeriod:vu(e.defaultPeriod)}}function Iu(e){return xu(e)}function xu(e,t){return e==null?e:{enabled:K(e,"enabled")?e.enabled:void 0}}function Us(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function bu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:wu(e.backfill)}}function _u(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qo(e.objects,bu)}}function Cu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function Su(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qo(e.objects,Cu)}}function Eu(e){return Ou(e)}function Ou(e,t){return e==null?e:{apiKeyAsBasic:K(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:K(e,"apiKeyAsBasicOpts")?ru(e.apiKeyAsBasicOpts):void 0,docsURL:K(e,"docsURL")?e.docsURL:void 0}}function Nu(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function gr(e){return Tu(e)}function Tu(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:K(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Ru(e){return Au(e)}function Au(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Pu(e){return ju(e)}function ju(e,t){return e==null?e:{provider:e.provider,read:K(e,"read")?e.read:void 0,write:K(e,"write")?e.write:void 0,proxy:K(e,"proxy")?Iu(e.proxy):void 0}}function qs(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:Us(e.proxy)}}function Du(e){return ku(e)}function ku(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Pu(e.content)}}function Fu(e){return Mu(e)}function Mu(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Ws(e){return Lu(e)}function Lu(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Cr(e){return $u(e)}function $u(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:K(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:K(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Sr(e){return Ku(e)}function Ku(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:Cr(e.providerApp),group:Ws(e.group),consumer:Fu(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:K(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Vu(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:qs(e.content)}}function Hu(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Vu(e.config)}}function Bu(e){return Uu(e)}function Uu(e,t){return e==null?e:{enabled:K(e,"enabled")?e.enabled:void 0}}function qu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Wu(e){return Ju(e)}function Ju(e,t){return e==null?e:{mode:K(e,"mode")?e.mode:void 0,pageSize:K(e,"pageSize")?e.pageSize:void 0}}function zu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Xu(e){let t=!0;return t=t&&"fieldName"in e,t}function Gu(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:K(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Yu(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Zu(e){let t=!0;return t=t&&"mapToName"in e,t}function Js(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:K(e,"default")?e.default:void 0,prompt:K(e,"prompt")?e.prompt:void 0}}function Qu(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ji(e){return ed(e)}function ed(e,t){return e==null?e:{...Gu(e),...Js(e)}}function zi(e){if(e!==void 0)return e===null?null:Xu(e)?Yu(e):Zu(e)?Qu(e):{}}function zs(e){return td(e)}function td(e,t){return e}function nd(e){return rd(e)}function rd(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:K(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:K(e,"requiredFields")?e.requiredFields.map(Ji):void 0,optionalFields:K(e,"optionalFields")?e.optionalFields.map(Ji):void 0,optionalFieldsAuto:K(e,"optionalFieldsAuto")?zs(e.optionalFieldsAuto):void 0,backfill:K(e,"backfill")?Bs(e.backfill):void 0,delivery:K(e,"delivery")?Wu(e.delivery):void 0}}function od(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(zi),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(zi),optionalFieldsAuto:e.optionalFieldsAuto,backfill:yu(e.backfill),delivery:zu(e.delivery)}}function id(e){return sd(e)}function sd(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(nd):void 0}}function ad(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(od)}}function cd(e){return ld(e)}function ld(e,t){return e==null?e:{objectName:e.objectName,inheritMappingFromRead:K(e,"inheritMappingFromRead")?e.inheritMappingFromRead:void 0}}function ud(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMappingFromRead:e.inheritMappingFromRead}}function dd(e){return pd(e)}function pd(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(cd):void 0}}function fd(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ud)}}function md(e){return hd(e)}function hd(e,t){return e==null?e:{name:e.name,displayName:K(e,"displayName")?e.displayName:void 0,provider:e.provider,read:K(e,"read")?id(e.read):void 0,write:K(e,"write")?dd(e.write):void 0,proxy:K(e,"proxy")?Bu(e.proxy):void 0}}function gd(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:ad(e.read),write:fd(e.write),proxy:qu(e.proxy)}}function yd(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:gd(e.content)}}function vd(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:yd(e.latestRevision)}}function wd(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Id(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function xd(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function bd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function _d(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Cd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Sd(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:bd(e.basicAuth),oauth2ClientCredentials:_d(e.oauth2ClientCredentials),oauth2Password:Cd(e.oauth2Password)}}function Ed(e){return Od(e)}function Od(e,t){return e==null?e:{enabled:K(e,"enabled")?e.enabled:void 0}}function Nd(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:K(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,displayName:e.displayName}}function ao(e){return Td(e)}function Td(e,t){return e==null?e:{...Nd(e),...Js(e)}}function Rd(e){return Ad(e)}function Ad(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:K(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:K(e,"requiredFields")?e.requiredFields.map(ao):void 0,optionalFields:K(e,"optionalFields")?e.optionalFields.map(ao):void 0,optionalFieldsAuto:K(e,"optionalFieldsAuto")?zs(e.optionalFieldsAuto):void 0,allFields:K(e,"allFields")?e.allFields.map(ao):void 0,backfill:K(e,"backfill")?Bs(e.backfill):void 0}}function Pd(e){return jd(e)}function jd(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(Rd):void 0}}function Dd(e){return kd(e)}function kd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function Fd(e){return Md(e)}function Md(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(Dd):void 0}}function Ld(e){return $d(e)}function $d(e,t){return e==null?e:{name:e.name,displayName:K(e,"displayName")?e.displayName:void 0,provider:e.provider,read:K(e,"read")?Pd(e.read):void 0,write:K(e,"write")?Fd(e.write):void 0,proxy:K(e,"proxy")?Ed(e.proxy):void 0}}function Kd(e){return Vd(e)}function Vd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Ld(e.content)}}function Hd(e){if(e!==void 0)return e===null?null:{providerAppId:e.providerAppId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:e.providerConsumerRef,refreshToken:e.refreshToken,scopes:e.scopes}}function Bd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:qs(e.content)}}function Ud(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:Hd(e.connection),config:Bd(e.config)}}function Un(e){return qd(e)}function qd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:K(e,"group")?Ws(e.group):void 0,healthStatus:e.healthStatus,connection:Sr(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0,config:Du(e.config)}}function Wd(e){return Jd(e)}function Jd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:md(e.content)}}function Xi(e){return zd(e)}function zd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Wd(e.latestRevision)}}function Xd(e){return Gd(e)}function Gd(e,t){return e==null?e:{iconURL:K(e,"iconURL")?e.iconURL:void 0,logoURL:K(e,"logoURL")?e.logoURL:void 0}}function Yd(e){return Zd(e)}function Zd(e,t){return e==null?e:{iconURL:K(e,"iconURL")?e.iconURL:void 0,logoURL:K(e,"logoURL")?e.logoURL:void 0}}function Qd(e){return ep(e)}function ep(e,t){return e==null?e:{regular:K(e,"regular")?Yd(e.regular):void 0,darkMode:K(e,"darkMode")?Xd(e.darkMode):void 0}}function tp(e){return np(e)}function np(e,t){return e==null?e:{workspaceRefField:K(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:K(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:K(e,"scopesField")?e.scopesField:void 0}}function rp(e){return op(e)}function op(e,t){return e==null?e:{grantType:e.grantType,authURL:K(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:K(e,"audience")?e.audience:void 0,tokenMetadataFields:tp(e.tokenMetadataFields),docsURL:K(e,"docsURL")?e.docsURL:void 0,authURLParams:K(e,"authURLParams")?e.authURLParams:void 0}}function ip(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function sp(e){return ap(e)}function ap(e,t){return e==null?e:{bulkWrite:Ru(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Gi(e){return cp(e)}function cp(e,t){return e==null?e:{name:e.name,authType:du(e.authType),baseURL:e.baseURL,oauth2Opts:K(e,"oauth2Opts")?rp(e.oauth2Opts):void 0,apiKeyOpts:K(e,"apiKeyOpts")?lu(e.apiKeyOpts):void 0,basicOpts:K(e,"basicOpts")?Eu(e.basicOpts):void 0,support:sp(e.support),providerOpts:e.providerOpts,displayName:K(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:K(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:K(e,"media")?Qd(e.media):void 0,labels:K(e,"labels")?e.labels:void 0}}function lp(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:_u(e.read),write:Su(e.write),proxy:Us(e.proxy)}}function up(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:lp(e.content)}}function dp(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:up(e.config)}}function pp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:dp(e.installation)}}function fp(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function mp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:fp(e.project)}}function hp(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function gp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:hp(e.providerApp)}}class yp extends Pt{async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Sd(t.generateConnectionParams)},n);return new De(o,s=>Sr(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:i,query:r},n);return new De(o,s=>Sr(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(Sr))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class vp extends Pt{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Hu(t.installation)},n);return new De(o,s=>Un(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:i,query:r},n);return new Nn(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:r},n);return new De(o,s=>Un(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async importInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations:import".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Ud(t.installation)},n);return new De(o,s=>Un(s))}async importInstallation(t,n){return await(await this.importInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(Un))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ie("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:i,query:r,body:pp(t.installationUpdate)},n);return new De(o,s=>Un(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class wp extends Pt{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:Nu(t.batchUpsertIntegrationsRequest)},n);return new De(o,s=>s.map(Xi))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ie("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:vd(t.integration)},n);return new Nn(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:i,query:r},n);return new Nn(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(Xi))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Ip extends Pt{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};i["Content-Type"]="application/json";const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:ip(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new De(o):new nu(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class xp extends Pt{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:wd(t.project)},n);return new De(o,s=>gr(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:r},n);return new Nn(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>gr(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new De(i,o=>o.map(gr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ie("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:mp(t.projectUpdate)},n);return new De(o,s=>gr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class bp extends Pt{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new De(o,s=>Gi(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new De(i,o=>qo(o,Gi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class _p extends Pt{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Id(t.providerApp)},n);return new De(o,s=>Cr(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:i,query:r},n);return new Nn(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(Cr))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ie("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:r,body:gp(t.providerAppUpdate)},n);return new De(o,s=>Cr(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Cp extends Pt{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:xd(t.revision)},n);return new Nn(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ie("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:i,query:r},n);return new De(o,s=>Kd(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Sp{constructor(t){this.connectionApi=new yp(t),this.installationApi=new vp(t),this.integrationApi=new wp(t),this.oAuthApi=new Ip(t),this.projectApi=new xp(t),this.providerApi=new bp(t),this.providerAppApi=new _p(t),this.revisionApi=new Cp(t)}}const Ep="1.17.5",Op="v1",yr="https://api.withampersand.com";function Xs(){try{const e=process.env.REACT_APP_AMP_SERVER;switch(e){case"local":return"http://localhost:8080";case"dev":return"https://dev-api.withampersand.com";case"staging":return"https://staging-api.withampersand.com";case"prod":return yr;case"mock":return"http://127.0.0.1:4010";case"":return yr;default:return e??yr}}catch{return yr}}const Np=(e,t)=>`${e}/${t}`;function Tp(){return Np(Xs(),Op)}const Rp=Xs(),Ap=Tp(),Pp=new $s({basePath:Ap,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Ep}});let jp=new Sp(Pp);const Ee=()=>jp;function Dp(){return a.jsx(T.Box,{className:"loading-icon",height:"100%",width:"100%",display:"flex",justifyContent:"center",marginTop:"20%",marginBottom:"20%",children:a.jsx(T.Stack,{alignItems:"center",children:a.jsx(T.Spinner,{height:"100px",width:"100px",alignSelf:"center",thickness:"8px",speed:"1s",emptyColor:"gray.200",color:"blue.500",size:"xl",margin:"20px"})})})}const kp="_loader_h78nh_1",Fp="_rotate_h78nh_1",Mp="_ball1_h78nh_1",Lp="_ball2_h78nh_1",$p={loader:kp,rotate:Fp,ball1:Mp,ball2:Lp};function Kp(){return a.jsx("span",{className:$p.loader})}function Nt(){return Pe?a.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:a.jsx(Kp,{})}):a.jsx(Dp,{})}const Ge=async(e,t)=>{var n;if(e instanceof Ks){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);const o=await e.response.json(),s=((n=o==null?void 0:o.causes)==null?void 0:n.join(`
3
- `))||"[ERROR] Creating installation failed.";console.error("[Error Message]",s),t&&t(s)}else console.error("Unexpected error:",e.message)},Gs=g.createContext({integrations:null}),Ys=()=>{const e=g.useContext(Gs);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Vp({projectIdOrName:e,children:t}){const n=Ve(),{setError:r,isError:i}=sn(),[o,s]=g.useState(null),[c,l]=g.useState(!0);g.useEffect(()=>{Ee().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(d=>{l(!1),s(d||[])}).catch(d=>{console.error("Error retrieving integration information."),Ge(d),l(!1),r(Se.INTEGRATION_LIST,e)})},[e,n,r]);const u=g.useMemo(()=>({integrations:o}),[o]);return i(Se.INTEGRATION_LIST,e)?a.jsx(qt,{message:"Error retrieving integrations for the project, double check the API key"}):a.jsx(Gs.Provider,{value:u,children:c?a.jsx(Nt,{}):t})}const Zs=g.createContext({project:null,appName:"",projectId:"",projectIdOrName:""}),Re=()=>{const e=g.useContext(Zs);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Hp({projectIdOrName:e,children:t}){const n=Ve(),{isError:r,setError:i}=sn(),[o,s]=g.useState(null),[c,l]=g.useState(!0);g.useEffect(()=>{Ee().projectApi.getProject({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(d=>{l(!1),s(d)}).catch(d=>{console.error("Error loading Ampersand project."),Ge(d),i(Se.PROJECT,e),l(!1)})},[e,n,l,i]);const u=g.useMemo(()=>({projectId:(o==null?void 0:o.id)||"",projectIdOrName:e,project:o,appName:(o==null?void 0:o.appName)||""}),[e,o]);return r(Se.PROJECT,e)?a.jsx(qt,{message:`Error loading project ${e}`}):a.jsx(Zs.Provider,{value:u,children:c?a.jsx(Nt,{}):t})}function Bp(e){const{options:{apiKey:t,projectId:n,project:r},children:i}=e,o=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!o)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return a.jsx(Kl,{children:a.jsx(Bl,{children:a.jsx(Vl,{value:t,children:a.jsx(Hp,{projectIdOrName:o,children:a.jsx(Vp,{projectIdOrName:o,children:i})})})})})}const Qs=g.createContext(null);function Up(){const e=g.useContext(Qs);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
4
- component is wrapped with AmpersandProvider`);return e}const qp=()=>{const[e,t]=g.useState(!1),n=g.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}},ea=g.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function ot(){const e=g.useContext(ea);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Wp({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:l,fieldMapping:u}){const d=Ve(),{projectId:f}=Re(),{integrations:h}=Ys(),{setError:p,isError:m}=sn(),{isIntegrationDeleted:y,setIntegrationDeleted:I}=qp(),[C,w]=g.useState([]),[_,b]=g.useState(!0),x=(C==null?void 0:C[0])||null,E=g.useMemo(()=>ql(t,h||[]),[t,h]);g.useEffect(()=>{E===null&&(h!=null&&h.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,E,h]);const M=g.useCallback(X=>{w([X])},[w]),O=g.useCallback(()=>{E!=null&&E.id&&Ee().installationApi.listInstallations({projectIdOrName:f,integrationId:E.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(X=>{b(!1),w(X||[])}).catch(X=>{p(Se.INSTALLATION_LIST,E.id),b(!1),console.error("Error retrieving installation information: ",X)})},[E,f,d,p,i]),V=(E==null?void 0:E.id)||"";g.useEffect(()=>{O()},[O]);const J=g.useMemo(()=>({integrationId:(E==null?void 0:E.id)||"",provider:(E==null?void 0:E.provider)||"",integrationObj:E,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:x,setInstallation:M,resetInstallations:O,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:l,isIntegrationDeleted:y,setIntegrationDeleted:I,fieldMapping:u}),[E,n,r,i,o,x,M,O,s,c,l,y,I,u]);if(E!==null){const X=`Error retrieving installation information for integration "${(E==null?void 0:E.name)||"unknown"}"`;return m(Se.INSTALLATION_LIST,V)?a.jsx(qt,{message:X}):a.jsx(ea.Provider,{value:J,children:_?a.jsx(Nt,{}):e})}return a.jsx(qt,{message:`Integration "${t}" not found`})}const ta=g.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Ln=()=>{const e=g.useContext(ta);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function na({provider:e,groupRef:t,children:n}){const r=Ve(),{projectId:i}=Re(),[o,s]=g.useState(null),[c,l]=g.useState(null),[u,d]=g.useState(!0),{setError:f,isError:h}=sn(),{provider:p}=ot();if(!i)throw new Error("ConnectionsProvider must be used within AmpersandProvider");const m=e||p;if(!m)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");g.useEffect(()=>{Ee().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:m},{headers:{"X-Api-Key":r??""}}).then(I=>{d(!1),s(I)}).catch(I=>{console.error(`Error retrieving existing OAuth connections for group ID ${t}.`),Ge(I),d(!1),f(Se.CONNECTION_LIST,i)})},[i,r,t,m,f]);const y=g.useMemo(()=>({connections:o,selectedConnection:c,setConnections:s,setSelectedConnection:l}),[o,c,s,l]);return h(Se.CONNECTION_LIST,i)?a.jsx(qt,{message:"Error retrieving existing connections"}):a.jsx(ta.Provider,{value:y,children:u?a.jsx(Nt,{}):n})}var vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tr={exports:{}};Tr.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,c="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",h="[object Error]",p="[object Function]",m="[object GeneratorFunction]",y="[object Map]",I="[object Number]",C="[object Null]",w="[object Object]",_="[object Promise]",b="[object Proxy]",x="[object RegExp]",E="[object Set]",M="[object String]",O="[object Symbol]",V="[object Undefined]",J="[object WeakMap]",X="[object ArrayBuffer]",Z="[object DataView]",te="[object Float32Array]",q="[object Float64Array]",ae="[object Int8Array]",re="[object Int16Array]",ee="[object Int32Array]",pe="[object Uint8Array]",me="[object Uint8ClampedArray]",N="[object Uint16Array]",j="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,k=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,A={};A[te]=A[q]=A[ae]=A[re]=A[ee]=A[pe]=A[me]=A[N]=A[j]=!0,A[c]=A[l]=A[X]=A[d]=A[Z]=A[f]=A[h]=A[p]=A[y]=A[I]=A[w]=A[x]=A[E]=A[M]=A[J]=!1;var G=typeof vr=="object"&&vr&&vr.Object===Object&&vr,Y=typeof self=="object"&&self&&self.Object===Object&&self,H=G||Y||Function("return this")(),Q=t&&!t.nodeType&&t,W=Q&&!0&&e&&!e.nodeType&&e,ce=W&&W.exports===Q,P=ce&&G.process,fe=function(){try{return P&&P.binding&&P.binding("util")}catch{}}(),B=fe&&fe.isTypedArray;function Ie(v,S){for(var R=-1,z=v==null?0:v.length,_e=0,le=[];++R<z;){var Ae=v[R];S(Ae,R,v)&&(le[_e++]=Ae)}return le}function ke(v,S){for(var R=-1,z=S.length,_e=v.length;++R<z;)v[_e+R]=S[R];return v}function qe(v,S){for(var R=-1,z=v==null?0:v.length;++R<z;)if(S(v[R],R,v))return!0;return!1}function Fe(v,S){for(var R=-1,z=Array(v);++R<v;)z[R]=S(R);return z}function he(v){return function(S){return v(S)}}function It(v,S){return v.has(S)}function We(v,S){return v==null?void 0:v[S]}function it(v){var S=-1,R=Array(v.size);return v.forEach(function(z,_e){R[++S]=[_e,z]}),R}function xt(v,S){return function(R){return v(S(R))}}function bt(v){var S=-1,R=Array(v.size);return v.forEach(function(z){R[++S]=z}),R}var Je=Array.prototype,He=Function.prototype,Me=Object.prototype,Oe=H["__core-js_shared__"],_t=He.toString,Ye=Me.hasOwnProperty,Ft=function(){var v=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||"");return v?"Symbol(src)_1."+v:""}(),Jt=Me.toString,st=RegExp("^"+_t.call(Ye).replace(L,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ne=ce?H.Buffer:void 0,Mt=H.Symbol,zt=H.Uint8Array,Lt=Me.propertyIsEnumerable,ln=Je.splice,et=Mt?Mt.toStringTag:void 0,$t=Object.getOwnPropertySymbols,Xt=Ne?Ne.isBuffer:void 0,un=xt(Object.keys,Object),Gt=Cn(H,"DataView"),Ce=Cn(H,"Map"),Ze=Cn(H,"Promise"),ne=Cn(H,"Set"),de=Cn(H,"WeakMap"),Le=Cn(Object,"create"),Kt=fn(Gt),U=fn(Ce),oe=fn(Ze),se=fn(ne),je=fn(de),$e=Mt?Mt.prototype:void 0,tt=$e?$e.valueOf:void 0;function Be(v){var S=-1,R=v==null?0:v.length;for(this.clear();++S<R;){var z=v[S];this.set(z[0],z[1])}}function ze(){this.__data__=Le?Le(null):{},this.size=0}function nt(v){var S=this.has(v)&&delete this.__data__[v];return this.size-=S?1:0,S}function be(v){var S=this.__data__;if(Le){var R=S[v];return R===r?void 0:R}return Ye.call(S,v)?S[v]:void 0}function dn(v){var S=this.__data__;return Le?S[v]!==void 0:Ye.call(S,v)}function ro(v,S){var R=this.__data__;return this.size+=this.has(v)?0:1,R[v]=Le&&S===void 0?r:S,this}Be.prototype.clear=ze,Be.prototype.delete=nt,Be.prototype.get=be,Be.prototype.has=dn,Be.prototype.set=ro;function mt(v){var S=-1,R=v==null?0:v.length;for(this.clear();++S<R;){var z=v[S];this.set(z[0],z[1])}}function ar(){this.__data__=[],this.size=0}function cr(v){var S=this.__data__,R=dr(S,v);if(R<0)return!1;var z=S.length-1;return R==z?S.pop():ln.call(S,R,1),--this.size,!0}function lr(v){var S=this.__data__,R=dr(S,v);return R<0?void 0:S[R][1]}function xe(v){return dr(this.__data__,v)>-1}function Ct(v,S){var R=this.__data__,z=dr(R,v);return z<0?(++this.size,R.push([v,S])):R[z][1]=S,this}mt.prototype.clear=ar,mt.prototype.delete=cr,mt.prototype.get=lr,mt.prototype.has=xe,mt.prototype.set=Ct;function St(v){var S=-1,R=v==null?0:v.length;for(this.clear();++S<R;){var z=v[S];this.set(z[0],z[1])}}function pn(){this.size=0,this.__data__={hash:new Be,map:new(Ce||mt),string:new Be}}function oo(v){var S=pr(this,v).delete(v);return this.size-=S?1:0,S}function Vn(v){return pr(this,v).get(v)}function sl(v){return pr(this,v).has(v)}function al(v,S){var R=pr(this,v),z=R.size;return R.set(v,S),this.size+=R.size==z?0:1,this}St.prototype.clear=pn,St.prototype.delete=oo,St.prototype.get=Vn,St.prototype.has=sl,St.prototype.set=al;function ur(v){var S=-1,R=v==null?0:v.length;for(this.__data__=new St;++S<R;)this.add(v[S])}function cl(v){return this.__data__.set(v,r),this}function ll(v){return this.__data__.has(v)}ur.prototype.add=ur.prototype.push=cl,ur.prototype.has=ll;function Yt(v){var S=this.__data__=new mt(v);this.size=S.size}function ul(){this.__data__=new mt,this.size=0}function dl(v){var S=this.__data__,R=S.delete(v);return this.size=S.size,R}function pl(v){return this.__data__.get(v)}function fl(v){return this.__data__.has(v)}function ml(v,S){var R=this.__data__;if(R instanceof mt){var z=R.__data__;if(!Ce||z.length<n-1)return z.push([v,S]),this.size=++R.size,this;R=this.__data__=new St(z)}return R.set(v,S),this.size=R.size,this}Yt.prototype.clear=ul,Yt.prototype.delete=dl,Yt.prototype.get=pl,Yt.prototype.has=fl,Yt.prototype.set=ml;function hl(v,S){var R=fr(v),z=!R&&Rl(v),_e=!R&&!z&&io(v),le=!R&&!z&&!_e&&Hi(v),Ae=R||z||_e||le,Ue=Ae?Fe(v.length,String):[],Xe=Ue.length;for(var Te in v)Ye.call(v,Te)&&!(Ae&&(Te=="length"||_e&&(Te=="offset"||Te=="parent")||le&&(Te=="buffer"||Te=="byteLength"||Te=="byteOffset")||Sl(Te,Xe)))&&Ue.push(Te);return Ue}function dr(v,S){for(var R=v.length;R--;)if(Li(v[R][0],S))return R;return-1}function gl(v,S,R){var z=S(v);return fr(v)?z:ke(z,R(v))}function Hn(v){return v==null?v===void 0?V:C:et&&et in Object(v)?_l(v):Tl(v)}function Di(v){return Bn(v)&&Hn(v)==c}function ki(v,S,R,z,_e){return v===S?!0:v==null||S==null||!Bn(v)&&!Bn(S)?v!==v&&S!==S:yl(v,S,R,z,ki,_e)}function yl(v,S,R,z,_e,le){var Ae=fr(v),Ue=fr(S),Xe=Ae?l:Zt(v),Te=Ue?l:Zt(S);Xe=Xe==c?w:Xe,Te=Te==c?w:Te;var at=Xe==w,Et=Te==w,Qe=Xe==Te;if(Qe&&io(v)){if(!io(S))return!1;Ae=!0,at=!1}if(Qe&&!at)return le||(le=new Yt),Ae||Hi(v)?Fi(v,S,R,z,_e,le):xl(v,S,Xe,R,z,_e,le);if(!(R&i)){var ht=at&&Ye.call(v,"__wrapped__"),gt=Et&&Ye.call(S,"__wrapped__");if(ht||gt){var Qt=ht?v.value():v,Vt=gt?S.value():S;return le||(le=new Yt),_e(Qt,Vt,R,z,le)}}return Qe?(le||(le=new Yt),bl(v,S,R,z,_e,le)):!1}function vl(v){if(!Vi(v)||Ol(v))return!1;var S=$i(v)?st:k;return S.test(fn(v))}function wl(v){return Bn(v)&&Ki(v.length)&&!!A[Hn(v)]}function Il(v){if(!Nl(v))return un(v);var S=[];for(var R in Object(v))Ye.call(v,R)&&R!="constructor"&&S.push(R);return S}function Fi(v,S,R,z,_e,le){var Ae=R&i,Ue=v.length,Xe=S.length;if(Ue!=Xe&&!(Ae&&Xe>Ue))return!1;var Te=le.get(v);if(Te&&le.get(S))return Te==S;var at=-1,Et=!0,Qe=R&o?new ur:void 0;for(le.set(v,S),le.set(S,v);++at<Ue;){var ht=v[at],gt=S[at];if(z)var Qt=Ae?z(gt,ht,at,S,v,le):z(ht,gt,at,v,S,le);if(Qt!==void 0){if(Qt)continue;Et=!1;break}if(Qe){if(!qe(S,function(Vt,mn){if(!It(Qe,mn)&&(ht===Vt||_e(ht,Vt,R,z,le)))return Qe.push(mn)})){Et=!1;break}}else if(!(ht===gt||_e(ht,gt,R,z,le))){Et=!1;break}}return le.delete(v),le.delete(S),Et}function xl(v,S,R,z,_e,le,Ae){switch(R){case Z:if(v.byteLength!=S.byteLength||v.byteOffset!=S.byteOffset)return!1;v=v.buffer,S=S.buffer;case X:return!(v.byteLength!=S.byteLength||!le(new zt(v),new zt(S)));case d:case f:case I:return Li(+v,+S);case h:return v.name==S.name&&v.message==S.message;case x:case M:return v==S+"";case y:var Ue=it;case E:var Xe=z&i;if(Ue||(Ue=bt),v.size!=S.size&&!Xe)return!1;var Te=Ae.get(v);if(Te)return Te==S;z|=o,Ae.set(v,S);var at=Fi(Ue(v),Ue(S),z,_e,le,Ae);return Ae.delete(v),at;case O:if(tt)return tt.call(v)==tt.call(S)}return!1}function bl(v,S,R,z,_e,le){var Ae=R&i,Ue=Mi(v),Xe=Ue.length,Te=Mi(S),at=Te.length;if(Xe!=at&&!Ae)return!1;for(var Et=Xe;Et--;){var Qe=Ue[Et];if(!(Ae?Qe in S:Ye.call(S,Qe)))return!1}var ht=le.get(v);if(ht&&le.get(S))return ht==S;var gt=!0;le.set(v,S),le.set(S,v);for(var Qt=Ae;++Et<Xe;){Qe=Ue[Et];var Vt=v[Qe],mn=S[Qe];if(z)var Bi=Ae?z(mn,Vt,Qe,S,v,le):z(Vt,mn,Qe,v,S,le);if(!(Bi===void 0?Vt===mn||_e(Vt,mn,R,z,le):Bi)){gt=!1;break}Qt||(Qt=Qe=="constructor")}if(gt&&!Qt){var mr=v.constructor,hr=S.constructor;mr!=hr&&"constructor"in v&&"constructor"in S&&!(typeof mr=="function"&&mr instanceof mr&&typeof hr=="function"&&hr instanceof hr)&&(gt=!1)}return le.delete(v),le.delete(S),gt}function Mi(v){return gl(v,jl,Cl)}function pr(v,S){var R=v.__data__;return El(S)?R[typeof S=="string"?"string":"hash"]:R.map}function Cn(v,S){var R=We(v,S);return vl(R)?R:void 0}function _l(v){var S=Ye.call(v,et),R=v[et];try{v[et]=void 0;var z=!0}catch{}var _e=Jt.call(v);return z&&(S?v[et]=R:delete v[et]),_e}var Cl=$t?function(v){return v==null?[]:(v=Object(v),Ie($t(v),function(S){return Lt.call(v,S)}))}:Dl,Zt=Hn;(Gt&&Zt(new Gt(new ArrayBuffer(1)))!=Z||Ce&&Zt(new Ce)!=y||Ze&&Zt(Ze.resolve())!=_||ne&&Zt(new ne)!=E||de&&Zt(new de)!=J)&&(Zt=function(v){var S=Hn(v),R=S==w?v.constructor:void 0,z=R?fn(R):"";if(z)switch(z){case Kt:return Z;case U:return y;case oe:return _;case se:return E;case je:return J}return S});function Sl(v,S){return S=S??s,!!S&&(typeof v=="number"||D.test(v))&&v>-1&&v%1==0&&v<S}function El(v){var S=typeof v;return S=="string"||S=="number"||S=="symbol"||S=="boolean"?v!=="__proto__":v===null}function Ol(v){return!!Ft&&Ft in v}function Nl(v){var S=v&&v.constructor,R=typeof S=="function"&&S.prototype||Me;return v===R}function Tl(v){return Jt.call(v)}function fn(v){if(v!=null){try{return _t.call(v)}catch{}try{return v+""}catch{}}return""}function Li(v,S){return v===S||v!==v&&S!==S}var Rl=Di(function(){return arguments}())?Di:function(v){return Bn(v)&&Ye.call(v,"callee")&&!Lt.call(v,"callee")},fr=Array.isArray;function Al(v){return v!=null&&Ki(v.length)&&!$i(v)}var io=Xt||kl;function Pl(v,S){return ki(v,S)}function $i(v){if(!Vi(v))return!1;var S=Hn(v);return S==p||S==m||S==u||S==b}function Ki(v){return typeof v=="number"&&v>-1&&v%1==0&&v<=s}function Vi(v){var S=typeof v;return v!=null&&(S=="object"||S=="function")}function Bn(v){return v!=null&&typeof v=="object"}var Hi=B?he(B):wl;function jl(v){return Al(v)?hl(v):Il(v)}function Dl(){return[]}function kl(){return!1}e.exports=Pl})(Tr,Tr.exports);var Jp=Tr.exports;const zp=Wo(Jp),nn="other";function jt(e){return!e.fieldName}function Xp(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Gp(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!jt(n)&&!!n.fieldName))||null}function Yp(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>jt(r)&&!!r.mapToName))||[]}function Zp(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!jt(n)&&!!n.fieldName))||null}const ra=(e,t)=>{var n,r,i;return(i=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:i[t]};function Qp(e){return jt(e)?e.mapToName:e.fieldName}const Jo=(e,t)=>{var r,i,o;const n=[];return(o=(i=(r=t.content)==null?void 0:r.read)==null?void 0:i.objects)==null||o.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Xn(s==null?void 0:s.objectName),completed:e?!!ra(e,s.objectName):!1})}),n},zo=e=>{var n;return{name:nn,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function ef(e,t){var o;const n=Jo(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?zo(e):void 0;return i&&n.push(i),n}function oa(e,t,n){const r=(e==null?void 0:e.filter(o=>!(t!=null&&t[o==null?void 0:o.mapToName])))||[],i=r.map(o=>o.mapToName);return n(Se.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Xo(e,t){return zp(e,t)}const tf=(e,t,n)=>{var p,m,y,I,C,w;if(!e)return null;const r=Xp(e,t),i=r&&Gp(r),o=r&&Zp(r),s=r&&Yp(r),c=(r==null?void 0:r.allFields)||[],l=n==null?void 0:n.content,u=((y=(m=(p=l==null?void 0:l.read)==null?void 0:p.objects)==null?void 0:m[t])==null?void 0:y.selectedFields)||{},d=((w=(C=(I=l==null?void 0:l.read)==null?void 0:I.objects)==null?void 0:C[t])==null?void 0:w.selectedFieldMappings)||{},f={...u},h={...d};return{allFields:c,requiredFields:i,optionalFields:o,requiredMapFields:s,selectedOptionalFields:u,selectedFieldMappings:d,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:f,requiredMapFields:h}}},nf=(e,t)=>{var s,c;if(!e)return null;const n=(c=(s=t==null?void 0:t.content)==null?void 0:s.write)==null?void 0:c.objects,r=Object.keys(n||{}),i={};r.forEach(l=>{i[l]=!0});const o={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:o}}};function ia(e,t,n){var o,s;const r=(o=e==null?void 0:e.content)==null?void 0:o.read,i=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:tf(r,t,n),write:nf(i,n)}}const sa=(e,t,n,r)=>{const i=ia(e,n,t);r(n,i)},rf=(e,t,n)=>{const r=ef(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=ia(e,o,t))}),n(i)},aa=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(Qp(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},ca=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n};function la(e,t){return t[e]||void 0}async function Go({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:i,apiKey:o,setError:s,setInstallation:c,onInstallSuccess:l}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:i,config:e}};try{const d=await Ee().installationApi.createInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}});c(d),l==null||l(d.id,d.config)}catch(d){Ge(d,s)}}function qr(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const of=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(i=>i.objectName===t)},sf=(e,t,n,r)=>{const i=aa(e),o=ca(e),s=of(n,t);if(!s)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:s.schedule,destination:s.destination,selectedFields:i,selectedFieldMappings:o,backfill:s.backfill}}}}};return qr(n)&&(c.content.proxy={enabled:!0}),c},af=(e,t,n,r,i,o,s,c,l,u,d,f)=>{const h=sf(l,o,c,r);return h?Go({createConfig:h,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:u,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},ua=e=>{var o,s;const t={},n=(o=e.write)==null?void 0:o.writeObjects,r=(s=e.write)==null?void 0:s.selectedNonConfigurableWriteFields,i=r?Object.keys(r):[];return n&&n.forEach(c=>{const l=c.objectName;i.includes(l)&&(t[l]={objectName:l})}),t},cf=e=>{const t=e.content.write;return t==null?void 0:t.objects},lf=(e,t,n)=>{if(!cf(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=ua(e),o={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return qr(t)&&(o.content.proxy={enabled:!0}),o},uf=(e,t,n,r,i,o,s,c,l,u,d)=>{const f=lf(c,s,r);return f?Go({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:l,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},df=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-background").trim()||"#FEF2F2",pf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-border").trim()||"#FECACA",ff=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-text").trim()||"#991B1B",mf={backgroundColor:df,borderColor:pf,color:ff,padding:".5rem 1rem"};function da({children:e,style:t}){return a.jsx(an,{style:{...mf,...t},children:e})}var pa={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),g=require("react");require("react-dom");function Nl(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 k=Nl(g),Os=g.createContext(null),Tl=Os.Provider,Je=()=>{const e=g.useContext(Os);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var Se=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e))(Se||{});const Es=g.createContext(void 0);function Zt(){const e=g.useContext(Es);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Rl=(()=>{const e={};return Object.values(Se).forEach(t=>{e[t]={}}),e})();function Al({children:e}){const[t,n]=g.useState(Rl),r=g.useCallback((d,f,m=!0)=>{n(p=>{const v={...p};return v[d]=v[d]||{},v[d][f]=m,v})},[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 v;const p={...m};return(v=p[d])==null||delete v[f],p})},[n]),a=g.useCallback(d=>{n(f=>{const m={...f};return m[d]={},m})},[n]),c=g.useCallback((d,f)=>{n(m=>{const p={...m};return p[d]=p[d]||{},f.forEach(v=>{p[d][v]=!0}),p})},[n]),l=g.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:a,setErrors:c,getError:o}),[t,n,r,i,s,a,c,o]);return u.jsx(Es.Provider,{value:l,children:e})}function Pl(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.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"}),u.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Dl="_box_1is6l_1",Ai={box:Dl};function vn({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Ai.box} ${t}`:Ai.box,style:n,children:e})}const jl="_container_1wvzr_1",Pi={container:jl};function Xn({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Pi.container} ${t}`:Pi.container,style:n,children:e})}const Fl="_errorBoxContainer_4sdb2_1",Ml="_errorBox_4sdb2_1",kl="_errorText_4sdb2_20",Qr={errorBoxContainer:Fl,errorBox:Ml,errorText:kl};function Lt({message:e}){return u.jsxs(Xn,{className:Qr.errorBoxContainer,children:[u.jsx(Pl,{}),u.jsx(vn,{className:Qr.errorBox,children:u.jsx("p",{className:Qr.errorText,children:e})})]})}const Ll="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ss{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ll}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Ts}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 $l=new Ss,Lr=class Lr{constructor(t=$l){this.configuration=t,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let o;try{o=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const a of this.middleware)a.onError&&(o=await a.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new Hl(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?Lr.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 Ns(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(l=>i[l]===void 0?delete i[l]:{});const o=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},a={...s,...await o({init:s,context:t})},c={...a,body:Vl(a.body)||a.body instanceof URLSearchParams||Kl(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Lr.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Et=Lr;function Kl(e){return typeof Blob<"u"&&e instanceof Blob}function Vl(e){return typeof FormData<"u"&&e instanceof FormData}class Ns extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Hl extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class oe extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function L(e,t){const n=e[t];return n!=null}function Ts(e,t=""){return Object.keys(e).map(n=>Rs(n,e[n],t)).filter(n=>n.length>0).join("&")}function Rs(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 Rs(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Ts(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Mo(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Ae{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class xn{constructor(t){this.raw=t}async value(){}}class Ul{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Bl(e){return ql(e)}function ql(e,t){return e==null?e:{fieldUsed:L(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:L(e,"keyFormat")?e.keyFormat:void 0}}function Wl(e){return Jl(e)}function Jl(e,t){return e==null?e:{name:e.name,valuePrefix:L(e,"valuePrefix")?e.valuePrefix:void 0}}function zl(e){return Xl(e)}function Xl(e,t){return e==null?e:{name:e.name}}function Gl(e){return Yl(e)}function Yl(e,t){return e==null?e:{attachmentType:e.attachmentType,query:L(e,"query")?zl(e.query):void 0,header:L(e,"header")?Wl(e.header):void 0,docsURL:L(e,"docsURL")?e.docsURL:void 0}}function Zl(e){return Ql(e)}function Ql(e,t){return e}function eu(e){return tu(e)}function tu(e,t){return e==null?e:{days:L(e,"days")?e.days:void 0,fullHistory:L(e,"fullHistory")?e.fullHistory:void 0}}function nu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function As(e){return ru(e)}function ru(e,t){return e==null?e:{defaultPeriod:eu(e.defaultPeriod)}}function ou(e){if(e!==void 0)return e===null?null:{defaultPeriod:nu(e.defaultPeriod)}}function iu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function su(e){if(e!==void 0)return e===null?null:{defaultPeriod:iu(e.defaultPeriod)}}function au(e){return cu(e)}function cu(e,t){return e==null?e:{enabled:L(e,"enabled")?e.enabled:void 0}}function Ps(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function lu(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:su(e.backfill)}}function uu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Mo(e.objects,lu)}}function du(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function fu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Mo(e.objects,du)}}function pu(e){return mu(e)}function mu(e,t){return e==null?e:{apiKeyAsBasic:L(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:L(e,"apiKeyAsBasicOpts")?Bl(e.apiKeyAsBasicOpts):void 0,docsURL:L(e,"docsURL")?e.docsURL:void 0}}function hu(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function dr(e){return gu(e)}function gu(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:L(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function vu(e){return yu(e)}function yu(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function wu(e){return Iu(e)}function Iu(e,t){return e==null?e:{provider:e.provider,read:L(e,"read")?e.read:void 0,write:L(e,"write")?e.write:void 0,proxy:L(e,"proxy")?au(e.proxy):void 0}}function Ds(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:Ps(e.proxy)}}function _u(e){return bu(e)}function bu(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:wu(e.content)}}function xu(e){return Cu(e)}function Cu(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function js(e){return Ou(e)}function Ou(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function wr(e){return Eu(e)}function Eu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:L(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:L(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function Ir(e){return Su(e)}function Su(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:wr(e.providerApp),group:js(e.group),consumer:xu(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:L(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:L(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:Ds(e.content)}}function Tu(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Nu(e.config)}}function Ru(e){return Au(e)}function Au(e,t){return e==null?e:{enabled:L(e,"enabled")?e.enabled:void 0}}function Pu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Du(e){return ju(e)}function ju(e,t){return e==null?e:{mode:L(e,"mode")?e.mode:void 0,pageSize:L(e,"pageSize")?e.pageSize:void 0}}function Fu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Mu(e){let t=!0;return t=t&&"fieldName"in e,t}function ku(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:L(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Lu(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function $u(e){let t=!0;return t=t&&"mapToName"in e,t}function Fs(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:L(e,"default")?e.default:void 0,prompt:L(e,"prompt")?e.prompt:void 0}}function Ku(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Di(e){return Vu(e)}function Vu(e,t){return e==null?e:{...ku(e),...Fs(e)}}function ji(e){if(e!==void 0)return e===null?null:Mu(e)?Lu(e):$u(e)?Ku(e):{}}function Ms(e){return Hu(e)}function Hu(e,t){return e}function Uu(e){return Bu(e)}function Bu(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:L(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:L(e,"requiredFields")?e.requiredFields.map(Di):void 0,optionalFields:L(e,"optionalFields")?e.optionalFields.map(Di):void 0,optionalFieldsAuto:L(e,"optionalFieldsAuto")?Ms(e.optionalFieldsAuto):void 0,backfill:L(e,"backfill")?As(e.backfill):void 0,delivery:L(e,"delivery")?Du(e.delivery):void 0}}function qu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(ji),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(ji),optionalFieldsAuto:e.optionalFieldsAuto,backfill:ou(e.backfill),delivery:Fu(e.delivery)}}function Wu(e){return Ju(e)}function Ju(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(Uu):void 0}}function zu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(qu)}}function Xu(e){return Gu(e)}function Gu(e,t){return e==null?e:{objectName:e.objectName,inheritMappingFromRead:L(e,"inheritMappingFromRead")?e.inheritMappingFromRead:void 0}}function Yu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMappingFromRead:e.inheritMappingFromRead}}function Zu(e){return Qu(e)}function Qu(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(Xu):void 0}}function ed(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Yu)}}function td(e){return nd(e)}function nd(e,t){return e==null?e:{name:e.name,displayName:L(e,"displayName")?e.displayName:void 0,provider:e.provider,read:L(e,"read")?Wu(e.read):void 0,write:L(e,"write")?Zu(e.write):void 0,proxy:L(e,"proxy")?Ru(e.proxy):void 0}}function rd(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:zu(e.read),write:ed(e.write),proxy:Pu(e.proxy)}}function od(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:rd(e.content)}}function id(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:od(e.latestRevision)}}function sd(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function ad(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function cd(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function ld(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function ud(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function dd(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 fd(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:ld(e.basicAuth),oauth2ClientCredentials:ud(e.oauth2ClientCredentials),oauth2Password:dd(e.oauth2Password)}}function pd(e){return md(e)}function md(e,t){return e==null?e:{enabled:L(e,"enabled")?e.enabled:void 0}}function hd(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:L(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0,displayName:e.displayName}}function eo(e){return gd(e)}function gd(e,t){return e==null?e:{...hd(e),...Fs(e)}}function vd(e){return yd(e)}function yd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:L(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:L(e,"requiredFields")?e.requiredFields.map(eo):void 0,optionalFields:L(e,"optionalFields")?e.optionalFields.map(eo):void 0,optionalFieldsAuto:L(e,"optionalFieldsAuto")?Ms(e.optionalFieldsAuto):void 0,allFields:L(e,"allFields")?e.allFields.map(eo):void 0,backfill:L(e,"backfill")?As(e.backfill):void 0}}function wd(e){return Id(e)}function Id(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(vd):void 0}}function _d(e){return bd(e)}function bd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function xd(e){return Cd(e)}function Cd(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(_d):void 0}}function Od(e){return Ed(e)}function Ed(e,t){return e==null?e:{name:e.name,displayName:L(e,"displayName")?e.displayName:void 0,provider:e.provider,read:L(e,"read")?wd(e.read):void 0,write:L(e,"write")?xd(e.write):void 0,proxy:L(e,"proxy")?pd(e.proxy):void 0}}function Sd(e){return Nd(e)}function Nd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Od(e.content)}}function Td(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 Rd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:Ds(e.content)}}function Ad(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:Td(e.connection),config:Rd(e.config)}}function Ln(e){return Pd(e)}function Pd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:L(e,"group")?js(e.group):void 0,healthStatus:e.healthStatus,connection:Ir(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0,config:_u(e.config)}}function Dd(e){return jd(e)}function jd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:td(e.content)}}function Fi(e){return Fd(e)}function Fd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Dd(e.latestRevision)}}function Md(e){return kd(e)}function kd(e,t){return e==null?e:{iconURL:L(e,"iconURL")?e.iconURL:void 0,logoURL:L(e,"logoURL")?e.logoURL:void 0}}function Ld(e){return $d(e)}function $d(e,t){return e==null?e:{iconURL:L(e,"iconURL")?e.iconURL:void 0,logoURL:L(e,"logoURL")?e.logoURL:void 0}}function Kd(e){return Vd(e)}function Vd(e,t){return e==null?e:{regular:L(e,"regular")?Ld(e.regular):void 0,darkMode:L(e,"darkMode")?Md(e.darkMode):void 0}}function Hd(e){return Ud(e)}function Ud(e,t){return e==null?e:{workspaceRefField:L(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:L(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:L(e,"scopesField")?e.scopesField:void 0}}function Bd(e){return qd(e)}function qd(e,t){return e==null?e:{grantType:e.grantType,authURL:L(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:L(e,"audience")?e.audience:void 0,tokenMetadataFields:Hd(e.tokenMetadataFields),docsURL:L(e,"docsURL")?e.docsURL:void 0,authURLParams:L(e,"authURLParams")?e.authURLParams:void 0}}function Wd(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function Jd(e){return zd(e)}function zd(e,t){return e==null?e:{bulkWrite:vu(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Mi(e){return Xd(e)}function Xd(e,t){return e==null?e:{name:e.name,authType:Zl(e.authType),baseURL:e.baseURL,oauth2Opts:L(e,"oauth2Opts")?Bd(e.oauth2Opts):void 0,apiKeyOpts:L(e,"apiKeyOpts")?Gl(e.apiKeyOpts):void 0,basicOpts:L(e,"basicOpts")?pu(e.basicOpts):void 0,support:Jd(e.support),providerOpts:e.providerOpts,displayName:L(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:L(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:L(e,"media")?Kd(e.media):void 0,labels:L(e,"labels")?e.labels:void 0}}function Gd(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:uu(e.read),write:fu(e.write),proxy:Ps(e.proxy)}}function Yd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Gd(e.content)}}function Zd(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Yd(e.config)}}function Qd(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Zd(e.installation)}}function ef(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function tf(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:ef(e.project)}}function nf(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 rf(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:nf(e.providerApp)}}class of extends Et{async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:fd(t.generateConnectionParams)},n);return new Ae(o,s=>Ir(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new oe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={},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 Ae(o,s=>Ir(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Ir))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class sf extends Et{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new oe("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Tu(t.installation)},n);return new Ae(o,s=>Ln(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:i,query:r},n);return new xn(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Ln(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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new oe("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:Ad(t.installation)},n);return new Ae(o,s=>Ln(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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Ln))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new oe("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:i,query:r,body:Qd(t.installationUpdate)},n);return new Ae(o,s=>Ln(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class af extends Et{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:hu(t.batchUpsertIntegrationsRequest)},n);return new Ae(o,s=>s.map(Fi))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new oe("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:id(t.integration)},n);return new xn(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:i,query:r},n);return new xn(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Fi))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class cf extends Et{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new oe("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};i["Content-Type"]="application/json";const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:Wd(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new Ae(o):new Ul(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class lf extends Et{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new oe("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:sd(t.project)},n);return new Ae(o,s=>dr(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:r},n);return new xn(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>dr(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Ae(i,o=>o.map(dr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new oe("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:tf(t.projectUpdate)},n);return new Ae(o,s=>dr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class uf extends Et{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new oe("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Mi(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 Ae(i,o=>Mo(o,Mi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class df extends Et{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new oe("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:ad(t.providerApp)},n);return new Ae(o,s=>wr(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new oe("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:i,query:r},n);return new xn(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(wr))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new oe("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new oe("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:r,body:rf(t.providerAppUpdate)},n);return new Ae(o,s=>wr(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class ff extends Et{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:cd(t.revision)},n);return new xn(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new oe("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new oe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Sd(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class pf{constructor(t){this.connectionApi=new of(t),this.installationApi=new sf(t),this.integrationApi=new af(t),this.oAuthApi=new cf(t),this.projectApi=new lf(t),this.providerApi=new uf(t),this.providerAppApi=new df(t),this.revisionApi=new ff(t)}}const mf="1.17.7",hf="v1",fr="https://api.withampersand.com";function ks(){try{const e=process.env.REACT_APP_AMP_SERVER;switch(e){case"local":return"http://localhost:8080";case"dev":return"https://dev-api.withampersand.com";case"staging":return"https://staging-api.withampersand.com";case"prod":return fr;case"mock":return"http://127.0.0.1:4010";case"":return fr;default:return e??fr}}catch{return fr}}const gf=(e,t)=>`${e}/${t}`;function vf(){return gf(ks(),hf)}const yf=ks(),wf=vf(),If=new Ss({basePath:wf,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":mf}});let _f=new pf(If);const Te=()=>_f,bf="_loader_6ubm6_1",xf="_rotate_6ubm6_1",Cf="_ball1_6ubm6_1",Of="_ball2_6ubm6_1",Ef={loader:bf,rotate:xf,ball1:Cf,ball2:Of};function Sf(){return u.jsx("span",{className:Ef.loader})}function $t(){return u.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:u.jsx(Sf,{})})}const Ye=async(e,t)=>{var n;if(e instanceof Ns){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);const o=await e.response.json(),s=((n=o==null?void 0:o.causes)==null?void 0:n.join(`
2
+ `))||"[ERROR] Creating installation failed.";console.error("[Error Message]",s),t&&t(s)}else console.error("Unexpected error:",e.message)},Ls=g.createContext({integrations:null}),$s=()=>{const e=g.useContext(Ls);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Nf({projectIdOrName:e,children:t}){const n=Je(),{setError:r,isError:i}=Zt(),[o,s]=g.useState(null),[a,c]=g.useState(!0);g.useEffect(()=>{Te().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(d=>{c(!1),s(d||[])}).catch(d=>{console.error("Error retrieving integration information."),Ye(d),c(!1),r(Se.INTEGRATION_LIST,e)})},[e,n,r]);const l=g.useMemo(()=>({integrations:o}),[o]);return i(Se.INTEGRATION_LIST,e)?u.jsx(Lt,{message:"Error retrieving integrations for the project, double check the API key"}):u.jsx(Ls.Provider,{value:l,children:a?u.jsx($t,{}):t})}const Ks=g.createContext({project:null,appName:"",projectId:"",projectIdOrName:""}),De=()=>{const e=g.useContext(Ks);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Tf({projectIdOrName:e,children:t}){const n=Je(),{isError:r,setError:i}=Zt(),[o,s]=g.useState(null),[a,c]=g.useState(!0);g.useEffect(()=>{Te().projectApi.getProject({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(d=>{c(!1),s(d)}).catch(d=>{console.error("Error loading Ampersand project."),Ye(d),i(Se.PROJECT,e),c(!1)})},[e,n,c,i]);const l=g.useMemo(()=>({projectId:(o==null?void 0:o.id)||"",projectIdOrName:e,project:o,appName:(o==null?void 0:o.appName)||""}),[e,o]);return r(Se.PROJECT,e)?u.jsx(Lt,{message:`Error loading project ${e}`}):u.jsx(Ks.Provider,{value:l,children:a?u.jsx($t,{}):t})}function Rf(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 u.jsx(Al,{children:u.jsx(Tl,{value:t,children:u.jsx(Tf,{projectIdOrName:o,children:u.jsx(Nf,{projectIdOrName:o,children:i})})})})}const Vs=g.createContext(null);function Af(){const e=g.useContext(Vs);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
3
+ component is wrapped with AmpersandProvider`);return e}function Un(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Qt(e,t){return(t==null?void 0:t.displayName)??Un(e)}const Pf=e=>e.split(`
4
+ `).filter(n=>n.trim()!==""),Df=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,jf=()=>{const[e,t]=g.useState(!1),n=g.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}},Hs=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 ut(){const e=g.useContext(Hs);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Ff({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:l}){const d=Je(),{projectId:f}=De(),{integrations:m}=$s(),{setError:p,isError:v}=Zt(),{isIntegrationDeleted:w,setIntegrationDeleted:I}=jf(),[O,y]=g.useState([]),[x,b]=g.useState(!0),_=(O==null?void 0:O[0])||null,E=g.useMemo(()=>Df(t,m||[]),[t,m]);g.useEffect(()=>{E===null&&(m!=null&&m.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,E,m]);const $=g.useCallback(z=>{y([z])},[y]),T=g.useCallback(()=>{E!=null&&E.id&&Te().installationApi.listInstallations({projectIdOrName:f,integrationId:E.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(z=>{b(!1),y(z||[])}).catch(z=>{p(Se.INSTALLATION_LIST,E.id),b(!1),console.error("Error retrieving installation information: ",z)})},[E,f,d,p,i]),J=(E==null?void 0:E.id)||"";g.useEffect(()=>{T()},[T]);const q=g.useMemo(()=>({integrationId:(E==null?void 0:E.id)||"",provider:(E==null?void 0:E.provider)||"",integrationObj:E,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:_,setInstallation:$,resetInstallations:T,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:w,setIntegrationDeleted:I,fieldMapping:l}),[E,n,r,i,o,_,$,T,s,a,c,w,I,l]);if(E!==null){const z=`Error retrieving installation information for integration "${(E==null?void 0:E.name)||"unknown"}"`;return v(Se.INSTALLATION_LIST,J)?u.jsx(Lt,{message:z}):u.jsx(Hs.Provider,{value:q,children:x?u.jsx($t,{}):e})}return u.jsx(Lt,{message:`Integration "${t}" not found`})}const Us=g.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Pn=()=>{const e=g.useContext(Us);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Bs({provider:e,groupRef:t,children:n}){const r=Je(),{projectId:i}=De(),[o,s]=g.useState(null),[a,c]=g.useState(null),[l,d]=g.useState(!0),{setError:f,isError:m}=Zt(),{provider:p}=ut();if(!i)throw new Error("ConnectionsProvider must be used within AmpersandProvider");const v=e||p;if(!v)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");g.useEffect(()=>{Te().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:v},{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(Se.CONNECTION_LIST,i)})},[i,r,t,v,f]);const w=g.useMemo(()=>({connections:o,selectedConnection:a,setConnections:s,setSelectedConnection:c}),[o,a,s,c]);return m(Se.CONNECTION_LIST,i)?u.jsx(Lt,{message:"Error retrieving existing connections"}):u.jsx(Us.Provider,{value:w,children:l?u.jsx($t,{}):n})}var pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ko(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cr={exports:{}};Cr.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",m="[object Error]",p="[object Function]",v="[object GeneratorFunction]",w="[object Map]",I="[object Number]",O="[object Null]",y="[object Object]",x="[object Promise]",b="[object Proxy]",_="[object RegExp]",E="[object Set]",$="[object String]",T="[object Symbol]",J="[object Undefined]",q="[object WeakMap]",z="[object ArrayBuffer]",Y="[object DataView]",ee="[object Float32Array]",U="[object Float64Array]",se="[object Int8Array]",ne="[object Int16Array]",Q="[object Int32Array]",de="[object Uint8Array]",pe="[object Uint8ClampedArray]",S="[object Uint16Array]",P="[object Uint32Array]",M=/[\\^$.*+?()[\]{}|]/g,j=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,R={};R[ee]=R[U]=R[se]=R[ne]=R[Q]=R[de]=R[pe]=R[S]=R[P]=!0,R[a]=R[c]=R[z]=R[d]=R[Y]=R[f]=R[m]=R[p]=R[w]=R[I]=R[y]=R[_]=R[E]=R[$]=R[q]=!1;var X=typeof pr=="object"&&pr&&pr.Object===Object&&pr,G=typeof self=="object"&&self&&self.Object===Object&&self,K=X||G||Function("return this")(),Z=t&&!t.nodeType&&t,B=Z&&!0&&e&&!e.nodeType&&e,ae=B&&B.exports===Z,A=ae&&X.process,fe=function(){try{return A&&A.binding&&A.binding("util")}catch{}}(),V=fe&&fe.isTypedArray;function we(h,C){for(var N=-1,W=h==null?0:h.length,be=0,ce=[];++N<W;){var Ne=h[N];C(Ne,N,h)&&(ce[be++]=Ne)}return ce}function Pe(h,C){for(var N=-1,W=C.length,be=h.length;++N<W;)h[be+N]=C[N];return h}function He(h,C){for(var N=-1,W=h==null?0:h.length;++N<W;)if(C(h[N],N,h))return!0;return!1}function je(h,C){for(var N=-1,W=Array(h);++N<h;)W[N]=C(N);return W}function me(h){return function(C){return h(C)}}function gt(h,C){return h.has(C)}function Ue(h,C){return h==null?void 0:h[C]}function nt(h){var C=-1,N=Array(h.size);return h.forEach(function(W,be){N[++C]=[be,W]}),N}function vt(h,C){return function(N){return h(C(N))}}function yt(h){var C=-1,N=Array(h.size);return h.forEach(function(W){N[++C]=W}),N}var Be=Array.prototype,$e=Function.prototype,Fe=Object.prototype,Ce=K["__core-js_shared__"],wt=$e.toString,ze=Fe.hasOwnProperty,Tt=function(){var h=/[^.]+$/.exec(Ce&&Ce.keys&&Ce.keys.IE_PROTO||"");return h?"Symbol(src)_1."+h:""}(),Kt=Fe.toString,rt=RegExp("^"+wt.call(ze).replace(M,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Oe=ae?K.Buffer:void 0,Rt=K.Symbol,Vt=K.Uint8Array,At=Fe.propertyIsEnumerable,tn=Be.splice,Ze=Rt?Rt.toStringTag:void 0,Pt=Object.getOwnPropertySymbols,Ht=Oe?Oe.isBuffer:void 0,nn=vt(Object.keys,Object),Ut=wn(K,"DataView"),xe=wn(K,"Map"),Xe=wn(K,"Promise"),te=wn(K,"Set"),ue=wn(K,"WeakMap"),Me=wn(Object,"create"),Dt=sn(Ut),H=sn(xe),re=sn(Xe),ie=sn(te),Re=sn(ue),ke=Rt?Rt.prototype:void 0,Qe=ke?ke.valueOf:void 0;function Ke(h){var C=-1,N=h==null?0:h.length;for(this.clear();++C<N;){var W=h[C];this.set(W[0],W[1])}}function qe(){this.__data__=Me?Me(null):{},this.size=0}function et(h){var C=this.has(h)&&delete this.__data__[h];return this.size-=C?1:0,C}function _e(h){var C=this.__data__;if(Me){var N=C[h];return N===r?void 0:N}return ze.call(C,h)?C[h]:void 0}function rn(h){var C=this.__data__;return Me?C[h]!==void 0:ze.call(C,h)}function Gr(h,C){var N=this.__data__;return this.size+=this.has(h)?0:1,N[h]=Me&&C===void 0?r:C,this}Ke.prototype.clear=qe,Ke.prototype.delete=et,Ke.prototype.get=_e,Ke.prototype.has=rn,Ke.prototype.set=Gr;function dt(h){var C=-1,N=h==null?0:h.length;for(this.clear();++C<N;){var W=h[C];this.set(W[0],W[1])}}function nr(){this.__data__=[],this.size=0}function rr(h){var C=this.__data__,N=sr(C,h);if(N<0)return!1;var W=C.length-1;return N==W?C.pop():tn.call(C,N,1),--this.size,!0}function or(h){var C=this.__data__,N=sr(C,h);return N<0?void 0:C[N][1]}function Ie(h){return sr(this.__data__,h)>-1}function It(h,C){var N=this.__data__,W=sr(N,h);return W<0?(++this.size,N.push([h,C])):N[W][1]=C,this}dt.prototype.clear=nr,dt.prototype.delete=rr,dt.prototype.get=or,dt.prototype.has=Ie,dt.prototype.set=It;function _t(h){var C=-1,N=h==null?0:h.length;for(this.clear();++C<N;){var W=h[C];this.set(W[0],W[1])}}function on(){this.size=0,this.__data__={hash:new Ke,map:new(xe||dt),string:new Ke}}function Yr(h){var C=ar(this,h).delete(h);return this.size-=C?1:0,C}function Fn(h){return ar(this,h).get(h)}function Zc(h){return ar(this,h).has(h)}function Qc(h,C){var N=ar(this,h),W=N.size;return N.set(h,C),this.size+=N.size==W?0:1,this}_t.prototype.clear=on,_t.prototype.delete=Yr,_t.prototype.get=Fn,_t.prototype.has=Zc,_t.prototype.set=Qc;function ir(h){var C=-1,N=h==null?0:h.length;for(this.__data__=new _t;++C<N;)this.add(h[C])}function el(h){return this.__data__.set(h,r),this}function tl(h){return this.__data__.has(h)}ir.prototype.add=ir.prototype.push=el,ir.prototype.has=tl;function Bt(h){var C=this.__data__=new dt(h);this.size=C.size}function nl(){this.__data__=new dt,this.size=0}function rl(h){var C=this.__data__,N=C.delete(h);return this.size=C.size,N}function ol(h){return this.__data__.get(h)}function il(h){return this.__data__.has(h)}function sl(h,C){var N=this.__data__;if(N instanceof dt){var W=N.__data__;if(!xe||W.length<n-1)return W.push([h,C]),this.size=++N.size,this;N=this.__data__=new _t(W)}return N.set(h,C),this.size=N.size,this}Bt.prototype.clear=nl,Bt.prototype.delete=rl,Bt.prototype.get=ol,Bt.prototype.has=il,Bt.prototype.set=sl;function al(h,C){var N=cr(h),W=!N&&bl(h),be=!N&&!W&&Zr(h),ce=!N&&!W&&!be&&Ti(h),Ne=N||W||be||ce,Ve=Ne?je(h.length,String):[],We=Ve.length;for(var Ee in h)ze.call(h,Ee)&&!(Ne&&(Ee=="length"||be&&(Ee=="offset"||Ee=="parent")||ce&&(Ee=="buffer"||Ee=="byteLength"||Ee=="byteOffset")||vl(Ee,We)))&&Ve.push(Ee);return Ve}function sr(h,C){for(var N=h.length;N--;)if(Oi(h[N][0],C))return N;return-1}function cl(h,C,N){var W=C(h);return cr(h)?W:Pe(W,N(h))}function Mn(h){return h==null?h===void 0?J:O:Ze&&Ze in Object(h)?hl(h):_l(h)}function _i(h){return kn(h)&&Mn(h)==a}function bi(h,C,N,W,be){return h===C?!0:h==null||C==null||!kn(h)&&!kn(C)?h!==h&&C!==C:ll(h,C,N,W,bi,be)}function ll(h,C,N,W,be,ce){var Ne=cr(h),Ve=cr(C),We=Ne?c:qt(h),Ee=Ve?c:qt(C);We=We==a?y:We,Ee=Ee==a?y:Ee;var ot=We==y,bt=Ee==y,Ge=We==Ee;if(Ge&&Zr(h)){if(!Zr(C))return!1;Ne=!0,ot=!1}if(Ge&&!ot)return ce||(ce=new Bt),Ne||Ti(h)?xi(h,C,N,W,be,ce):pl(h,C,We,N,W,be,ce);if(!(N&i)){var ft=ot&&ze.call(h,"__wrapped__"),pt=bt&&ze.call(C,"__wrapped__");if(ft||pt){var Wt=ft?h.value():h,jt=pt?C.value():C;return ce||(ce=new Bt),be(Wt,jt,N,W,ce)}}return Ge?(ce||(ce=new Bt),ml(h,C,N,W,be,ce)):!1}function ul(h){if(!Ni(h)||wl(h))return!1;var C=Ei(h)?rt:j;return C.test(sn(h))}function dl(h){return kn(h)&&Si(h.length)&&!!R[Mn(h)]}function fl(h){if(!Il(h))return nn(h);var C=[];for(var N in Object(h))ze.call(h,N)&&N!="constructor"&&C.push(N);return C}function xi(h,C,N,W,be,ce){var Ne=N&i,Ve=h.length,We=C.length;if(Ve!=We&&!(Ne&&We>Ve))return!1;var Ee=ce.get(h);if(Ee&&ce.get(C))return Ee==C;var ot=-1,bt=!0,Ge=N&o?new ir:void 0;for(ce.set(h,C),ce.set(C,h);++ot<Ve;){var ft=h[ot],pt=C[ot];if(W)var Wt=Ne?W(pt,ft,ot,C,h,ce):W(ft,pt,ot,h,C,ce);if(Wt!==void 0){if(Wt)continue;bt=!1;break}if(Ge){if(!He(C,function(jt,an){if(!gt(Ge,an)&&(ft===jt||be(ft,jt,N,W,ce)))return Ge.push(an)})){bt=!1;break}}else if(!(ft===pt||be(ft,pt,N,W,ce))){bt=!1;break}}return ce.delete(h),ce.delete(C),bt}function pl(h,C,N,W,be,ce,Ne){switch(N){case Y:if(h.byteLength!=C.byteLength||h.byteOffset!=C.byteOffset)return!1;h=h.buffer,C=C.buffer;case z:return!(h.byteLength!=C.byteLength||!ce(new Vt(h),new Vt(C)));case d:case f:case I:return Oi(+h,+C);case m:return h.name==C.name&&h.message==C.message;case _:case $:return h==C+"";case w:var Ve=nt;case E:var We=W&i;if(Ve||(Ve=yt),h.size!=C.size&&!We)return!1;var Ee=Ne.get(h);if(Ee)return Ee==C;W|=o,Ne.set(h,C);var ot=xi(Ve(h),Ve(C),W,be,ce,Ne);return Ne.delete(h),ot;case T:if(Qe)return Qe.call(h)==Qe.call(C)}return!1}function ml(h,C,N,W,be,ce){var Ne=N&i,Ve=Ci(h),We=Ve.length,Ee=Ci(C),ot=Ee.length;if(We!=ot&&!Ne)return!1;for(var bt=We;bt--;){var Ge=Ve[bt];if(!(Ne?Ge in C:ze.call(C,Ge)))return!1}var ft=ce.get(h);if(ft&&ce.get(C))return ft==C;var pt=!0;ce.set(h,C),ce.set(C,h);for(var Wt=Ne;++bt<We;){Ge=Ve[bt];var jt=h[Ge],an=C[Ge];if(W)var Ri=Ne?W(an,jt,Ge,C,h,ce):W(jt,an,Ge,h,C,ce);if(!(Ri===void 0?jt===an||be(jt,an,N,W,ce):Ri)){pt=!1;break}Wt||(Wt=Ge=="constructor")}if(pt&&!Wt){var lr=h.constructor,ur=C.constructor;lr!=ur&&"constructor"in h&&"constructor"in C&&!(typeof lr=="function"&&lr instanceof lr&&typeof ur=="function"&&ur instanceof ur)&&(pt=!1)}return ce.delete(h),ce.delete(C),pt}function Ci(h){return cl(h,Ol,gl)}function ar(h,C){var N=h.__data__;return yl(C)?N[typeof C=="string"?"string":"hash"]:N.map}function wn(h,C){var N=Ue(h,C);return ul(N)?N:void 0}function hl(h){var C=ze.call(h,Ze),N=h[Ze];try{h[Ze]=void 0;var W=!0}catch{}var be=Kt.call(h);return W&&(C?h[Ze]=N:delete h[Ze]),be}var gl=Pt?function(h){return h==null?[]:(h=Object(h),we(Pt(h),function(C){return At.call(h,C)}))}:El,qt=Mn;(Ut&&qt(new Ut(new ArrayBuffer(1)))!=Y||xe&&qt(new xe)!=w||Xe&&qt(Xe.resolve())!=x||te&&qt(new te)!=E||ue&&qt(new ue)!=q)&&(qt=function(h){var C=Mn(h),N=C==y?h.constructor:void 0,W=N?sn(N):"";if(W)switch(W){case Dt:return Y;case H:return w;case re:return x;case ie:return E;case Re:return q}return C});function vl(h,C){return C=C??s,!!C&&(typeof h=="number"||D.test(h))&&h>-1&&h%1==0&&h<C}function yl(h){var C=typeof h;return C=="string"||C=="number"||C=="symbol"||C=="boolean"?h!=="__proto__":h===null}function wl(h){return!!Tt&&Tt in h}function Il(h){var C=h&&h.constructor,N=typeof C=="function"&&C.prototype||Fe;return h===N}function _l(h){return Kt.call(h)}function sn(h){if(h!=null){try{return wt.call(h)}catch{}try{return h+""}catch{}}return""}function Oi(h,C){return h===C||h!==h&&C!==C}var bl=_i(function(){return arguments}())?_i:function(h){return kn(h)&&ze.call(h,"callee")&&!At.call(h,"callee")},cr=Array.isArray;function xl(h){return h!=null&&Si(h.length)&&!Ei(h)}var Zr=Ht||Sl;function Cl(h,C){return bi(h,C)}function Ei(h){if(!Ni(h))return!1;var C=Mn(h);return C==p||C==v||C==l||C==b}function Si(h){return typeof h=="number"&&h>-1&&h%1==0&&h<=s}function Ni(h){var C=typeof h;return h!=null&&(C=="object"||C=="function")}function kn(h){return h!=null&&typeof h=="object"}var Ti=V?me(V):dl;function Ol(h){return xl(h)?al(h):fl(h)}function El(){return[]}function Sl(){return!1}e.exports=Cl})(Cr,Cr.exports);var Mf=Cr.exports;const kf=ko(Mf),fn="other",Or="uninstall-installation";function Xt(e){return!e.fieldName}function Lf(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function $f(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Xt(n)&&!!n.fieldName))||null}function Kf(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Xt(r)&&!!r.mapToName))||[]}function Vf(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Xt(n)&&!!n.fieldName))||null}const qs=(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 Hf(e){return Xt(e)?e.mapToName:e.fieldName}const Ws=(e,t)=>{var r,i,o;const n=[];return(o=(i=(r=t.content)==null?void 0:r.read)==null?void 0:i.objects)==null||o.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Un(s==null?void 0:s.objectName),completed:e?!!qs(e,s.objectName):!1})}),n},Js=e=>{var n;return{name:fn,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Uf(e,t){var o;const n=Ws(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?Js(e):void 0;return i&&n.push(i),n}function zs(e,t,n){const r=(e==null?void 0:e.filter(o=>!(t!=null&&t[o==null?void 0:o.mapToName])))||[],i=r.map(o=>o.mapToName);return n(Se.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Lo(e,t){return kf(e,t)}const Bf=(e,t,n)=>{var p,v,w,I,O,y;if(!e)return null;const r=Lf(e,t),i=r&&$f(r),o=r&&Vf(r),s=r&&Kf(r),a=(r==null?void 0:r.allFields)||[],c=n==null?void 0:n.content,l=((w=(v=(p=c==null?void 0:c.read)==null?void 0:p.objects)==null?void 0:v[t])==null?void 0:w.selectedFields)||{},d=((y=(O=(I=c==null?void 0:c.read)==null?void 0:I.objects)==null?void 0:O[t])==null?void 0:y.selectedFieldMappings)||{},f={...l},m={...d};return{allFields:a,requiredFields:i,optionalFields:o,requiredMapFields:s,selectedOptionalFields:l,selectedFieldMappings:d,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:f,requiredMapFields:m}}},qf=(e,t)=>{var s,a;if(!e)return null;const n=(a=(s=t==null?void 0:t.content)==null?void 0:s.write)==null?void 0:a.objects,r=Object.keys(n||{}),i={};r.forEach(c=>{i[c]=!0});const o={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:o}}};function Xs(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:Bf(r,t,n),write:qf(i,n)}}const Gs=(e,t,n,r)=>{const i=Xs(e,n,t);r(n,i)},Wf=(e,t,n)=>{const r=Uf(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=Xs(e,o,t))}),n(i)},Ys=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(Hf(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},Zs=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 Qs(e,t){return t[e]||void 0}async function $o({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:i,apiKey:o,setError:s,setInstallation:a,onInstallSuccess:c}){const l={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:i,config:e}};try{const d=await Te().installationApi.createInstallation(l,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){Ye(d,s)}}function $r(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Jf=(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)},zf=(e,t,n,r)=>{const i=Ys(e),o=Zs(e),s=Jf(n,t);if(!s)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const a={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 $r(n)&&(a.content.proxy={enabled:!0}),a},Xf=(e,t,n,r,i,o,s,a,c,l,d,f)=>{const m=zf(c,o,a,r);return m?$o({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:l,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},ea=e=>{var o,s;const t={},n=(o=e.write)==null?void 0:o.writeObjects,r=(s=e.write)==null?void 0:s.selectedNonConfigurableWriteFields,i=r?Object.keys(r):[];return n&&n.forEach(a=>{const c=a.objectName;i.includes(c)&&(t[c]={objectName:c})}),t},Gf=e=>{const t=e.content.write;return t==null?void 0:t.objects},Yf=(e,t,n)=>{if(!Gf(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=ea(e),o={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return $r(t)&&(o.content.proxy={enabled:!0}),o},Zf=(e,t,n,r,i,o,s,a,c,l,d)=>{const f=Yf(a,s,r);return f?$o({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:c,setInstallation:l,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Qf={backgroundColor:"var(--amp-colors-status-critical-muted)",borderColor:"var(--amp-colors-status-critical-muted)",color:"var(--amp-colors-status-critical-dark)",padding:".5rem 1rem"};function ta({children:e,style:t}){return u.jsx(vn,{style:{...Qf,...t},children:e})}var na={exports:{}};/*!
5
5
  Copyright (c) 2018 Jed Watson.
6
6
  Licensed under the MIT License (MIT), see
7
7
  http://jedwatson.github.io/classnames
8
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",s=0;s<arguments.length;s++){var 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})()})(pa);var hf=pa.exports;const vt=Wo(hf),gf="_button_1bwj3_1",yf="_buttonError_1bwj3_21",vf="_danger_1bwj3_40",wf="_ghost_1bwj3_50",co={button:gf,buttonError:yf,danger:vf,ghost:wf};function wt({className:e,style:t,type:n,children:r,variant:i,...o}){const s=vt(co.button,{[co.danger]:i==="danger",[co.ghost]:i==="ghost",[e||""]:!!e});return a.jsx("button",{type:n,className:s,style:t,...o,children:r})}function fa(){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 Gn="uninstall-installation",If=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:[fa(),a.jsx(T.Box,{textAlign:"left",children:a.jsx(T.Text,{color:"red.800",children:e})})]}),n.children]})}),ma=g.createContext({hydratedRevision:null,loading:!1}),_n=()=>{const e=g.useContext(ma);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function xf({projectId:e,children:t}){var _;const{selectedConnection:n}=Ln(),{integrationId:r,integrationObj:i}=ot(),[o,s]=g.useState(null),[c,l]=g.useState(!0),{isError:u,removeError:d,setError:f}=sn(),h=Ve(),p=n==null?void 0:n.id,m=(_=i==null?void 0:i.latestRevision)==null?void 0:_.id,y=(i==null?void 0:i.name)||r;g.useEffect(()=>{e&&r&&m&&p&&h&&Ee().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:r,revisionId:m,connectionId:p},{headers:{"X-Api-Key":h??""}}).then(b=>{s(b),l(!1),d(Se.HYDRATED_REVISION,y)}).catch(b=>{console.error(`Error loading integration ${y}.`),Ge(b),l(!1),f(Se.HYDRATED_REVISION,y)})},[e,r,m,p,h,d,f,y]);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(ma.Provider,{value:I,children:u(Se.HYDRATED_REVISION,y)?a.jsx(qt,{message:w}):t})}function Bt(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 Co(e,t){return Co=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Co(e,t)}function bf(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Co(e,t)}var So={exports:{}},wr={exports:{}},ge={};/** @license React v16.13.1
8
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(o=i(o,r(a)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var a in o)t.call(o,a)&&o[a]&&(s=i(s,a));return s}function i(o,s){return s?o?o+" "+s:o+s:o}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(na);var ep=na.exports;const st=ko(ep),tp="_button_1kmag_1",np="_buttonError_1kmag_21",rp="_danger_1kmag_35",op="_ghost_1kmag_41",to={button:tp,buttonError:np,danger:rp,ghost:op};function ht({className:e,style:t,type:n,children:r,variant:i,...o}){const s=st(to.button,{[to.danger]:i==="danger",[to.ghost]:i==="ghost",[e||""]:!!e});return u.jsx("button",{type:n,className:s,style:t,...o,children:r})}const ra=g.createContext({hydratedRevision:null,loading:!1}),Dn=()=>{const e=g.useContext(ra);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function ip({projectId:e,children:t}){var x;const{selectedConnection:n}=Pn(),{integrationId:r,integrationObj:i}=ut(),[o,s]=g.useState(null),[a,c]=g.useState(!0),{isError:l,removeError:d,setError:f}=Zt(),m=Je(),p=n==null?void 0:n.id,v=(x=i==null?void 0:i.latestRevision)==null?void 0:x.id,w=(i==null?void 0:i.name)||r;g.useEffect(()=>{e&&r&&v&&p&&m&&Te().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:r,revisionId:v,connectionId:p},{headers:{"X-Api-Key":m??""}}).then(b=>{s(b),c(!1),d(Se.HYDRATED_REVISION,w)}).catch(b=>{console.error(`Error loading integration ${w}.`),Ye(b),c(!1),f(Se.HYDRATED_REVISION,w)})},[e,r,v,p,m,d,f,w]);const I=g.useMemo(()=>({hydratedRevision:o,loading:a}),[o,a]),y=`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 u.jsx(ra.Provider,{value:I,children:l(Se.HYDRATED_REVISION,w)?u.jsx(Lt,{message:y}):t})}function Mt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function le(){return le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},le.apply(null,arguments)}function vo(e,t){return vo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},vo(e,t)}function sp(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,vo(e,t)}var yo={exports:{}},mr={exports:{}},he={};/** @license React v16.13.1
9
9
  * react-is.production.min.js
10
10
  *
11
11
  * Copyright (c) Facebook, Inc. and its affiliates.
12
12
  *
13
13
  * This source code is licensed under the MIT license found in the
14
14
  * LICENSE file in the root directory of this source tree.
15
- */var Yi;function _f(){if(Yi)return ge;Yi=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,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,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,y=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 E=x.$$typeof;switch(E){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 m:case p:case s:return x;default:return E}}case n:return E}}}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=m,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)===m},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===h||typeof x=="object"&&x!==null&&(x.$$typeof===m||x.$$typeof===p||x.$$typeof===s||x.$$typeof===c||x.$$typeof===d||x.$$typeof===I||x.$$typeof===C||x.$$typeof===w||x.$$typeof===y)},ge.typeOf=_,ge}var ye={};/** @license React v16.13.1
15
+ */var ki;function ap(){if(ki)return he;ki=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,l=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,v=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,I=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function x(_){if(typeof _=="object"&&_!==null){var E=_.$$typeof;switch(E){case t:switch(_=_.type,_){case c:case l:case r:case o:case i:case f:return _;default:switch(_=_&&_.$$typeof,_){case a:case d:case v:case p:case s:return _;default:return E}}case n:return E}}}function b(_){return x(_)===l}return he.AsyncMode=c,he.ConcurrentMode=l,he.ContextConsumer=a,he.ContextProvider=s,he.Element=t,he.ForwardRef=d,he.Fragment=r,he.Lazy=v,he.Memo=p,he.Portal=n,he.Profiler=o,he.StrictMode=i,he.Suspense=f,he.isAsyncMode=function(_){return b(_)||x(_)===c},he.isConcurrentMode=b,he.isContextConsumer=function(_){return x(_)===a},he.isContextProvider=function(_){return x(_)===s},he.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===t},he.isForwardRef=function(_){return x(_)===d},he.isFragment=function(_){return x(_)===r},he.isLazy=function(_){return x(_)===v},he.isMemo=function(_){return x(_)===p},he.isPortal=function(_){return x(_)===n},he.isProfiler=function(_){return x(_)===o},he.isStrictMode=function(_){return x(_)===i},he.isSuspense=function(_){return x(_)===f},he.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===l||_===o||_===i||_===f||_===m||typeof _=="object"&&_!==null&&(_.$$typeof===v||_.$$typeof===p||_.$$typeof===s||_.$$typeof===a||_.$$typeof===d||_.$$typeof===I||_.$$typeof===O||_.$$typeof===y||_.$$typeof===w)},he.typeOf=x,he}var ge={};/** @license React v16.13.1
16
16
  * react-is.development.js
17
17
  *
18
18
  * Copyright (c) Facebook, Inc. and its affiliates.
19
19
  *
20
20
  * This source code is licensed under the MIT license found in the
21
21
  * LICENSE file in the root directory of this source tree.
22
- */var Zi;function Cf(){return Zi||(Zi=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,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,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,y=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 _(P){return typeof P=="string"||typeof P=="function"||P===r||P===u||P===o||P===i||P===f||P===h||typeof P=="object"&&P!==null&&(P.$$typeof===m||P.$$typeof===p||P.$$typeof===s||P.$$typeof===c||P.$$typeof===d||P.$$typeof===I||P.$$typeof===C||P.$$typeof===w||P.$$typeof===y)}function b(P){if(typeof P=="object"&&P!==null){var fe=P.$$typeof;switch(fe){case t:var B=P.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 m:case p:case s:return Ie;default:return fe}}case n:return fe}}}var x=l,E=u,M=c,O=s,V=t,J=d,X=r,Z=m,te=p,q=n,ae=o,re=i,ee=f,pe=!1;function me(P){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(P)||b(P)===l}function N(P){return b(P)===u}function j(P){return b(P)===c}function L(P){return b(P)===s}function k(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function D(P){return b(P)===d}function A(P){return b(P)===r}function G(P){return b(P)===m}function Y(P){return b(P)===p}function H(P){return b(P)===n}function Q(P){return b(P)===o}function W(P){return b(P)===i}function ce(P){return b(P)===f}ye.AsyncMode=x,ye.ConcurrentMode=E,ye.ContextConsumer=M,ye.ContextProvider=O,ye.Element=V,ye.ForwardRef=J,ye.Fragment=X,ye.Lazy=Z,ye.Memo=te,ye.Portal=q,ye.Profiler=ae,ye.StrictMode=re,ye.Suspense=ee,ye.isAsyncMode=me,ye.isConcurrentMode=N,ye.isContextConsumer=j,ye.isContextProvider=L,ye.isElement=k,ye.isForwardRef=D,ye.isFragment=A,ye.isLazy=G,ye.isMemo=Y,ye.isPortal=H,ye.isProfiler=Q,ye.isStrictMode=W,ye.isSuspense=ce,ye.isValidElementType=_,ye.typeOf=b}()),ye}var Qi;function ha(){return Qi||(Qi=1,process.env.NODE_ENV==="production"?wr.exports=_f():wr.exports=Cf()),wr.exports}/*
22
+ */var Li;function cp(){return Li||(Li=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,l=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,v=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,I=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function x(A){return typeof A=="string"||typeof A=="function"||A===r||A===l||A===o||A===i||A===f||A===m||typeof A=="object"&&A!==null&&(A.$$typeof===v||A.$$typeof===p||A.$$typeof===s||A.$$typeof===a||A.$$typeof===d||A.$$typeof===I||A.$$typeof===O||A.$$typeof===y||A.$$typeof===w)}function b(A){if(typeof A=="object"&&A!==null){var fe=A.$$typeof;switch(fe){case t:var V=A.type;switch(V){case c:case l:case r:case o:case i:case f:return V;default:var we=V&&V.$$typeof;switch(we){case a:case d:case v:case p:case s:return we;default:return fe}}case n:return fe}}}var _=c,E=l,$=a,T=s,J=t,q=d,z=r,Y=v,ee=p,U=n,se=o,ne=i,Q=f,de=!1;function pe(A){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),S(A)||b(A)===c}function S(A){return b(A)===l}function P(A){return b(A)===a}function M(A){return b(A)===s}function j(A){return typeof A=="object"&&A!==null&&A.$$typeof===t}function D(A){return b(A)===d}function R(A){return b(A)===r}function X(A){return b(A)===v}function G(A){return b(A)===p}function K(A){return b(A)===n}function Z(A){return b(A)===o}function B(A){return b(A)===i}function ae(A){return b(A)===f}ge.AsyncMode=_,ge.ConcurrentMode=E,ge.ContextConsumer=$,ge.ContextProvider=T,ge.Element=J,ge.ForwardRef=q,ge.Fragment=z,ge.Lazy=Y,ge.Memo=ee,ge.Portal=U,ge.Profiler=se,ge.StrictMode=ne,ge.Suspense=Q,ge.isAsyncMode=pe,ge.isConcurrentMode=S,ge.isContextConsumer=P,ge.isContextProvider=M,ge.isElement=j,ge.isForwardRef=D,ge.isFragment=R,ge.isLazy=X,ge.isMemo=G,ge.isPortal=K,ge.isProfiler=Z,ge.isStrictMode=B,ge.isSuspense=ae,ge.isValidElementType=x,ge.typeOf=b}()),ge}var $i;function oa(){return $i||($i=1,process.env.NODE_ENV==="production"?mr.exports=ap():mr.exports=cp()),mr.exports}/*
23
23
  object-assign
24
24
  (c) Sindre Sorhus
25
25
  @license MIT
26
- */var lo,es;function Sf(){if(es)return lo;es=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},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 lo=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 h=0;h<u.length;h++)n.call(c,u[h])&&(l[u[h]]=c[u[h]])}}return l},lo}var uo,ts;function Yo(){if(ts)return uo;ts=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return uo=e,uo}var po,ns;function ga(){return ns||(ns=1,po=Function.call.bind(Object.prototype.hasOwnProperty)),po}var fo,rs;function Ef(){if(rs)return fo;rs=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Yo(),n={},r=ga();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 h=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 h.name="Invariant Violation",h}f=o[d](s,d,l,c,null,t)}catch(m){f=m}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={})},fo=i,fo}var mo,os;function Of(){if(os)return mo;os=1;var e=ha(),t=Sf(),n=Yo(),r=ga(),i=Ef(),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 mo=function(c,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(N){var j=N&&(u&&N[u]||N[d]);if(typeof j=="function")return j}var h="<<anonymous>>",p={array:C("array"),bigint:C("bigint"),bool:C("boolean"),func:C("function"),number:C("number"),object:C("object"),string:C("string"),symbol:C("symbol"),any:w(),arrayOf:_,element:b(),elementType:x(),instanceOf:E,node:J(),objectOf:O,oneOf:M,oneOfType:V,shape:Z,exact:te};function m(N,j){return N===j?N!==0||1/N===1/j:N!==N&&j!==j}function y(N,j){this.message=N,this.data=j&&typeof j=="object"?j:{},this.stack=""}y.prototype=Error.prototype;function I(N){if(process.env.NODE_ENV!=="production")var j={},L=0;function k(A,G,Y,H,Q,W,ce){if(H=H||h,W=W||Y,ce!==n){if(l){var P=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw P.name="Invariant Violation",P}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var fe=H+":"+Y;!j[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."),j[fe]=!0,L++)}}return G[Y]==null?A?G[Y]===null?new y("The "+Q+" `"+W+"` is marked as required "+("in `"+H+"`, but its value is `null`.")):new y("The "+Q+" `"+W+"` is marked as required in "+("`"+H+"`, but its value is `undefined`.")):null:N(G,Y,H,Q,W)}var D=k.bind(null,!1);return D.isRequired=k.bind(null,!0),D}function C(N){function j(L,k,D,A,G,Y){var H=L[k],Q=re(H);if(Q!==N){var W=ee(H);return new y("Invalid "+A+" `"+G+"` of type "+("`"+W+"` supplied to `"+D+"`, expected ")+("`"+N+"`."),{expectedType:N})}return null}return I(j)}function w(){return I(s)}function _(N){function j(L,k,D,A,G){if(typeof N!="function")return new y("Property `"+G+"` of component `"+D+"` has invalid PropType notation inside arrayOf.");var Y=L[k];if(!Array.isArray(Y)){var H=re(Y);return new y("Invalid "+A+" `"+G+"` of type "+("`"+H+"` supplied to `"+D+"`, expected an array."))}for(var Q=0;Q<Y.length;Q++){var W=N(Y,Q,D,A,G+"["+Q+"]",n);if(W instanceof Error)return W}return null}return I(j)}function b(){function N(j,L,k,D,A){var G=j[L];if(!c(G)){var Y=re(G);return new y("Invalid "+D+" `"+A+"` of type "+("`"+Y+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return I(N)}function x(){function N(j,L,k,D,A){var G=j[L];if(!e.isValidElementType(G)){var Y=re(G);return new y("Invalid "+D+" `"+A+"` of type "+("`"+Y+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return I(N)}function E(N){function j(L,k,D,A,G){if(!(L[k]instanceof N)){var Y=N.name||h,H=me(L[k]);return new y("Invalid "+A+" `"+G+"` of type "+("`"+H+"` supplied to `"+D+"`, expected ")+("instance of `"+Y+"`."))}return null}return I(j)}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 j(L,k,D,A,G){for(var Y=L[k],H=0;H<N.length;H++)if(m(Y,N[H]))return null;var Q=JSON.stringify(N,function(ce,P){var fe=ee(P);return fe==="symbol"?String(P):P});return new y("Invalid "+A+" `"+G+"` of value `"+String(Y)+"` "+("supplied to `"+D+"`, expected one of "+Q+"."))}return I(j)}function O(N){function j(L,k,D,A,G){if(typeof N!="function")return new y("Property `"+G+"` of component `"+D+"` has invalid PropType notation inside objectOf.");var Y=L[k],H=re(Y);if(H!=="object")return new y("Invalid "+A+" `"+G+"` of type "+("`"+H+"` supplied to `"+D+"`, expected an object."));for(var Q in Y)if(r(Y,Q)){var W=N(Y,Q,D,A,G+"."+Q,n);if(W instanceof Error)return W}return null}return I(j)}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 j=0;j<N.length;j++){var L=N[j];if(typeof L!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+pe(L)+" at index "+j+"."),s}function k(D,A,G,Y,H){for(var Q=[],W=0;W<N.length;W++){var ce=N[W],P=ce(D,A,G,Y,H,n);if(P==null)return null;P.data&&r(P.data,"expectedType")&&Q.push(P.data.expectedType)}var fe=Q.length>0?", expected one of type ["+Q.join(", ")+"]":"";return new y("Invalid "+Y+" `"+H+"` supplied to "+("`"+G+"`"+fe+"."))}return I(k)}function J(){function N(j,L,k,D,A){return q(j[L])?null:new y("Invalid "+D+" `"+A+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return I(N)}function X(N,j,L,k,D){return new y((N||"React class")+": "+j+" type `"+L+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+D+"`.")}function Z(N){function j(L,k,D,A,G){var Y=L[k],H=re(Y);if(H!=="object")return new y("Invalid "+A+" `"+G+"` 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,G,Q,ee(W));var ce=W(Y,Q,D,A,G+"."+Q,n);if(ce)return ce}return null}return I(j)}function te(N){function j(L,k,D,A,G){var Y=L[k],H=re(Y);if(H!=="object")return new y("Invalid "+A+" `"+G+"` 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,G,W,ee(ce));if(!ce)return new y("Invalid "+A+" `"+G+"` key `"+W+"` supplied to `"+D+"`.\nBad object: "+JSON.stringify(L[k],null," ")+`
27
- Valid keys: `+JSON.stringify(Object.keys(N),null," "));var P=ce(Y,W,D,A,G+"."+W,n);if(P)return P}return null}return I(j)}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 j=f(N);if(j){var L=j.call(N),k;if(j!==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,j){return N==="symbol"?!0:j?j["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&j instanceof Symbol:!1}function re(N){var j=typeof N;return Array.isArray(N)?"array":N instanceof RegExp?"object":ae(j,N)?"symbol":j}function ee(N){if(typeof N>"u"||N===null)return""+N;var j=re(N);if(j==="object"){if(N instanceof Date)return"date";if(N instanceof RegExp)return"regexp"}return j}function pe(N){var j=ee(N);switch(j){case"array":case"object":return"an "+j;case"boolean":case"date":case"regexp":return"a "+j;default:return j}}function me(N){return!N.constructor||!N.constructor.name?h:N.constructor.name}return p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},mo}var ho,is;function Nf(){if(is)return ho;is=1;var e=Yo();function t(){}function n(){}return n.resetWarningCache=t,ho=function(){function r(s,c,l,u,d,f){if(f!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},ho}if(process.env.NODE_ENV!=="production"){var Tf=ha(),Rf=!0;So.exports=Of()(Tf.isElement,Rf)}else So.exports=Nf()();var Af=So.exports;const F=Wo(Af);var Eo={exports:{}},ve={};/**
26
+ */var no,Ki;function lp(){if(Ki)return no;Ki=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(c.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(d){l[d]=d}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return no=i()?Object.assign:function(o,s){for(var a,c=r(o),l,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var f in a)t.call(a,f)&&(c[f]=a[f]);if(e){l=e(a);for(var m=0;m<l.length;m++)n.call(a,l[m])&&(c[l[m]]=a[l[m]])}}return c},no}var ro,Vi;function Ko(){if(Vi)return ro;Vi=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ro=e,ro}var oo,Hi;function ia(){return Hi||(Hi=1,oo=Function.call.bind(Object.prototype.hasOwnProperty)),oo}var io,Ui;function up(){if(Ui)return io;Ui=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Ko(),n={},r=ia();e=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,a,c,l){if(process.env.NODE_ENV!=="production"){for(var d in o)if(r(o,d)){var f;try{if(typeof o[d]!="function"){var m=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}f=o[d](s,d,c,a,null,t)}catch(v){f=v}if(f&&!(f instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var p=l?l():"";e("Failed "+a+" type: "+f.message+(p??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},io=i,io}var so,Bi;function dp(){if(Bi)return so;Bi=1;var e=oa(),t=lp(),n=Ko(),r=ia(),i=up(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function s(){return null}return so=function(a,c){var l=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(S){var P=S&&(l&&S[l]||S[d]);if(typeof P=="function")return P}var m="<<anonymous>>",p={array:O("array"),bigint:O("bigint"),bool:O("boolean"),func:O("function"),number:O("number"),object:O("object"),string:O("string"),symbol:O("symbol"),any:y(),arrayOf:x,element:b(),elementType:_(),instanceOf:E,node:q(),objectOf:T,oneOf:$,oneOfType:J,shape:Y,exact:ee};function v(S,P){return S===P?S!==0||1/S===1/P:S!==S&&P!==P}function w(S,P){this.message=S,this.data=P&&typeof P=="object"?P:{},this.stack=""}w.prototype=Error.prototype;function I(S){if(process.env.NODE_ENV!=="production")var P={},M=0;function j(R,X,G,K,Z,B,ae){if(K=K||m,B=B||G,ae!==n){if(c){var A=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw A.name="Invariant Violation",A}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var fe=K+":"+G;!P[fe]&&M<3&&(o("You are manually calling a React.PropTypes validation function for the `"+B+"` prop on `"+K+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),P[fe]=!0,M++)}}return X[G]==null?R?X[G]===null?new w("The "+Z+" `"+B+"` is marked as required "+("in `"+K+"`, but its value is `null`.")):new w("The "+Z+" `"+B+"` is marked as required in "+("`"+K+"`, but its value is `undefined`.")):null:S(X,G,K,Z,B)}var D=j.bind(null,!1);return D.isRequired=j.bind(null,!0),D}function O(S){function P(M,j,D,R,X,G){var K=M[j],Z=ne(K);if(Z!==S){var B=Q(K);return new w("Invalid "+R+" `"+X+"` of type "+("`"+B+"` supplied to `"+D+"`, expected ")+("`"+S+"`."),{expectedType:S})}return null}return I(P)}function y(){return I(s)}function x(S){function P(M,j,D,R,X){if(typeof S!="function")return new w("Property `"+X+"` of component `"+D+"` has invalid PropType notation inside arrayOf.");var G=M[j];if(!Array.isArray(G)){var K=ne(G);return new w("Invalid "+R+" `"+X+"` of type "+("`"+K+"` supplied to `"+D+"`, expected an array."))}for(var Z=0;Z<G.length;Z++){var B=S(G,Z,D,R,X+"["+Z+"]",n);if(B instanceof Error)return B}return null}return I(P)}function b(){function S(P,M,j,D,R){var X=P[M];if(!a(X)){var G=ne(X);return new w("Invalid "+D+" `"+R+"` of type "+("`"+G+"` supplied to `"+j+"`, expected a single ReactElement."))}return null}return I(S)}function _(){function S(P,M,j,D,R){var X=P[M];if(!e.isValidElementType(X)){var G=ne(X);return new w("Invalid "+D+" `"+R+"` of type "+("`"+G+"` supplied to `"+j+"`, expected a single ReactElement type."))}return null}return I(S)}function E(S){function P(M,j,D,R,X){if(!(M[j]instanceof S)){var G=S.name||m,K=pe(M[j]);return new w("Invalid "+R+" `"+X+"` of type "+("`"+K+"` supplied to `"+D+"`, expected ")+("instance of `"+G+"`."))}return null}return I(P)}function $(S){if(!Array.isArray(S))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),s;function P(M,j,D,R,X){for(var G=M[j],K=0;K<S.length;K++)if(v(G,S[K]))return null;var Z=JSON.stringify(S,function(ae,A){var fe=Q(A);return fe==="symbol"?String(A):A});return new w("Invalid "+R+" `"+X+"` of value `"+String(G)+"` "+("supplied to `"+D+"`, expected one of "+Z+"."))}return I(P)}function T(S){function P(M,j,D,R,X){if(typeof S!="function")return new w("Property `"+X+"` of component `"+D+"` has invalid PropType notation inside objectOf.");var G=M[j],K=ne(G);if(K!=="object")return new w("Invalid "+R+" `"+X+"` of type "+("`"+K+"` supplied to `"+D+"`, expected an object."));for(var Z in G)if(r(G,Z)){var B=S(G,Z,D,R,X+"."+Z,n);if(B instanceof Error)return B}return null}return I(P)}function J(S){if(!Array.isArray(S))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var P=0;P<S.length;P++){var M=S[P];if(typeof M!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+de(M)+" at index "+P+"."),s}function j(D,R,X,G,K){for(var Z=[],B=0;B<S.length;B++){var ae=S[B],A=ae(D,R,X,G,K,n);if(A==null)return null;A.data&&r(A.data,"expectedType")&&Z.push(A.data.expectedType)}var fe=Z.length>0?", expected one of type ["+Z.join(", ")+"]":"";return new w("Invalid "+G+" `"+K+"` supplied to "+("`"+X+"`"+fe+"."))}return I(j)}function q(){function S(P,M,j,D,R){return U(P[M])?null:new w("Invalid "+D+" `"+R+"` supplied to "+("`"+j+"`, expected a ReactNode."))}return I(S)}function z(S,P,M,j,D){return new w((S||"React class")+": "+P+" type `"+M+"."+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+D+"`.")}function Y(S){function P(M,j,D,R,X){var G=M[j],K=ne(G);if(K!=="object")return new w("Invalid "+R+" `"+X+"` of type `"+K+"` "+("supplied to `"+D+"`, expected `object`."));for(var Z in S){var B=S[Z];if(typeof B!="function")return z(D,R,X,Z,Q(B));var ae=B(G,Z,D,R,X+"."+Z,n);if(ae)return ae}return null}return I(P)}function ee(S){function P(M,j,D,R,X){var G=M[j],K=ne(G);if(K!=="object")return new w("Invalid "+R+" `"+X+"` of type `"+K+"` "+("supplied to `"+D+"`, expected `object`."));var Z=t({},M[j],S);for(var B in Z){var ae=S[B];if(r(S,B)&&typeof ae!="function")return z(D,R,X,B,Q(ae));if(!ae)return new w("Invalid "+R+" `"+X+"` key `"+B+"` supplied to `"+D+"`.\nBad object: "+JSON.stringify(M[j],null," ")+`
27
+ Valid keys: `+JSON.stringify(Object.keys(S),null," "));var A=ae(G,B,D,R,X+"."+B,n);if(A)return A}return null}return I(P)}function U(S){switch(typeof S){case"number":case"string":case"undefined":return!0;case"boolean":return!S;case"object":if(Array.isArray(S))return S.every(U);if(S===null||a(S))return!0;var P=f(S);if(P){var M=P.call(S),j;if(P!==S.entries){for(;!(j=M.next()).done;)if(!U(j.value))return!1}else for(;!(j=M.next()).done;){var D=j.value;if(D&&!U(D[1]))return!1}}else return!1;return!0;default:return!1}}function se(S,P){return S==="symbol"?!0:P?P["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&P instanceof Symbol:!1}function ne(S){var P=typeof S;return Array.isArray(S)?"array":S instanceof RegExp?"object":se(P,S)?"symbol":P}function Q(S){if(typeof S>"u"||S===null)return""+S;var P=ne(S);if(P==="object"){if(S instanceof Date)return"date";if(S instanceof RegExp)return"regexp"}return P}function de(S){var P=Q(S);switch(P){case"array":case"object":return"an "+P;case"boolean":case"date":case"regexp":return"a "+P;default:return P}}function pe(S){return!S.constructor||!S.constructor.name?m:S.constructor.name}return p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},so}var ao,qi;function fp(){if(qi)return ao;qi=1;var e=Ko();function t(){}function n(){}return n.resetWarningCache=t,ao=function(){function r(s,a,c,l,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},ao}if(process.env.NODE_ENV!=="production"){var pp=oa(),mp=!0;yo.exports=dp()(pp.isElement,mp)}else yo.exports=fp()();var hp=yo.exports;const F=ko(hp);var wo={exports:{}},ve={};/**
28
28
  * @license React
29
29
  * react-is.production.min.js
30
30
  *
@@ -32,7 +32,7 @@ Valid keys: `+JSON.stringify(Object.keys(N),null," "));var P=ce(Y,W,D,A,G+"."+W
32
32
  *
33
33
  * This source code is licensed under the MIT license found in the
34
34
  * LICENSE file in the root directory of this source tree.
35
- */var ss;function Pf(){if(ss)return ve;ss=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),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"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),m;m=Symbol.for("react.module.reference");function y(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 h:case f:case o:return I;default:return C}}case t:return C}}}return ve.ContextConsumer=s,ve.ContextProvider=o,ve.Element=e,ve.ForwardRef=l,ve.Fragment=n,ve.Lazy=h,ve.Memo=f,ve.Portal=t,ve.Profiler=i,ve.StrictMode=r,ve.Suspense=u,ve.SuspenseList=d,ve.isAsyncMode=function(){return!1},ve.isConcurrentMode=function(){return!1},ve.isContextConsumer=function(I){return y(I)===s},ve.isContextProvider=function(I){return y(I)===o},ve.isElement=function(I){return typeof I=="object"&&I!==null&&I.$$typeof===e},ve.isForwardRef=function(I){return y(I)===l},ve.isFragment=function(I){return y(I)===n},ve.isLazy=function(I){return y(I)===h},ve.isMemo=function(I){return y(I)===f},ve.isPortal=function(I){return y(I)===t},ve.isProfiler=function(I){return y(I)===i},ve.isStrictMode=function(I){return y(I)===r},ve.isSuspense=function(I){return y(I)===u},ve.isSuspenseList=function(I){return y(I)===d},ve.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===h||I.$$typeof===f||I.$$typeof===o||I.$$typeof===s||I.$$typeof===l||I.$$typeof===m||I.getModuleId!==void 0)},ve.typeOf=y,ve}var we={};/**
35
+ */var Wi;function gp(){if(Wi)return ve;Wi=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),l=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"),v;v=Symbol.for("react.module.reference");function w(I){if(typeof I=="object"&&I!==null){var O=I.$$typeof;switch(O){case e:switch(I=I.type,I){case n:case i:case r:case l:case d:return I;default:switch(I=I&&I.$$typeof,I){case a:case s:case c:case m:case f:case o:return I;default:return O}}case t:return O}}}return ve.ContextConsumer=s,ve.ContextProvider=o,ve.Element=e,ve.ForwardRef=c,ve.Fragment=n,ve.Lazy=m,ve.Memo=f,ve.Portal=t,ve.Profiler=i,ve.StrictMode=r,ve.Suspense=l,ve.SuspenseList=d,ve.isAsyncMode=function(){return!1},ve.isConcurrentMode=function(){return!1},ve.isContextConsumer=function(I){return w(I)===s},ve.isContextProvider=function(I){return w(I)===o},ve.isElement=function(I){return typeof I=="object"&&I!==null&&I.$$typeof===e},ve.isForwardRef=function(I){return w(I)===c},ve.isFragment=function(I){return w(I)===n},ve.isLazy=function(I){return w(I)===m},ve.isMemo=function(I){return w(I)===f},ve.isPortal=function(I){return w(I)===t},ve.isProfiler=function(I){return w(I)===i},ve.isStrictMode=function(I){return w(I)===r},ve.isSuspense=function(I){return w(I)===l},ve.isSuspenseList=function(I){return w(I)===d},ve.isValidElementType=function(I){return typeof I=="string"||typeof I=="function"||I===n||I===i||I===r||I===l||I===d||I===p||typeof I=="object"&&I!==null&&(I.$$typeof===m||I.$$typeof===f||I.$$typeof===o||I.$$typeof===s||I.$$typeof===c||I.$$typeof===v||I.getModuleId!==void 0)},ve.typeOf=w,ve}var ye={};/**
36
36
  * @license React
37
37
  * react-is.development.js
38
38
  *
@@ -40,10 +40,10 @@ Valid keys: `+JSON.stringify(Object.keys(N),null," "));var P=ce(Y,W,D,A,G+"."+W
40
40
  *
41
41
  * This source code is licensed under the MIT license found in the
42
42
  * LICENSE file in the root directory of this source tree.
43
- */var as;function jf(){return as||(as=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),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"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),m=!1,y=!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||m||y||I||typeof B=="object"&&B!==null&&(B.$$typeof===h||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 h:case f:case o:return qe;default:return Ie}}case t:return Ie}}}var E=s,M=o,O=e,V=l,J=n,X=h,Z=f,te=t,q=i,ae=r,re=u,ee=d,pe=!1,me=!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 j(B){return me||(me=!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 G(B){return x(B)===n}function Y(B){return x(B)===h}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 P(B){return x(B)===u}function fe(B){return x(B)===d}we.ContextConsumer=E,we.ContextProvider=M,we.Element=O,we.ForwardRef=V,we.Fragment=J,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=j,we.isContextConsumer=L,we.isContextProvider=k,we.isElement=D,we.isForwardRef=A,we.isFragment=G,we.isLazy=Y,we.isMemo=H,we.isPortal=Q,we.isProfiler=W,we.isStrictMode=ce,we.isSuspense=P,we.isSuspenseList=fe,we.isValidElementType=b,we.typeOf=x}()),we}process.env.NODE_ENV==="production"?Eo.exports=Pf():Eo.exports=jf();var cs=Eo.exports;const ls=e=>typeof e=="object"&&e!=null&&e.nodeType===1,us=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",go=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return us(n.overflowY,t)||us(n.overflowX,t)||(r=>{const i=(o=>{if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},Ir=(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,Df=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},kf=(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(!ls(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let m=e;for(;ls(m)&&f(m);){if(m=Df(m),m===h){p.push(m);break}m!=null&&m===document.body&&go(m)&&!go(document.documentElement)||m!=null&&go(m,d)&&p.push(m)}const y=(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:E,bottom:M,left:O}=e.getBoundingClientRect(),{top:V,right:J,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"?O+b/2-Z+J:l==="end"?E+J:O-Z;const ae=[];for(let re=0;re<p.length;re++){const ee=p[re],{height:pe,width:me,top:N,right:j,bottom:L,left:k}=ee.getBoundingClientRect();if(s==="if-needed"&&x>=0&&O>=0&&M<=I&&E<=y&&x>=N&&M<=L&&O>=k&&E<=j)return ae;const D=getComputedStyle(ee),A=parseInt(D.borderLeftWidth,10),G=parseInt(D.borderTopWidth,10),Y=parseInt(D.borderRightWidth,10),H=parseInt(D.borderBottomWidth,10);let Q=0,W=0;const ce="offsetWidth"in ee?ee.offsetWidth-ee.clientWidth-A-Y:0,P="offsetHeight"in ee?ee.offsetHeight-ee.clientHeight-G-H:0,fe="offsetWidth"in ee?ee.offsetWidth===0?0:me/ee.offsetWidth:0,B="offsetHeight"in ee?ee.offsetHeight===0?0:pe/ee.offsetHeight:0;if(h===ee)Q=c==="start"?te:c==="end"?te-I:c==="nearest"?Ir(w,w+I,I,G,H,w+te,w+te+_,_):te-I/2,W=l==="start"?q:l==="center"?q-y/2:l==="end"?q-y:Ir(C,C+y,y,A,Y,C+q,C+q+b,b),Q=Math.max(0,Q+w),W=Math.max(0,W+C);else{Q=c==="start"?te-N-G:c==="end"?te-L+H+P:c==="nearest"?Ir(N,L,pe,G,H+P,te,te+_,_):te-(N+pe/2)+P/2,W=l==="start"?q-k-A:l==="center"?q-(k+me/2)+ce/2:l==="end"?q-j+Y+ce:Ir(k,j,me,A,Y+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+P)),W=fe===0?0:Math.max(0,Math.min(Ie+W/fe,ee.scrollWidth-me/fe+ce)),te+=ke-Q,q+=Ie-W}ae.push({el:ee,top:Q,left:W})}return ae};var Tn=function(){return Tn=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},Tn.apply(this,arguments)};var Ff=0;function ds(e){return typeof e=="function"?e:ct}function ct(){}function ya(e,t){if(e){var n=kf(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var i=r.el,o=r.top,s=r.left;i.scrollTop=o,i.scrollLeft=s})}}function ps(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Zo(e,t){var n;function r(){n&&clearTimeout(n)}function i(){for(var o=arguments.length,s=new Array(o),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 En(){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 va(){return String(Ff++)}function Mf(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(n===1?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function fs(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function wa(e){return typeof e.type=="string"}function Ia(e){return e.props}function Lf(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var $f=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function xr(e){e===void 0&&(e={});var t={};return $f.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Rr(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=Ar(t,r)?t[r]:e[r],n},{})}function Ar(e,t){return e[t]!==void 0}function Oo(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Kf(e){return Object.prototype.toString.call(e)==="[object Object]"}function yn(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=Rn(c,t<0,n,r,i);return l===-1?e>=o?-1:e:l}function Rn(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?Rn(t?o-1:0,t,n,r):-1}function Pr(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(ps(i,e,n)||r&&ps(i,n.document.activeElement,n))})}var Qo=ct;process.env.NODE_ENV!=="production"&&(Qo=function(t,n,r){var i="This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props";Object.keys(t).forEach(function(o){n[o]!==void 0&&r[o]===void 0?console.error('downshift: A component has changed the controlled prop "'+o+'" to be uncontrolled. '+i):n[o]===void 0&&r[o]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+o+'" to be controlled. '+i)})});var Vf=Zo(function(e){xa(e).textContent=""},500);function xa(e){var t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}function ba(e,t){if(!(!e||!t)){var n=xa(t);n.textContent=e,Vf(t)}}function Hf(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var _a=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Ca=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Sa=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Er=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Or=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Ea=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Oa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Na=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Ta=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Ra=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Aa=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Pa=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,ja=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,No=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Da=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,ka=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Fa=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Bf=Object.freeze({__proto__:null,blurButton:Da,blurInput:Aa,changeInput:Pa,clickButton:No,clickItem:Ra,controlledPropUpdatedSelectedItem:ka,itemMouseEnter:Sa,keyDownArrowDown:Or,keyDownArrowUp:Er,keyDownEnd:Ta,keyDownEnter:Oa,keyDownEscape:Ea,keyDownHome:Na,keyDownSpaceButton:ja,mouseUp:Ca,touchEnd:Fa,unknown:_a}),Uf=["refKey","ref"],qf=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Wf=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Jf=["refKey","ref"],zf=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Xf=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+va(),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&&(_={}),_=xr(_),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){_=xr(_),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,E={},M=typeof w=="function";return!M&&w.hasOwnProperty("inputValue")&&o.props.onInputValueChange(w.inputValue,ue({},o.getStateAndHelpers(),w)),o.setState(function(O){var V;O=o.getState(O);var J=M?w(O):w;J=o.props.stateReducer(O,J),b=J.hasOwnProperty("selectedItem");var X={};return b&&J.selectedItem!==O.selectedItem&&(x=J.selectedItem),(V=J).type||(V.type=_a),Object.keys(J).forEach(function(Z){O[Z]!==J[Z]&&(E[Z]=J[Z]),Z!=="type"&&(J[Z],Ar(o.props,Z)||(X[Z]=J[Z]))}),M&&J.hasOwnProperty("inputValue")&&o.props.onInputValueChange(J.inputValue,ue({},o.getStateAndHelpers(),J)),X},function(){ds(_)();var O=Object.keys(E).length>1;O&&o.props.onStateChange(E,o.getStateAndHelpers()),b&&o.props.onSelect(w.selectedItem,o.getStateAndHelpers()),x!==void 0&&o.props.onChange(x,o.getStateAndHelpers()),o.props.onUserAction(E,o.getStateAndHelpers())})},o.rootRef=function(w){return o._rootNode=w},o.getRootProps=function(w,_){var b,x=w===void 0?{}:w,E=x.refKey,M=E===void 0?"ref":E,O=x.ref,V=Bt(x,Uf),J=_===void 0?{}:_,X=J.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]=En(O,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:Or})}else this.internalSetState({isOpen:!0,type:Or},function(){var E=b.getItemCount();if(E>0){var M=b.getState(),O=M.highlightedIndex,V=yn(O,1,{length:E},b.isItemDisabled,!0);b.setHighlightedIndex(V,{type:Or})}})},ArrowUp:function(_){var b=this;if(_.preventDefault(),this.getState().isOpen){var x=_.shiftKey?-5:-1;this.moveHighlightedIndex(x,{type:Er})}else this.internalSetState({isOpen:!0,type:Er},function(){var E=b.getItemCount();if(E>0){var M=b.getState(),O=M.highlightedIndex,V=yn(O,-1,{length:E},b.isItemDisabled,!0);b.setHighlightedIndex(V,{type:Er})}})},Enter:function(_){if(_.which!==229){var b=this.getState(),x=b.isOpen,E=b.highlightedIndex;if(x&&E!=null){_.preventDefault();var M=this.items[E],O=this.getItemNodeFromIndex(E);if(M==null||O&&O.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Oa})}}},Escape:function(_){_.preventDefault(),this.reset(ue({type:Ea},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=ue({},o.keyDownHandlers,{" ":function(_){_.preventDefault(),this.toggleMenu({type:ja})}}),o.inputKeyDownHandlers=ue({},o.keyDownHandlers,{Home:function(_){var b=this.getState(),x=b.isOpen;if(x){_.preventDefault();var E=this.getItemCount();if(!(E<=0||!x)){var M=Rn(0,!1,{length:E},this.isItemDisabled);this.setHighlightedIndex(M,{type:Na})}}},End:function(_){var b=this.getState(),x=b.isOpen;if(x){_.preventDefault();var E=this.getItemCount();if(!(E<=0||!x)){var M=Rn(E-1,!0,{length:E},this.isItemDisabled);this.setHighlightedIndex(M,{type:Ta})}}}}),o.getToggleButtonProps=function(w){var _=w===void 0?{}:w,b=_.onClick;_.onPress;var x=_.onKeyDown,E=_.onKeyUp,M=_.onBlur,O=Bt(_,qf),V=o.getState(),J=V.isOpen,X={onClick:Ke(b,o.buttonHandleClick),onKeyDown:Ke(x,o.buttonHandleKeyDown),onKeyUp:Ke(E,o.buttonHandleKeyUp),onBlur:Ke(M,o.buttonHandleBlur)},Z=O.disabled?{}:X;return ue({type:"button",role:"button","aria-label":J?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},Z,O)},o.buttonHandleKeyUp=function(w){w.preventDefault()},o.buttonHandleKeyDown=function(w){var _=Oo(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:No}):o.internalSetTimeout(function(){return o.toggleMenu({type:No})})},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:Da})}})},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,E=_.onChange,M=_.onInput;_.onChangeText;var O=Bt(_,Wf),V,J={};V="onChange";var X=o.getState(),Z=X.inputValue,te=X.isOpen,q=X.highlightedIndex;if(!O.disabled){var ae;J=(ae={},ae[V]=Ke(E,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":O&&O["aria-label"]?void 0:o.labelId,autoComplete:"off",value:Z,id:o.inputId},J,O)},o.inputHandleKeyDown=function(w){var _=Oo(w);_&&o.inputKeyDownHandlers[_]&&o.inputKeyDownHandlers[_].call(o,w)},o.inputHandleChange=function(w){o.internalSetState({type:Pa,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:Aa})}})},o.menuRef=function(w){o._menuNode=w},o.getMenuProps=function(w,_){var b,x=w===void 0?{}:w,E=x.refKey,M=E===void 0?"ref":E,O=x.ref,V=Bt(x,Jf),J=_===void 0?{}:_,X=J.suppressRefError,Z=X===void 0?!1:X;return o.getMenuProps.called=!0,o.getMenuProps.refKey=M,o.getMenuProps.suppressRefError=Z,ue((b={},b[M]=En(O,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,E=b.onMouseDown,M=b.onClick;b.onPress;var O=b.index,V=b.item,J=V===void 0?process.env.NODE_ENV==="production"?void 0:Lf("getItemProps","item"):V,X=Bt(b,zf);O===void 0?(o.items.push(J),O=o.items.indexOf(J)):o.items[O]=J;var Z="onClick",te=M,q=(_={onMouseMove:Ke(x,function(){O!==o.getState().highlightedIndex&&(o.setHighlightedIndex(O,{type:Sa}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:Ke(E,function(re){re.preventDefault()})},_[Z]=Ke(te,function(){o.selectItemAtIndex(O,{type:Ra})}),_),ae=X.disabled?{onMouseDown:q.onMouseDown}:q;return ue({id:o.getItemId(O),role:"option","aria-selected":o.getState().highlightedIndex===O},ae,X)},o.clearItems=function(){o.items=[]},o.reset=function(w,_){w===void 0&&(w={}),w=xr(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=xr(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,E=b.highlightedIndex;x&&o.getItemCount()>0&&typeof E=="number"&&o.setHighlightedIndex(E,w),ds(_)()})},o.openMenu=function(w){o.internalSetState({isOpen:!0},w)},o.closeMenu=function(w){o.internalSetState({isOpen:!1},w)},o.updateStatus=Zo(function(){var w;if((w=o.props)!=null&&(w=w.environment)!=null&&w.document){var _=o.getState(),b=o.items[_.highlightedIndex],x=o.getItemCount(),E=o.props.getA11yStatusMessage(ue({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:x,highlightedItem:b},_));o.previousResultCount=x,ba(E,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,h=f===void 0?d:f,p=s.initialInputValue,m=p===void 0?"":p,y=s.initialSelectedItem,I=y===void 0?null:y,C=o.getState({highlightedIndex:u,isOpen:h,inputValue:m,selectedItem:I});return C.selectedItem!=null&&o.props.initialInputValue===void 0&&(C.inputValue=o.props.itemToString(C.selectedItem)),o.state=C,o}bf(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(o){clearTimeout(o)}),this.timeoutIds=[]},r.getState=function(o){return o===void 0&&(o=this.state),Rr(o,this.props)},r.getItemCount=function(){var o=this.items.length;return this.itemCount!=null?o=this.itemCount:this.props.itemCount!==void 0&&(o=this.props.itemCount),o},r.getItemNodeFromIndex=function(o){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(o)):null},r.scrollHighlightedItemIntoView=function(){{var o=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(o,this._menuNode)}},r.moveHighlightedIndex=function(o,s){var c=this.getItemCount(),l=this.getState(),u=l.highlightedIndex;if(c>0){var d=yn(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,h=this.getRootProps,p=this.getToggleButtonProps,m=this.getLabelProps,y=this.getMenuProps,I=this.getInputProps,C=this.getItemProps,w=this.openMenu,_=this.closeMenu,b=this.toggleMenu,x=this.selectItem,E=this.selectItemAtIndex,M=this.selectHighlightedItem,O=this.setHighlightedIndex,V=this.clearSelection,J=this.clearItems,X=this.reset,Z=this.setItemCount,te=this.unsetItemCount,q=this.internalSetState;return{getRootProps:h,getToggleButtonProps:p,getLabelProps:m,getMenuProps:y,getInputProps:I,getItemProps:C,reset:X,openMenu:w,closeMenu:_,toggleMenu:b,selectItem:x,selectItemAtIndex:E,selectHighlightedItem:M,setHighlightedIndex:O,clearSelection:V,clearItems:J,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&&ms(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 m=Pr(p.target,[o._rootNode,o._menuNode],o.props.environment);!m&&o.getState().isOpen&&o.reset({type:Ca},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},l=function(){o.isTouchMove=!1},u=function(){o.isTouchMove=!0},d=function(p){var m=Pr(p.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!m&&o.getState().isOpen&&o.reset({type:Fa},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,h=l!==d;return f||h},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(Qo(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&ms(this._menuNode,this.getMenuProps)),Ar(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:ka,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,o)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var o=fs(this.props.children,ct);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var s=fs(o(this.getStateAndHelpers()));if(!s)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&Gf(s,this.getRootProps),s;if(wa(s))return g.cloneElement(s,this.getRootProps(Ia(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:Mf,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Kf(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:ct,onInputValueChange:ct,onUserAction:ct,onChange:ct,onSelect:ct,onOuterClick:ct,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:ya},e.stateChangeTypes=Bf,e}();process.env.NODE_ENV!=="production"&&(Xf.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 ms(e,t){var n=t.refKey;e||console.error('downshift: The ref prop "'+n+'" from getMenuProps was not applied correctly on your menu element.')}function Gf(e,t){var n=t.refKey,r=n!=="ref",i=!wa(e);i&&!r&&!cs.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!i&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!cs.isForwardRef(e)&&!Ia(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Ma={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Yf(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){Zf(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 Zf(e,t,n,r){var i=t.props,o=t.type,s="on"+ei(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](ue({type:o},r))}function Qf(e,t){return t.changes}var hs=Zo(function(e,t){ba(e,t)},200),em=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?g.useLayoutEffect:g.useEffect,tm="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-"+va():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 nm(e,t,n,r){var i,o;if(e===void 0){if(t===void 0)throw new Error(r);i=n[t],o=t}else o=t===void 0?n.indexOf(e):t,i=e;return[i,o]}function ei(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function La(e){var t=g.useRef(e);return t.current=e,t}function rm(e,t,n,r){var i=g.useRef(),o=g.useRef(),s=g.useCallback(function(p,m){o.current=m,p=Rr(p,m.props);var y=e(p,m),I=m.props.stateReducer(p,ue({},m,{changes:y}));return I},[e]),c=g.useReducer(s,t,n),l=c[0],u=c[1],d=La(t),f=g.useCallback(function(p){return u(ue({props:d.current},p))},[d]),h=o.current;return g.useEffect(function(){var p=Rr(i.current,h==null?void 0:h.props),m=h&&i.current&&!r(p,l);m&&Yf(h,p,l),i.current=l},[l,h,r]),[l,f]}var Wn={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:Qf,scrollIntoView:ya,environment:typeof window>"u"?void 0:window};function en(e,t,n){n===void 0&&(n=Ma);var r=e["default"+ei(t)];return r!==void 0?r:n[t]}function Jn(e,t,n){n===void 0&&(n=Ma);var r=e[t];if(r!==void 0)return r;var i=e["initial"+ei(t)];return i!==void 0?i:en(e,t,n)}function om(e){var t=Jn(e,"selectedItem"),n=Jn(e,"isOpen"),r=lm(e),i=Jn(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 im(e,t,n){var r=g.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return g.useEffect(function(){if(!e)return ct;var i=n.map(function(d){return d.current});function o(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,Pr(d.target,i,e)||t()}function 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&&!Pr(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 $a=function(){return ct};process.env.NODE_ENV!=="production"&&($a=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 sm(e,t,n,r){r===void 0&&(r={});var i=r.document,o=Wr();g.useEffect(function(){if(!(!e||o||!i)){var s=e(t);hs(s,i)}},n),g.useEffect(function(){return function(){hs.cancel(),Hf(i)}},[i])}function am(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 em(function(){t<0||!n||!Object.keys(r.current).length||(c.current===!1?c.current=!0:s(i(t),o))},[t]),c}var Ka=ct;process.env.NODE_ENV!=="production"&&(Ka=function(t){var n=t.props,r=t.state,i=g.useRef(n),o=Wr();g.useEffect(function(){o||(Qo(r,i.current,n),i.current=n)},[r,n,o])});function gs(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return ue({isOpen:!1,highlightedIndex:-1},i&&ue({selectedItem:e.items[t],isOpen:en(e,"isOpen"),highlightedIndex:en(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function cm(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Wr(){var e=g.useRef(!0);return g.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function To(e){var t=en(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function lm(e){var t=Jn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Nr={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},Va=ue({},Nr,{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 um(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:To(i),isOpen:en(i,"isOpen"),selectedItem:en(i,"selectedItem"),inputValue:en(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return ue({},e,o)}Tn(Tn({},Va),{items:F.array.isRequired,isItemDisabled:F.func});Tn(Tn({},Wn),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var ti=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,ni=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,ri=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,oi=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,ii=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,si=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,ai=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,ci=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,li=process.env.NODE_ENV!=="production"?"__input_change__":8,jr=process.env.NODE_ENV!=="production"?"__input_blur__":9,ui=process.env.NODE_ENV!=="production"?"__input_click__":10,Ha=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Ba=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,di=process.env.NODE_ENV!=="production"?"__item_click__":13,Ua=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,qa=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Wa=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Ja=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,za=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,pi=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Xa=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Ga=process.env.NODE_ENV!=="production"?"__function_reset__":21,fi=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Ya=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:fi,FunctionCloseMenu:Ja,FunctionOpenMenu:Wa,FunctionReset:Ga,FunctionSelectItem:pi,FunctionSetHighlightedIndex:za,FunctionSetInputValue:Xa,FunctionToggleMenu:qa,InputBlur:jr,InputChange:li,InputClick:ui,InputKeyDownArrowDown:ti,InputKeyDownArrowUp:ni,InputKeyDownEnd:ii,InputKeyDownEnter:ci,InputKeyDownEscape:ri,InputKeyDownHome:oi,InputKeyDownPageDown:ai,InputKeyDownPageUp:si,ItemClick:di,ItemMouseMove:Ba,MenuMouseLeave:Ha,ToggleButtonClick:Ua});function dm(e){var t=om(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 pm=ue({},Va,{items:F.array.isRequired,isItemDisabled:F.func,inputValue:F.string,defaultInputValue:F.string,initialInputValue:F.string,inputId:F.string,onInputValueChange:F.func});function fm(e,t,n,r){var i=g.useRef(),o=rm(e,t,n,r),s=o[0],c=o[1],l=Wr();return g.useEffect(function(){if(Ar(t,"selectedItem")){if(!l){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);u&&c({type:fi,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Rr(s,t),c]}var Za=ct;process.env.NODE_ENV!=="production"&&(Za=function(t,n){F.checkPropTypes(pm,t,"prop",n.name)});var mm=ue({},Wn,{isItemDisabled:function(){return!1}});function hm(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case di:s={isOpen:en(i,"isOpen"),highlightedIndex:To(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case ti:e.isOpen?s={highlightedIndex:yn(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 ni:e.isOpen?o?s=gs(i,e.highlightedIndex):s={highlightedIndex:yn(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:zn(i,e,-1),isOpen:i.items.length>=0};break;case ci:s=gs(i,e.highlightedIndex);break;case ri:s=ue({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case si:s={highlightedIndex:yn(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case ai:s={highlightedIndex:yn(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case oi:s={highlightedIndex:Rn(0,!1,i.items,i.isItemDisabled)};break;case ii:s={highlightedIndex:Rn(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case jr: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 li:s={isOpen:!0,highlightedIndex:To(i),inputValue:t.inputValue};break;case ui:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:zn(i,e,0)};break;case pi:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case fi:s={inputValue:t.inputValue};break;default:return um(e,t,Ya)}return ue({},e,s)}var gm=["onMouseLeave","refKey","ref"],ym=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],vm=["onClick","onPress","refKey","ref"],wm=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];mi.stateChangeTypes=Ya;function mi(e){e===void 0&&(e={}),Za(e,mi);var t=ue({},mm,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=fm(hm,t,dm,cm),c=s[0],l=s[1],u=c.isOpen,d=c.highlightedIndex,f=c.selectedItem,h=c.inputValue,p=g.useRef(null),m=g.useRef({}),y=g.useRef(null),I=g.useRef(null),C=Wr(),w=tm(t),_=g.useRef(),b=La({state:c,props:t}),x=g.useCallback(function(L){return m.current[w.getItemId(L)]},[w]);sm(o,c,[u,d,f,h],i);var E=am({menuElement:p.current,highlightedIndex:d,isOpen:u,itemRefs:m,scrollIntoView:r,getItemNodeFromIndex:x});Ka({props:t,state:c}),g.useEffect(function(){var L=Jn(t,"isOpen");L&&y.current&&y.current.focus()},[]),g.useEffect(function(){C||(_.current=n.length)});var M=im(i,g.useCallback(function(){b.current.state.isOpen&&l({type:jr,selectItem:!1})},[l,b]),g.useMemo(function(){return[p,I,y]},[p.current,I.current,y.current])),O=$a("getInputProps","getMenuProps");g.useEffect(function(){u||(m.current={})},[u]),g.useEffect(function(){var L;!u||!(i!=null&&i.document)||!(y!=null&&(L=y.current)!=null&&L.focus)||i.document.activeElement!==y.current&&y.current.focus()},[u,i]);var V=g.useMemo(function(){return{ArrowDown:function(k){k.preventDefault(),l({type:ti,altKey:k.altKey})},ArrowUp:function(k){k.preventDefault(),l({type:ni,altKey:k.altKey})},Home:function(k){b.current.state.isOpen&&(k.preventDefault(),l({type:oi}))},End:function(k){b.current.state.isOpen&&(k.preventDefault(),l({type:ii}))},Escape:function(k){var D=b.current.state;(D.isOpen||D.inputValue||D.selectedItem||D.highlightedIndex>-1)&&(k.preventDefault(),l({type:ri}))},Enter:function(k){var D=b.current.state;!D.isOpen||k.which===229||(k.preventDefault(),l({type:ci}))},PageUp:function(k){b.current.state.isOpen&&(k.preventDefault(),l({type:si}))},PageDown:function(k){b.current.state.isOpen&&(k.preventDefault(),l({type:ai}))}}},[l,b]),J=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,G=A.onMouseLeave,Y=A.refKey,H=Y===void 0?"ref":Y,Q=A.ref,W=Bt(A,gm),ce=k===void 0?{}:k,P=ce.suppressRefError,fe=P===void 0?!1:P;return O("getMenuProps",fe,H,p),ue((D={},D[H]=En(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(G,function(){l({type:Ha})}),D),W)},[l,O,w]),Z=g.useCallback(function(L){var k,D,A=L===void 0?{}:L,G=A.item,Y=A.index,H=A.refKey,Q=H===void 0?"ref":H,W=A.ref,ce=A.onMouseMove,P=A.onMouseDown,fe=A.onClick;A.onPress;var B=A.disabled,Ie=Bt(A,ym);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,he=nm(G,Y,qe.items,"Pass either item or index to getItemProps!"),It=he[0],We=he[1],it=qe.isItemDisabled(It,We),xt="onClick",bt=fe,Je=function(){M.isTouchEnd||We===Fe.highlightedIndex||(E.current=!1,l({type:Ba,index:We,disabled:it}))},He=function(){l({type:di,index:We})},Me=function(_t){return _t.preventDefault()};return ue((k={},k[Q]=En(W,function(Oe){Oe&&(m.current[w.getItemId(We)]=Oe)}),k["aria-disabled"]=it,k["aria-selected"]=We===Fe.highlightedIndex,k.id=w.getItemId(We),k.role="option",k),!it&&(D={},D[xt]=Ke(bt,He),D),{onMouseMove:Ke(ce,Je),onMouseDown:Ke(P,Me)},Ie)},[l,w,b,M,E]),te=g.useCallback(function(L){var k,D=L===void 0?{}:L,A=D.onClick;D.onPress;var G=D.refKey,Y=G===void 0?"ref":G,H=D.ref,Q=Bt(D,vm),W=b.current.state,ce=function(){l({type:Ua})};return ue((k={},k[Y]=En(H,function(P){I.current=P}),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,G=A.onKeyDown,Y=A.onChange,H=A.onInput,Q=A.onBlur;A.onChangeText;var W=A.onClick,ce=A.refKey,P=ce===void 0?"ref":ce,fe=A.ref,B=Bt(A,wm),Ie=k===void 0?{}:k,ke=Ie.suppressRefError,qe=ke===void 0?!1:ke;O("getInputProps",qe,P,y);var Fe=b.current.state,he=function(Me){var Oe=Oo(Me);Oe&&V[Oe]&&V[Oe](Me)},It=function(Me){l({type:li,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:jr,selectItem:!Oe})}},it=function(){l({type:ui})},xt="onChange",bt={};if(!B.disabled){var Je;bt=(Je={},Je[xt]=Ke(Y,H,It),Je.onKeyDown=Ke(G,he),Je.onBlur=Ke(Q,We),Je.onClick=Ke(W,it),Je)}return ue((D={},D[P]=En(fe,function(He){y.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),bt,B)},[l,w,i,V,b,M,O]),ae=g.useCallback(function(){l({type:qa})},[l]),re=g.useCallback(function(){l({type:Ja})},[l]),ee=g.useCallback(function(){l({type:Wa})},[l]),pe=g.useCallback(function(L){l({type:za,highlightedIndex:L})},[l]),me=g.useCallback(function(L){l({type:pi,selectedItem:L})},[l]),N=g.useCallback(function(L){l({type:Xa,inputValue:L})},[l]),j=g.useCallback(function(){l({type:Ga})},[l]);return{getItemProps:Z,getLabelProps:J,getMenuProps:X,getInputProps:q,getToggleButtonProps:te,toggleMenu:ae,openMenu:ee,closeMenu:re,setHighlightedIndex:pe,setInputValue:N,selectItem:me,reset:j,highlightedIndex:d,isOpen:u,selectedItem:f,inputValue:h}}Nr.stateReducer,Nr.itemToKey,Nr.environment,F.array,F.array,F.array,F.func,F.number,F.number,F.number,F.func,F.func,F.string,F.string;Wn.itemToKey,Wn.stateReducer,Wn.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 Im="_comboboxContainer_1yunp_1",xm="_label_1yunp_8",bm="_inputContainer_1yunp_12",_m="_input_1yunp_12",Cm="_toggleButton_1yunp_25",Sm="_menu_1yunp_30",Em="_menuItem_1yunp_43",Om="_highlighted_1yunp_50",Nm="_selected_1yunp_54",Tm="_hidden_1yunp_58",Ht={comboboxContainer:Im,label:xm,inputContainer:bm,input:_m,toggleButton:Cm,menu:Sm,menuItem:Em,highlighted:Om,selected:Nm,hidden:Tm};function Rm(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function Am({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(Rm(p)))},{isOpen:c,getToggleButtonProps:l,getMenuProps:u,getInputProps:d,highlightedIndex:f,getItemProps:h}=mi({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:Ht.comboboxContainer,children:a.jsxs("div",{className:Ht.inputContainer,children:[a.jsx("input",{placeholder:r,className:Ht.input,...d()}),a.jsx("button",{"aria-label":"toggle menu",className:Ht.toggleButton,type:"button",...l(),children:c?a.jsx(a.Fragment,{children:"↑"}):a.jsx(a.Fragment,{children:"↓"})})]})}),a.jsx("ul",{className:`${Ht.menu} ${c&&e.length?"":Ht.hidden}`,...u(),children:c&&i.map((p,m)=>a.jsx("li",{className:`${Ht.menuItem} ${f===m?Ht.highlighted:""} ${t===(p==null?void 0:p.value)?Ht.selected:""}`,...h({item:p,index:m}),children:a.jsx("span",{children:p.label})},p.id))})]})}const An=Math.min,vn=Math.max,Dr=Math.round,br=Math.floor,rn=e=>({x:e,y:e}),Pm={left:"right",right:"left",bottom:"top",top:"bottom"},jm={start:"end",end:"start"};function Ro(e,t,n){return vn(e,An(t,n))}function nr(e,t){return typeof e=="function"?e(t):e}function wn(e){return e.split("-")[0]}function rr(e){return e.split("-")[1]}function Qa(e){return e==="x"?"y":"x"}function hi(e){return e==="y"?"height":"width"}function Pn(e){return["top","bottom"].includes(wn(e))?"y":"x"}function gi(e){return Qa(Pn(e))}function Dm(e,t,n){n===void 0&&(n=!1);const r=rr(e),i=gi(e),o=hi(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=kr(s)),[s,kr(s)]}function km(e){const t=kr(e);return[Ao(e),t,Ao(t)]}function Ao(e){return e.replace(/start|end/g,t=>jm[t])}function Fm(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 Mm(e,t,n,r){const i=rr(e);let o=Fm(wn(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Ao)))),o}function kr(e){return e.replace(/left|right|bottom|top/g,t=>Pm[t])}function Lm(e){return{top:0,right:0,bottom:0,left:0,...e}}function ec(e){return typeof e!="number"?Lm(e):{top:e,right:e,bottom:e,left:e}}function Fr(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ys(e,t,n){let{reference:r,floating:i}=e;const o=Pn(t),s=gi(t),c=hi(s),l=wn(t),u=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=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(rr(t)){case"start":p[s]-=h*(n&&u?-1:1);break;case"end":p[s]+=h*(n&&u?-1:1);break}return p}const $m=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}=ys(u,r,l),h=r,p={},m=0;for(let y=0;y<c.length;y++){const{name:I,fn:C}=c[y],{x:w,y:_,data:b,reset:x}=await C({x:d,y:f,initialPlacement:r,placement:h,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&&m<=50&&(m++,typeof x=="object"&&(x.placement&&(h=x.placement),x.rects&&(u=x.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:d,y:f}=ys(u,h,l)),y=-1)}return{x:d,y:f,placement:h,strategy:i,middlewareData:p}};async function tc(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:h=!1,padding:p=0}=nr(t,e),m=ec(p),I=c[h?f==="floating"?"reference":"floating":f],C=Fr(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=Fr(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:_,strategy:l}):w);return{top:(C.top-x.top+m.top)/b.y,bottom:(x.bottom-C.bottom+m.bottom)/b.y,left:(C.left-x.left+m.left)/b.x,right:(x.right-C.right+m.right)/b.x}}const Km=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}=nr(e,t)||{};if(u==null)return{};const f=ec(d),h={x:n,y:r},p=gi(i),m=hi(p),y=await s.getDimensions(u),I=p==="y",C=I?"top":"left",w=I?"bottom":"right",_=I?"clientHeight":"clientWidth",b=o.reference[m]+o.reference[p]-h[p]-o.floating[m],x=h[p]-o.reference[p],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let M=E?E[_]:0;(!M||!await(s.isElement==null?void 0:s.isElement(E)))&&(M=c.floating[_]||o.floating[m]);const O=b/2-x/2,V=M/2-y[m]/2-1,J=An(f[C],V),X=An(f[w],V),Z=J,te=M-y[m]-X,q=M/2-y[m]/2+O,ae=Ro(Z,q,te),re=!l.arrow&&rr(i)!=null&&q!==ae&&o.reference[m]/2-(q<Z?J:X)-y[m]/2<0,ee=re?q<Z?q-Z:q-te:0;return{[p]:h[p]+ee,data:{[p]:ae,centerOffset:q-ae-ee,...re&&{alignmentOffset:ee}},reset:re}}}),Vm=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:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...I}=nr(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const C=wn(i),w=Pn(c),_=wn(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(u.floating)),x=h||(_||!y?[kr(c)]:km(c)),E=m!=="none";!h&&E&&x.push(...Mm(c,y,m,b));const M=[c,...x],O=await tc(t,I),V=[];let J=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&V.push(O[C]),f){const q=Dm(i,s,b);V.push(O[q[0]],O[q[1]])}if(J=[...J,{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:J},reset:{placement:ae}};let re=(Z=J.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=J.filter(pe=>{if(E){const me=Pn(pe.placement);return me===w||me==="y"}return!0}).map(pe=>[pe.placement,pe.overflows.filter(me=>me>0).reduce((me,N)=>me+N,0)]).sort((pe,me)=>pe[1]-me[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 Hm(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=wn(n),c=rr(n),l=Pn(n)==="y",u=["left","top"].includes(s)?-1:1,d=o&&l?-1:1,f=nr(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof m=="number"&&(p=c==="end"?m*-1:m),l?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const Bm=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 Hm(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}}}}},Um=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}=nr(e,t),u={x:n,y:r},d=await tc(t,l),f=Pn(wn(i)),h=Qa(f);let p=u[h],m=u[f];if(o){const I=h==="y"?"top":"left",C=h==="y"?"bottom":"right",w=p+d[I],_=p-d[C];p=Ro(w,p,_)}if(s){const I=f==="y"?"top":"left",C=f==="y"?"bottom":"right",w=m+d[I],_=m-d[C];m=Ro(w,m,_)}const y=c.fn({...t,[h]:p,[f]:m});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:o,[f]:s}}}}}};function Jr(){return typeof window<"u"}function $n(e){return nc(e)?(e.nodeName||"").toLowerCase():"#document"}function lt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function kt(e){var t;return(t=(nc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function nc(e){return Jr()?e instanceof Node||e instanceof lt(e).Node:!1}function Tt(e){return Jr()?e instanceof Element||e instanceof lt(e).Element:!1}function Dt(e){return Jr()?e instanceof HTMLElement||e instanceof lt(e).HTMLElement:!1}function vs(e){return!Jr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof lt(e).ShadowRoot}function or(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Rt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function qm(e){return["table","td","th"].includes($n(e))}function zr(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function yi(e){const t=vi(),n=Tt(e)?Rt(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 Wm(e){let t=on(e);for(;Dt(t)&&!jn(t);){if(yi(t))return t;if(zr(t))return null;t=on(t)}return null}function vi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function jn(e){return["html","body","#document"].includes($n(e))}function Rt(e){return lt(e).getComputedStyle(e)}function Xr(e){return Tt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function on(e){if($n(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vs(e)&&e.host||kt(e);return vs(t)?t.host:t}function rc(e){const t=on(e);return jn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Dt(t)&&or(t)?t:rc(t)}function Yn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=rc(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=lt(i);if(o){const c=Po(s);return t.concat(s,s.visualViewport||[],or(i)?i:[],c&&n?Yn(c):[])}return t.concat(i,Yn(i,[],n))}function Po(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oc(e){const t=Rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Dt(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,c=Dr(n)!==o||Dr(r)!==s;return c&&(n=o,r=s),{width:n,height:r,$:c}}function wi(e){return Tt(e)?e:e.contextElement}function On(e){const t=wi(e);if(!Dt(t))return rn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=oc(t);let s=(o?Dr(n.width):n.width)/r,c=(o?Dr(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Jm=rn(0);function ic(e){const t=lt(e);return!vi()||!t.visualViewport?Jm:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==lt(e)?!1:t}function In(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=wi(e);let s=rn(1);t&&(r?Tt(r)&&(s=On(r)):s=On(e));const c=zm(o,n,r)?ic(o):rn(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 h=lt(o),p=r&&Tt(r)?lt(r):r;let m=h,y=Po(m);for(;y&&r&&p!==m;){const I=On(y),C=y.getBoundingClientRect(),w=Rt(y),_=C.left+(y.clientLeft+parseFloat(w.paddingLeft))*I.x,b=C.top+(y.clientTop+parseFloat(w.paddingTop))*I.y;l*=I.x,u*=I.y,d*=I.x,f*=I.y,l+=_,u+=b,m=lt(y),y=Po(m)}}return Fr({width:d,height:f,x:l,y:u})}function Xm(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=kt(r),c=t?zr(t.floating):!1;if(r===s||c&&o)return n;let l={scrollLeft:0,scrollTop:0},u=rn(1);const d=rn(0),f=Dt(r);if((f||!f&&!o)&&(($n(r)!=="body"||or(s))&&(l=Xr(r)),Dt(r))){const h=In(r);u=On(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x,y:n.y*u.y-l.scrollTop*u.y+d.y}}function Gm(e){return Array.from(e.getClientRects())}function jo(e,t){const n=Xr(e).scrollLeft;return t?t.left+n:In(kt(e)).left+n}function Ym(e){const t=kt(e),n=Xr(e),r=e.ownerDocument.body,i=vn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=vn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+jo(e);const c=-n.scrollTop;return Rt(r).direction==="rtl"&&(s+=vn(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:c}}function Zm(e,t){const n=lt(e),r=kt(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=vi();(!u||u&&t==="fixed")&&(c=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:c,y:l}}function Qm(e,t){const n=In(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Dt(e)?On(e):rn(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 ws(e,t,n){let r;if(t==="viewport")r=Zm(e,n);else if(t==="document")r=Ym(kt(e));else if(Tt(t))r=Qm(t,n);else{const i=ic(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Fr(r)}function sc(e,t){const n=on(e);return n===t||!Tt(n)||jn(n)?!1:Rt(n).position==="fixed"||sc(n,t)}function eh(e,t){const n=t.get(e);if(n)return n;let r=Yn(e,[],!1).filter(c=>Tt(c)&&$n(c)!=="body"),i=null;const o=Rt(e).position==="fixed";let s=o?on(e):e;for(;Tt(s)&&!jn(s);){const c=Rt(s),l=yi(s);!l&&c.position==="fixed"&&(i=null),(o?!l&&!i:!l&&c.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||or(s)&&!l&&sc(e,s))?r=r.filter(d=>d!==s):i=c,s=on(s)}return t.set(e,r),r}function th(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?zr(t)?[]:eh(t,this._c):[].concat(n),r],c=s[0],l=s.reduce((u,d)=>{const f=ws(t,d,i);return u.top=vn(f.top,u.top),u.right=An(f.right,u.right),u.bottom=An(f.bottom,u.bottom),u.left=vn(f.left,u.left),u},ws(t,c,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function nh(e){const{width:t,height:n}=oc(e);return{width:t,height:n}}function rh(e,t,n){const r=Dt(t),i=kt(t),o=n==="fixed",s=In(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const l=rn(0);if(r||!r&&!o)if(($n(t)!=="body"||or(i))&&(c=Xr(t)),r){const p=In(t,!0,o,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else i&&(l.x=jo(i));let u=0,d=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();d=p.top+c.scrollTop,u=p.left+c.scrollLeft-jo(i,p)}const f=s.left+c.scrollLeft-l.x-u,h=s.top+c.scrollTop-l.y-d;return{x:f,y:h,width:s.width,height:s.height}}function yo(e){return Rt(e).position==="static"}function Is(e,t){if(!Dt(e)||Rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return kt(e)===n&&(n=n.ownerDocument.body),n}function ac(e,t){const n=lt(e);if(zr(e))return n;if(!Dt(e)){let i=on(e);for(;i&&!jn(i);){if(Tt(i)&&!yo(i))return i;i=on(i)}return n}let r=Is(e,t);for(;r&&qm(r)&&yo(r);)r=Is(r,t);return r&&jn(r)&&yo(r)&&!yi(r)?n:r||Wm(e)||n}const oh=async function(e){const t=this.getOffsetParent||ac,n=this.getDimensions,r=await n(e.floating);return{reference:rh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ih(e){return Rt(e).direction==="rtl"}const sh={convertOffsetParentRelativeRectToViewportRelativeRect:Xm,getDocumentElement:kt,getClippingRect:th,getOffsetParent:ac,getElementRects:oh,getClientRects:Gm,getDimensions:nh,getScale:On,isElement:Tt,isRTL:ih};function ah(e,t){let n=null,r;const i=kt(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:h}=e.getBoundingClientRect();if(c||t(),!f||!h)return;const p=br(d),m=br(i.clientWidth-(u+f)),y=br(i.clientHeight-(d+h)),I=br(u),w={rootMargin:-p+"px "+-m+"px "+-y+"px "+-I+"px",threshold:vn(0,An(1,l))||1};let _=!0;function b(x){const E=x[0].intersectionRatio;if(E!==l){if(!_)return s();E?s(!1,E):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 ch(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=wi(e),d=i||o?[...u?Yn(u):[],...Yn(t)]:[];d.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),o&&C.addEventListener("resize",n)});const f=u&&c?ah(u,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(C=>{let[w]=C;w&&w.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(t)})),n()}),u&&!l&&p.observe(u),p.observe(t));let m,y=l?In(e):null;l&&I();function I(){const C=In(e);y&&(C.x!==y.x||C.y!==y.y||C.width!==y.width||C.height!==y.height)&&n(),y=C,m=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(m)}}const lh=Bm,uh=Um,dh=Vm,ph=Km,xs=(e,t,n)=>{const r=new Map,i={platform:sh,...n},o={...i.platform,_c:r};return $m(e,t,{...i,platform:o})};/*
43
+ */var Ji;function vp(){return Ji||(Ji=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),l=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"),v=!1,w=!1,I=!1,O=!1,y=!1,x;x=Symbol.for("react.module.reference");function b(V){return!!(typeof V=="string"||typeof V=="function"||V===n||V===i||y||V===r||V===l||V===d||O||V===p||v||w||I||typeof V=="object"&&V!==null&&(V.$$typeof===m||V.$$typeof===f||V.$$typeof===o||V.$$typeof===s||V.$$typeof===c||V.$$typeof===x||V.getModuleId!==void 0))}function _(V){if(typeof V=="object"&&V!==null){var we=V.$$typeof;switch(we){case e:var Pe=V.type;switch(Pe){case n:case i:case r:case l:case d:return Pe;default:var He=Pe&&Pe.$$typeof;switch(He){case a:case s:case c:case m:case f:case o:return He;default:return we}}case t:return we}}}var E=s,$=o,T=e,J=c,q=n,z=m,Y=f,ee=t,U=i,se=r,ne=l,Q=d,de=!1,pe=!1;function S(V){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function P(V){return pe||(pe=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function M(V){return _(V)===s}function j(V){return _(V)===o}function D(V){return typeof V=="object"&&V!==null&&V.$$typeof===e}function R(V){return _(V)===c}function X(V){return _(V)===n}function G(V){return _(V)===m}function K(V){return _(V)===f}function Z(V){return _(V)===t}function B(V){return _(V)===i}function ae(V){return _(V)===r}function A(V){return _(V)===l}function fe(V){return _(V)===d}ye.ContextConsumer=E,ye.ContextProvider=$,ye.Element=T,ye.ForwardRef=J,ye.Fragment=q,ye.Lazy=z,ye.Memo=Y,ye.Portal=ee,ye.Profiler=U,ye.StrictMode=se,ye.Suspense=ne,ye.SuspenseList=Q,ye.isAsyncMode=S,ye.isConcurrentMode=P,ye.isContextConsumer=M,ye.isContextProvider=j,ye.isElement=D,ye.isForwardRef=R,ye.isFragment=X,ye.isLazy=G,ye.isMemo=K,ye.isPortal=Z,ye.isProfiler=B,ye.isStrictMode=ae,ye.isSuspense=A,ye.isSuspenseList=fe,ye.isValidElementType=b,ye.typeOf=_}()),ye}process.env.NODE_ENV==="production"?wo.exports=gp():wo.exports=vp();var zi=wo.exports;const Xi=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Gi=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",co=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Gi(n.overflowY,t)||Gi(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},hr=(e,t,n,r,i,o,s,a)=>o<e&&s>t||o>e&&s<t?0:o<=e&&a<=n||s>=t&&a>=n?o-e-r:s>t&&a<n||o<e&&a>n?s-t+i:0,yp=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},wp=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:l,skipOverflowHiddenElements:d}=t,f=typeof l=="function"?l:ne=>ne!==l;if(!Xi(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let v=e;for(;Xi(v)&&f(v);){if(v=yp(v),v===m){p.push(v);break}v!=null&&v===document.body&&co(v)&&!co(document.documentElement)||v!=null&&co(v,d)&&p.push(v)}const w=(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:O,scrollY:y}=window,{height:x,width:b,top:_,right:E,bottom:$,left:T}=e.getBoundingClientRect(),{top:J,right:q,bottom:z,left:Y}=(ne=>{const Q=window.getComputedStyle(ne);return{top:parseFloat(Q.scrollMarginTop)||0,right:parseFloat(Q.scrollMarginRight)||0,bottom:parseFloat(Q.scrollMarginBottom)||0,left:parseFloat(Q.scrollMarginLeft)||0}})(e);let ee=a==="start"||a==="nearest"?_-J:a==="end"?$+z:_+x/2-J+z,U=c==="center"?T+b/2-Y+q:c==="end"?E+q:T-Y;const se=[];for(let ne=0;ne<p.length;ne++){const Q=p[ne],{height:de,width:pe,top:S,right:P,bottom:M,left:j}=Q.getBoundingClientRect();if(s==="if-needed"&&_>=0&&T>=0&&$<=I&&E<=w&&_>=S&&$<=M&&T>=j&&E<=P)return se;const D=getComputedStyle(Q),R=parseInt(D.borderLeftWidth,10),X=parseInt(D.borderTopWidth,10),G=parseInt(D.borderRightWidth,10),K=parseInt(D.borderBottomWidth,10);let Z=0,B=0;const ae="offsetWidth"in Q?Q.offsetWidth-Q.clientWidth-R-G:0,A="offsetHeight"in Q?Q.offsetHeight-Q.clientHeight-X-K:0,fe="offsetWidth"in Q?Q.offsetWidth===0?0:pe/Q.offsetWidth:0,V="offsetHeight"in Q?Q.offsetHeight===0?0:de/Q.offsetHeight:0;if(m===Q)Z=a==="start"?ee:a==="end"?ee-I:a==="nearest"?hr(y,y+I,I,X,K,y+ee,y+ee+x,x):ee-I/2,B=c==="start"?U:c==="center"?U-w/2:c==="end"?U-w:hr(O,O+w,w,R,G,O+U,O+U+b,b),Z=Math.max(0,Z+y),B=Math.max(0,B+O);else{Z=a==="start"?ee-S-X:a==="end"?ee-M+K+A:a==="nearest"?hr(S,M,de,X,K+A,ee,ee+x,x):ee-(S+de/2)+A/2,B=c==="start"?U-j-R:c==="center"?U-(j+pe/2)+ae/2:c==="end"?U-P+G+ae:hr(j,P,pe,R,G+ae,U,U+b,b);const{scrollLeft:we,scrollTop:Pe}=Q;Z=V===0?0:Math.max(0,Math.min(Pe+Z/V,Q.scrollHeight-de/V+A)),B=fe===0?0:Math.max(0,Math.min(we+B/fe,Q.scrollWidth-pe/fe+ae)),ee+=Pe-Z,U+=we-B}se.push({el:Q,top:Z,left:B})}return se};var Cn=function(){return Cn=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},Cn.apply(this,arguments)};var Ip=0;function Yi(e){return typeof e=="function"?e:it}function it(){}function sa(e,t){if(e){var n=wp(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 Zi(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Vo(e,t){var n;function r(){n&&clearTimeout(n)}function i(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return i.cancel=r,i}function Le(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(o)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function _n(){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 aa(){return String(Ip++)}function _p(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 Qi(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function ca(e){return typeof e.type=="string"}function la(e){return e.props}function bp(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var xp=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function gr(e){e===void 0&&(e={});var t={};return xp.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Er(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=Sr(t,r)?t[r]:e[r],n},{})}function Sr(e,t){return e[t]!==void 0}function Io(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Cp(e){return Object.prototype.toString.call(e)==="[object Object]"}function un(e,t,n,r,i){var o=n.length;if(o===0)return-1;var s=o-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var c=On(a,t<0,n,r,i);return c===-1?e>=o?-1:e:c}function On(e,t,n,r,i){i===void 0&&(i=!1);var o=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<o;a++)if(!r(n[a],a))return a;return i?On(t?o-1:0,t,n,r):-1}function Nr(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(Zi(i,e,n)||r&&Zi(i,n.document.activeElement,n))})}var Ho=it;process.env.NODE_ENV!=="production"&&(Ho=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 Op=Vo(function(e){ua(e).textContent=""},500);function ua(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 da(e,t){if(!(!e||!t)){var n=ua(t);n.textContent=e,Op(t)}}function Ep(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var fa=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,pa=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,ma=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,_r=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,br=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,ha=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,ga=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,va=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,ya=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,wa=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Ia=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,_a=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,ba=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,_o=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,xa=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Ca=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Oa=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Sp=Object.freeze({__proto__:null,blurButton:xa,blurInput:Ia,changeInput:_a,clickButton:_o,clickItem:wa,controlledPropUpdatedSelectedItem:Ca,itemMouseEnter:ma,keyDownArrowDown:br,keyDownArrowUp:_r,keyDownEnd:ya,keyDownEnter:ga,keyDownEscape:ha,keyDownHome:va,keyDownSpaceButton:ba,mouseUp:pa,touchEnd:Oa,unknown:fa}),Np=["refKey","ref"],Tp=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Rp=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Ap=["refKey","ref"],Pp=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Dp=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+aa(),o.menuId=o.props.menuId||o.id+"-menu",o.labelId=o.props.labelId||o.id+"-label",o.inputId=o.props.inputId||o.id+"-input",o.getItemId=o.props.getItemId||function(y){return o.id+"-item-"+y},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(y,x){var b=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(_){return _!==b}),y()},x);o.timeoutIds.push(b)},o.setItemCount=function(y){o.itemCount=y},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(y,x){var b=o.getItemNodeFromIndex(x);return b&&b.hasAttribute("disabled")},o.setHighlightedIndex=function(y,x){y===void 0&&(y=o.props.defaultHighlightedIndex),x===void 0&&(x={}),x=gr(x),o.internalSetState(le({highlightedIndex:y},x))},o.clearSelection=function(y){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},y)},o.selectItem=function(y,x,b){x=gr(x),o.internalSetState(le({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:y,inputValue:o.props.itemToString(y)},x),b)},o.selectItemAtIndex=function(y,x,b){var _=o.items[y];_!=null&&o.selectItem(_,x,b)},o.selectHighlightedItem=function(y,x){return o.selectItemAtIndex(o.getState().highlightedIndex,y,x)},o.internalSetState=function(y,x){var b,_,E={},$=typeof y=="function";return!$&&y.hasOwnProperty("inputValue")&&o.props.onInputValueChange(y.inputValue,le({},o.getStateAndHelpers(),y)),o.setState(function(T){var J;T=o.getState(T);var q=$?y(T):y;q=o.props.stateReducer(T,q),b=q.hasOwnProperty("selectedItem");var z={};return b&&q.selectedItem!==T.selectedItem&&(_=q.selectedItem),(J=q).type||(J.type=fa),Object.keys(q).forEach(function(Y){T[Y]!==q[Y]&&(E[Y]=q[Y]),Y!=="type"&&(q[Y],Sr(o.props,Y)||(z[Y]=q[Y]))}),$&&q.hasOwnProperty("inputValue")&&o.props.onInputValueChange(q.inputValue,le({},o.getStateAndHelpers(),q)),z},function(){Yi(x)();var T=Object.keys(E).length>1;T&&o.props.onStateChange(E,o.getStateAndHelpers()),b&&o.props.onSelect(y.selectedItem,o.getStateAndHelpers()),_!==void 0&&o.props.onChange(_,o.getStateAndHelpers()),o.props.onUserAction(E,o.getStateAndHelpers())})},o.rootRef=function(y){return o._rootNode=y},o.getRootProps=function(y,x){var b,_=y===void 0?{}:y,E=_.refKey,$=E===void 0?"ref":E,T=_.ref,J=Mt(_,Np),q=x===void 0?{}:x,z=q.suppressRefError,Y=z===void 0?!1:z;o.getRootProps.called=!0,o.getRootProps.refKey=$,o.getRootProps.suppressRefError=Y;var ee=o.getState(),U=ee.isOpen;return le((b={},b[$]=_n(T,o.rootRef),b.role="combobox",b["aria-expanded"]=U,b["aria-haspopup"]="listbox",b["aria-owns"]=U?o.menuId:void 0,b["aria-labelledby"]=o.labelId,b),J)},o.keyDownHandlers={ArrowDown:function(x){var b=this;if(x.preventDefault(),this.getState().isOpen){var _=x.shiftKey?5:1;this.moveHighlightedIndex(_,{type:br})}else this.internalSetState({isOpen:!0,type:br},function(){var E=b.getItemCount();if(E>0){var $=b.getState(),T=$.highlightedIndex,J=un(T,1,{length:E},b.isItemDisabled,!0);b.setHighlightedIndex(J,{type:br})}})},ArrowUp:function(x){var b=this;if(x.preventDefault(),this.getState().isOpen){var _=x.shiftKey?-5:-1;this.moveHighlightedIndex(_,{type:_r})}else this.internalSetState({isOpen:!0,type:_r},function(){var E=b.getItemCount();if(E>0){var $=b.getState(),T=$.highlightedIndex,J=un(T,-1,{length:E},b.isItemDisabled,!0);b.setHighlightedIndex(J,{type:_r})}})},Enter:function(x){if(x.which!==229){var b=this.getState(),_=b.isOpen,E=b.highlightedIndex;if(_&&E!=null){x.preventDefault();var $=this.items[E],T=this.getItemNodeFromIndex(E);if($==null||T&&T.hasAttribute("disabled"))return;this.selectHighlightedItem({type:ga})}}},Escape:function(x){x.preventDefault(),this.reset(le({type:ha},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=le({},o.keyDownHandlers,{" ":function(x){x.preventDefault(),this.toggleMenu({type:ba})}}),o.inputKeyDownHandlers=le({},o.keyDownHandlers,{Home:function(x){var b=this.getState(),_=b.isOpen;if(_){x.preventDefault();var E=this.getItemCount();if(!(E<=0||!_)){var $=On(0,!1,{length:E},this.isItemDisabled);this.setHighlightedIndex($,{type:va})}}},End:function(x){var b=this.getState(),_=b.isOpen;if(_){x.preventDefault();var E=this.getItemCount();if(!(E<=0||!_)){var $=On(E-1,!0,{length:E},this.isItemDisabled);this.setHighlightedIndex($,{type:ya})}}}}),o.getToggleButtonProps=function(y){var x=y===void 0?{}:y,b=x.onClick;x.onPress;var _=x.onKeyDown,E=x.onKeyUp,$=x.onBlur,T=Mt(x,Tp),J=o.getState(),q=J.isOpen,z={onClick:Le(b,o.buttonHandleClick),onKeyDown:Le(_,o.buttonHandleKeyDown),onKeyUp:Le(E,o.buttonHandleKeyUp),onBlur:Le($,o.buttonHandleBlur)},Y=T.disabled?{}:z;return le({type:"button",role:"button","aria-label":q?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},Y,T)},o.buttonHandleKeyUp=function(y){y.preventDefault()},o.buttonHandleKeyDown=function(y){var x=Io(y);o.buttonKeyDownHandlers[x]&&o.buttonKeyDownHandlers[x].call(o,y)},o.buttonHandleClick=function(y){if(y.preventDefault(),o.props.environment){var x=o.props.environment.document,b=x.body,_=x.activeElement;b&&b===_&&y.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:_o}):o.internalSetTimeout(function(){return o.toggleMenu({type:_o})})},o.buttonHandleBlur=function(y){var x=y.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var b=o.props.environment.document.activeElement;(b==null||b.id!==o.inputId)&&b!==x&&o.reset({type:xa})}})},o.getLabelProps=function(y){return le({htmlFor:o.inputId,id:o.labelId},y)},o.getInputProps=function(y){var x=y===void 0?{}:y,b=x.onKeyDown,_=x.onBlur,E=x.onChange,$=x.onInput;x.onChangeText;var T=Mt(x,Rp),J,q={};J="onChange";var z=o.getState(),Y=z.inputValue,ee=z.isOpen,U=z.highlightedIndex;if(!T.disabled){var se;q=(se={},se[J]=Le(E,$,o.inputHandleChange),se.onKeyDown=Le(b,o.inputHandleKeyDown),se.onBlur=Le(_,o.inputHandleBlur),se)}return le({"aria-autocomplete":"list","aria-activedescendant":ee&&typeof U=="number"&&U>=0?o.getItemId(U):void 0,"aria-controls":ee?o.menuId:void 0,"aria-labelledby":T&&T["aria-label"]?void 0:o.labelId,autoComplete:"off",value:Y,id:o.inputId},q,T)},o.inputHandleKeyDown=function(y){var x=Io(y);x&&o.inputKeyDownHandlers[x]&&o.inputKeyDownHandlers[x].call(o,y)},o.inputHandleChange=function(y){o.internalSetState({type:_a,isOpen:!0,inputValue:y.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var y;if(!(o.isMouseDown||!o.props.environment)){var x=o.props.environment.document.activeElement,b=(x==null||(y=x.dataset)==null?void 0:y.toggle)&&o._rootNode&&o._rootNode.contains(x);b||o.reset({type:Ia})}})},o.menuRef=function(y){o._menuNode=y},o.getMenuProps=function(y,x){var b,_=y===void 0?{}:y,E=_.refKey,$=E===void 0?"ref":E,T=_.ref,J=Mt(_,Ap),q=x===void 0?{}:x,z=q.suppressRefError,Y=z===void 0?!1:z;return o.getMenuProps.called=!0,o.getMenuProps.refKey=$,o.getMenuProps.suppressRefError=Y,le((b={},b[$]=_n(T,o.menuRef),b.role="listbox",b["aria-labelledby"]=J&&J["aria-label"]?void 0:o.labelId,b.id=o.menuId,b),J)},o.getItemProps=function(y){var x,b=y===void 0?{}:y,_=b.onMouseMove,E=b.onMouseDown,$=b.onClick;b.onPress;var T=b.index,J=b.item,q=J===void 0?process.env.NODE_ENV==="production"?void 0:bp("getItemProps","item"):J,z=Mt(b,Pp);T===void 0?(o.items.push(q),T=o.items.indexOf(q)):o.items[T]=q;var Y="onClick",ee=$,U=(x={onMouseMove:Le(_,function(){T!==o.getState().highlightedIndex&&(o.setHighlightedIndex(T,{type:ma}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:Le(E,function(ne){ne.preventDefault()})},x[Y]=Le(ee,function(){o.selectItemAtIndex(T,{type:wa})}),x),se=z.disabled?{onMouseDown:U.onMouseDown}:U;return le({id:o.getItemId(T),role:"option","aria-selected":o.getState().highlightedIndex===T},se,z)},o.clearItems=function(){o.items=[]},o.reset=function(y,x){y===void 0&&(y={}),y=gr(y),o.internalSetState(function(b){var _=b.selectedItem;return le({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(_)},y)},x)},o.toggleMenu=function(y,x){y===void 0&&(y={}),y=gr(y),o.internalSetState(function(b){var _=b.isOpen;return le({isOpen:!_},_&&{highlightedIndex:o.props.defaultHighlightedIndex},y)},function(){var b=o.getState(),_=b.isOpen,E=b.highlightedIndex;_&&o.getItemCount()>0&&typeof E=="number"&&o.setHighlightedIndex(E,y),Yi(x)()})},o.openMenu=function(y){o.internalSetState({isOpen:!0},y)},o.closeMenu=function(y){o.internalSetState({isOpen:!1},y)},o.updateStatus=Vo(function(){var y;if((y=o.props)!=null&&(y=y.environment)!=null&&y.document){var x=o.getState(),b=o.items[x.highlightedIndex],_=o.getItemCount(),E=o.props.getA11yStatusMessage(le({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:_,highlightedItem:b},x));o.previousResultCount=_,da(E,o.props.environment.document)}},200);var s=o.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,l=c===void 0?a:c,d=s.defaultIsOpen,f=s.initialIsOpen,m=f===void 0?d:f,p=s.initialInputValue,v=p===void 0?"":p,w=s.initialSelectedItem,I=w===void 0?null:w,O=o.getState({highlightedIndex:l,isOpen:m,inputValue:v,selectedItem:I});return O.selectedItem!=null&&o.props.initialInputValue===void 0&&(O.inputValue=o.props.itemToString(O.selectedItem)),o.state=O,o}sp(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),Er(o,this.props)},r.getItemCount=function(){var o=this.items.length;return this.itemCount!=null?o=this.itemCount:this.props.itemCount!==void 0&&(o=this.props.itemCount),o},r.getItemNodeFromIndex=function(o){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(o)):null},r.scrollHighlightedItemIntoView=function(){{var o=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(o,this._menuNode)}},r.moveHighlightedIndex=function(o,s){var a=this.getItemCount(),c=this.getState(),l=c.highlightedIndex;if(a>0){var d=un(l,o,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var o=this.getState(),s=o.highlightedIndex,a=o.inputValue,c=o.selectedItem,l=o.isOpen,d=this.props.itemToString,f=this.id,m=this.getRootProps,p=this.getToggleButtonProps,v=this.getLabelProps,w=this.getMenuProps,I=this.getInputProps,O=this.getItemProps,y=this.openMenu,x=this.closeMenu,b=this.toggleMenu,_=this.selectItem,E=this.selectItemAtIndex,$=this.selectHighlightedItem,T=this.setHighlightedIndex,J=this.clearSelection,q=this.clearItems,z=this.reset,Y=this.setItemCount,ee=this.unsetItemCount,U=this.internalSetState;return{getRootProps:m,getToggleButtonProps:p,getLabelProps:v,getMenuProps:w,getInputProps:I,getItemProps:O,reset:z,openMenu:y,closeMenu:x,toggleMenu:b,selectItem:_,selectItemAtIndex:E,selectHighlightedItem:$,setHighlightedIndex:T,clearSelection:J,clearItems:q,setItemCount:Y,unsetItemCount:ee,setState:U,itemToString:d,id:f,highlightedIndex:s,inputValue:a,isOpen:l,selectedItem:c}},r.componentDidMount=function(){var o=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&es(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){o.internalClearTimeouts()};else{var s=function(){o.isMouseDown=!0},a=function(p){o.isMouseDown=!1;var v=Nr(p.target,[o._rootNode,o._menuNode],o.props.environment);!v&&o.getState().isOpen&&o.reset({type:pa},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},c=function(){o.isTouchMove=!1},l=function(){o.isTouchMove=!0},d=function(p){var v=Nr(p.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!v&&o.getState().isOpen&&o.reset({type:Oa},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},f=this.props.environment;f.addEventListener("mousedown",s),f.addEventListener("mouseup",a),f.addEventListener("touchstart",c),f.addEventListener("touchmove",l),f.addEventListener("touchend",d),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),f.removeEventListener("mousedown",s),f.removeEventListener("mouseup",a),f.removeEventListener("touchstart",c),f.removeEventListener("touchmove",l),f.removeEventListener("touchend",d)}}},r.shouldScroll=function(o,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,l=s.highlightedIndex===void 0?o:s,d=l.highlightedIndex,f=c&&this.getState().isOpen&&!o.isOpen,m=c!==d;return f||m},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(Ho(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&es(this._menuNode,this.getMenuProps)),Sr(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Ca,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=Qi(this.props.children,it);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=Qi(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&&jp(s,this.getRootProps),s;if(ca(s))return g.cloneElement(s,this.getRootProps(la(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:_p,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Cp(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:it,onInputValueChange:it,onUserAction:it,onChange:it,onSelect:it,onOuterClick:it,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:sa},e.stateChangeTypes=Sp,e}();process.env.NODE_ENV!=="production"&&(Dp.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 es(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 jp(e,t){var n=t.refKey,r=n!=="ref",i=!ca(e);i&&!r&&!zi.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+'"'),!zi.isForwardRef(e)&&!la(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Ea={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Fp(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){Mp(s,e,t,n),n[s]!==t[s]&&(o[s]=n[s])}),r.onStateChange&&Object.keys(o).length&&r.onStateChange(le({type:i},o))}function Mp(e,t,n,r){var i=t.props,o=t.type,s="on"+Uo(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](le({type:o},r))}function kp(e,t){return t.changes}var ts=Vo(function(e,t){da(e,t)},200),Lp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?g.useLayoutEffect:g.useEffect,$p="useId"in g?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+g.useId();n||(n=c);var l=g.useRef({labelId:r||n+"-label",menuId:i||n+"-menu",getItemId:o||function(d){return n+"-item-"+d},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return l.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+aa():n,i=t.labelId,o=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,l=g.useRef({labelId:i||r+"-label",menuId:o||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return l.current};function Kp(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 Uo(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Sa(e){var t=g.useRef(e);return t.current=e,t}function Vp(e,t,n,r){var i=g.useRef(),o=g.useRef(),s=g.useCallback(function(p,v){o.current=v,p=Er(p,v.props);var w=e(p,v),I=v.props.stateReducer(p,le({},v,{changes:w}));return I},[e]),a=g.useReducer(s,t,n),c=a[0],l=a[1],d=Sa(t),f=g.useCallback(function(p){return l(le({props:d.current},p))},[d]),m=o.current;return g.useEffect(function(){var p=Er(i.current,m==null?void 0:m.props),v=m&&i.current&&!r(p,c);v&&Fp(m,p,c),i.current=c},[c,m,r]),[c,f]}var Kn={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:kp,scrollIntoView:sa,environment:typeof window>"u"?void 0:window};function Jt(e,t,n){n===void 0&&(n=Ea);var r=e["default"+Uo(t)];return r!==void 0?r:n[t]}function Vn(e,t,n){n===void 0&&(n=Ea);var r=e[t];if(r!==void 0)return r;var i=e["initial"+Uo(t)];return i!==void 0?i:Jt(e,t,n)}function Hp(e){var t=Vn(e,"selectedItem"),n=Vn(e,"isOpen"),r=Jp(e),i=Vn(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(o){return e.itemToKey(o)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:i}}function Hn(e,t,n){var r=e.items,i=e.initialHighlightedIndex,o=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,l=t.highlightedIndex;return r.length===0?-1:i!==void 0&&l===i&&!s(r[i],i)?i:o!==void 0&&!s(r[o],o)?o:c?r.findIndex(function(d){return a(c)===a(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function Up(e,t,n){var r=g.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return g.useEffect(function(){if(!e)return it;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,Nr(d.target,i,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function l(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!Nr(d.target,i,e,!1)&&t()}return e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",l),function(){e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",l)}},[n,e,t]),r.current}var Na=function(){return it};process.env.NODE_ENV!=="production"&&(Na=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=g.useRef(n.reduce(function(s,a){return s[a]={},s},{}));g.useEffect(function(){Object.keys(i.current).forEach(function(s){var a=i.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var c=a.suppressRefError,l=a.refKey,d=a.elementRef;c||d!=null&&d.current||console.error('downshift: The ref prop "'+l+'" from '+s+" was not applied correctly on your element.")})},[]);var o=g.useCallback(function(s,a,c,l){i.current[s]={suppressRefError:a,refKey:c,elementRef:l}},[]);return o});function Bp(e,t,n,r){r===void 0&&(r={});var i=r.document,o=Kr();g.useEffect(function(){if(!(!e||o||!i)){var s=e(t);ts(s,i)}},n),g.useEffect(function(){return function(){ts.cancel(),Ep(i)}},[i])}function qp(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,o=e.menuElement,s=e.scrollIntoView,a=g.useRef(!0);return Lp(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var Ta=it;process.env.NODE_ENV!=="production"&&(Ta=function(t){var n=t.props,r=t.state,i=g.useRef(n),o=Kr();g.useEffect(function(){o||(Ho(r,i.current,n),i.current=n)},[r,n,o])});function ns(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return le({isOpen:!1,highlightedIndex:-1},i&&le({selectedItem:e.items[t],isOpen:Jt(e,"isOpen"),highlightedIndex:Jt(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Wp(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Kr(){var e=g.useRef(!0);return g.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function bo(e){var t=Jt(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function Jp(e){var t=Vn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var xr={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},Ra=le({},xr,{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 zp(e,t,n){var r=t.type,i=t.props,o;switch(r){case n.ItemMouseMove:o={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:o={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:o={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Hn(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:Hn(i,e,0)};break;case n.FunctionCloseMenu:o={isOpen:!1};break;case n.FunctionSetHighlightedIndex:o={highlightedIndex:i.isItemDisabled(i.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:o={inputValue:t.inputValue};break;case n.FunctionReset:o={highlightedIndex:bo(i),isOpen:Jt(i,"isOpen"),selectedItem:Jt(i,"selectedItem"),inputValue:Jt(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return le({},e,o)}Cn(Cn({},Ra),{items:F.array.isRequired,isItemDisabled:F.func});Cn(Cn({},Kn),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var Bo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,qo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Wo=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Jo=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,zo=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Xo=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Go=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Yo=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Zo=process.env.NODE_ENV!=="production"?"__input_change__":8,Tr=process.env.NODE_ENV!=="production"?"__input_blur__":9,Qo=process.env.NODE_ENV!=="production"?"__input_click__":10,Aa=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Pa=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ei=process.env.NODE_ENV!=="production"?"__item_click__":13,Da=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,ja=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Fa=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Ma=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,ka=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,ti=process.env.NODE_ENV!=="production"?"__function_select_item__":19,La=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,$a=process.env.NODE_ENV!=="production"?"__function_reset__":21,ni=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Ka=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ni,FunctionCloseMenu:Ma,FunctionOpenMenu:Fa,FunctionReset:$a,FunctionSelectItem:ti,FunctionSetHighlightedIndex:ka,FunctionSetInputValue:La,FunctionToggleMenu:ja,InputBlur:Tr,InputChange:Zo,InputClick:Qo,InputKeyDownArrowDown:Bo,InputKeyDownArrowUp:qo,InputKeyDownEnd:zo,InputKeyDownEnter:Yo,InputKeyDownEscape:Wo,InputKeyDownHome:Jo,InputKeyDownPageDown:Go,InputKeyDownPageUp:Xo,ItemClick:ei,ItemMouseMove:Pa,MenuMouseLeave:Aa,ToggleButtonClick:Da});function Xp(e){var t=Hp(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),le({},t,{inputValue:r})}var Gp=le({},Ra,{items:F.array.isRequired,isItemDisabled:F.func,inputValue:F.string,defaultInputValue:F.string,initialInputValue:F.string,inputId:F.string,onInputValueChange:F.func});function Yp(e,t,n,r){var i=g.useRef(),o=Vp(e,t,n,r),s=o[0],a=o[1],c=Kr();return g.useEffect(function(){if(Sr(t,"selectedItem")){if(!c){var l=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);l&&a({type:ni,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Er(s,t),a]}var Va=it;process.env.NODE_ENV!=="production"&&(Va=function(t,n){F.checkPropTypes(Gp,t,"prop",n.name)});var Zp=le({},Kn,{isItemDisabled:function(){return!1}});function Qp(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case ei:s={isOpen:Jt(i,"isOpen"),highlightedIndex:bo(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case Bo:e.isOpen?s={highlightedIndex:un(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:Hn(i,e,1),isOpen:i.items.length>=0};break;case qo:e.isOpen?o?s=ns(i,e.highlightedIndex):s={highlightedIndex:un(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Hn(i,e,-1),isOpen:i.items.length>=0};break;case Yo:s=ns(i,e.highlightedIndex);break;case Wo:s=le({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Xo:s={highlightedIndex:un(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case Go:s={highlightedIndex:un(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case Jo:s={highlightedIndex:On(0,!1,i.items,i.isItemDisabled)};break;case zo:s={highlightedIndex:On(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case Tr:s=le({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=i.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])});break;case Zo:s={isOpen:!0,highlightedIndex:bo(i),inputValue:t.inputValue};break;case Qo:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Hn(i,e,0)};break;case ti:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case ni:s={inputValue:t.inputValue};break;default:return zp(e,t,Ka)}return le({},e,s)}var em=["onMouseLeave","refKey","ref"],tm=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],nm=["onClick","onPress","refKey","ref"],rm=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];ri.stateChangeTypes=Ka;function ri(e){e===void 0&&(e={}),Va(e,ri);var t=le({},Zp,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=Yp(Qp,t,Xp,Wp),a=s[0],c=s[1],l=a.isOpen,d=a.highlightedIndex,f=a.selectedItem,m=a.inputValue,p=g.useRef(null),v=g.useRef({}),w=g.useRef(null),I=g.useRef(null),O=Kr(),y=$p(t),x=g.useRef(),b=Sa({state:a,props:t}),_=g.useCallback(function(M){return v.current[y.getItemId(M)]},[y]);Bp(o,a,[l,d,f,m],i);var E=qp({menuElement:p.current,highlightedIndex:d,isOpen:l,itemRefs:v,scrollIntoView:r,getItemNodeFromIndex:_});Ta({props:t,state:a}),g.useEffect(function(){var M=Vn(t,"isOpen");M&&w.current&&w.current.focus()},[]),g.useEffect(function(){O||(x.current=n.length)});var $=Up(i,g.useCallback(function(){b.current.state.isOpen&&c({type:Tr,selectItem:!1})},[c,b]),g.useMemo(function(){return[p,I,w]},[p.current,I.current,w.current])),T=Na("getInputProps","getMenuProps");g.useEffect(function(){l||(v.current={})},[l]),g.useEffect(function(){var M;!l||!(i!=null&&i.document)||!(w!=null&&(M=w.current)!=null&&M.focus)||i.document.activeElement!==w.current&&w.current.focus()},[l,i]);var J=g.useMemo(function(){return{ArrowDown:function(j){j.preventDefault(),c({type:Bo,altKey:j.altKey})},ArrowUp:function(j){j.preventDefault(),c({type:qo,altKey:j.altKey})},Home:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Jo}))},End:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:zo}))},Escape:function(j){var D=b.current.state;(D.isOpen||D.inputValue||D.selectedItem||D.highlightedIndex>-1)&&(j.preventDefault(),c({type:Wo}))},Enter:function(j){var D=b.current.state;!D.isOpen||j.which===229||(j.preventDefault(),c({type:Yo}))},PageUp:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Xo}))},PageDown:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Go}))}}},[c,b]),q=g.useCallback(function(M){return le({id:y.labelId,htmlFor:y.inputId},M)},[y]),z=g.useCallback(function(M,j){var D,R=M===void 0?{}:M,X=R.onMouseLeave,G=R.refKey,K=G===void 0?"ref":G,Z=R.ref,B=Mt(R,em),ae=j===void 0?{}:j,A=ae.suppressRefError,fe=A===void 0?!1:A;return T("getMenuProps",fe,K,p),le((D={},D[K]=_n(Z,function(V){p.current=V}),D.id=y.menuId,D.role="listbox",D["aria-labelledby"]=B&&B["aria-label"]?void 0:""+y.labelId,D.onMouseLeave=Le(X,function(){c({type:Aa})}),D),B)},[c,T,y]),Y=g.useCallback(function(M){var j,D,R=M===void 0?{}:M,X=R.item,G=R.index,K=R.refKey,Z=K===void 0?"ref":K,B=R.ref,ae=R.onMouseMove,A=R.onMouseDown,fe=R.onClick;R.onPress;var V=R.disabled,we=Mt(R,tm);V!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Pe=b.current,He=Pe.props,je=Pe.state,me=Kp(X,G,He.items,"Pass either item or index to getItemProps!"),gt=me[0],Ue=me[1],nt=He.isItemDisabled(gt,Ue),vt="onClick",yt=fe,Be=function(){$.isTouchEnd||Ue===je.highlightedIndex||(E.current=!1,c({type:Pa,index:Ue,disabled:nt}))},$e=function(){c({type:ei,index:Ue})},Fe=function(wt){return wt.preventDefault()};return le((j={},j[Z]=_n(B,function(Ce){Ce&&(v.current[y.getItemId(Ue)]=Ce)}),j["aria-disabled"]=nt,j["aria-selected"]=Ue===je.highlightedIndex,j.id=y.getItemId(Ue),j.role="option",j),!nt&&(D={},D[vt]=Le(yt,$e),D),{onMouseMove:Le(ae,Be),onMouseDown:Le(A,Fe)},we)},[c,y,b,$,E]),ee=g.useCallback(function(M){var j,D=M===void 0?{}:M,R=D.onClick;D.onPress;var X=D.refKey,G=X===void 0?"ref":X,K=D.ref,Z=Mt(D,nm),B=b.current.state,ae=function(){c({type:Da})};return le((j={},j[G]=_n(K,function(A){I.current=A}),j["aria-controls"]=y.menuId,j["aria-expanded"]=B.isOpen,j.id=y.toggleButtonId,j.tabIndex=-1,j),!Z.disabled&&le({},{onClick:Le(R,ae)}),Z)},[c,b,y]),U=g.useCallback(function(M,j){var D,R=M===void 0?{}:M,X=R.onKeyDown,G=R.onChange,K=R.onInput,Z=R.onBlur;R.onChangeText;var B=R.onClick,ae=R.refKey,A=ae===void 0?"ref":ae,fe=R.ref,V=Mt(R,rm),we=j===void 0?{}:j,Pe=we.suppressRefError,He=Pe===void 0?!1:Pe;T("getInputProps",He,A,w);var je=b.current.state,me=function(Fe){var Ce=Io(Fe);Ce&&J[Ce]&&J[Ce](Fe)},gt=function(Fe){c({type:Zo,inputValue:Fe.target.value})},Ue=function(Fe){if(i!=null&&i.document&&je.isOpen&&!$.isMouseDown){var Ce=Fe.relatedTarget===null&&i.document.activeElement!==i.document.body;c({type:Tr,selectItem:!Ce})}},nt=function(){c({type:Qo})},vt="onChange",yt={};if(!V.disabled){var Be;yt=(Be={},Be[vt]=Le(G,K,gt),Be.onKeyDown=Le(X,me),Be.onBlur=Le(Z,Ue),Be.onClick=Le(B,nt),Be)}return le((D={},D[A]=_n(fe,function($e){w.current=$e}),D["aria-activedescendant"]=je.isOpen&&je.highlightedIndex>-1?y.getItemId(je.highlightedIndex):"",D["aria-autocomplete"]="list",D["aria-controls"]=y.menuId,D["aria-expanded"]=je.isOpen,D["aria-labelledby"]=V&&V["aria-label"]?void 0:y.labelId,D.autoComplete="off",D.id=y.inputId,D.role="combobox",D.value=je.inputValue,D),yt,V)},[c,y,i,J,b,$,T]),se=g.useCallback(function(){c({type:ja})},[c]),ne=g.useCallback(function(){c({type:Ma})},[c]),Q=g.useCallback(function(){c({type:Fa})},[c]),de=g.useCallback(function(M){c({type:ka,highlightedIndex:M})},[c]),pe=g.useCallback(function(M){c({type:ti,selectedItem:M})},[c]),S=g.useCallback(function(M){c({type:La,inputValue:M})},[c]),P=g.useCallback(function(){c({type:$a})},[c]);return{getItemProps:Y,getLabelProps:q,getMenuProps:z,getInputProps:U,getToggleButtonProps:ee,toggleMenu:se,openMenu:Q,closeMenu:ne,setHighlightedIndex:de,setInputValue:S,selectItem:pe,reset:P,highlightedIndex:d,isOpen:l,selectedItem:f,inputValue:m}}xr.stateReducer,xr.itemToKey,xr.environment,F.array,F.array,F.array,F.func,F.number,F.number,F.number,F.func,F.func,F.string,F.string;Kn.itemToKey,Kn.stateReducer,Kn.environment;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;const om="_comboboxContainer_b5o5a_1",im="_label_b5o5a_8",sm="_inputContainer_b5o5a_12",am="_input_b5o5a_12",cm="_toggleButton_b5o5a_26",lm="_menu_b5o5a_32",um="_menuItem_b5o5a_47",dm="_highlighted_b5o5a_54",fm="_selected_b5o5a_58",pm="_hidden_b5o5a_62",Ft={comboboxContainer:om,label:im,inputContainer:sm,input:am,toggleButton:cm,menu:lm,menuItem:um,highlighted:dm,selected:fm,hidden:pm};function mm(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function hm({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:i}){const[o,s]=g.useState(e),a=g.useRef(null);g.useEffect(()=>s(e),[e]);const c=b=>{s(e.filter(mm(b)))},{isOpen:l,getToggleButtonProps:d,getMenuProps:f,getInputProps:m,highlightedIndex:p,getItemProps:v,setInputValue:w}=ri({items:o,selectedItem:t?e.find(b=>b.value===t):null,itemToString:b=>(b==null?void 0:b.label)||"",onInputValueChange:({inputValue:b})=>c(b),onSelectedItemChange:({selectedItem:b})=>{var _;(_=a.current)==null||_.blur(),n(b)}}),I=()=>{w(""),s(e)},O=()=>I(),y=g.useMemo(()=>{var b;return(b=e.find(_=>_.value===t))==null?void 0:b.label},[e,t]),x=()=>w(y||"");return u.jsxs("div",{children:[u.jsx("div",{className:Ft.comboboxContainer,children:u.jsxs("div",{className:Ft.inputContainer,children:[u.jsx("input",{style:{border:"none"},disabled:i,placeholder:y||r,className:Ft.input,...m({onFocus:O,onBlur:x,ref:a})}),u.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:Ft.toggleButton,type:"button",...d(),children:l?u.jsx(u.Fragment,{children:"↑"}):u.jsx(u.Fragment,{children:"↓"})})]})}),u.jsx("ul",{className:`${Ft.menu} ${l&&e.length?"":Ft.hidden}`,...f(),children:l&&o.map((b,_)=>u.jsx("li",{className:`${Ft.menuItem} ${p===_?Ft.highlighted:""} ${t===(b==null?void 0:b.value)?Ft.selected:""}`,...v({item:b,index:_}),children:u.jsx("span",{children:b.label})},b.id))})]})}const En=Math.min,dn=Math.max,Rr=Math.round,vr=Math.floor,Gt=e=>({x:e,y:e}),gm={left:"right",right:"left",bottom:"top",top:"bottom"},vm={start:"end",end:"start"};function xo(e,t,n){return dn(e,En(t,n))}function Gn(e,t){return typeof e=="function"?e(t):e}function pn(e){return e.split("-")[0]}function Yn(e){return e.split("-")[1]}function Ha(e){return e==="x"?"y":"x"}function oi(e){return e==="y"?"height":"width"}function Sn(e){return["top","bottom"].includes(pn(e))?"y":"x"}function ii(e){return Ha(Sn(e))}function ym(e,t,n){n===void 0&&(n=!1);const r=Yn(e),i=ii(e),o=oi(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Ar(s)),[s,Ar(s)]}function wm(e){const t=Ar(e);return[Co(e),t,Co(t)]}function Co(e){return e.replace(/start|end/g,t=>vm[t])}function Im(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 _m(e,t,n,r){const i=Yn(e);let o=Im(pn(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Co)))),o}function Ar(e){return e.replace(/left|right|bottom|top/g,t=>gm[t])}function bm(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ua(e){return typeof e!="number"?bm(e):{top:e,right:e,bottom:e,left:e}}function Pr(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 rs(e,t,n){let{reference:r,floating:i}=e;const o=Sn(t),s=ii(t),a=oi(s),c=pn(t),l=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,m=r[a]/2-i[a]/2;let p;switch(c){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Yn(t)){case"start":p[s]-=m*(n&&l?-1:1);break;case"end":p[s]+=m*(n&&l?-1:1);break}return p}const xm=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:f}=rs(l,r,c),m=r,p={},v=0;for(let w=0;w<a.length;w++){const{name:I,fn:O}=a[w],{x:y,y:x,data:b,reset:_}=await O({x:d,y:f,initialPlacement:r,placement:m,strategy:i,middlewareData:p,rects:l,platform:s,elements:{reference:e,floating:t}});d=y??d,f=x??f,p={...p,[I]:{...p[I],...b}},_&&v<=50&&(v++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(l=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):_.rects),{x:d,y:f}=rs(l,m,c)),w=-1)}return{x:d,y:f,placement:m,strategy:i,middlewareData:p}};async function Ba(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=Gn(t,e),v=Ua(p),I=a[m?f==="floating"?"reference":"floating":f],O=Pr(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(a.floating)),boundary:l,rootBoundary:d,strategy:c})),y=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),b=await(o.isElement==null?void 0:o.isElement(x))?await(o.getScale==null?void 0:o.getScale(x))||{x:1,y:1}:{x:1,y:1},_=Pr(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:x,strategy:c}):y);return{top:(O.top-_.top+v.top)/b.y,bottom:(_.bottom-O.bottom+v.bottom)/b.y,left:(O.left-_.left+v.left)/b.x,right:(_.right-O.right+v.right)/b.x}}const Cm=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:c}=t,{element:l,padding:d=0}=Gn(e,t)||{};if(l==null)return{};const f=Ua(d),m={x:n,y:r},p=ii(i),v=oi(p),w=await s.getDimensions(l),I=p==="y",O=I?"top":"left",y=I?"bottom":"right",x=I?"clientHeight":"clientWidth",b=o.reference[v]+o.reference[p]-m[p]-o.floating[v],_=m[p]-o.reference[p],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l));let $=E?E[x]:0;(!$||!await(s.isElement==null?void 0:s.isElement(E)))&&($=a.floating[x]||o.floating[v]);const T=b/2-_/2,J=$/2-w[v]/2-1,q=En(f[O],J),z=En(f[y],J),Y=q,ee=$-w[v]-z,U=$/2-w[v]/2+T,se=xo(Y,U,ee),ne=!c.arrow&&Yn(i)!=null&&U!==se&&o.reference[v]/2-(U<Y?q:z)-w[v]/2<0,Q=ne?U<Y?U-Y:U-ee:0;return{[p]:m[p]+Q,data:{[p]:se,centerOffset:U-se-Q,...ne&&{alignmentOffset:Q}},reset:ne}}}),Om=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:w=!0,...I}=Gn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const O=pn(i),y=Sn(a),x=pn(a)===a,b=await(c.isRTL==null?void 0:c.isRTL(l.floating)),_=m||(x||!w?[Ar(a)]:wm(a)),E=v!=="none";!m&&E&&_.push(..._m(a,w,v,b));const $=[a,..._],T=await Ba(t,I),J=[];let q=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&J.push(T[O]),f){const U=ym(i,s,b);J.push(T[U[0]],T[U[1]])}if(q=[...q,{placement:i,overflows:J}],!J.every(U=>U<=0)){var z,Y;const U=(((z=o.flip)==null?void 0:z.index)||0)+1,se=$[U];if(se)return{data:{index:U,overflows:q},reset:{placement:se}};let ne=(Y=q.filter(Q=>Q.overflows[0]<=0).sort((Q,de)=>Q.overflows[1]-de.overflows[1])[0])==null?void 0:Y.placement;if(!ne)switch(p){case"bestFit":{var ee;const Q=(ee=q.filter(de=>{if(E){const pe=Sn(de.placement);return pe===y||pe==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(pe=>pe>0).reduce((pe,S)=>pe+S,0)]).sort((de,pe)=>de[1]-pe[1])[0])==null?void 0:ee[0];Q&&(ne=Q);break}case"initialPlacement":ne=a;break}if(i!==ne)return{reset:{placement:ne}}}return{}}}};async function Em(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=pn(n),a=Yn(n),c=Sn(n)==="y",l=["left","top"].includes(s)?-1:1,d=o&&c?-1:1,f=Gn(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof v=="number"&&(p=a==="end"?v*-1:v),c?{x:p*d,y:m*l}:{x:m*l,y:p*d}}const Sm=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,c=await Em(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},Nm=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:I=>{let{x:O,y}=I;return{x:O,y}}},...c}=Gn(e,t),l={x:n,y:r},d=await Ba(t,c),f=Sn(pn(i)),m=Ha(f);let p=l[m],v=l[f];if(o){const I=m==="y"?"top":"left",O=m==="y"?"bottom":"right",y=p+d[I],x=p-d[O];p=xo(y,p,x)}if(s){const I=f==="y"?"top":"left",O=f==="y"?"bottom":"right",y=v+d[I],x=v-d[O];v=xo(y,v,x)}const w=a.fn({...t,[m]:p,[f]:v});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[m]:o,[f]:s}}}}}};function Vr(){return typeof window<"u"}function jn(e){return qa(e)?(e.nodeName||"").toLowerCase():"#document"}function at(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Nt(e){var t;return(t=(qa(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function qa(e){return Vr()?e instanceof Node||e instanceof at(e).Node:!1}function Ct(e){return Vr()?e instanceof Element||e instanceof at(e).Element:!1}function St(e){return Vr()?e instanceof HTMLElement||e instanceof at(e).HTMLElement:!1}function os(e){return!Vr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof at(e).ShadowRoot}function Zn(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ot(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function Tm(e){return["table","td","th"].includes(jn(e))}function Hr(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function si(e){const t=ai(),n=Ct(e)?Ot(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Rm(e){let t=Yt(e);for(;St(t)&&!Nn(t);){if(si(t))return t;if(Hr(t))return null;t=Yt(t)}return null}function ai(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Nn(e){return["html","body","#document"].includes(jn(e))}function Ot(e){return at(e).getComputedStyle(e)}function Ur(e){return Ct(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yt(e){if(jn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||os(e)&&e.host||Nt(e);return os(t)?t.host:t}function Wa(e){const t=Yt(e);return Nn(t)?e.ownerDocument?e.ownerDocument.body:e.body:St(t)&&Zn(t)?t:Wa(t)}function Bn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Wa(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=at(i);if(o){const a=Oo(s);return t.concat(s,s.visualViewport||[],Zn(i)?i:[],a&&n?Bn(a):[])}return t.concat(i,Bn(i,[],n))}function Oo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ja(e){const t=Ot(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=St(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=Rr(n)!==o||Rr(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function ci(e){return Ct(e)?e:e.contextElement}function bn(e){const t=ci(e);if(!St(t))return Gt(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=Ja(t);let s=(o?Rr(n.width):n.width)/r,a=(o?Rr(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Am=Gt(0);function za(e){const t=at(e);return!ai()||!t.visualViewport?Am:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==at(e)?!1:t}function mn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=ci(e);let s=Gt(1);t&&(r?Ct(r)&&(s=bn(r)):s=bn(e));const a=Pm(o,n,r)?za(o):Gt(0);let c=(i.left+a.x)/s.x,l=(i.top+a.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const m=at(o),p=r&&Ct(r)?at(r):r;let v=m,w=Oo(v);for(;w&&r&&p!==v;){const I=bn(w),O=w.getBoundingClientRect(),y=Ot(w),x=O.left+(w.clientLeft+parseFloat(y.paddingLeft))*I.x,b=O.top+(w.clientTop+parseFloat(y.paddingTop))*I.y;c*=I.x,l*=I.y,d*=I.x,f*=I.y,c+=x,l+=b,v=at(w),w=Oo(v)}}return Pr({width:d,height:f,x:c,y:l})}function Dm(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=Nt(r),a=t?Hr(t.floating):!1;if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},l=Gt(1);const d=Gt(0),f=St(r);if((f||!f&&!o)&&((jn(r)!=="body"||Zn(s))&&(c=Ur(r)),St(r))){const m=mn(r);l=bn(r),d.x=m.x+r.clientLeft,d.y=m.y+r.clientTop}return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+d.x,y:n.y*l.y-c.scrollTop*l.y+d.y}}function jm(e){return Array.from(e.getClientRects())}function Eo(e,t){const n=Ur(e).scrollLeft;return t?t.left+n:mn(Nt(e)).left+n}function Fm(e){const t=Nt(e),n=Ur(e),r=e.ownerDocument.body,i=dn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=dn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Eo(e);const a=-n.scrollTop;return Ot(r).direction==="rtl"&&(s+=dn(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function Mm(e,t){const n=at(e),r=Nt(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;const l=ai();(!l||l&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}function km(e,t){const n=mn(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=St(e)?bn(e):Gt(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,c=i*o.x,l=r*o.y;return{width:s,height:a,x:c,y:l}}function is(e,t,n){let r;if(t==="viewport")r=Mm(e,n);else if(t==="document")r=Fm(Nt(e));else if(Ct(t))r=km(t,n);else{const i=za(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Pr(r)}function Xa(e,t){const n=Yt(e);return n===t||!Ct(n)||Nn(n)?!1:Ot(n).position==="fixed"||Xa(n,t)}function Lm(e,t){const n=t.get(e);if(n)return n;let r=Bn(e,[],!1).filter(a=>Ct(a)&&jn(a)!=="body"),i=null;const o=Ot(e).position==="fixed";let s=o?Yt(e):e;for(;Ct(s)&&!Nn(s);){const a=Ot(s),c=si(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Zn(s)&&!c&&Xa(e,s))?r=r.filter(d=>d!==s):i=a,s=Yt(s)}return t.set(e,r),r}function $m(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Hr(t)?[]:Lm(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((l,d)=>{const f=is(t,d,i);return l.top=dn(f.top,l.top),l.right=En(f.right,l.right),l.bottom=En(f.bottom,l.bottom),l.left=dn(f.left,l.left),l},is(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Km(e){const{width:t,height:n}=Ja(e);return{width:t,height:n}}function Vm(e,t,n){const r=St(t),i=Nt(t),o=n==="fixed",s=mn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Gt(0);if(r||!r&&!o)if((jn(t)!=="body"||Zn(i))&&(a=Ur(t)),r){const p=mn(t,!0,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&(c.x=Eo(i));let l=0,d=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();d=p.top+a.scrollTop,l=p.left+a.scrollLeft-Eo(i,p)}const f=s.left+a.scrollLeft-c.x-l,m=s.top+a.scrollTop-c.y-d;return{x:f,y:m,width:s.width,height:s.height}}function lo(e){return Ot(e).position==="static"}function ss(e,t){if(!St(e)||Ot(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Nt(e)===n&&(n=n.ownerDocument.body),n}function Ga(e,t){const n=at(e);if(Hr(e))return n;if(!St(e)){let i=Yt(e);for(;i&&!Nn(i);){if(Ct(i)&&!lo(i))return i;i=Yt(i)}return n}let r=ss(e,t);for(;r&&Tm(r)&&lo(r);)r=ss(r,t);return r&&Nn(r)&&lo(r)&&!si(r)?n:r||Rm(e)||n}const Hm=async function(e){const t=this.getOffsetParent||Ga,n=this.getDimensions,r=await n(e.floating);return{reference:Vm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Um(e){return Ot(e).direction==="rtl"}const Bm={convertOffsetParentRelativeRectToViewportRelativeRect:Dm,getDocumentElement:Nt,getClippingRect:$m,getOffsetParent:Ga,getElementRects:Hm,getClientRects:jm,getDimensions:Km,getScale:bn,isElement:Ct,isRTL:Um};function qm(e,t){let n=null,r;const i=Nt(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const{left:l,top:d,width:f,height:m}=e.getBoundingClientRect();if(a||t(),!f||!m)return;const p=vr(d),v=vr(i.clientWidth-(l+f)),w=vr(i.clientHeight-(d+m)),I=vr(l),y={rootMargin:-p+"px "+-v+"px "+-w+"px "+-I+"px",threshold:dn(0,En(1,c))||1};let x=!0;function b(_){const E=_[0].intersectionRatio;if(E!==c){if(!x)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver(b,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,y)}n.observe(e)}return s(!0),o}function Wm(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,l=ci(e),d=i||o?[...l?Bn(l):[],...Bn(t)]:[];d.forEach(O=>{i&&O.addEventListener("scroll",n,{passive:!0}),o&&O.addEventListener("resize",n)});const f=l&&a?qm(l,n):null;let m=-1,p=null;s&&(p=new ResizeObserver(O=>{let[y]=O;y&&y.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let v,w=c?mn(e):null;c&&I();function I(){const O=mn(e);w&&(O.x!==w.x||O.y!==w.y||O.width!==w.width||O.height!==w.height)&&n(),w=O,v=requestAnimationFrame(I)}return n(),()=>{var O;d.forEach(y=>{i&&y.removeEventListener("scroll",n),o&&y.removeEventListener("resize",n)}),f==null||f(),(O=p)==null||O.disconnect(),p=null,c&&cancelAnimationFrame(v)}}const Jm=Sm,zm=Nm,Xm=Om,Gm=Cm,as=(e,t,n)=>{const r=new Map,i={platform:Bm,...n},o={...i.platform,_c:r};return xm(e,t,{...i,platform:o})};/*
44
44
  * React Tooltip
45
45
  * {@link https://github.com/ReactTooltip/react-tooltip}
46
46
  * @copyright ReactTooltip Team
47
47
  * @license MIT
48
- */const fh="react-tooltip-core-styles",mh="react-tooltip-base-styles",bs={core:!1,base:!1};function _s({css:e,id:t=mh,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||bs[n]||n==="core"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=fh),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)),bs[n]=!0}const Cs=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[lh(Number(i)),dh({fallbackAxisSideDirection:"start"}),uh({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(ph({element:n,padding:5})),xs(e,t,{placement:r,strategy:o,middleware:l}).then(({x:u,y:d,placement:f,middlewareData:h})=>{var p,m;const y={left:`${u}px`,top:`${d}px`,border:c},{x:I,y:C}=(p=h.arrow)!==null&&p!==void 0?p:{x:0,y:0},w=(m={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&m!==void 0?m:"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:y,tooltipArrowStyles:{left:I!=null?`${I}px`:"",top:C!=null?`${C}px`:"",right:"",bottom:"",..._,[w]:`-${4+b}px`},place:f}})):xs(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}))},Ss=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Es=(e,t,n)=>{let r=null;const i=function(...o){const s=()=>{r=null};!r&&(e.apply(this,o),r=setTimeout(s,t))};return i.cancel=()=>{r&&(clearTimeout(r),r=null)},i},Os=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Do=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,o)=>Do(i,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Os(e)||!Os(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>Do(e[i],t[i]))},hh=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"})},Ns=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(hh(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},gh=typeof window<"u"?g.useLayoutEffect:g.useEffect,yt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},yh="DEFAULT_TOOLTIP_ID",vh={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},wh=g.createContext({getTooltipData:()=>vh});function cc(e=yh){return g.useContext(wh).getTooltipData(e)}var Sn={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},vo={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const Ih=({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:h,wrapper:p,delayShow:m=0,delayHide:y=0,float:I=!1,hidden:C=!1,noArrow:w=!1,clickable:_=!1,closeOnEsc:b=!1,closeOnScroll:x=!1,closeOnResize:E=!1,openEvents:M,closeEvents:O,globalCloseEvents:V,imperativeModeOnly:J,style:X,position:Z,afterShow:te,afterHide:q,disableTooltip:ae,content:re,contentWrapperRef:ee,isOpen:pe,defaultIsOpen:me=!1,setIsOpen:N,activeAnchor:j,setActiveAnchor:L,border:k,opacity:D,arrowColor:A,role:G="tooltip"})=>{var Y;const H=g.useRef(null),Q=g.useRef(null),W=g.useRef(null),ce=g.useRef(null),P=g.useRef(null),[fe,B]=g.useState({tooltipStyles:{},tooltipArrowStyles:{},place:c}),[Ie,ke]=g.useState(!1),[qe,Fe]=g.useState(!1),[he,It]=g.useState(null),We=g.useRef(!1),it=g.useRef(null),{anchorRefs:xt,setActiveAnchor:bt}=cc(t),Je=g.useRef(!1),[He,Me]=g.useState([]),Oe=g.useRef(!1),_t=d||u.includes("click"),Ye=_t||(M==null?void 0:M.click)||(M==null?void 0:M.dblclick)||(M==null?void 0:M.mousedown),Ft=M?{...M}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!M&&_t&&Object.assign(Ft,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Jt=O?{...O}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!O&&_t&&Object.assign(Jt,{mouseleave:!1,blur:!1,mouseout:!1});const st=V?{...V}:{escape:b||!1,scroll:x||!1,resize:E||!1,clickOutsideAnchor:Ye||!1};J&&(Object.assign(Ft,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Jt,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(st,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),gh(()=>(Oe.current=!0,()=>{Oe.current=!1}),[]);const Ne=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(yt(P),We.current=Ie,Ie)te==null||te();else{const U=(oe=>{const se=oe.match(/^([\d.]+)(ms|s)$/);if(!se)return 0;const[,je,$e]=se;return Number(je)*($e==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));P.current=setTimeout(()=>{Fe(!1),It(null),q==null||q()},U+25)}},[Ie]);const Mt=U=>{B(oe=>Do(oe,U)?oe:U)},zt=(U=m)=>{yt(W),qe?Ne(!0):W.current=setTimeout(()=>{Ne(!0)},U)},Lt=(U=y)=>{yt(ce),ce.current=setTimeout(()=>{Je.current||Ne(!1)},U)},ln=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 bt({current:null});m?zt():Ne(!0),L(se),bt({current:se}),yt(ce)},et=()=>{_?Lt(y||100):y?Lt():Ne(!1),yt(W)},$t=({x:U,y:oe})=>{var se;const je={getBoundingClientRect:()=>({x:U,y:oe,width:0,height:0,top:oe,left:U,right:U,bottom:oe})};Cs({place:(se=he==null?void 0:he.place)!==null&&se!==void 0?se:c,offset:l,elementReference:je,tooltipReference:H.current,tooltipArrowReference:Q.current,strategy:f,middlewares:h,border:k}).then($e=>{Mt($e)})},Xt=U=>{if(!U)return;const oe=U,se={x:oe.clientX,y:oe.clientY};$t(se),it.current=se},un=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(je=>je==null?void 0:je.contains(se))||(Ne(!1),yt(W)))},Gt=Es(ln,50),Ce=Es(et,50),Ze=U=>{Ce.cancel(),Gt(U)},ne=()=>{Gt.cancel(),Ce()},de=g.useCallback(()=>{var U,oe;const se=(U=he==null?void 0:he.position)!==null&&U!==void 0?U:Z;se?$t(se):I?it.current&&$t(it.current):j!=null&&j.isConnected&&Cs({place:(oe=he==null?void 0:he.place)!==null&&oe!==void 0?oe:c,offset:l,elementReference:j,tooltipReference:H.current,tooltipArrowReference:Q.current,strategy:f,middlewares:h,border:k}).then(je=>{Oe.current&&Mt(je)})},[Ie,j,re,X,c,he==null?void 0:he.place,l,f,Z,he==null?void 0:he.position,I]);g.useEffect(()=>{var U,oe;const se=new Set(xt);He.forEach(xe=>{ae!=null&&ae(xe)||se.add({current:xe})});const je=document.querySelector(`[id='${o}']`);je&&!(ae!=null&&ae(je))&&se.add({current:je});const $e=()=>{Ne(!1)},tt=Ns(j),Be=Ns(H.current);st.scroll&&(window.addEventListener("scroll",$e),tt==null||tt.addEventListener("scroll",$e),Be==null||Be.addEventListener("scroll",$e));let ze=null;st.resize?window.addEventListener("resize",$e):j&&H.current&&(ze=ch(j,H.current,de,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const nt=xe=>{xe.key==="Escape"&&Ne(!1)};st.escape&&window.addEventListener("keydown",nt),st.clickOutsideAnchor&&window.addEventListener("click",un);const be=[],dn=xe=>{Ie&&(xe==null?void 0:xe.target)===j||ln(xe)},ro=xe=>{Ie&&(xe==null?void 0:xe.target)===j&&et()},mt=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],ar=["click","dblclick","mousedown","mouseup"];Object.entries(Ft).forEach(([xe,Ct])=>{Ct&&(mt.includes(xe)?be.push({event:xe,listener:Ze}):ar.includes(xe)&&be.push({event:xe,listener:dn}))}),Object.entries(Jt).forEach(([xe,Ct])=>{Ct&&(mt.includes(xe)?be.push({event:xe,listener:ne}):ar.includes(xe)&&be.push({event:xe,listener:ro}))}),I&&be.push({event:"pointermove",listener:Xt});const cr=()=>{Je.current=!0},lr=()=>{Je.current=!1,et()};return _&&!Ye&&((U=H.current)===null||U===void 0||U.addEventListener("mouseenter",cr),(oe=H.current)===null||oe===void 0||oe.addEventListener("mouseleave",lr)),be.forEach(({event:xe,listener:Ct})=>{se.forEach(St=>{var pn;(pn=St.current)===null||pn===void 0||pn.addEventListener(xe,Ct)})}),()=>{var xe,Ct;st.scroll&&(window.removeEventListener("scroll",$e),tt==null||tt.removeEventListener("scroll",$e),Be==null||Be.removeEventListener("scroll",$e)),st.resize?window.removeEventListener("resize",$e):ze==null||ze(),st.clickOutsideAnchor&&window.removeEventListener("click",un),st.escape&&window.removeEventListener("keydown",nt),_&&!Ye&&((xe=H.current)===null||xe===void 0||xe.removeEventListener("mouseenter",cr),(Ct=H.current)===null||Ct===void 0||Ct.removeEventListener("mouseleave",lr)),be.forEach(({event:St,listener:pn})=>{se.forEach(oo=>{var Vn;(Vn=oo.current)===null||Vn===void 0||Vn.removeEventListener(St,pn)})})}},[j,de,qe,xt,He,M,O,V,_t,m,y]),g.useEffect(()=>{var U,oe;let se=(oe=(U=he==null?void 0:he.anchorSelect)!==null&&U!==void 0?U:s)!==null&&oe!==void 0?oe:"";!se&&t&&(se=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const je=new MutationObserver($e=>{const tt=[],Be=[];$e.forEach(ze=>{if(ze.type==="attributes"&&ze.attributeName==="data-tooltip-id"&&(ze.target.getAttribute("data-tooltip-id")===t?tt.push(ze.target):ze.oldValue===t&&Be.push(ze.target)),ze.type==="childList"){if(j){const nt=[...ze.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 dn;return!!(!((dn=be==null?void 0:be.contains)===null||dn===void 0)&&dn.call(be,j))&&(Fe(!1),Ne(!1),L(null),yt(W),yt(ce),!0)})}if(se)try{const nt=[...ze.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(ze=>[...ze.filter(nt=>!Be.includes(nt)),...tt])});return je.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{je.disconnect()}},[t,s,he==null?void 0:he.anchorSelect,j]),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];j&&se.includes(j)||L((U=He[0])!==null&&U!==void 0?U:oe)},[o,He,j]),g.useEffect(()=>(me&&Ne(!0),()=>{yt(W),yt(ce)}),[]),g.useEffect(()=>{var U;let oe=(U=he==null?void 0:he.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,he==null?void 0:he.anchorSelect]),g.useEffect(()=>{W.current&&(yt(W),zt(m))},[m]);const Le=(Y=he==null?void 0:he.content)!==null&&Y!==void 0?Y:re,Kt=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`)}It(U??null),U!=null&&U.delay?zt(U.delay):Ne(!0)},close:U=>{U!=null&&U.delay?Lt(U.delay):Ne(!1)},activeAnchor:j,place:fe.place,isOpen:!!(qe&&!C&&Le&&Kt)})),qe&&!C&&Le?g.createElement(p,{id:t,role:G,className:vt("react-tooltip",Sn.tooltip,vo.tooltip,vo[i],n,`react-tooltip__place-${fe.place}`,Sn[Kt?"show":"closing"],Kt?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&Sn.fixed,_&&Sn.clickable),onTransitionEnd:U=>{yt(P),Ie||U.propertyName!=="opacity"||(Fe(!1),It(null),q==null||q())},style:{...X,...fe.tooltipStyles,opacity:D!==void 0&&Kt?D:void 0},ref:H},Le,g.createElement(p,{className:vt("react-tooltip-arrow",Sn.arrow,vo.arrow,r,w&&Sn.noArrow),style:{...fe.tooltipArrowStyles,background:A?`linear-gradient(to right bottom, transparent 50%, ${A} 50%)`:void 0},ref:Q})):null},xh=({content:e})=>g.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),bh=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:h=null,events:p=["hover"],openOnClick:m=!1,positionStrategy:y="absolute",middlewares:I,delayShow:C=0,delayHide:w=0,float:_=!1,hidden:b=!1,noArrow:x=!1,clickable:E=!1,closeOnEsc:M=!1,closeOnScroll:O=!1,closeOnResize:V=!1,openEvents:J,closeEvents:X,globalCloseEvents:Z,imperativeModeOnly:te=!1,style:q,position:ae,isOpen:re,defaultIsOpen:ee=!1,disableStyleInjection:pe=!1,border:me,opacity:N,arrowColor:j,setIsOpen:L,afterShow:k,afterHide:D,disableTooltip:A,role:G="tooltip"},Y)=>{const[H,Q]=g.useState(r),[W,ce]=g.useState(i),[P,fe]=g.useState(u),[B,Ie]=g.useState(l),[ke,qe]=g.useState(d),[Fe,he]=g.useState(C),[It,We]=g.useState(w),[it,xt]=g.useState(_),[bt,Je]=g.useState(b),[He,Me]=g.useState(f),[Oe,_t]=g.useState(p),[Ye,Ft]=g.useState(y),[Jt,st]=g.useState(null),[Ne,Mt]=g.useState(null),zt=g.useRef(pe),{anchorRefs:Lt,activeAnchor:ln}=cc(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},{}),$t=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(" ");_t(de??p)},"position-strategy":ne=>{var de;Ft((de=ne)!==null&&de!==void 0?de:y)},"delay-show":ne=>{he(ne===null?C:Number(ne))},"delay-hide":ne=>{We(ne===null?w:Number(ne))},float:ne=>{xt(ne===null?_:ne==="true")},hidden:ne=>{Je(ne===null?b:ne==="true")},"class-name":ne=>{st(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(()=>{he(C)},[C]),g.useEffect(()=>{We(w)},[w]),g.useEffect(()=>{xt(_)},[_]),g.useEffect(()=>{Je(b)},[b]),g.useEffect(()=>{Ft(y)},[y]),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(Lt);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=Ne??de)!==null&&Ce!==void 0?Ce:ln.current,Kt=new MutationObserver(oe=>{oe.forEach(se=>{var je;if(!Le||se.type!=="attributes"||!(!((je=se.attributeName)===null||je===void 0)&&je.startsWith("data-tooltip-")))return;const $e=et(Le);$t($e)})}),U={attributes:!0,childList:!1,subtree:!1};if(Le){const oe=et(Le);$t(oe),Kt.observe(Le,U)}return()=>{Kt.disconnect()}},[Lt,ln,Ne,t,n]),g.useEffect(()=>{q!=null&&q.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),me&&!Ss("border",`${me}`)&&console.warn(`[react-tooltip] "${me}" is not a valid \`border\`.`),q!=null&&q.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),N&&!Ss("opacity",`${N}`)&&console.warn(`[react-tooltip] "${N}" is not a valid \`opacity\`.`)},[]);let Xt=h;const un=g.useRef(null);if(o){const Ce=o({content:(Ne==null?void 0:Ne.getAttribute("data-tooltip-content"))||H||null,activeAnchor:Ne});Xt=Ce?g.createElement("div",{ref:un,className:"react-tooltip-content-wrapper"},Ce):null}else H&&(Xt=H);W&&(Xt=g.createElement(xh,{content:W}));const Gt={forwardRef:Y,id:e,anchorId:t,anchorSelect:n,className:vt(s,Jt),classNameArrow:c,content:Xt,contentWrapperRef:un,place:P,variant:B,offset:ke,wrapper:He,events:Oe,openOnClick:m,positionStrategy:Ye,middlewares:I,delayShow:Fe,delayHide:It,float:it,hidden:bt,noArrow:x,clickable:E,closeOnEsc:M,closeOnScroll:O,closeOnResize:V,openEvents:J,closeEvents:X,globalCloseEvents:Z,imperativeModeOnly:te,style:q,position:ae,isOpen:re,defaultIsOpen:ee,border:me,opacity:N,arrowColor:j,setIsOpen:L,afterShow:k,afterHide:D,disableTooltip:A,activeAnchor:Ne,setActiveAnchor:Ce=>Mt(Ce),role:G};return g.createElement(Ih,{...Gt})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||_s({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||_s({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 _h(){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 Ch({id:e,tooltipText:t}){return a.jsxs(a.Fragment,{children:[a.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:_h()}),a.jsx(bh,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const Ii=g.createContext(null);function lc(){const e=g.useContext(Ii);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const xi=g.createContext(()=>{});function Sh(){const e=g.useContext(xi);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var uc=Symbol.for("immer-nothing"),Ts=Symbol.for("immer-draftable"),ut=Symbol.for("immer-state"),Eh=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=Eh[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 Dn=Object.getPrototypeOf;function kn(e){return!!e&&!!e[ut]}function xn(e){var t;return e?dc(e)||Array.isArray(e)||!!e[Ts]||!!((t=e.constructor)!=null&&t[Ts])||Yr(e)||Zr(e):!1}var Oh=Object.prototype.constructor.toString();function dc(e){if(!e||typeof e!="object")return!1;const t=Dn(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)===Oh}function Mr(e,t){Gr(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Gr(e){const t=e[ut];return t?t.type_:Array.isArray(e)?1:Yr(e)?2:Zr(e)?3:0}function ko(e,t){return Gr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function pc(e,t,n){const r=Gr(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Nh(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Yr(e){return e instanceof Map}function Zr(e){return e instanceof Set}function gn(e){return e.copy_||e.base_}function Fo(e,t){if(Yr(e))return new Map(e);if(Zr(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=dc(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[ut];let i=Reflect.ownKeys(r);for(let o=0;o<i.length;o++){const s=i[o],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(Dn(e),r)}else{const r=Dn(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function bi(e,t=!1){return Qr(e)||kn(e)||!xn(e)||(Gr(e)>1&&(e.set=e.add=e.clear=e.delete=Th),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>bi(r,!0))),e}function Th(){rt(2)}function Qr(e){return Object.isFrozen(e)}var Rh={};function bn(e){const t=Rh[e];return t||rt(0,e),t}var Zn;function fc(){return Zn}function Ah(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Rs(e,t){t&&(bn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Mo(e){Lo(e),e.drafts_.forEach(Ph),e.drafts_=null}function Lo(e){e===Zn&&(Zn=e.parent_)}function As(e){return Zn=Ah(Zn,e)}function Ph(e){const t=e[ut];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ps(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[ut].modified_&&(Mo(t),rt(4)),xn(e)&&(e=Lr(t,e),t.parent_||$r(t,e)),t.patches_&&bn("Patches").generateReplacementPatches_(n[ut].base_,e,t.patches_,t.inversePatches_)):e=Lr(t,n,[]),Mo(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==uc?e:void 0}function Lr(e,t,n){if(Qr(t))return t;const r=t[ut];if(!r)return Mr(t,(i,o)=>js(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return $r(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),Mr(o,(c,l)=>js(e,r,i,c,l,n,s)),$r(e,i,!1),n&&e.patches_&&bn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function js(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&rt(5),kn(i)){const c=o&&t&&t.type_!==3&&!ko(t.assigned_,r)?o.concat(r):void 0,l=Lr(e,i,c);if(pc(n,r,l),kn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(xn(i)&&!Qr(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Lr(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&$r(e,i)}}function $r(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&bi(t,n)}function jh(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:fc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=_i;n&&(i=[r],o=Qn);const{revoke:s,proxy:c}=Proxy.revocable(i,o);return r.draft_=c,r.revoke_=s,c}var _i={get(e,t){if(t===ut)return e;const n=gn(e);if(!ko(n,t))return Dh(e,n,t);const r=n[t];return e.finalized_||!xn(r)?r:r===wo(e.base_,t)?(Io(e),e.copy_[t]=Ko(r,e)):r},has(e,t){return t in gn(e)},ownKeys(e){return Reflect.ownKeys(gn(e))},set(e,t,n){const r=mc(gn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=wo(gn(e),t),o=i==null?void 0:i[ut];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Nh(n,i)&&(n!==void 0||ko(e.base_,t)))return!0;Io(e),$o(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 wo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Io(e),$o(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=gn(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 Dn(e.base_)},setPrototypeOf(){rt(12)}},Qn={};Mr(_i,(e,t)=>{Qn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Qn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&rt(13),Qn.set.call(this,e,t,void 0)};Qn.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&rt(14),_i.set.call(this,e[0],t,n,e[0])};function wo(e,t){const n=e[ut];return(n?gn(n):e)[t]}function Dh(e,t,n){var i;const r=mc(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function mc(e,t){if(!(t in e))return;let n=Dn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Dn(n)}}function $o(e){e.modified_||(e.modified_=!0,e.parent_&&$o(e.parent_))}function Io(e){e.copy_||(e.copy_=Fo(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var kh=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(xn(t)){const o=As(this),s=Ko(t,void 0);let c=!0;try{i=n(s),c=!1}finally{c?Mo(o):Lo(o)}return Rs(o,r),Ps(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===uc&&(i=void 0),this.autoFreeze_&&bi(i,!0),r){const o=[],s=[];bn("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){xn(e)||rt(8),kn(e)&&(e=Fh(e));const t=As(this),n=Ko(e,void 0);return n[ut].isManual_=!0,Lo(t),n}finishDraft(e,t){const n=e&&e[ut];(!n||!n.isManual_)&&rt(9);const{scope_:r}=n;return Rs(r,t),Ps(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=bn("Patches").applyPatches_;return kn(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Ko(e,t){const n=Yr(e)?bn("MapSet").proxyMap_(e,t):Zr(e)?bn("MapSet").proxySet_(e,t):jh(e,t);return(t?t.scope_:fc()).drafts_.push(n),n}function Fh(e){return kn(e)||rt(10,e),hc(e)}function hc(e){if(!xn(e)||Qr(e))return e;const t=e[ut];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Fo(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Fo(e,!0);return Mr(n,(r,i)=>{pc(n,r,hc(i))}),t&&(t.finalized_=!1),n}var dt=new kh,qn=dt.produce;dt.produceWithPatches.bind(dt);dt.setAutoFreeze.bind(dt);dt.setUseStrictShallowCopy.bind(dt);dt.applyPatches.bind(dt);dt.createDraft.bind(dt);dt.finishDraft.bind(dt);const gc=g.createContext(void 0),Mh={};function eo(){const e=g.useContext(gc);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Lh({children:e}){const{installation:t}=ot(),{hydratedRevision:n,loading:r}=_n(),[i,o]=g.useState(Mh),s=t==null?void 0:t.config;g.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&rf(n,s,o)},[n,r,s,i]);const c=g.useCallback((p,m)=>{o(y=>qn(y,I=>{I[p]=qn(I[p],m)}))},[o]),l=g.useCallback((p,m)=>{o(y=>qn(y,I=>{I[p]=m}))},[o]),u=g.useCallback(()=>{o(qn(p=>{const m=p.other.write;m&&(m.isWriteModified=!1)}))},[o]),d=g.useCallback(p=>{o(qn(m=>{var I;const y=(I=m[p])==null?void 0:I.read;y&&(y.isOptionalFieldsModified=!1,y.isRequiredMapFieldsModified=!1)}))},[o]),f=g.useCallback(p=>{p===nn?u():d(p)},[d,u]),h=g.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:c,resetConfigureState:l,resetPendingConfigurationState:f}),[i,l,f,c]);return a.jsx(gc.Provider,{value:h,children:e})}const Wt=()=>{const{appName:e}=Re(),{objectConfigurationsState:t,setConfigureState:n}=eo(),{selectedObjectName:r}=lc(),i=la(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}};function $h(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=!Xo(o,r);e.read.isRequiredMapFieldsModified=c}}function yc(e,t,n,r){t(e,i=>$h(i,n,r))}function Vo({field:e,onSelectChange:t,allFields:n}){var p;const{configureState:r,selectedObjectName:i,setConfigureState:o}=Wt(),[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&&yc(i,o,e.mapToName,e._default),c(!1)},[e,o,i,u,r]);const d=g.useMemo(()=>n==null?void 0:n.map(m=>a.jsx("option",{value:m.fieldName,children:m.displayName},m.fieldName)),[n]),f=g.useMemo(()=>n.map(m=>({id:m.fieldName,label:m.displayName,value:m.fieldName})),[n]),h=Pe?a.jsx(Am,{items:f,selectedValue:u||null,onSelectedItemChange:m=>{t({target:{name:e.mapToName,value:m==null?void 0:m.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(Ch,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),h]},e.mapToName)}const Kh="_formControl_4arwu_1",Vh="_formLabel_4arwu_5",Hh="_formLabelRequired_4arwu_11",Bh="_formInput_4arwu_16",Uh="_formInputInvalid_4arwu_20",qh="_formError_4arwu_24",Wh="_disabled_4arwu_30",hn={formControl:Kh,formLabel:Vh,formLabelRequired:Hh,formInput:Bh,formInputInvalid:Uh,formError:qh,disabled:Wh};function Jh({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return a.jsxs("div",{className:vt(hn.formControl,{[hn.disabled]:r}),children:[t&&a.jsx("label",{htmlFor:e,className:vt(hn.formLabel,{[hn.formLabelRequired]:n}),children:t}),a.jsx("div",{id:e,className:vt(hn.formInput,{[hn.formInputInvalid]:i}),children:s}),i&&o&&a.jsx("div",{className:hn.formError,role:"alert",children:o})]})}const zh="_divider_j6suu_1",Ds={divider:zh};function ir({className:e,style:t}){return Pe?a.jsx("hr",{className:e?`${Ds.divider} ${e}`:Ds.divider,style:t}):a.jsx(T.Divider,{className:e,style:t})}const Xh=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-text-secondary").trim()||"#737373";function Kn({string:e}){return a.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[a.jsx("h3",{style:{color:Xh,fontSize:"1rem",fontWeight:"500"},children:e}),a.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:a.jsx(ir,{style:{marginLeft:"1rem"}})})]})}function Gh(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=Wt(),{fieldMapping:r}=ot(),{isError:i,removeError:o}=sn(),s=l=>{const{value:u,name:d}=l.target;u&&(e&&yc(e,n,d,u),i(Se.MAPPING,d)&&o(Se.MAPPING,d))},c=g.useMemo(()=>{var f;const l=((f=t==null?void 0:t.read)==null?void 0:f.requiredMapFields)||[],u=e&&r?Object.values(r[e]||{}).flat():[];return l.concat(u).reduce((h,p)=>h.find(y=>y.mapToName===p.mapToName)?h.map(y=>y.mapToName===p.mapToName?p:y):h.concat(p),new Array).filter(jt)},[t,r,e]);return c!=null&&c.length?a.jsxs(a.Fragment,{children:[a.jsx(Kn,{string:"Map the following fields (required)"}),a.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(l=>{var u,d;return Pe?a.jsx(Jh,{id:l.mapToName,isInvalid:i(Se.MAPPING,l.mapToName),errorMessage:"* required",children:a.jsx(Vo,{allFields:((u=t==null?void 0:t.read)==null?void 0:u.allFields)||[],field:l,onSelectChange:s})},l.mapToName):a.jsxs(T.FormControl,{isInvalid:i(Se.MAPPING,l.mapToName),children:[a.jsx(Vo,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:l,onSelectChange:s}),a.jsx(T.FormErrorMessage,{children:" * required"})]},l.mapToName)})})]}):null}const Yh=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-callout-background").trim()||"#f5f5f5",Zh={backgroundColor:Yh,border:"none",padding:".5rem 1rem"};function Qh({children:e,style:t}){return a.jsx(an,{style:{...Zh,...t},children:e})}function eg(){var d,f,h;const{project:e}=Re(),{hydratedRevision:t}=_n(),{selectedObjectName:n}=Wt(),{provider:r}=ot(),i=e==null?void 0:e.appName,o=At(r),s=(h=(f=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:f.objects)==null?void 0:h.find(p=>p.objectName===n),c=(s==null?void 0:s.displayName)||n&&Xn(n),l=s==null?void 0:s.mapToName,u=(s==null?void 0:s.mapToDisplayName)||l&&Xn(l);return u&&i&&o?a.jsx(Qh,{style:{marginTop:"1rem"},children:a.jsxs("p",{children:[a.jsx("b",{children:u})," in ",i," is mapped to ",a.jsx("b",{children:c})," in ",o,"."]})}):null}function tg(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function vc(...e){return t=>e.forEach(n=>tg(n,t))}function er(...e){return $.useCallback(vc(...e),e)}function ng(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:h,children:p,...m}=f,y=((C=h==null?void 0:h[e])==null?void 0:C[l])||c,I=$.useMemo(()=>m,Object.values(m));return a.jsx(y.Provider,{value:I,children:p})};u.displayName=o+"Provider";function d(f,h){var y;const p=((y=h==null?void 0:h[e])==null?void 0:y[l])||c,m=$.useContext(p);if(m)return m;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,rg(i,...t)]}function rg(...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 Ci(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 Si({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=og({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,c=Ci(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 og({defaultProp:e,onChange:t}){const n=$.useState(e),[r]=n,i=$.useRef(r),o=Ci(t);return $.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function ig(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 Kr=globalThis!=null&&globalThis.document?$.useLayoutEffect:()=>{};function sg(e){const[t,n]=$.useState(void 0);return Kr(()=>{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 ag(e,t){return $.useReducer((n,r)=>t[n][r]??n,e)}var Ei=e=>{const{present:t,children:n}=e,r=cg(t),i=typeof n=="function"?n({present:r.isPresent}):$.Children.only(n),o=er(r.ref,lg(i));return typeof n=="function"||r.isPresent?$.cloneElement(i,{ref:o}):null};Ei.displayName="Presence";function cg(e){const[t,n]=$.useState(),r=$.useRef({}),i=$.useRef(e),o=$.useRef("none"),s=e?"mounted":"unmounted",[c,l]=ag(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return $.useEffect(()=>{const u=_r(r.current);o.current=c==="mounted"?u:"none"},[c]),Kr(()=>{const u=r.current,d=i.current;if(d!==e){const h=o.current,p=_r(u);e?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Kr(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const y=_r(r.current).includes(p.animationName);if(p.target===t&&y&&(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)})}},h=p=>{p.target===t&&(o.current=_r(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:$.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function _r(e){return(e==null?void 0:e.animationName)||"none"}function lg(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Vr=$.forwardRef((e,t)=>{const{children:n,...r}=e,i=$.Children.toArray(n),o=i.find(dg);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(Ho,{...r,ref:t,children:$.isValidElement(s)?$.cloneElement(s,void 0,c):null})}return a.jsx(Ho,{...r,ref:t,children:n})});Vr.displayName="Slot";var Ho=$.forwardRef((e,t)=>{const{children:n,...r}=e;if($.isValidElement(n)){const i=fg(n);return $.cloneElement(n,{...pg(r,n.props),ref:t?vc(t,i):i})}return $.Children.count(n)>1?$.Children.only(null):null});Ho.displayName="SlotClone";var ug=({children:e})=>a.jsx(a.Fragment,{children:e});function dg(e){return $.isValidElement(e)&&e.type===ug}function pg(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 fg(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 mg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],cn=mg.reduce((e,t)=>{const n=$.forwardRef((r,i)=>{const{asChild:o,...s}=r,c=o?Vr: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}},{}),Oi="Checkbox",[hg,Xv]=ng(Oi),[gg,yg]=hg(Oi),wc=$.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,[h,p]=$.useState(null),m=er(t,b=>p(b)),y=$.useRef(!1),I=h?d||!!h.closest("form"):!0,[C=!1,w]=Si({prop:i,defaultProp:o,onChange:u}),_=$.useRef(C);return $.useEffect(()=>{const b=h==null?void 0:h.form;if(b){const x=()=>w(_.current);return b.addEventListener("reset",x),()=>b.removeEventListener("reset",x)}},[h,w]),a.jsxs(gg,{scope:n,state:C,disabled:c,children:[a.jsx(cn.button,{type:"button",role:"checkbox","aria-checked":tn(C)?"mixed":C,"aria-required":s,"data-state":bc(C),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:m,onKeyDown:Ot(e.onKeyDown,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:Ot(e.onClick,b=>{w(x=>tn(x)?!0:!x),I&&(y.current=b.isPropagationStopped(),y.current||b.stopPropagation())})}),I&&a.jsx(vg,{control:h,bubbles:!y.current,name:r,value:l,checked:C,required:s,disabled:c,form:d,style:{transform:"translateX(-100%)"},defaultChecked:tn(o)?!1:o})]})});wc.displayName=Oi;var Ic="CheckboxIndicator",xc=$.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=yg(Ic,n);return a.jsx(Ei,{present:r||tn(o.state)||o.state===!0,children:a.jsx(cn.span,{"data-state":bc(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});xc.displayName=Ic;var vg=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,s=$.useRef(null),c=ig(n),l=sg(t);$.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&p){const m=new Event("click",{bubbles:r});d.indeterminate=tn(n),p.call(d,tn(n)?!1:n),d.dispatchEvent(m)}},[c,n,r]);const u=$.useRef(tn(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 tn(e){return e==="indeterminate"}function bc(e){return tn(e)?"indeterminate":e?"checked":"unchecked"}var _c=wc,Cc=xc;function Sc(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 wg=["color"],Ec=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Sc(e,wg);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"}))}),Ig=["color"],xg=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Sc(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:"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 bg="_checkboxGroupContainer_19hkn_1",_g="_stack_19hkn_6",Cg="_selectAllContainer_19hkn_11",Sg="_fieldContainer_19hkn_18",Eg="_checkbox_19hkn_1",Fn={checkboxGroupContainer:bg,stack:_g,selectAllContainer:Cg,fieldContainer:Sg,checkbox:Eg};function Oc({id:e,isChecked:t,label:n,onCheckedChange:r}){return a.jsxs("div",{className:Fn.fieldContainer,children:[a.jsx(_c,{className:Fn.checkbox,id:e,onCheckedChange:r,checked:t,children:a.jsx(Cc,{children:a.jsx(Ec,{})})}),a.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Nc({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return a.jsxs("div",{className:Fn.selectAllContainer,children:[a.jsx(_c,{className:Fn.checkbox,id:e,onCheckedChange:r,children:a.jsxs(Cc,{children:[i&&a.jsx(xg,{}),t===!0&&a.jsx(Ec,{})]})}),a.jsx("label",{htmlFor:e,children:n})]})}function Tc({children:e}){return a.jsx("div",{className:Fn.checkboxGroupContainer,children:e})}function Rc({children:e}){return a.jsx("div",{className:Fn.stack,children:e})}function Og(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=!Xo(s,r);e.read.isOptionalFieldsModified=l}else console.warn("read.savedConfig.optionalFields is undefined")}function Hr(e,t,n,r){t(e,i=>Og(i,n,r))}function Ng(){var f,h;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Wt(),i=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,o=(p,m)=>{p!=="indeterminate"&&r&&t&&Hr(r,n,m,p)},s=(h=t==null?void 0:t.read)==null?void 0:h.optionalFields,c=p=>{r&&s&&s.forEach(m=>{jt(m)||Hr(r,n,m.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(Kn,{string:`${e} reads the following optional fields`}),a.jsxs(Tc,{children:[((s==null?void 0:s.length)||0)>=2&&a.jsx(Nc,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:c,isIndeterminate:d}),a.jsx(Rc,{children:s.map(p=>jt(p)?null:a.jsx(Oc,{id:p.fieldName,isChecked:!!(i!=null&&i[p==null?void 0:p.fieldName]),label:p.displayName,onCheckedChange:m=>o(m,p.fieldName)},p.fieldName))})]})]})}function Tg(){var f,h;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Wt(),i=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,o=p=>{const{name:m,checked:y}=p.target;r&&t&&Hr(r,n,m,y)},s=(h=t==null?void 0:t.read)==null?void 0:h.optionalFields,c=p=>{const{checked:m}=p.target;r&&s&&s.forEach(y=>{jt(y)||Hr(r,n,y.fieldName,m)})},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(Kn,{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=>jt(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 Rg(){return Pe?a.jsx(Ng,{}):a.jsx(Tg,{})}const Ag=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-badge").trim()||"#e5e5e5",Pg=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-badge-text").trim()||"#404040",jg={color:Pg,backgroundColor:Ag,borderRadius:"4px",display:"inline-block",fontSize:"0.75rem",fontWeight:500,lineHeight:"1.25",padding:"0.25rem 0.5rem"};function Dg({children:e,style:t,...n}){return a.jsx("span",{style:{...jg,...t},...n,children:e})}function kg(){var r,i,o;const{configureState:e,selectedObjectName:t}=Wt(),{appName:n}=Re();return a.jsxs(a.Fragment,{children:[a.jsx(Kn,{string:`${n} reads the following ${t} fields`}),a.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(i=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&i.length?(o=e.read)==null?void 0:o.requiredFields.map(s=>jt(s)?null:a.jsx(Dg,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function Fg(){return a.jsxs(a.Fragment,{children:[a.jsx(eg,{}),a.jsx(kg,{}),a.jsx(Gh,{}),a.jsx(Rg,{})]})}function Mg(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=!Xo(c,s);e.write.isWriteModified=u}}}function Br(e,t,n,r){t(e,i=>{Mg(i,n,r)})}function Lg(){var f,h,p,m;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Wt(),i=(f=n==null?void 0:n.write)==null?void 0:f.selectedNonConfigurableWriteFields,o=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects,s=(y,I)=>{y!=="indeterminate"&&t&&n&&Br(t,r,I,y)},c=y=>{var I,C;t&&n&&((C=(I=n==null?void 0:n.write)==null?void 0:I.writeObjects)==null||C.forEach(w=>{Br(t,r,w.objectName,y)}))},l=!!o,u=Object.keys(i||{}).length===((m=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null?void 0:m.length),d=!u&&Object.keys(i||{}).length>0;return l&&a.jsxs(a.Fragment,{children:[a.jsx(Kn,{string:`Allow ${e} to write to these objects`}),a.jsxs(Tc,{children:[((o==null?void 0:o.length)||0)>=2&&a.jsx(Nc,{id:"select-all-fields",onCheckedChange:c,isIndeterminate:d,isChecked:u,label:"Select all"}),a.jsx(Rc,{children:o.map(y=>a.jsx(Oc,{id:y.objectName,onCheckedChange:I=>s(I,y.objectName),isChecked:!!(i!=null&&i[y.objectName]),label:y.displayName},y.objectName))})]})]})}function $g(){var f,h,p,m;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Wt(),i=(f=n==null?void 0:n.write)==null?void 0:f.selectedNonConfigurableWriteFields,o=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects,s=y=>{const{name:I,checked:C}=y.target;t&&n&&Br(t,r,I,C)},c=y=>{var C,w;const{checked:I}=y.target;t&&n&&((w=(C=n==null?void 0:n.write)==null?void 0:C.writeObjects)==null||w.forEach(_=>{Br(t,r,_.objectName,I)}))},l=!!o,u=Object.keys(i||{}).length===((m=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null?void 0:m.length),d=!u&&Object.keys(i||{}).length>0;return l&&a.jsxs(a.Fragment,{children:[a.jsx(Kn,{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(y=>a.jsx(T.Box,{display:"flex",alignItems:"center",borderBottom:"1px",borderColor:"gray.100",paddingX:4,paddingY:2,children:a.jsx(T.Checkbox,{name:y.objectName,id:y.objectName,onChange:s,isChecked:!!(i!=null&&i[y.objectName]),children:a.jsx("p",{style:{overflowWrap:"anywhere"},children:y.displayName})})},y.objectName))]})]})}function Kg(){return Pe?a.jsx(Lg,{}):a.jsx($g,{})}function Ac({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const r=Ve(),{projectId:i}=Re(),{integrationId:o,installation:s,resetInstallations:c,setIntegrationDeleted:l,onUninstallSuccess:u}=ot(),[d,f]=g.useState(!1),h=!i||!o||!(s!=null&&s.id)||d,p=async()=>{if(!h){f(!0),console.warn("uninstalling installation",{projectId:i,integrationId:o,installationId:s.id});try{await Ee().installationApi.deleteInstallation({projectIdOrName:i,integrationId:o,installationId:s.id},{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}),console.warn("successfully uninstalled installation:",s.id),u==null||u(s==null?void 0:s.id),c(),l()}catch(I){console.error("Error uninstalling installation."),Ge(I)}finally{f(!1)}}},m=d?"Uninstalling...":e,y=Pe?a.jsx(wt,{type:"button",onClick:p,disabled:h,variant:t,style:n,children:m}):a.jsx(T.Button,{onClick:p,variant:t,isDisabled:h,style:n,children:m});return s!=null&&s.id?y:null}function Vg(){const{appName:e}=Re(),{installation:t}=ot(),n=t!=null&&t.id?`Once you uninstall this integration, all your configuration will be lost, and "${e}" may stop working.`:"You've successfully uninstalled the integration.";return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[a.jsx("p",{children:n}),a.jsx(Ac,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}const Hg=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-border").trim()||"#e5e5e5",Bg=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-background").trim()||"white";function Pc({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var E,M,O;const{installation:o}=ot(),{hydratedRevision:s,loading:c}=_n(),{configureState:l,selectedObjectName:u}=Wt(),d=o==null?void 0:o.config,f=d&&u&&!!ra(d,u)||!1,h=((E=l==null?void 0:l.read)==null?void 0:E.isOptionalFieldsModified)||((M=l==null?void 0:l.read)==null?void 0:M.isRequiredMapFieldsModified),p=(O=l==null?void 0:l.write)==null?void 0:O.isWriteModified,C=c||n||!l||!u||!(h||p||r||u!==nn&&!f),w=u===nn,_=u===Gn,b=Pe?a.jsx(wt,{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(wt,{type:"button",onClick:t,disabled:C,variant:"ghost",children:"Reset"}):a.jsx(T.Button,{isDisabled:C,onClick:t,children:"Reset"});return n?a.jsx(Nt,{}):a.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"2rem"},children:[b,x]}),a.jsxs(an,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:Bg,borderColor:Hg},children:[i&&a.jsx(da,{children:typeof i=="string"?i:"Installation Failed."}),c&&a.jsx(Nt,{}),s&&!_&&!w&&a.jsx(Fg,{}),s&&!_&&w&&a.jsx(Kg,{}),!c&&_&&a.jsx(Vg,{})]})]})}const jc=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o}=ot(),{hydratedRevision:s,loading:c}=_n(),{selectedObjectName:l}=lc(),{selectedConnection:u}=Ln(),d=Ve(),{projectId:f}=Re(),{resetBoundary:h,setErrors:p,setError:m,getError:y}=sn(),{resetConfigureState:I,objectConfigurationsState:C,resetPendingConfigurationState:w}=eo(),_=la(l||"",C),{onNextIncompleteTab:b}=Sh(),x=g.useCallback(()=>{h(Se.INSTALLATION_MUTATION)},[h]),E=g.useCallback(O=>O?V=>{m(Se.INSTALLATION_MUTATION,O,V)}:V=>{console.error("objectName is required to set installation error: ",V)},[m]),M=g.useCallback(O=>O?y(Se.INSTALLATION_MUTATION,O):"",[y]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:c,selectedObjectName:l,selectedConnection:u,apiKey:d,projectId:f,resetBoundary:h,setErrors:p,setMutateInstallationError:E,getMutateInstallationError:M,resetMutateInstallationErrorState:x,resetConfigureState:I,objectConfigurationsState:C,resetPendingConfigurationState:w,configureState:_,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:b}},Ug=void 0;function qg(){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:h,getMutateInstallationError:p,resetMutateInstallationErrorState:m,resetConfigureState:y,objectConfigurationsState:I,resetPendingConfigurationState:C,configureState:w,onInstallSuccess:_,onNextIncompleteTab:b}=jc(),[x,E]=g.useState(!1),M=s===nn,O=p(s),V=g.useCallback(()=>{d(Se.MAPPING),i!=null&&i.content&&!o&&s&&sa(i,Ug,s,y)},[d,i,o,s,y]);g.useEffect(()=>{!w&&(i!=null&&i.content)&&!o&&V()},[w,I,i,o,V]);const J=()=>{m();const{requiredMapFields:te,selectedFieldMappings:q}=(w==null?void 0:w.read)||{},{errorList:ae}=oa(te,q,f);ae.length>0||(s&&(c!=null&&c.id)&&l&&u&&e&&t&&n&&i?(E(!0),af(u,e,t,n,c.id,s,l,i,w,h(s),r,_).finally(()=>{E(!1),C(s),b()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},X=()=>{m(),s&&(c!=null&&c.id)&&l&&u&&e&&t&&n&&i?(E(!0),uf(u,e,t,n,c.id,l,i,w,h(s),r,_).finally(()=>{E(!1),C(s),b()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},Z=te=>{te.preventDefault(),M?X():J()};return a.jsx(Pc,{errorMsg:O,isCreateMode:!0,isLoading:x,onSave:Z,onReset:V})}function Wg({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 Ee().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=>{Ge(d,l)})}const Jg=(e,t,n,r,i,o)=>{const s=aa(e),c=ca(e),l={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:c,backfill:o}}}}};return qr(i)&&(l.content||(l.content={}),l.content.proxy={enabled:!0}),l},zg=(e,t,n,r,i,o,s,c,l,u,d)=>{const f=Jg(o,r||"",c,c.schedule,l,c.backfill);return f?Wg({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))},Xg=(e,t)=>{const r={content:{write:{objects:ua(e)}}};return qr(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},Gg=(e,t,n,r,i,o,s,c,l)=>{const u=Xg(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 Ee().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=>{Ge(f,s)})};function Yg({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:h,resetPendingConfigurationState:p,configureState:m,onUpdateSuccess:y,onNextIncompleteTab:I}=jc(),[C,w]=g.useState(!1),_=o===nn,b=f(o),{config:x}=e,E=g.useCallback(()=>{l(Se.MAPPING),r!=null&&r.content&&!i&&o&&sa(r,x,o,h)},[l,r,i,o,x,h]);g.useEffect(()=>{m||E()},[m,E]),g.useEffect(()=>{e&&E()},[e,E]);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]),O=()=>{const{requiredMapFields:X,selectedFieldMappings:Z}=(m==null?void 0:m.read)||{},{errorList:te}=oa(X,Z,u);te.length>0||(r&&e&&o&&s&&c&&M?(w(!0),zg(c,t.id,e.id,o,s,m,n,M,r,d(o),y).finally(()=>{w(!1),p(o),I()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},V=()=>{e&&o&&s&&c&&r?(w(!0),Gg(c,t.id,e.id,s,m,r,d(o),n,y).finally(()=>{w(!1),p(o),I()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},J=X=>{X.preventDefault(),_?V():O()};return a.jsx(Pc,{errorMsg:b,onSave:J,onReset:E,isLoading:C})}function Zg(){const{integrationObj:e,installation:t}=ot();return e?t&&e?a.jsx(Yg,{installation:t,integrationObj:e}):a.jsx(qg,{}):a.jsx(qt,{message:"We can't load the integration"})}function Qg(){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 Ni({text:e,children:t}){return a.jsx(Mn,{children:a.jsxs(an,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[a.jsx(Qg,{}),a.jsx("p",{children:e}),t]})})}const ey=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function ty({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:i,apiKey:o,hydratedRevision:s,setError:c,setInstallation:l,onInstallSuccess:u}){const d=ey(s,r);return d?Go({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 ny({provider:e}){const t=`You have successfully installed your ${At(e)} integration.`;return a.jsx(Ni,{text:t,children:a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:a.jsx(Ac,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const ry=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 oy({children:e,resetComponent:t}){var b;const{projectId:n}=Re(),r=Ve(),{hydratedRevision:i,loading:o}=_n(),{integrationObj:s,installation:c,groupRef:l,consumerRef:u,setInstallation:d,onInstallSuccess:f,isIntegrationDeleted:h}=ot(),{selectedConnection:p}=Ln(),[m,y]=g.useState(!1),I=o||m,C=(b=i==null?void 0:i.content)==null?void 0:b.provider,w=ry(i),_=x=>{console.error("Error when creating proxy installation:",x)};return g.useEffect(()=>{!I&&i&&w&&!c&&p&&r&&(s!=null&&s.id)&&(y(!0),ty({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(()=>{y(!1)}).catch(x=>{y(!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]),h?a.jsx(Ni,{text:"Integration successfully uninstalled.",children:Pe&&a.jsx(wt,{type:"button",onClick:t,style:{width:"100%"},children:"Reinstall Integration"})}):s?I?a.jsx(Nt,{}):w&&C&&c?a.jsx(ny,{provider:C}):a.jsx("div",{children:e}):a.jsx(qt,{message:"We can't load the integration"})}function Ti(){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 pt({children:e}){return a.jsx(Mn,{children:a.jsxs(an,{children:[a.jsx("div",{style:{padding:"3rem 2rem"},children:e}),a.jsx(Ti,{})]})})}function sr({children:e}){return a.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function ft({error:e}){return e?a.jsx(da,{style:{marginTop:"2em"},children:e}):null}function Ri({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(pt,{children:[a.jsx(sr,{children:o||`Set up ${r} integration`}),a.jsx(ft,{error:t}),i,a.jsx(wt,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const iy="_link_oo2kv_1",sy={link:iy};function Ai({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return Pe?a.jsx("a",{className:sy.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 ay=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-text-secondary").trim()||"#737373";function to({url:e,providerDisplayName:t,credentialName:n}){return a.jsxs("p",{style:{color:ay},children:[a.jsx(Ai,{href:e,newTab:!0,children:a.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const cy="_input_19woe_1",ly="_inputError_19woe_17",uy="_error_19woe_31",xo={input:cy,inputError:ly,error:uy};function dy({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?vt(xo.inputError,xo.input):xo.input;return a.jsx("input",{id:e,type:t,className:vt(o,n),...i})}const py="_textarea_1efhx_1",fy="_textareaError_1efhx_13",my="_error_1efhx_27",bo={textarea:py,textareaError:fy,error:my};function hy({className:e,isError:t=!1,...n}){const r=t?vt(bo.textareaError,bo.textarea):bo.textarea;return a.jsx("textarea",{className:vt(e,r),...n})}const Ut={Input:dy,Textarea:hy};function gy({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var y;const[o,s]=g.useState(!1),c=()=>s(!o),[l,u]=g.useState(""),d=I=>u(I.currentTarget.value),f=l.length>0,h=i||!f,p=At(e,t),m=(y=t.apiKeyOpts)==null?void 0:y.docsURL;return a.jsx(pt,{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(ft,{error:r}),a.jsxs(T.Stack,{spacing:4,children:[m&&a.jsx(to,{url:m,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:h,width:"100%",type:"submit",onClick:()=>{n({apiKey:l})},children:"Next"})]})})}function yy({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var y;const[o,s]=g.useState(!1),c=()=>s(I=>!I),[l,u]=g.useState(""),d=I=>u(I.currentTarget.value),f=l.length>0,h=i||!f,p=At(e,t),m=(y=t.apiKeyOpts)==null?void 0:y.docsURL;return a.jsx(Ri,{providerName:p,handleSubmit:()=>{n({apiKey:l})},error:r,isButtonDisabled:h,children:a.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[m&&a.jsx(to,{url:m,providerDisplayName:p,credentialName:"API key"}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(Ut.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"Password",onChange:I=>d(I)}),a.jsx(wt,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,children:o?"Hide":"Show"})]})]})})}function vy({...e}){return Pe?a.jsx(yy,{...e}):a.jsx(gy,{...e})}function wy({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:c,setSelectedConnection:l}){const u=Re(),[d,f]=g.useState(!1),[h,p]=g.useState(null),m=Ve();g.useEffect(()=>{if(e&&Ee&&d&&h!=null){const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:h};Ee().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:I},{headers:{"X-Api-Key":m??"","Content-Type":"application/json"}}).then(C=>{l(C)}).catch(C=>{console.error("Error loading provider info."),Ge(C)})}},[m,e,d,r,n,o,i,u,l,h]);const y=I=>{p(I.apiKey),f(!0)};return c===null?a.jsx(vy,{provider:e,providerInfo:t,handleSubmit:y,error:null}):s}function Iy({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(""),h=_=>u(_.currentTarget.value),p=_=>f(_.currentTarget.value),m=At(e,t),y=(w=t.basicOpts)==null?void 0:w.docsURL,I=l.length>0,C=i||!I;return a.jsx(pt,{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 ${m} integration`})}),a.jsx(ft,{error:r}),a.jsx("br",{}),a.jsxs(T.Stack,{spacing:4,children:[y&&a.jsx(to,{url:y,providerDisplayName:m,credentialName:"credentials"}),a.jsx(T.Input,{placeholder:"Username",onChange:h}),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 xy({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,h=At(e,t),p=(C=t.basicOpts)==null?void 0:C.docsURL,m=d.length>0,y=i||!m,I=w=>{const{name:_,value:b}=w.currentTarget;u(x=>({...x,[_]:b}))};return a.jsx(Ri,{providerName:h,handleSubmit:()=>{n({user:d,pass:f})},error:r,isButtonDisabled:y,children:a.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[p&&a.jsx(to,{url:p,providerDisplayName:h,credentialName:"credentials"}),a.jsx(Ut.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:w=>I(w)}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(Ut.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"Password",onChange:w=>I(w)}),a.jsx(wt,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,children:o?"Hide":"Show"})]})]})})}function by({...e}){return Pe?a.jsx(xy,{...e}):a.jsx(Iy,{...e})}function _y({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:c,setSelectedConnection:l}){const u=Re(),[d,f]=g.useState(!1),[h,p]=g.useState(null),m=Ve();g.useEffect(()=>{if(e&&Ee&&d&&h!=null){const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:h.user,password:h.pass}};Ee().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:I},{headers:{"X-Api-Key":m??"","Content-Type":"application/json"}}).then(C=>{l(C)}).catch(C=>{console.error("Error loading provider info."),Ge(C)})}},[m,e,d,r,n,o,i,u,h,l]);const y=I=>{const{user:C,pass:w}=I;p({user:C,pass:w}),f(!0)};return c===null?a.jsx(by,{provider:e,providerInfo:t,handleSubmit:y,error:null}):s}function Cy({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return a.jsx(pt,{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(ft,{error:t}),a.jsx("br",{}),a.jsx(T.Button,{variant:"primary",isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Sy({...e}){return Pe?a.jsx(Ri,{...e}):a.jsx(Cy,{...e})}function Ey({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,setSelectedConnection:c,providerName:l}){const u=Re(),d=Ve(),[f,h]=g.useState(!1);g.useEffect(()=>{if(e&&Ee&&f){const m={groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e};Ee().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:m},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(y=>{c(y)}).catch(y=>{console.error("Error loading provider info."),Ge(y)})}},[d,e,f,n,t,i,r,c,u]);const p=()=>{h(!0)};return s===null?a.jsx(Sy,{handleSubmit:p,error:null,providerName:l}):o}const Dc=async(e,t,n,r,i,o,s,c)=>{var u,d;const l=await Ee().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"||((d=l.oauth2Opts)==null?void 0:d.grantType)==="authorizationCodePKCE")){const h=(await Ee().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(I=>I.provider===i),p=At(i,l);if(!h)throw new Error(`You must first set up a ${p} Provider App using the Ampersand Console.`);const m={connectOAuthParams:{providerWorkspaceRef:o,projectId:e,groupRef:n,groupName:c,consumerRef:t,consumerName:s,providerAppId:h.id,provider:i,enableCSRFProtection:!0}};return await Ee().oAuthApi.oauthConnect(m,{credentials:"include",headers:{"X-Api-Key":r??"","Content-Type":"application/json"}})}throw new Error(`Provider ${i} does not support an OAuth2 web flow.`)},ks=600,Fs=600,Oy="AUTHORIZATION_SUCCEEDED",Ny="AUTHORIZATION_FAILED";function Ty(e,t,n){return g.useCallback(async r=>{const i=await Ee().connectionApi.getConnection({projectIdOrName:e,connectionId:r},{headers:{"X-Api-Key":t??""}});n(i)},[e,t,n])}function Ry(e,t,n,r){return g.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-ks)/2,o=window.screenY+(window.outerHeight-Fs)/2.5,s=`width=${ks},height=${Fs},left=${i},top=${o}`,c=window.open(r,e,s);t(c),window.addEventListener("message",n,!1)},[r,e,t,n])}function Ay(e,t){return g.useCallback(n=>{var r,i;if(n.origin===Rp){if(n.data.eventType===Oy){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===Ny&&(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 kc({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i}){const o=Ve(),{projectId:s}=Re(),[c,l]=g.useState(null),[u,d]=g.useState(null),{setSelectedConnection:f}=Ln(),h=Ay(l,r),p=Ry(n,d,h,t),m=Ty(s,o,f);return g.useEffect(()=>{t&&!u&&p()},[t,u,p,h,n]),g.useEffect(()=>{c&&m(c).then(()=>{u==null||u.close()}).catch(y=>{console.error("Error refreshing connection: ",y),r==null||r(y.message??"Unexpected error: not able to refresh connection")})},[c,o,f,m,u,r]),g.useEffect(()=>{if(!u)return;const y=setInterval(()=>{u.closed&&(clearInterval(y),window.removeEventListener("message",h),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(y),window.removeEventListener("message",h)}},[u,c,i,h,r]),a.jsx("div",{children:e})}function Py({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return a.jsx(pt,{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(ft,{error:t}),a.jsx("br",{}),a.jsx(T.Button,{variant:"primary",isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function jy({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return Pe?a.jsxs(pt,{children:[a.jsx(sr,{children:`Set up ${r} integration`}),a.jsx(ft,{error:t}),a.jsx(wt,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]}):a.jsx(Py,{handleSubmit:e,error:t,isButtonDisabled:n,providerName:r})}function Dy({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Re(),c=Ve(),[l,u]=g.useState(null),[d,f]=g.useState(null),h=async()=>{f(null);try{const m=await Dc(s,t,r,c,e,void 0,n,i);u(m)}catch(m){console.error("Could not fetch OAuth popup URL."),Ge(m),f(m.message??"Unexpected error")}},p=g.useCallback(m=>{f(m),u(null)},[]);return a.jsx(kc,{windowTitle:`Connect to ${o}`,oauthUrl:l,onError:p,children:a.jsx(jy,{handleSubmit:h,error:d,providerName:o})})}const ky=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"})]})}),Fc="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Fy({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return a.jsx(pt,{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(Ai,{href:Fc,newTab:!0,children:["What is my Salesforce subdomain? ",a.jsx(ky,{})]}),a.jsx(ft,{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 My({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){const i={handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r};return Pe?a.jsxs(pt,{children:[a.jsx(sr,{children:"Enter your Salesforce subdomain"}),a.jsx(Ai,{href:Fc,newTab:!0,children:"What is my Salesforce subdomain?"}),a.jsx(ft,{error:n}),a.jsxs("div",{style:{display:"flex",marginTop:"1em"},children:[a.jsx(Ut.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(wt,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]}):a.jsx(Fy,{...i})}function Ly({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:i}){return a.jsx(pt,{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(ft,{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 $y({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(Ly,{...o})}return a.jsxs(pt,{children:[a.jsxs(sr,{children:["Enter your ",i," workspace"]}),a.jsx(ft,{error:n}),a.jsx("br",{}),a.jsx(Ut.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:o=>t(o.currentTarget.value)}),a.jsx("br",{}),a.jsx(wt,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Ky="salesforce";function Vy({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Re(),c=Ve(),[l,u]=g.useState(""),[d,f]=g.useState(null),[h,p]=g.useState(null),m=async()=>{if(p(null),!l){p("Workspace is required");return}try{const C=await Dc(s,t,r,c,e,l,n,i);f(C)}catch(C){console.error(C),p((C==null?void 0:C.message)??"Unexpected error")}},y=g.useCallback(C=>{p(C),f(null)},[]),I=e===Ky?a.jsx(My,{handleSubmit:m,setWorkspace:u,error:h,isButtonDisabled:l.length===0}):a.jsx($y,{handleSubmit:m,setWorkspace:u,error:h,isButtonDisabled:l.length===0,providerName:o});return a.jsx(kc,{windowTitle:`Connect to ${o}`,oauthUrl:d,onError:y,children:I})}function Hy({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,h]=g.useState(""),p=()=>s(!o),m=x=>l(x.currentTarget.value),y=x=>d(x.currentTarget.value),I=x=>h(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=Uo(f)),e(x)};return a.jsx(pt,{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(ft,{error:t}),a.jsx("br",{}),a.jsxs(T.Stack,{spacing:4,children:[a.jsx(T.Input,{placeholder:"Client ID",onChange:y}),a.jsxs(T.InputGroup,{size:"md",children:[a.jsx(T.Input,{onChange:m,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 By({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,explicitScopesRequired:o,providerName:s,selectedConnection:c,setSelectedConnection:l}){const{projectId:u}=Re(),d=Ve(),[f,h]=g.useState(null),p=async m=>{h(null);const y={groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes}};Ee().connectionApi.generateConnection({projectIdOrName:u,generateConnectionParams:y},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(I=>{l(I)}).catch(I=>{console.error("Error loading provider info."),Ge(I),h("Error loading provider info")})};return c===null?a.jsx(Hy,{providerName:s,handleSubmit:p,error:f,explicitScopesRequired:o}):a.jsx(Nt,{})}function Uy({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,h]=g.useState(""),[p,m]=g.useState(""),y=()=>s(!o),I=V=>l(V.currentTarget.value),C=V=>d(V.currentTarget.value),w=V=>h(V.currentTarget.value),_=V=>m(V.currentTarget.value),b=c.length>0,x=u.length>0,E=f.length>0,M=n||!b||!x||!E,O=()=>{const V={workspace:f,clientId:u,clientSecret:c};i&&p.length>0&&(V.scopes=Uo(p)),e(V)};return a.jsx(pt,{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(ft,{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:y,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:O,children:"Next"})]})})}function qy({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,selectedConnection:c,setSelectedConnection:l}){const{projectId:u}=Re(),d=Ve(),[f,h]=g.useState(null),p=async m=>{h(null);const y={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:m.workspace,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes}};Ee().connectionApi.generateConnection({projectIdOrName:u,generateConnectionParams:y},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(I=>{l(I)}).catch(I=>{console.error("Error loading provider info."),Ge(I),h("Error loading provider info")})};return c===null?a.jsx(Uy,{providerName:t,handleSubmit:p,error:f,explicitScopesRequired:s}):a.jsx(Nt,{})}function Wy({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:E,value:M}=x.currentTarget;u(O=>({...O,[E]:M}))},{clientSecret:h,clientId:p,workspace:m,scopes:y}=l,I=h.length>0,C=p.length>0,w=o?m.length>0:!0,_=n||!I||!C||!w,b=()=>{const x={clientId:p,clientSecret:h};o&&(x.workspace=m),i&&y.length>0&&(x.scopes=Uo(y)),e(x)};return a.jsxs(pt,{children:[a.jsx(sr,{children:`Set up ${r} integration`}),a.jsx(ft,{error:t}),a.jsx("br",{}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[o&&a.jsx(Ut.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:x=>f(x)}),a.jsx(Ut.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(Ut.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:x=>f(x)}),a.jsx(wt,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:d,children:s?"Hide":"Show"})]}),i&&a.jsx(Ut.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:x=>f(x)})]}),a.jsx("br",{}),a.jsx(wt,{style:{marginTop:"1em",width:"100%"},disabled:_,type:"submit",onClick:b,children:"Next"})]})}function Jy({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,explicitWorkspaceRequired:c,selectedConnection:l,setSelectedConnection:u}){const{projectId:d}=Re(),f=Ve(),[h,p]=g.useState(null),m=async y=>{p(null);const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:y.workspace,oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret,scopes:y.scopes}};Ee().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."),Ge(C),p("Error loading provider info")})};return l===null?a.jsx(Wy,{providerName:t,handleSubmit:m,error:h,explicitScopesRequired:s,explicitWorkspaceRequired:c}):a.jsx(Nt,{})}function zy({...e}){return Pe?a.jsx(Jy,{...e}):e.explicitWorkspaceRequired?a.jsx(qy,{...e}):a.jsx(By,{...e})}const Xy="authorizationCode",Gy="authorizationCodePKCE",Yy="clientCredentials";function Zy({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=At(e,t),h={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:f};return l===Xy||l===Gy?d?a.jsx(Vy,{...h}):a.jsx(Dy,{...h}):l===Yy?a.jsx(zy,{...h,explicitWorkspaceRequired:d,explicitScopesRequired:u,selectedConnection:s,setSelectedConnection:c}):l==="password"?a.jsx("em",{children:"Password flow not supported yet"}):a.jsxs("em",{children:["Unsupported grant type: ",l]})}function Qy(e){const{selectedConnection:t}=Ln();g.useEffect(()=>{e&&t&&e(t.id)},[e,t])}function ev({onSuccess:e}){Qy(e)}const tv=async(e,t)=>{const n=await Ee().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function Mc({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s}){const c=Ve(),[l,u]=g.useState(null),{provider:d}=ot(),{selectedConnection:f,setSelectedConnection:h,connections:p}=Ln();ev({onSuccess:s});const m=e||d,y=(l==null?void 0:l.displayName)??Xn(m);if(g.useEffect(()=>{if(!f&&p&&p.length>0){const[C]=p;h(C)}tv(c,m).then(C=>{u(C)}).catch(C=>{console.error("Error loading provider info."),Ge(C)})},[p,f,h,c,m]),!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:m,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:f,setSelectedConnection:h,providerName:y,providerInfo:l};return l.authType==="none"?a.jsx(Ey,{...I,children:o}):l.authType==="basic"?a.jsx(_y,{...I,children:o}):l.authType==="apiKey"?a.jsx(wy,{...I,children:o}):a.jsx(Zy,{...I})}const nv=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 Lc(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?nv: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 $c=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:[Lc(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 rv({pending:e,completed:t,displayName:n}){return a.jsxs(a.Fragment,{children:[a.jsx(ir,{style:{margin:"1rem 0"}}),a.jsx($c,{objectName:nn,completed:t,pending:e,displayName:n},"other-write")]})}function ov(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:h,children:p,...m}=f,y=((C=h==null?void 0:h[e])==null?void 0:C[l])||c,I=$.useMemo(()=>m,Object.values(m));return a.jsx(y.Provider,{value:I,children:p})};u.displayName=o+"Provider";function d(f,h){var y;const p=((y=h==null?void 0:h[e])==null?void 0:y[l])||c,m=$.useContext(p);if(m)return m;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,iv(i,...t)]}function iv(...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 Kc(e,t=[]){let n=[];function r(o,s){const c=$.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...m}=f,y=(h==null?void 0:h[e][l])||c,I=$.useMemo(()=>m,Object.values(m));return a.jsx(y.Provider,{value:I,children:p})}function d(f,h){const p=(h==null?void 0:h[e][l])||c,m=$.useContext(p);if(m)return m;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,sv(i,...t)]}function sv(...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 av(e){const t=e+"CollectionProvider",[n,r]=Kc(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:m,children:y}=p,I=g.useRef(null),C=g.useRef(new Map).current;return a.jsx(i,{scope:m,itemMap:C,collectionRef:I,children:y})};s.displayName=t;const c=e+"CollectionSlot",l=g.forwardRef((p,m)=>{const{scope:y,children:I}=p,C=o(c,y),w=er(m,C.collectionRef);return a.jsx(Vr,{ref:w,children:I})});l.displayName=c;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=g.forwardRef((p,m)=>{const{scope:y,children:I,...C}=p,w=g.useRef(null),_=er(m,w),b=o(u,y);return g.useEffect(()=>(b.itemMap.set(w,{ref:w,...C}),()=>void b.itemMap.delete(w))),a.jsx(Vr,{[d]:"",ref:_,children:I})});f.displayName=u;function h(p){const m=o(e+"CollectionConsumer",p);return g.useCallback(()=>{const I=m.collectionRef.current;if(!I)return[];const C=Array.from(I.querySelectorAll(`[${d}]`));return Array.from(m.itemMap.values()).sort((b,x)=>C.indexOf(b.ref.current)-C.indexOf(x.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}var cv=$.useId||(()=>{}),lv=0;function Vc(e){const[t,n]=$.useState(cv());return Kr(()=>{e||n(r=>r??String(lv++))},[e]),e||(t?`radix-${t}`:"")}var uv=$.createContext(void 0);function Hc(e){const t=$.useContext(uv);return e||t||"ltr"}var _o="rovingFocusGroup.onEntryFocus",dv={bubbles:!1,cancelable:!0},no="RovingFocusGroup",[Bo,Bc,pv]=av(no),[fv,Uc]=Kc(no,[pv]),[mv,hv]=fv(no),qc=$.forwardRef((e,t)=>a.jsx(Bo.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Bo.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(gv,{...e,ref:t})})}));qc.displayName=no;var gv=$.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,h=$.useRef(null),p=er(t,h),m=Hc(o),[y=null,I]=Si({prop:s,defaultProp:c,onChange:l}),[C,w]=$.useState(!1),_=Ci(u),b=Bc(n),x=$.useRef(!1),[E,M]=$.useState(0);return $.useEffect(()=>{const O=h.current;if(O)return O.addEventListener(_o,_),()=>O.removeEventListener(_o,_)},[_]),a.jsx(mv,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:y,onItemFocus:$.useCallback(O=>I(O),[I]),onItemShiftTab:$.useCallback(()=>w(!0),[]),onFocusableItemAdd:$.useCallback(()=>M(O=>O+1),[]),onFocusableItemRemove:$.useCallback(()=>M(O=>O-1),[]),children:a.jsx(cn.div,{tabIndex:C||E===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,O=>{const V=!x.current;if(O.target===O.currentTarget&&V&&!C){const J=new CustomEvent(_o,dv);if(O.currentTarget.dispatchEvent(J),!J.defaultPrevented){const X=b().filter(re=>re.focusable),Z=X.find(re=>re.active),te=X.find(re=>re.id===y),ae=[Z,te,...X].filter(Boolean).map(re=>re.ref.current);zc(ae,d)}}x.current=!1}),onBlur:Ot(e.onBlur,()=>w(!1))})})}),Wc="RovingFocusGroupItem",Jc=$.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,c=Vc(),l=o||c,u=hv(Wc,n),d=u.currentTabStopId===l,f=Bc(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return $.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),a.jsx(Bo.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:a.jsx(cn.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Ot(e.onMouseDown,m=>{r?u.onItemFocus(l):m.preventDefault()}),onFocus:Ot(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Ot(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){u.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const y=wv(m,u.orientation,u.dir);if(y!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let C=f().filter(w=>w.focusable).map(w=>w.ref.current);if(y==="last")C.reverse();else if(y==="prev"||y==="next"){y==="prev"&&C.reverse();const w=C.indexOf(m.currentTarget);C=u.loop?Iv(C,w+1):C.slice(w+1)}setTimeout(()=>zc(C))}})})})});Jc.displayName=Wc;var yv={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function vv(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function wv(e,t,n){const r=vv(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return yv[r]}function zc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Iv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var xv=qc,bv=Jc,Pi="Tabs",[_v,Gv]=ov(Pi,[Uc]),Xc=Uc(),[Cv,ji]=_v(Pi),Gc=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:c,activationMode:l="automatic",...u}=e,d=Hc(c),[f,h]=Si({prop:r,onChange:i,defaultProp:o});return a.jsx(Cv,{scope:n,baseId:Vc(),value:f,onValueChange:h,orientation:s,dir:d,activationMode:l,children:a.jsx(cn.div,{dir:d,"data-orientation":s,...u,ref:t})})});Gc.displayName=Pi;var Yc="TabsList",Zc=$.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=ji(Yc,n),s=Xc(n);return a.jsx(xv,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:a.jsx(cn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});Zc.displayName=Yc;var Qc="TabsTrigger",el=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=ji(Qc,n),c=Xc(n),l=nl(s.baseId,r),u=rl(s.baseId,r),d=r===s.value;return a.jsx(bv,{asChild:!0,...c,focusable:!i,active:d,children:a.jsx(cn.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)})})})});el.displayName=Qc;var tl="TabsContent",Sv=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,c=ji(tl,n),l=nl(c.baseId,r),u=rl(c.baseId,r),d=r===c.value,f=$.useRef(d);return $.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(Ei,{present:i||d,children:({present:h})=>a.jsx(cn.div,{"data-state":d?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&o})})});Sv.displayName=tl;function nl(e,t){return`${e}-trigger-${t}`}function rl(e,t){return`${e}-content-${t}`}var Ev=Gc,Ov=Zc,ol=el;const Nv="_tabsRoot_bghy2_1",Tv="_tabsList_bghy2_6",Rv="_tabTrigger_bghy2_12",Av="_danger_bghy2_29",tr={tabsRoot:Nv,tabsList:Tv,tabTrigger:Rv,danger:Av};function il({objectName:e,completed:t,pending:n,displayName:r}){return a.jsx(ol,{value:e,className:tr.tabTrigger,children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Lc(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 Pv({completed:e,pending:t,displayName:n}){return a.jsxs(a.Fragment,{children:[a.jsx(ir,{style:{margin:"1rem 0"}}),a.jsx(il,{objectName:nn,completed:e,pending:t,displayName:n},"other-write")]})}function jv(){return a.jsxs(a.Fragment,{children:[a.jsx(ir,{style:{margin:"3rem 0 1rem 0"}}),a.jsx(ol,{value:Gn,className:vt(tr.tabTrigger,tr.danger),children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[fa(),a.jsx("span",{children:"Uninstall"})]})})]})}function Dv({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,otherNavObject:i,showUninstallButton:o}){var s,c;return a.jsx(Ev,{value:e,className:tr.tabsRoot,onValueChange:n,children:a.jsxs(Ov,{className:tr.tabsList,children:[t.map(l=>{var u,d,f,h;return a.jsx(il,{objectName:l.name,displayName:l.displayName,completed:l.completed,pending:((d=(u=r==null?void 0:r[l.name])==null?void 0:u.read)==null?void 0:d.isOptionalFieldsModified)||((h=(f=r==null?void 0:r[l.name])==null?void 0:f.read)==null?void 0:h.isRequiredMapFieldsModified)||!1},l.name)}),i&&a.jsx(Pv,{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(jv,{})]})})}function kv(e,t){return t===Gn?{name:Gn,completed:!1}:e.find(n=>n.name===t)}const Fv=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-background").trim()||"white";function Mv({children:e}){var C;const{project:t}=Re(),{installation:n,provider:r}=ot(),{hydratedRevision:i}=_n(),{objectConfigurationsState:o}=eo(),[s,c]=g.useState(""),l=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=i&&Jo(u,i),f=d!==null,h=!!((C=i==null?void 0:i.content)!=null&&C.write),p=h?zo(u):void 0,m=g.useMemo(()=>{const w=[...d||[]];return p&&h&&w.push(p),w},[d,p,h]),y=kv(m,s),I=g.useCallback(()=>{const w=m.find(_=>y!==_&&!_.completed);w&&c(w.name)},[m,y]);return g.useEffect(()=>{!s&&m.length>0&&c(m[0].name)},[m,s,I]),a.jsx(xi.Provider,{value:I,children:a.jsx(Ii.Provider,{value:y==null?void 0:y.name,children:a.jsxs(Mn,{style:{maxWidth:"55rem"},children:[a.jsxs(an,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:Fv},children:[a.jsxs("div",{style:{width:"20rem"},children:[a.jsxs("h1",{children:[At(r)," integration"]}),a.jsx("h3",{style:{marginBottom:"20px",fontSize:"1.125rem",fontWeight:"500"},children:l}),f&&a.jsx(Dv,{value:s,readNavObjects:d,onValueChange:w=>c(w),objectConfigurationsState:o,otherNavObject:p,showUninstallButton:!!n})]}),e]}),a.jsx(Ti,{})]})})})}function Lv(e,t){return e!=null&&e[t]?e[t]:{name:Gn,completed:!1}}const $v=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-background").trim()||"white";function Kv({children:e}){var C,w,_;const{project:t}=Re(),{installation:n,provider:r}=ot(),{hydratedRevision:i}=_n(),{objectConfigurationsState:o}=eo(),[s,c]=g.useState(0),l=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=i&&Jo(u,i),f=d!==null,h=!!((C=i==null?void 0:i.content)!=null&&C.write),p=h?zo(u):void 0,m=g.useMemo(()=>{const b=[...d||[]];return p&&h&&b.push(p),b},[d,p,h]),y=Lv(m,s),I=g.useCallback(()=>{const b=m.find(x=>y!==x&&!x.completed);b&&c(m.indexOf(b))},[m,y]);return a.jsx(xi.Provider,{value:I,children:a.jsx(Ii.Provider,{value:y==null?void 0:y.name,children:a.jsxs(Mn,{style:{maxWidth:"55rem"},children:[a.jsxs(an,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:$v},children:[a.jsxs("div",{style:{width:"20rem"},children:[a.jsxs(T.Text,{children:[At(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,E,M,O;return a.jsx($c,{objectName:b.name,displayName:b.displayName,completed:b.completed,pending:((E=(x=o[b.name])==null?void 0:x.read)==null?void 0:E.isOptionalFieldsModified)||((O=(M=o[b.name])==null?void 0:M.read)==null?void 0:O.isRequiredMapFieldsModified)},b.name)}),h&&p&&a.jsx(rv,{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(ir,{style:{margin:"3rem 0 1rem 0"}}),a.jsx(If,{text:"Uninstall"},"uninstall-installation")]})]})]}),e]}),a.jsx(Ti,{})]})})})}function Vv({...e}){return Pe?a.jsx(Mv,{...e}):a.jsx(Kv,{...e})}function Hv(){const[e,t]=g.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}function Bv({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:c,fieldMapping:l}){var p;const{projectId:u}=Re(),{errorState:d}=sn(),{seed:f,reset:h}=Hv();return(p=d[Se.INTEGRATION_LIST])!=null&&p.apiError?a.jsx(qt,{message:"Something went wrong, couldn't find integration information"}):a.jsx(Wp,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:c,fieldMapping:l,children:a.jsx(na,{groupRef:r,children:a.jsx(Mc,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:a.jsx(xf,{projectId:u,children:a.jsx(oy,{resetComponent:h,children:a.jsx(Lh,{children:a.jsx(Vv,{children:a.jsx(Zg,{})})})})})})})},f)}function Uv(){return a.jsxs(Mn,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[a.jsx(Nt,{}),a.jsx("p",{children:"Redirecting"})]})}function qv({redirectURL:e,children:t}){return g.useEffect(()=>{e&&window.location.replace(e)},[e]),e?a.jsx(Uv,{}):t}function Wv({provider:e}){const{appName:t}=Re(),n=`You have successfully connected your ${At(e)} account to ${t}.`;return a.jsx(Ni,{text:n})}function Jv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s}){return a.jsx(na,{provider:e,groupRef:r,children:a.jsx(Mc,{provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:s,children:a.jsx(qv,{redirectURL:o,children:a.jsx(Wv,{provider:e})})})})}const zv=(e,t)=>{const n=Ve(),{projectId:r}=Re(),{integrations:i}=Ys(),[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&&Ee().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."),Ge(d),s(!0)})},[t,n,r,u]),{isLoaded:o,isIntegrationInstalled:c}};exports.AmpersandContext=Qs;exports.AmpersandProvider=Bp;exports.ConnectProvider=Jv;exports.FieldMapping=Vo;exports.InstallIntegration=Bv;exports.useAmpersandProvider=Up;exports.useIsIntegrationInstalled=zv;
48
+ */const Ym="react-tooltip-core-styles",Zm="react-tooltip-base-styles",cs={core:!1,base:!1};function ls({css:e,id:t=Zm,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||cs[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=Ym),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css",s==="top"&&a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),cs[n]=!0}const us=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[Jm(Number(i)),Xm({fallbackAxisSideDirection:"start"}),zm({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(Gm({element:n,padding:5})),as(e,t,{placement:r,strategy:o,middleware:c}).then(({x:l,y:d,placement:f,middlewareData:m})=>{var p,v;const w={left:`${l}px`,top:`${d}px`,border:a},{x:I,y:O}=(p=m.arrow)!==null&&p!==void 0?p:{x:0,y:0},y=(v={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&v!==void 0?v:"bottom",x=a&&{borderBottom:a,borderRight:a};let b=0;if(a){const _=`${a}`.match(/(\d+)px/);b=_!=null&&_[1]?Number(_[1]):1}return{tooltipStyles:w,tooltipArrowStyles:{left:I!=null?`${I}px`:"",top:O!=null?`${O}px`:"",right:"",bottom:"",...x,[y]:`-${4+b}px`},place:f}})):as(e,t,{placement:"bottom",strategy:o,middleware:c}).then(({x:l,y:d,placement:f})=>({tooltipStyles:{left:`${l}px`,top:`${d}px`},tooltipArrowStyles:{},place:f}))},ds=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),fs=(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},ps=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",So=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,o)=>So(i,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!ps(e)||!ps(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>So(e[i],t[i]))},Qm=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"})},ms=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Qm(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},eh=typeof window<"u"?g.useLayoutEffect:g.useEffect,mt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},th="DEFAULT_TOOLTIP_ID",nh={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},rh=g.createContext({getTooltipData:()=>nh});function Ya(e=th){return g.useContext(rh).getTooltipData(e)}var In={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"},uo={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 oh=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i="dark",anchorId:o,anchorSelect:s,place:a="top",offset:c=10,events:l=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:m,wrapper:p,delayShow:v=0,delayHide:w=0,float:I=!1,hidden:O=!1,noArrow:y=!1,clickable:x=!1,closeOnEsc:b=!1,closeOnScroll:_=!1,closeOnResize:E=!1,openEvents:$,closeEvents:T,globalCloseEvents:J,imperativeModeOnly:q,style:z,position:Y,afterShow:ee,afterHide:U,disableTooltip:se,content:ne,contentWrapperRef:Q,isOpen:de,defaultIsOpen:pe=!1,setIsOpen:S,activeAnchor:P,setActiveAnchor:M,border:j,opacity:D,arrowColor:R,role:X="tooltip"})=>{var G;const K=g.useRef(null),Z=g.useRef(null),B=g.useRef(null),ae=g.useRef(null),A=g.useRef(null),[fe,V]=g.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[we,Pe]=g.useState(!1),[He,je]=g.useState(!1),[me,gt]=g.useState(null),Ue=g.useRef(!1),nt=g.useRef(null),{anchorRefs:vt,setActiveAnchor:yt}=Ya(t),Be=g.useRef(!1),[$e,Fe]=g.useState([]),Ce=g.useRef(!1),wt=d||l.includes("click"),ze=wt||($==null?void 0:$.click)||($==null?void 0:$.dblclick)||($==null?void 0:$.mousedown),Tt=$?{...$}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!$&&wt&&Object.assign(Tt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Kt=T?{...T}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!T&&wt&&Object.assign(Kt,{mouseleave:!1,blur:!1,mouseout:!1});const rt=J?{...J}:{escape:b||!1,scroll:_||!1,resize:E||!1,clickOutsideAnchor:ze||!1};q&&(Object.assign(Tt,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Kt,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(rt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),eh(()=>(Ce.current=!0,()=>{Ce.current=!1}),[]);const Oe=H=>{Ce.current&&(H&&je(!0),setTimeout(()=>{Ce.current&&(S==null||S(H),de===void 0&&Pe(H))},10))};g.useEffect(()=>{if(de===void 0)return()=>null;de&&je(!0);const H=setTimeout(()=>{Pe(de)},10);return()=>{clearTimeout(H)}},[de]),g.useEffect(()=>{if(we!==Ue.current)if(mt(A),Ue.current=we,we)ee==null||ee();else{const H=(re=>{const ie=re.match(/^([\d.]+)(ms|s)$/);if(!ie)return 0;const[,Re,ke]=ie;return Number(Re)*(ke==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));A.current=setTimeout(()=>{je(!1),gt(null),U==null||U()},H+25)}},[we]);const Rt=H=>{V(re=>So(re,H)?re:H)},Vt=(H=v)=>{mt(B),He?Oe(!0):B.current=setTimeout(()=>{Oe(!0)},H)},At=(H=w)=>{mt(ae),ae.current=setTimeout(()=>{Be.current||Oe(!1)},H)},tn=H=>{var re;if(!H)return;const ie=(re=H.currentTarget)!==null&&re!==void 0?re:H.target;if(!(ie!=null&&ie.isConnected))return M(null),void yt({current:null});v?Vt():Oe(!0),M(ie),yt({current:ie}),mt(ae)},Ze=()=>{x?At(w||100):w?At():Oe(!1),mt(B)},Pt=({x:H,y:re})=>{var ie;const Re={getBoundingClientRect:()=>({x:H,y:re,width:0,height:0,top:re,left:H,right:H,bottom:re})};us({place:(ie=me==null?void 0:me.place)!==null&&ie!==void 0?ie:a,offset:c,elementReference:Re,tooltipReference:K.current,tooltipArrowReference:Z.current,strategy:f,middlewares:m,border:j}).then(ke=>{Rt(ke)})},Ht=H=>{if(!H)return;const re=H,ie={x:re.clientX,y:re.clientY};Pt(ie),nt.current=ie},nn=H=>{var re;if(!we)return;const ie=H.target;ie.isConnected&&(!((re=K.current)===null||re===void 0)&&re.contains(ie)||[document.querySelector(`[id='${o}']`),...$e].some(Re=>Re==null?void 0:Re.contains(ie))||(Oe(!1),mt(B)))},Ut=fs(tn,50),xe=fs(Ze,50),Xe=H=>{xe.cancel(),Ut(H)},te=()=>{Ut.cancel(),xe()},ue=g.useCallback(()=>{var H,re;const ie=(H=me==null?void 0:me.position)!==null&&H!==void 0?H:Y;ie?Pt(ie):I?nt.current&&Pt(nt.current):P!=null&&P.isConnected&&us({place:(re=me==null?void 0:me.place)!==null&&re!==void 0?re:a,offset:c,elementReference:P,tooltipReference:K.current,tooltipArrowReference:Z.current,strategy:f,middlewares:m,border:j}).then(Re=>{Ce.current&&Rt(Re)})},[we,P,ne,z,a,me==null?void 0:me.place,c,f,Y,me==null?void 0:me.position,I]);g.useEffect(()=>{var H,re;const ie=new Set(vt);$e.forEach(Ie=>{se!=null&&se(Ie)||ie.add({current:Ie})});const Re=document.querySelector(`[id='${o}']`);Re&&!(se!=null&&se(Re))&&ie.add({current:Re});const ke=()=>{Oe(!1)},Qe=ms(P),Ke=ms(K.current);rt.scroll&&(window.addEventListener("scroll",ke),Qe==null||Qe.addEventListener("scroll",ke),Ke==null||Ke.addEventListener("scroll",ke));let qe=null;rt.resize?window.addEventListener("resize",ke):P&&K.current&&(qe=Wm(P,K.current,ue,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const et=Ie=>{Ie.key==="Escape"&&Oe(!1)};rt.escape&&window.addEventListener("keydown",et),rt.clickOutsideAnchor&&window.addEventListener("click",nn);const _e=[],rn=Ie=>{we&&(Ie==null?void 0:Ie.target)===P||tn(Ie)},Gr=Ie=>{we&&(Ie==null?void 0:Ie.target)===P&&Ze()},dt=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],nr=["click","dblclick","mousedown","mouseup"];Object.entries(Tt).forEach(([Ie,It])=>{It&&(dt.includes(Ie)?_e.push({event:Ie,listener:Xe}):nr.includes(Ie)&&_e.push({event:Ie,listener:rn}))}),Object.entries(Kt).forEach(([Ie,It])=>{It&&(dt.includes(Ie)?_e.push({event:Ie,listener:te}):nr.includes(Ie)&&_e.push({event:Ie,listener:Gr}))}),I&&_e.push({event:"pointermove",listener:Ht});const rr=()=>{Be.current=!0},or=()=>{Be.current=!1,Ze()};return x&&!ze&&((H=K.current)===null||H===void 0||H.addEventListener("mouseenter",rr),(re=K.current)===null||re===void 0||re.addEventListener("mouseleave",or)),_e.forEach(({event:Ie,listener:It})=>{ie.forEach(_t=>{var on;(on=_t.current)===null||on===void 0||on.addEventListener(Ie,It)})}),()=>{var Ie,It;rt.scroll&&(window.removeEventListener("scroll",ke),Qe==null||Qe.removeEventListener("scroll",ke),Ke==null||Ke.removeEventListener("scroll",ke)),rt.resize?window.removeEventListener("resize",ke):qe==null||qe(),rt.clickOutsideAnchor&&window.removeEventListener("click",nn),rt.escape&&window.removeEventListener("keydown",et),x&&!ze&&((Ie=K.current)===null||Ie===void 0||Ie.removeEventListener("mouseenter",rr),(It=K.current)===null||It===void 0||It.removeEventListener("mouseleave",or)),_e.forEach(({event:_t,listener:on})=>{ie.forEach(Yr=>{var Fn;(Fn=Yr.current)===null||Fn===void 0||Fn.removeEventListener(_t,on)})})}},[P,ue,He,vt,$e,$,T,J,wt,v,w]),g.useEffect(()=>{var H,re;let ie=(re=(H=me==null?void 0:me.anchorSelect)!==null&&H!==void 0?H:s)!==null&&re!==void 0?re:"";!ie&&t&&(ie=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Re=new MutationObserver(ke=>{const Qe=[],Ke=[];ke.forEach(qe=>{if(qe.type==="attributes"&&qe.attributeName==="data-tooltip-id"&&(qe.target.getAttribute("data-tooltip-id")===t?Qe.push(qe.target):qe.oldValue===t&&Ke.push(qe.target)),qe.type==="childList"){if(P){const et=[...qe.removedNodes].filter(_e=>_e.nodeType===1);if(ie)try{Ke.push(...et.filter(_e=>_e.matches(ie))),Ke.push(...et.flatMap(_e=>[..._e.querySelectorAll(ie)]))}catch{}et.some(_e=>{var rn;return!!(!((rn=_e==null?void 0:_e.contains)===null||rn===void 0)&&rn.call(_e,P))&&(je(!1),Oe(!1),M(null),mt(B),mt(ae),!0)})}if(ie)try{const et=[...qe.addedNodes].filter(_e=>_e.nodeType===1);Qe.push(...et.filter(_e=>_e.matches(ie))),Qe.push(...et.flatMap(_e=>[..._e.querySelectorAll(ie)]))}catch{}}}),(Qe.length||Ke.length)&&Fe(qe=>[...qe.filter(et=>!Ke.includes(et)),...Qe])});return Re.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Re.disconnect()}},[t,s,me==null?void 0:me.anchorSelect,P]),g.useEffect(()=>{ue()},[ue]),g.useEffect(()=>{if(!(Q!=null&&Q.current))return()=>null;const H=new ResizeObserver(()=>{setTimeout(()=>ue())});return H.observe(Q.current),()=>{H.disconnect()}},[ne,Q==null?void 0:Q.current]),g.useEffect(()=>{var H;const re=document.querySelector(`[id='${o}']`),ie=[...$e,re];P&&ie.includes(P)||M((H=$e[0])!==null&&H!==void 0?H:re)},[o,$e,P]),g.useEffect(()=>(pe&&Oe(!0),()=>{mt(B),mt(ae)}),[]),g.useEffect(()=>{var H;let re=(H=me==null?void 0:me.anchorSelect)!==null&&H!==void 0?H:s;if(!re&&t&&(re=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),re)try{const ie=Array.from(document.querySelectorAll(re));Fe(ie)}catch{Fe([])}},[t,s,me==null?void 0:me.anchorSelect]),g.useEffect(()=>{B.current&&(mt(B),Vt(v))},[v]);const Me=(G=me==null?void 0:me.content)!==null&&G!==void 0?G:ne,Dt=we&&Object.keys(fe.tooltipStyles).length>0;return g.useImperativeHandle(e,()=>({open:H=>{if(H!=null&&H.anchorSelect)try{document.querySelector(H.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${H.anchorSelect}" is not a valid CSS selector`)}gt(H??null),H!=null&&H.delay?Vt(H.delay):Oe(!0)},close:H=>{H!=null&&H.delay?At(H.delay):Oe(!1)},activeAnchor:P,place:fe.place,isOpen:!!(He&&!O&&Me&&Dt)})),He&&!O&&Me?g.createElement(p,{id:t,role:X,className:st("react-tooltip",In.tooltip,uo.tooltip,uo[i],n,`react-tooltip__place-${fe.place}`,In[Dt?"show":"closing"],Dt?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&In.fixed,x&&In.clickable),onTransitionEnd:H=>{mt(A),we||H.propertyName!=="opacity"||(je(!1),gt(null),U==null||U())},style:{...z,...fe.tooltipStyles,opacity:D!==void 0&&Dt?D:void 0},ref:K},Me,g.createElement(p,{className:st("react-tooltip-arrow",In.arrow,uo.arrow,r,y&&In.noArrow),style:{...fe.tooltipArrowStyles,background:R?`linear-gradient(to right bottom, transparent 50%, ${R} 50%)`:void 0},ref:Z})):null},ih=({content:e})=>g.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),sh=g.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:o,className:s,classNameArrow:a,variant:c="dark",place:l="top",offset:d=10,wrapper:f="div",children:m=null,events:p=["hover"],openOnClick:v=!1,positionStrategy:w="absolute",middlewares:I,delayShow:O=0,delayHide:y=0,float:x=!1,hidden:b=!1,noArrow:_=!1,clickable:E=!1,closeOnEsc:$=!1,closeOnScroll:T=!1,closeOnResize:J=!1,openEvents:q,closeEvents:z,globalCloseEvents:Y,imperativeModeOnly:ee=!1,style:U,position:se,isOpen:ne,defaultIsOpen:Q=!1,disableStyleInjection:de=!1,border:pe,opacity:S,arrowColor:P,setIsOpen:M,afterShow:j,afterHide:D,disableTooltip:R,role:X="tooltip"},G)=>{const[K,Z]=g.useState(r),[B,ae]=g.useState(i),[A,fe]=g.useState(l),[V,we]=g.useState(c),[Pe,He]=g.useState(d),[je,me]=g.useState(O),[gt,Ue]=g.useState(y),[nt,vt]=g.useState(x),[yt,Be]=g.useState(b),[$e,Fe]=g.useState(f),[Ce,wt]=g.useState(p),[ze,Tt]=g.useState(w),[Kt,rt]=g.useState(null),[Oe,Rt]=g.useState(null),Vt=g.useRef(de),{anchorRefs:At,activeAnchor:tn}=Ya(e),Ze=xe=>xe==null?void 0:xe.getAttributeNames().reduce((Xe,te)=>{var ue;return te.startsWith("data-tooltip-")&&(Xe[te.replace(/^data-tooltip-/,"")]=(ue=xe==null?void 0:xe.getAttribute(te))!==null&&ue!==void 0?ue:null),Xe},{}),Pt=xe=>{const Xe={place:te=>{var ue;fe((ue=te)!==null&&ue!==void 0?ue:l)},content:te=>{Z(te??r)},html:te=>{ae(te??i)},variant:te=>{var ue;we((ue=te)!==null&&ue!==void 0?ue:c)},offset:te=>{He(te===null?d:Number(te))},wrapper:te=>{var ue;Fe((ue=te)!==null&&ue!==void 0?ue:f)},events:te=>{const ue=te==null?void 0:te.split(" ");wt(ue??p)},"position-strategy":te=>{var ue;Tt((ue=te)!==null&&ue!==void 0?ue:w)},"delay-show":te=>{me(te===null?O:Number(te))},"delay-hide":te=>{Ue(te===null?y:Number(te))},float:te=>{vt(te===null?x:te==="true")},hidden:te=>{Be(te===null?b:te==="true")},"class-name":te=>{rt(te)}};Object.values(Xe).forEach(te=>te(null)),Object.entries(xe).forEach(([te,ue])=>{var Me;(Me=Xe[te])===null||Me===void 0||Me.call(Xe,ue)})};g.useEffect(()=>{Z(r)},[r]),g.useEffect(()=>{ae(i)},[i]),g.useEffect(()=>{fe(l)},[l]),g.useEffect(()=>{we(c)},[c]),g.useEffect(()=>{He(d)},[d]),g.useEffect(()=>{me(O)},[O]),g.useEffect(()=>{Ue(y)},[y]),g.useEffect(()=>{vt(x)},[x]),g.useEffect(()=>{Be(b)},[b]),g.useEffect(()=>{Tt(w)},[w]),g.useEffect(()=>{Vt.current!==de&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[de]),g.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:de==="core",disableBase:de}}))},[]),g.useEffect(()=>{var xe;const Xe=new Set(At);let te=n;if(!te&&e&&(te=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),te)try{document.querySelectorAll(te).forEach(re=>{Xe.add({current:re})})}catch{console.warn(`[react-tooltip] "${te}" is not a valid CSS selector`)}const ue=document.querySelector(`[id='${t}']`);if(ue&&Xe.add({current:ue}),!Xe.size)return()=>null;const Me=(xe=Oe??ue)!==null&&xe!==void 0?xe:tn.current,Dt=new MutationObserver(re=>{re.forEach(ie=>{var Re;if(!Me||ie.type!=="attributes"||!(!((Re=ie.attributeName)===null||Re===void 0)&&Re.startsWith("data-tooltip-")))return;const ke=Ze(Me);Pt(ke)})}),H={attributes:!0,childList:!1,subtree:!1};if(Me){const re=Ze(Me);Pt(re),Dt.observe(Me,H)}return()=>{Dt.disconnect()}},[At,tn,Oe,t,n]),g.useEffect(()=>{U!=null&&U.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),pe&&!ds("border",`${pe}`)&&console.warn(`[react-tooltip] "${pe}" is not a valid \`border\`.`),U!=null&&U.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),S&&!ds("opacity",`${S}`)&&console.warn(`[react-tooltip] "${S}" is not a valid \`opacity\`.`)},[]);let Ht=m;const nn=g.useRef(null);if(o){const xe=o({content:(Oe==null?void 0:Oe.getAttribute("data-tooltip-content"))||K||null,activeAnchor:Oe});Ht=xe?g.createElement("div",{ref:nn,className:"react-tooltip-content-wrapper"},xe):null}else K&&(Ht=K);B&&(Ht=g.createElement(ih,{content:B}));const Ut={forwardRef:G,id:e,anchorId:t,anchorSelect:n,className:st(s,Kt),classNameArrow:a,content:Ht,contentWrapperRef:nn,place:A,variant:V,offset:Pe,wrapper:$e,events:Ce,openOnClick:v,positionStrategy:ze,middlewares:I,delayShow:je,delayHide:gt,float:nt,hidden:yt,noArrow:_,clickable:E,closeOnEsc:$,closeOnScroll:T,closeOnResize:J,openEvents:q,closeEvents:z,globalCloseEvents:Y,imperativeModeOnly:ee,style:U,position:se,isOpen:ne,defaultIsOpen:Q,border:pe,opacity:S,arrowColor:P,setIsOpen:M,afterShow:j,afterHide:D,disableTooltip:R,activeAnchor:Oe,setActiveAnchor:xe=>Rt(xe),role:X};return g.createElement(oh,{...Ut})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||ls({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||ls({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 ah(){return u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[u.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[u.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"}),u.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),u.jsx("defs",{children:u.jsx("clipPath",{id:"clip0_2896_16290",children:u.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function ch({id:e,tooltipText:t}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:ah()}),u.jsx(sh,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const Za=g.createContext(null);function Qa(){const e=g.useContext(Za);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const ec=g.createContext(()=>{});function lh(){const e=g.useContext(ec);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var tc=Symbol.for("immer-nothing"),hs=Symbol.for("immer-draftable"),ct=Symbol.for("immer-state"),uh=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function tt(e,...t){if(process.env.NODE_ENV!=="production"){const n=uh[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 Tn=Object.getPrototypeOf;function Rn(e){return!!e&&!!e[ct]}function hn(e){var t;return e?nc(e)||Array.isArray(e)||!!e[hs]||!!((t=e.constructor)!=null&&t[hs])||qr(e)||Wr(e):!1}var dh=Object.prototype.constructor.toString();function nc(e){if(!e||typeof e!="object")return!1;const t=Tn(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)===dh}function Dr(e,t){Br(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Br(e){const t=e[ct];return t?t.type_:Array.isArray(e)?1:qr(e)?2:Wr(e)?3:0}function No(e,t){return Br(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function rc(e,t,n){const r=Br(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function fh(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function qr(e){return e instanceof Map}function Wr(e){return e instanceof Set}function ln(e){return e.copy_||e.base_}function To(e,t){if(qr(e))return new Map(e);if(Wr(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=nc(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[ct];let i=Reflect.ownKeys(r);for(let o=0;o<i.length;o++){const s=i[o],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Tn(e),r)}else{const r=Tn(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function li(e,t=!1){return Jr(e)||Rn(e)||!hn(e)||(Br(e)>1&&(e.set=e.add=e.clear=e.delete=ph),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>li(r,!0))),e}function ph(){tt(2)}function Jr(e){return Object.isFrozen(e)}var mh={};function gn(e){const t=mh[e];return t||tt(0,e),t}var qn;function oc(){return qn}function hh(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function gs(e,t){t&&(gn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ro(e){Ao(e),e.drafts_.forEach(gh),e.drafts_=null}function Ao(e){e===qn&&(qn=e.parent_)}function vs(e){return qn=hh(qn,e)}function gh(e){const t=e[ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function ys(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[ct].modified_&&(Ro(t),tt(4)),hn(e)&&(e=jr(t,e),t.parent_||Fr(t,e)),t.patches_&&gn("Patches").generateReplacementPatches_(n[ct].base_,e,t.patches_,t.inversePatches_)):e=jr(t,n,[]),Ro(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==tc?e:void 0}function jr(e,t,n){if(Jr(t))return t;const r=t[ct];if(!r)return Dr(t,(i,o)=>ws(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Fr(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),Dr(o,(a,c)=>ws(e,r,i,a,c,n,s)),Fr(e,i,!1),n&&e.patches_&&gn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function ws(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&tt(5),Rn(i)){const a=o&&t&&t.type_!==3&&!No(t.assigned_,r)?o.concat(r):void 0,c=jr(e,i,a);if(rc(n,r,c),Rn(c))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(hn(i)&&!Jr(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;jr(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Fr(e,i)}}function Fr(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&li(t,n)}function vh(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:oc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=ui;n&&(i=[r],o=Wn);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var ui={get(e,t){if(t===ct)return e;const n=ln(e);if(!No(n,t))return yh(e,n,t);const r=n[t];return e.finalized_||!hn(r)?r:r===fo(e.base_,t)?(po(e),e.copy_[t]=Do(r,e)):r},has(e,t){return t in ln(e)},ownKeys(e){return Reflect.ownKeys(ln(e))},set(e,t,n){const r=ic(ln(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=fo(ln(e),t),o=i==null?void 0:i[ct];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(fh(n,i)&&(n!==void 0||No(e.base_,t)))return!0;po(e),Po(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 fo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,po(e),Po(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ln(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){tt(11)},getPrototypeOf(e){return Tn(e.base_)},setPrototypeOf(){tt(12)}},Wn={};Dr(ui,(e,t)=>{Wn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Wn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&tt(13),Wn.set.call(this,e,t,void 0)};Wn.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&tt(14),ui.set.call(this,e[0],t,n,e[0])};function fo(e,t){const n=e[ct];return(n?ln(n):e)[t]}function yh(e,t,n){var i;const r=ic(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function ic(e,t){if(!(t in e))return;let n=Tn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Tn(n)}}function Po(e){e.modified_||(e.modified_=!0,e.parent_&&Po(e.parent_))}function po(e){e.copy_||(e.copy_=To(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var wh=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const s=this;return function(c=o,...l){return s.produce(c,d=>n.call(this,d,...l))}}typeof n!="function"&&tt(6),r!==void 0&&typeof r!="function"&&tt(7);let i;if(hn(t)){const o=vs(this),s=Do(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?Ro(o):Ao(o)}return gs(o,r),ys(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===tc&&(i=void 0),this.autoFreeze_&&li(i,!0),r){const o=[],s=[];gn("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else tt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,i;return[this.produce(t,n,(s,a)=>{r=s,i=a}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){hn(e)||tt(8),Rn(e)&&(e=Ih(e));const t=vs(this),n=Do(e,void 0);return n[ct].isManual_=!0,Ao(t),n}finishDraft(e,t){const n=e&&e[ct];(!n||!n.isManual_)&&tt(9);const{scope_:r}=n;return gs(r,t),ys(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=gn("Patches").applyPatches_;return Rn(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Do(e,t){const n=qr(e)?gn("MapSet").proxyMap_(e,t):Wr(e)?gn("MapSet").proxySet_(e,t):vh(e,t);return(t?t.scope_:oc()).drafts_.push(n),n}function Ih(e){return Rn(e)||tt(10,e),sc(e)}function sc(e){if(!hn(e)||Jr(e))return e;const t=e[ct];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=To(e,t.scope_.immer_.useStrictShallowCopy_)}else n=To(e,!0);return Dr(n,(r,i)=>{rc(n,r,sc(i))}),t&&(t.finalized_=!1),n}var lt=new wh,$n=lt.produce;lt.produceWithPatches.bind(lt);lt.setAutoFreeze.bind(lt);lt.setUseStrictShallowCopy.bind(lt);lt.applyPatches.bind(lt);lt.createDraft.bind(lt);lt.finishDraft.bind(lt);const ac=g.createContext(void 0),_h={};function di(){const e=g.useContext(ac);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function bh({children:e}){const{installation:t}=ut(),{hydratedRevision:n,loading:r}=Dn(),[i,o]=g.useState(_h),s=t==null?void 0:t.config;g.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&Wf(n,s,o)},[n,r,s,i]);const a=g.useCallback((p,v)=>{o(w=>$n(w,I=>{I[p]=$n(I[p],v)}))},[o]),c=g.useCallback((p,v)=>{o(w=>$n(w,I=>{I[p]=v}))},[o]),l=g.useCallback(()=>{o($n(p=>{const v=p.other.write;v&&(v.isWriteModified=!1)}))},[o]),d=g.useCallback(p=>{o($n(v=>{var I;const w=(I=v[p])==null?void 0:I.read;w&&(w.isOptionalFieldsModified=!1,w.isRequiredMapFieldsModified=!1)}))},[o]),f=g.useCallback(p=>{p===fn?l():d(p)},[d,l]),m=g.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:f}),[i,c,f,a]);return u.jsx(ac.Provider,{value:m,children:e})}const yn=()=>{const{appName:e}=De(),{objectConfigurationsState:t,setConfigureState:n}=di(),{selectedObjectName:r}=Qa(),i=Qs(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}};function xh(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,a=!Lo(o,r);e.read.isRequiredMapFieldsModified=a}}function cc(e,t,n,r){t(e,i=>xh(i,n,r))}function lc({field:e,onSelectChange:t,allFields:n}){var m;const{configureState:r,selectedObjectName:i,setConfigureState:o}=yn(),[s,a]=g.useState(!0),c=(m=r==null?void 0:r.read)==null?void 0:m.selectedFieldMappings,l=c==null?void 0:c[e.mapToName];g.useEffect(()=>{e._default&&!l&&i&&r&&cc(i,o,e.mapToName,e._default),a(!1)},[e,o,i,l,r]);const d=g.useMemo(()=>n.map(p=>({id:p.fieldName,label:p.displayName,value:p.fieldName})),[n]),f=u.jsx(hm,{disabled:s,items:d,selectedValue:l||null,onSelectedItemChange:p=>{t({target:{name:e.mapToName,value:p==null?void 0:p.value}})},placeholder:"Please select one"});return u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[u.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName}),u.jsx("span",{children:(e==null?void 0:e.prompt)&&u.jsx(ch,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),f]},e.mapToName)}const Ch="_formControl_9qd8d_1",Oh="_formLabel_9qd8d_5",Eh="_formLabelRequired_9qd8d_11",Sh="_formInput_9qd8d_16",Nh="_formInputInvalid_9qd8d_20",Th="_formError_9qd8d_24",Rh="_disabled_9qd8d_30",cn={formControl:Ch,formLabel:Oh,formLabelRequired:Eh,formInput:Sh,formInputInvalid:Nh,formError:Th,disabled:Rh};function Ah({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return u.jsxs("div",{className:st(cn.formControl,{[cn.disabled]:r}),children:[t&&u.jsx("label",{htmlFor:e,className:st(cn.formLabel,{[cn.formLabelRequired]:n}),children:t}),u.jsx("div",{id:e,className:st(cn.formInput,{[cn.formInputInvalid]:i}),children:s}),i&&o&&u.jsx("div",{className:cn.formError,role:"alert",children:o})]})}const Ph="_divider_1kmoj_1",Is={divider:Ph};function fi({className:e,style:t}){return u.jsx("hr",{className:e?`${Is.divider} ${e}`:Is.divider,style:t})}function zr({string:e}){return u.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[u.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),u.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:u.jsx(fi,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Dh(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=yn(),{fieldMapping:r}=ut(),{isError:i,removeError:o}=Zt(),s=c=>{const{value:l,name:d}=c.target;l&&(e&&cc(e,n,d,l),i(Se.MAPPING,d)&&o(Se.MAPPING,d))},a=g.useMemo(()=>{var f;const c=((f=t==null?void 0:t.read)==null?void 0:f.requiredMapFields)||[],l=e&&r?Object.values(r[e]||{}).flat():[];return c.concat(l).reduce((m,p)=>m.find(w=>w.mapToName===p.mapToName)?m.map(w=>w.mapToName===p.mapToName?p:w):m.concat(p),new Array).filter(Xt)},[t,r,e]);return a!=null&&a.length?u.jsxs(u.Fragment,{children:[u.jsx(zr,{string:"Map the following fields"}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:a.map(c=>{var l;return u.jsx(Ah,{id:c.mapToName,isInvalid:i(Se.MAPPING,c.mapToName),errorMessage:"* required",children:u.jsx(lc,{allFields:((l=t==null?void 0:t.read)==null?void 0:l.allFields)||[],field:c,onSelectChange:s})},c.mapToName)})})]}):null}const jh={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function Fh({children:e,style:t}){return u.jsx(vn,{style:{...jh,...t},children:e})}function Mh(){var d,f,m;const{project:e}=De(),{hydratedRevision:t}=Dn(),{selectedObjectName:n}=yn(),{provider:r}=ut(),i=e==null?void 0:e.appName,o=Qt(r),s=(m=(f=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:f.objects)==null?void 0:m.find(p=>p.objectName===n),a=(s==null?void 0:s.displayName)||n&&Un(n),c=s==null?void 0:s.mapToName,l=(s==null?void 0:s.mapToDisplayName)||c&&Un(c);return l&&i&&o?u.jsx(Fh,{style:{marginTop:"1rem"},children:u.jsxs("p",{style:{margin:"1rem 0"},children:[u.jsx("b",{children:l})," in ",i," is mapped to ",u.jsx("b",{children:a})," in ",o,"."]})}):null}function kh(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function uc(...e){return t=>e.forEach(n=>kh(n,t))}function Jn(...e){return k.useCallback(uc(...e),e)}function Lh(e,t=[]){let n=[];function r(o,s){const a=k.createContext(s),c=n.length;n=[...n,s];const l=f=>{var O;const{scope:m,children:p,...v}=f,w=((O=m==null?void 0:m[e])==null?void 0:O[c])||a,I=k.useMemo(()=>v,Object.values(v));return u.jsx(w.Provider,{value:I,children:p})};l.displayName=o+"Provider";function d(f,m){var w;const p=((w=m==null?void 0:m[e])==null?void 0:w[c])||a,v=k.useContext(p);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[l,d]}const i=()=>{const o=n.map(s=>k.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return k.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[r,$h(i,...t)]}function $h(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:c,scopeName:l})=>{const f=c(o)[`__scope${l}`];return{...a,...f}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function xt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function pi(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function mi({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=Kh({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=pi(n),c=k.useCallback(l=>{if(o){const f=typeof l=="function"?l(e):l;f!==e&&a(f)}else i(l)},[o,e,i,a]);return[s,c]}function Kh({defaultProp:e,onChange:t}){const n=k.useState(e),[r]=n,i=k.useRef(r),o=pi(t);return k.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function Vh(e){const t=k.useRef({value:e,previous:e});return k.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Mr=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{};function Hh(e){const[t,n]=k.useState(void 0);return Mr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const c=o.borderBoxSize,l=Array.isArray(c)?c[0]:c;s=l.inlineSize,a=l.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function Uh(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var hi=e=>{const{present:t,children:n}=e,r=Bh(t),i=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),o=Jn(r.ref,qh(i));return typeof n=="function"||r.isPresent?k.cloneElement(i,{ref:o}):null};hi.displayName="Presence";function Bh(e){const[t,n]=k.useState(),r=k.useRef({}),i=k.useRef(e),o=k.useRef("none"),s=e?"mounted":"unmounted",[a,c]=Uh(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const l=yr(r.current);o.current=a==="mounted"?l:"none"},[a]),Mr(()=>{const l=r.current,d=i.current;if(d!==e){const m=o.current,p=yr(l);e?c("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(d&&m!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Mr(()=>{if(t){let l;const d=t.ownerDocument.defaultView??window,f=p=>{const w=yr(r.current).includes(p.animationName);if(p.target===t&&w&&(c("ANIMATION_END"),!i.current)){const I=t.style.animationFillMode;t.style.animationFillMode="forwards",l=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=I)})}},m=p=>{p.target===t&&(o.current=yr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(l),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:k.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function yr(e){return(e==null?void 0:e.animationName)||"none"}function qh(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var kr=k.forwardRef((e,t)=>{const{children:n,...r}=e,i=k.Children.toArray(n),o=i.find(Jh);if(o){const s=o.props.children,a=i.map(c=>c===o?k.Children.count(s)>1?k.Children.only(null):k.isValidElement(s)?s.props.children:null:c);return u.jsx(jo,{...r,ref:t,children:k.isValidElement(s)?k.cloneElement(s,void 0,a):null})}return u.jsx(jo,{...r,ref:t,children:n})});kr.displayName="Slot";var jo=k.forwardRef((e,t)=>{const{children:n,...r}=e;if(k.isValidElement(n)){const i=Xh(n);return k.cloneElement(n,{...zh(r,n.props),ref:t?uc(t,i):i})}return k.Children.count(n)>1?k.Children.only(null):null});jo.displayName="SlotClone";var Wh=({children:e})=>u.jsx(u.Fragment,{children:e});function Jh(e){return k.isValidElement(e)&&e.type===Wh}function zh(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{o(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Xh(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 Gh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],en=Gh.reduce((e,t)=>{const n=k.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?kr:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(a,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),gi="Checkbox",[Yh,py]=Lh(gi),[Zh,Qh]=Yh(gi),dc=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:c="on",onCheckedChange:l,form:d,...f}=e,[m,p]=k.useState(null),v=Jn(t,b=>p(b)),w=k.useRef(!1),I=m?d||!!m.closest("form"):!0,[O=!1,y]=mi({prop:i,defaultProp:o,onChange:l}),x=k.useRef(O);return k.useEffect(()=>{const b=m==null?void 0:m.form;if(b){const _=()=>y(x.current);return b.addEventListener("reset",_),()=>b.removeEventListener("reset",_)}},[m,y]),u.jsxs(Zh,{scope:n,state:O,disabled:a,children:[u.jsx(en.button,{type:"button",role:"checkbox","aria-checked":zt(O)?"mixed":O,"aria-required":s,"data-state":mc(O),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:v,onKeyDown:xt(e.onKeyDown,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:xt(e.onClick,b=>{y(_=>zt(_)?!0:!_),I&&(w.current=b.isPropagationStopped(),w.current||b.stopPropagation())})}),I&&u.jsx(eg,{control:m,bubbles:!w.current,name:r,value:c,checked:O,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:zt(o)?!1:o})]})});dc.displayName=gi;var fc="CheckboxIndicator",pc=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=Qh(fc,n);return u.jsx(hi,{present:r||zt(o.state)||o.state===!0,children:u.jsx(en.span,{"data-state":mc(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});pc.displayName=fc;var eg=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,s=k.useRef(null),a=Vh(n),c=Hh(t);k.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&p){const v=new Event("click",{bubbles:r});d.indeterminate=zt(n),p.call(d,zt(n)?!1:n),d.dispatchEvent(v)}},[a,n,r]);const l=k.useRef(zt(n)?!1:n);return u.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??l.current,...o,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function zt(e){return e==="indeterminate"}function mc(e){return zt(e)?"indeterminate":e?"checked":"unchecked"}var hc=dc,gc=pc;function vc(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 tg=["color"],yc=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=vc(e,tg);return g.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),g.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),ng=["color"],rg=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=vc(e,ng);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 og="_checkboxGroupContainer_1jhjx_1",ig="_stack_1jhjx_6",sg="_selectAllContainer_1jhjx_11",ag="_fieldContainer_1jhjx_18",cg="_checkbox_1jhjx_1",An={checkboxGroupContainer:og,stack:ig,selectAllContainer:sg,fieldContainer:ag,checkbox:cg};function wc({id:e,isChecked:t,label:n,onCheckedChange:r}){return u.jsxs("div",{className:An.fieldContainer,children:[u.jsx(hc,{className:An.checkbox,id:e,onCheckedChange:r,checked:t,children:u.jsx(gc,{children:u.jsx(yc,{})})}),u.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Ic({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return u.jsxs("div",{className:An.selectAllContainer,children:[u.jsx(hc,{className:An.checkbox,id:e,onCheckedChange:r,children:u.jsxs(gc,{children:[i&&u.jsx(rg,{}),t===!0&&u.jsx(yc,{})]})}),u.jsx("label",{htmlFor:e,children:n})]})}function _c({children:e}){return u.jsx("div",{className:An.checkboxGroupContainer,children:e})}function bc({children:e}){return u.jsx("div",{className:An.stack,children:e})}function lg(e,t,n){var i,o;const r=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(o=e.read)!=null&&o.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,c=!Lo(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function _s(e,t,n,r){t(e,i=>lg(i,n,r))}function ug(){var f,m;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=yn(),i=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,o=(p,v)=>{p!=="indeterminate"&&r&&t&&_s(r,n,v,p)},s=(m=t==null?void 0:t.read)==null?void 0:m.optionalFields,a=p=>{r&&s&&s.forEach(v=>{Xt(v)||_s(r,n,v.fieldName,p)})},c=!!(s&&s.length>0),l=Object.keys(i||{}).length===(s==null?void 0:s.length),d=!l&&Object.keys(i||{}).length>0;return c&&u.jsxs(u.Fragment,{children:[u.jsx(zr,{string:`${e} reads the following optional fields`}),u.jsxs(_c,{children:[((s==null?void 0:s.length)||0)>=2&&u.jsx(Ic,{id:"select-all-fields",isChecked:l,label:"Select all",onCheckedChange:a,isIndeterminate:d}),u.jsx(bc,{children:s.map(p=>Xt(p)?null:u.jsx(wc,{id:p.fieldName,isChecked:!!(i!=null&&i[p==null?void 0:p.fieldName]),label:p.displayName,onCheckedChange:v=>o(v,p.fieldName)},p.fieldName))})]})]})}function dg(){return u.jsx(ug,{})}const fg={color:"var(--amp-colors-text-regular)",backgroundColor:"var(--amp-colors-bg-highlight)",borderRadius:"4px",display:"inline-block",fontSize:"0.75rem",fontWeight:500,lineHeight:"1.25",padding:"0.25rem 0.5rem"};function pg({children:e,style:t,...n}){return u.jsx("span",{style:{...fg,...t},...n,children:e})}function mg(){var r,i,o;const{configureState:e,selectedObjectName:t}=yn(),{appName:n}=De();return u.jsxs(u.Fragment,{children:[u.jsx(zr,{string:`${n} reads the following ${t} fields`}),u.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(i=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&i.length?(o=e.read)==null?void 0:o.requiredFields.map(s=>Xt(s)?null:u.jsx(pg,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function hg(){return u.jsxs(u.Fragment,{children:[u.jsx(Mh,{}),u.jsx(mg,{}),u.jsx(Dh,{}),u.jsx(dg,{})]})}function gg(e,t,n){var r,i,o;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedNonConfigurableWriteFields)===null&&(e.write.selectedNonConfigurableWriteFields={}),e!=null&&e.write){const s=e.write.selectedNonConfigurableWriteFields;if(s[t]=n,n||delete s[t],(o=(i=e==null?void 0:e.write)==null?void 0:i.savedConfig)!=null&&o.selectedNonConfigurableWriteFields){const a=e.write.savedConfig.selectedNonConfigurableWriteFields,l=!Lo(a,s);e.write.isWriteModified=l}}}function bs(e,t,n,r){t(e,i=>{gg(i,n,r)})}function vg(){var f,m,p,v;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=yn(),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=(w,I)=>{w!=="indeterminate"&&t&&n&&bs(t,r,I,w)},a=w=>{var I,O;t&&n&&((O=(I=n==null?void 0:n.write)==null?void 0:I.writeObjects)==null||O.forEach(y=>{bs(t,r,y.objectName,w)}))},c=!!o,l=Object.keys(i||{}).length===((v=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null?void 0:v.length),d=!l&&Object.keys(i||{}).length>0;return c&&u.jsxs(u.Fragment,{children:[u.jsx(zr,{string:`Allow ${e} to write to these objects`}),u.jsxs(_c,{children:[((o==null?void 0:o.length)||0)>=2&&u.jsx(Ic,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:l,label:"Select all"}),u.jsx(bc,{children:o.map(w=>u.jsx(wc,{id:w.objectName,onCheckedChange:I=>s(I,w.objectName),isChecked:!!(i!=null&&i[w.objectName]),label:w.displayName},w.objectName))})]})]})}function yg(){return u.jsx(vg,{})}function xc({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const r=Je(),{projectId:i}=De(),{integrationId:o,installation:s,resetInstallations:a,setIntegrationDeleted:c,onUninstallSuccess:l}=ut(),[d,f]=g.useState(!1),m=!i||!o||!(s!=null&&s.id)||d,p=async()=>{if(!m){f(!0),console.warn("uninstalling installation",{projectId:i,integrationId:o,installationId:s.id});try{await Te().installationApi.deleteInstallation({projectIdOrName:i,integrationId:o,installationId:s.id},{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}),console.warn("successfully uninstalled installation:",s.id),l==null||l(s==null?void 0:s.id),a(),c()}catch(I){console.error("Error uninstalling installation."),Ye(I)}finally{f(!1)}}},v=d?"Uninstalling...":e,w=u.jsx(ht,{type:"button",onClick:p,disabled:m,variant:t,style:n,children:v});return s!=null&&s.id?w:null}function wg(){const{appName:e}=De(),{installation:t}=ut(),n=t!=null&&t.id?`Once you uninstall this integration, all your configuration will be lost, and "${e}" may stop working.`:"You've successfully uninstalled the integration.";return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[u.jsx("p",{children:n}),u.jsx(xc,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function Cc({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var E,$,T;const{installation:o}=ut(),{hydratedRevision:s,loading:a}=Dn(),{configureState:c,selectedObjectName:l}=yn(),d=o==null?void 0:o.config,f=d&&l&&!!qs(d,l)||!1,m=((E=c==null?void 0:c.read)==null?void 0:E.isOptionalFieldsModified)||(($=c==null?void 0:c.read)==null?void 0:$.isRequiredMapFieldsModified),p=(T=c==null?void 0:c.write)==null?void 0:T.isWriteModified,O=a||n||!c||!l||!(m||p||r||l!==fn&&!f),y=l===fn,x=l===Or,b=u.jsx(ht,{type:"submit",disabled:O,children:r?"Install":"Save"}),_=u.jsx(ht,{type:"button",onClick:t,disabled:O,variant:"ghost",children:"Reset"});return n?u.jsx($t,{}):u.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[u.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px"},children:[b,_]}),u.jsxs(vn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&u.jsx(ta,{children:typeof i=="string"?i:"Installation Failed."}),a&&u.jsx($t,{}),s&&!x&&!y&&u.jsx(hg,{}),s&&!x&&y&&u.jsx(yg,{}),!a&&x&&u.jsx(wg,{})]})]})}const Oc=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o}=ut(),{hydratedRevision:s,loading:a}=Dn(),{selectedObjectName:c}=Qa(),{selectedConnection:l}=Pn(),d=Je(),{projectId:f}=De(),{resetBoundary:m,setErrors:p,setError:v,getError:w}=Zt(),{resetConfigureState:I,objectConfigurationsState:O,resetPendingConfigurationState:y}=di(),x=Qs(c||"",O),{onNextIncompleteTab:b}=lh(),_=g.useCallback(()=>{m(Se.INSTALLATION_MUTATION)},[m]),E=g.useCallback(T=>T?J=>{v(Se.INSTALLATION_MUTATION,T,J)}:J=>{console.error("objectName is required to set installation error: ",J)},[v]),$=g.useCallback(T=>T?w(Se.INSTALLATION_MUTATION,T):"",[w]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:l,apiKey:d,projectId:f,resetBoundary:m,setErrors:p,setMutateInstallationError:E,getMutateInstallationError:$,resetMutateInstallationErrorState:_,resetConfigureState:I,objectConfigurationsState:O,resetPendingConfigurationState:y,configureState:x,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:b}},Ig=void 0;function _g(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:i,loading:o,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:l,resetBoundary:d,setErrors:f,setMutateInstallationError:m,getMutateInstallationError:p,resetMutateInstallationErrorState:v,resetConfigureState:w,objectConfigurationsState:I,resetPendingConfigurationState:O,configureState:y,onInstallSuccess:x,onNextIncompleteTab:b}=Oc(),[_,E]=g.useState(!1),$=s===fn,T=p(s),J=g.useCallback(()=>{d(Se.MAPPING),i!=null&&i.content&&!o&&s&&Gs(i,Ig,s,w)},[d,i,o,s,w]);g.useEffect(()=>{!y&&(i!=null&&i.content)&&!o&&J()},[y,I,i,o,J]);const q=()=>{v();const{requiredMapFields:ee,selectedFieldMappings:U}=(y==null?void 0:y.read)||{},{errorList:se}=zs(ee,U,f);se.length>0||(s&&(a!=null&&a.id)&&c&&l&&e&&t&&n&&i?(E(!0),Xf(l,e,t,n,a.id,s,c,i,y,m(s),r,x).finally(()=>{E(!1),O(s),b()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},z=()=>{v(),s&&(a!=null&&a.id)&&c&&l&&e&&t&&n&&i?(E(!0),Zf(l,e,t,n,a.id,c,i,y,m(s),r,x).finally(()=>{E(!1),O(s),b()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},Y=ee=>{ee.preventDefault(),$?z():q()};return u.jsx(Cc,{errorMsg:T,isCreateMode:!0,isLoading:_,onSave:Y,onReset:J})}function bg({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:i,selectedObjectName:o,setInstallation:s,onUpdateSuccess:a,setError:c}){const l={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${o}`],installation:{config:e}}};return Te().installationApi.updateInstallation(l,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}).then(d=>{s(d),a==null||a(d.id,d.config)}).catch(d=>{Ye(d,c)})}const xg=(e,t,n,r,i,o)=>{const s=Ys(e),a=Zs(e),c={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,backfill:o}}}}};return $r(i)&&(c.content||(c.content={}),c.content.proxy={enabled:!0}),c},Cg=(e,t,n,r,i,o,s,a,c,l,d)=>{const f=xg(o,r||"",a,a.schedule,c,a.backfill);return f?bg({updateConfig:f,projectId:e,integrationId:t,installationId:n,apiKey:i,selectedObjectName:r,setError:l,setInstallation:s,onUpdateSuccess:d}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},Og=(e,t)=>{const r={content:{write:{objects:ea(e)}}};return $r(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},Eg=(e,t,n,r,i,o,s,a,c)=>{const l=Og(i,o);if(!l)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:l}}};return Te().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(f=>{a(f),c==null||c(f.id,f.config)}).catch(f=>{Ye(f,s)})};function Sg({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:i,selectedObjectName:o,apiKey:s,projectId:a,resetBoundary:c,setErrors:l,setMutateInstallationError:d,getMutateInstallationError:f,resetConfigureState:m,resetPendingConfigurationState:p,configureState:v,onUpdateSuccess:w,onNextIncompleteTab:I}=Oc(),[O,y]=g.useState(!1),x=o===fn,b=f(o),{config:_}=e,E=g.useCallback(()=>{c(Se.MAPPING),r!=null&&r.content&&!i&&o&&Gs(r,_,o,m)},[c,r,i,o,_,m]);g.useEffect(()=>{v||E()},[v,E]),g.useEffect(()=>{e&&E()},[e,E]);const $=g.useMemo(()=>{var Y,ee,U;return(U=(ee=(Y=r==null?void 0:r.content)==null?void 0:Y.read)==null?void 0:ee.objects)==null?void 0:U.find(se=>(se==null?void 0:se.objectName)===o)},[r,o]),T=()=>{const{requiredMapFields:z,selectedFieldMappings:Y}=(v==null?void 0:v.read)||{},{errorList:ee}=zs(z,Y,l);ee.length>0||(r&&e&&o&&s&&a&&$?(y(!0),Cg(a,t.id,e.id,o,s,v,n,$,r,d(o),w).finally(()=>{y(!1),p(o),I()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},J=()=>{e&&o&&s&&a&&r?(y(!0),Eg(a,t.id,e.id,s,v,r,d(o),n,w).finally(()=>{y(!1),p(o),I()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},q=z=>{z.preventDefault(),x?J():T()};return u.jsx(Cc,{errorMsg:b,onSave:q,onReset:E,isLoading:O})}function Ng(){const{integrationObj:e,installation:t}=ut();return e?t&&e?u.jsx(Sg,{installation:t,integrationObj:e}):u.jsx(_g,{}):u.jsx(Lt,{message:"We can't load the integration"})}function Tg(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),u.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function vi({text:e,children:t}){return u.jsx(Xn,{children:u.jsxs(vn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[u.jsx(Tg,{}),u.jsx("p",{children:e}),t]})})}const Rg=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function Ag({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:i,apiKey:o,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:l}){const d=Rg(s,r);return d?$o({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:a,setInstallation:c,onInstallSuccess:l}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function Pg({provider:e}){const t=`You have successfully installed your ${Qt(e)} integration.`;return u.jsx(vi,{text:t,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(xc,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Dg=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 jg({children:e,resetComponent:t}){var b;const{projectId:n}=De(),r=Je(),{hydratedRevision:i,loading:o}=Dn(),{integrationObj:s,installation:a,groupRef:c,consumerRef:l,setInstallation:d,onInstallSuccess:f,isIntegrationDeleted:m}=ut(),{selectedConnection:p}=Pn(),[v,w]=g.useState(!1),I=o||v,O=(b=i==null?void 0:i.content)==null?void 0:b.provider,y=Dg(i),x=_=>{console.error("Error when creating proxy installation:",_)};return g.useEffect(()=>{!I&&i&&y&&!a&&p&&r&&(s!=null&&s.id)&&(w(!0),Ag({apiKey:r,projectId:n,integrationId:s==null?void 0:s.id,groupRef:c,consumerRef:l,connectionId:p==null?void 0:p.id,hydratedRevision:i,setError:x,setInstallation:d,onInstallSuccess:f}).then(()=>{w(!1)}).catch(_=>{w(!1),console.error("Error when creating proxy installation:",_)}))},[i,y,a,p,r,n,s==null?void 0:s.id,c,l,d,I,f]),m?u.jsx(vi,{text:"Integration successfully uninstalled.",children:u.jsx(ht,{type:"button",onClick:t,style:{width:"100%"},children:"Reinstall Integration"})}):s?I?u.jsx($t,{}):y&&O&&a?u.jsx(Pg,{provider:O}):u.jsx("div",{children:e}):u.jsx(Lt,{message:"We can't load the integration"})}function Ec(){return u.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:[u.jsx("p",{children:"Secured by"}),u.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:u.jsx("img",{style:{height:".8em"},src:"https://ampersand-website.vercel.app/logo-black.svg",alt:"Ampersand"})})]})}function Qn({children:e}){return u.jsx(Xn,{children:u.jsxs(vn,{children:[u.jsx("div",{style:{padding:"3rem 2rem"},children:e}),u.jsx(Ec,{})]})})}function er({children:e}){return u.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function tr({error:e}){return e?u.jsx(ta,{style:{marginTop:"2em"},children:e}):null}function yi({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 u.jsxs(Qn,{children:[u.jsx(er,{children:o||`Set up ${r} integration`}),u.jsx(tr,{error:t}),i,u.jsx(ht,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const Fg="_link_oo2kv_1",Mg={link:Fg};function Sc({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return u.jsx("a",{className:st(Mg.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function Nc({url:e,providerDisplayName:t,credentialName:n}){return u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[u.jsx(Sc,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const kg="_input_ed211_1",Lg="_inputError_ed211_17",$g="_error_ed211_31",mo={input:kg,inputError:Lg,error:$g};function Kg({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?st(mo.inputError,mo.input):mo.input;return u.jsx("input",{id:e,type:t,className:st(o,n),...i})}const Vg="_textarea_1jmqi_1",Hg="_textareaError_1jmqi_13",Ug="_error_1jmqi_27",ho={textarea:Vg,textareaError:Hg,error:Ug};function Bg({className:e,isError:t=!1,...n}){const r=t?st(ho.textareaError,ho.textarea):ho.textarea;return u.jsx("textarea",{className:st(e,r),...n})}const kt={Input:Kg,Textarea:Bg};function qg({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var w;const[o,s]=g.useState(!1),a=()=>s(I=>!I),[c,l]=g.useState(""),d=I=>l(I.currentTarget.value),f=c.length>0,m=i||!f,p=Qt(e,t),v=(w=t.apiKeyOpts)==null?void 0:w.docsURL;return u.jsx(yi,{providerName:p,handleSubmit:()=>{n({apiKey:c})},error:r,isButtonDisabled:m,children:u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&u.jsx(Nc,{url:v,providerDisplayName:p,credentialName:"API key"}),u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(kt.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"Password",onChange:I=>d(I)}),u.jsx(ht,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function Wg({...e}){return u.jsx(qg,{...e})}function Jg({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const l=De(),[d,f]=g.useState(!1),[m,p]=g.useState(null),v=Je();g.useEffect(()=>{if(e&&Te&&d&&m!=null){const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:m};Te().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:I},{headers:{"X-Api-Key":v??"","Content-Type":"application/json"}}).then(O=>{c(O)}).catch(O=>{console.error("Error loading provider info."),Ye(O)})}},[v,e,d,r,n,o,i,l,c,m]);const w=I=>{p(I.apiKey),f(!0)};return a===null?u.jsx(Wg,{provider:e,providerInfo:t,handleSubmit:w,error:null}):s}function zg({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var O;const[o,s]=g.useState(!1),a=()=>s(y=>!y),[c,l]=g.useState({username:"",password:""}),{username:d,password:f}=c,m=Qt(e,t),p=(O=t.basicOpts)==null?void 0:O.docsURL,v=d.length>0,w=i||!v,I=y=>{const{name:x,value:b}=y.currentTarget;l(_=>({..._,[x]:b}))};return u.jsx(yi,{providerName:m,handleSubmit:()=>{n({user:d,pass:f})},error:r,isButtonDisabled:w,children:u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[p&&u.jsx(Nc,{url:p,providerDisplayName:m,credentialName:"credentials"}),u.jsx(kt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:y=>I(y)}),u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(kt.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"Password",onChange:y=>I(y)}),u.jsx(ht,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function Xg({...e}){return u.jsx(zg,{...e})}function Gg({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const l=De(),[d,f]=g.useState(!1),[m,p]=g.useState(null),v=Je();g.useEffect(()=>{if(e&&Te&&d&&m!=null){const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m.user,password:m.pass}};Te().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:I},{headers:{"X-Api-Key":v??"","Content-Type":"application/json"}}).then(O=>{c(O)}).catch(O=>{console.error("Error loading provider info."),Ye(O)})}},[v,e,d,r,n,o,i,l,m,c]);const w=I=>{const{user:O,pass:y}=I;p({user:O,pass:y}),f(!0)};return a===null?u.jsx(Xg,{provider:e,providerInfo:t,handleSubmit:w,error:null}):s}function Yg({...e}){return u.jsx(yi,{...e})}function Zg({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,setSelectedConnection:a,providerName:c}){const l=De(),d=Je(),[f,m]=g.useState(!1);g.useEffect(()=>{if(e&&Te&&f){const v={groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e};Te().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:v},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(w=>{a(w)}).catch(w=>{console.error("Error loading provider info."),Ye(w)})}},[d,e,f,n,t,i,r,a,l]);const p=()=>{m(!0)};return s===null?u.jsx(Yg,{handleSubmit:p,error:null,providerName:c}):o}const Tc=async(e,t,n,r,i,o,s,a)=>{var l,d;const c=await Te().providerApi.getProvider({provider:i},{headers:{"X-Api-Key":r??""}});if(!c)throw new Error(`Provider ${i} not found`);if(c.authType==="oauth2"&&(((l=c.oauth2Opts)==null?void 0:l.grantType)==="authorizationCode"||((d=c.oauth2Opts)==null?void 0:d.grantType)==="authorizationCodePKCE")){const m=(await Te().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(I=>I.provider===i),p=Qt(i,c);if(!m)throw new Error(`You must first set up a ${p} Provider App using the Ampersand Console.`);const v={connectOAuthParams:{providerWorkspaceRef:o,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:m.id,provider:i,enableCSRFProtection:!0}};return await Te().oAuthApi.oauthConnect(v,{credentials:"include",headers:{"X-Api-Key":r??"","Content-Type":"application/json"}})}throw new Error(`Provider ${i} does not support an OAuth2 web flow.`)},xs=600,Cs=600,Qg="AUTHORIZATION_SUCCEEDED",ev="AUTHORIZATION_FAILED";function tv(e,t,n){return g.useCallback(async r=>{const i=await Te().connectionApi.getConnection({projectIdOrName:e,connectionId:r},{headers:{"X-Api-Key":t??""}});n(i)},[e,t,n])}function nv(e,t,n,r){return g.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-xs)/2,o=window.screenY+(window.outerHeight-Cs)/2.5,s=`width=${xs},height=${Cs},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function rv(e,t){return g.useCallback(n=>{var r,i;if(n.origin===yf){if(n.data.eventType===Qg){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===ev&&(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 Rc({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i}){const o=Je(),{projectId:s}=De(),[a,c]=g.useState(null),[l,d]=g.useState(null),{setSelectedConnection:f}=Pn(),m=rv(c,r),p=nv(n,d,m,t),v=tv(s,o,f);return g.useEffect(()=>{t&&!l&&p()},[t,l,p,m,n]),g.useEffect(()=>{a&&v(a).then(()=>{l==null||l.close()}).catch(w=>{console.error("Error refreshing connection: ",w),r==null||r(w.message??"Unexpected error: not able to refresh connection")})},[a,o,f,v,l,r]),g.useEffect(()=>{if(!l)return;const w=setInterval(()=>{l.closed&&(clearInterval(w),window.removeEventListener("message",m),d(null),!a&&!i?(console.error("OAuth failed. Please try again."),r==null||r("OAuth failed. Please try again.")):a&&(r==null||r(null)))},500);return()=>{clearInterval(w),window.removeEventListener("message",m)}},[l,a,i,m,r]),u.jsx("div",{children:e})}function ov({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs(Qn,{children:[u.jsx(er,{children:`Set up ${r} integration`}),u.jsx(tr,{error:t}),u.jsx(ht,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function iv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=De(),a=Je(),[c,l]=g.useState(null),[d,f]=g.useState(null),m=async()=>{f(null);try{const v=await Tc(s,t,r,a,e,void 0,n,i);l(v)}catch(v){console.error("Could not fetch OAuth popup URL."),Ye(v),f(v.message??"Unexpected error")}},p=g.useCallback(v=>{f(v),l(null)},[]);return u.jsx(Rc,{windowTitle:`Connect to ${o}`,oauthUrl:c,onError:p,children:u.jsx(ov,{handleSubmit:m,error:d,providerName:o})})}const sv="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function av({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return u.jsxs(Qn,{children:[u.jsx(er,{children:"Enter your Salesforce subdomain"}),u.jsx(Sc,{href:sv,newTab:!0,children:"What is my Salesforce subdomain?"}),u.jsx(tr,{error:n}),u.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[u.jsx(kt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:i=>t(i.currentTarget.value)}),u.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),u.jsx(ht,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function cv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:i}){return u.jsxs(Qn,{children:[u.jsxs(er,{children:["Enter your ",i," workspace"]}),u.jsx(tr,{error:n}),u.jsx("br",{}),u.jsx(kt.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:o=>t(o.currentTarget.value)}),u.jsx("br",{}),u.jsx(ht,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const lv="salesforce";function uv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=De(),a=Je(),[c,l]=g.useState(""),[d,f]=g.useState(null),[m,p]=g.useState(null),v=async()=>{if(p(null),!c){p("Workspace is required");return}try{const O=await Tc(s,t,r,a,e,c,n,i);f(O)}catch(O){console.error(O),p((O==null?void 0:O.message)??"Unexpected error")}},w=g.useCallback(O=>{p(O),f(null)},[]),I=e===lv?u.jsx(av,{handleSubmit:v,setWorkspace:l,error:m,isButtonDisabled:c.length===0}):u.jsx(cv,{handleSubmit:v,setWorkspace:l,error:m,isButtonDisabled:c.length===0,providerName:o});return u.jsx(Rc,{windowTitle:`Connect to ${o}`,oauthUrl:d,onError:w,children:I})}function dv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:i,explicitWorkspaceRequired:o}){const[s,a]=g.useState(!1),[c,l]=g.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),d=()=>a(_=>!_),f=_=>{const{name:E,value:$}=_.currentTarget;l(T=>({...T,[E]:$}))},{clientSecret:m,clientId:p,workspace:v,scopes:w}=c,I=m.length>0,O=p.length>0,y=o?v.length>0:!0,x=n||!I||!O||!y,b=()=>{const _={clientId:p,clientSecret:m};o&&(_.workspace=v),i&&w.length>0&&(_.scopes=Pf(w)),e(_)};return u.jsxs(Qn,{children:[u.jsx(er,{children:`Set up ${r} integration`}),u.jsx(tr,{error:t}),u.jsx("br",{}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[o&&u.jsx(kt.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:_=>f(_)}),u.jsx(kt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:_=>f(_)}),u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(kt.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:_=>f(_)}),u.jsx(ht,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:d,children:s?"Hide":"Show"})]}),i&&u.jsx(kt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:_=>f(_)})]}),u.jsx("br",{}),u.jsx(ht,{style:{marginTop:"1em",width:"100%"},disabled:x,type:"submit",onClick:b,children:"Next"})]})}function fv({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c,setSelectedConnection:l}){const{projectId:d}=De(),f=Je(),[m,p]=g.useState(null),v=async w=>{p(null);const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:w.workspace,oauth2ClientCredentials:{clientId:w.clientId,clientSecret:w.clientSecret,scopes:w.scopes}};Te().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:I},{headers:{"X-Api-Key":f??"","Content-Type":"application/json"}}).then(O=>{l(O)}).catch(O=>{console.error("Error loading provider info."),Ye(O),p("Error loading provider info")})};return c===null?u.jsx(dv,{providerName:t,handleSubmit:v,error:m,explicitScopesRequired:s,explicitWorkspaceRequired:a}):u.jsx($t,{})}function pv({...e}){return u.jsx(fv,{...e})}const mv="authorizationCode",hv="authorizationCodePKCE",gv="clientCredentials";function vv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:a}){if(t.oauth2Opts===void 0)return u.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:c,explicitScopesRequired:l,explicitWorkspaceRequired:d}=t.oauth2Opts,f=Qt(e,t),m={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:f};return c===mv||c===hv?d?u.jsx(uv,{...m}):u.jsx(iv,{...m}):c===gv?u.jsx(pv,{...m,explicitWorkspaceRequired:d,explicitScopesRequired:l,selectedConnection:s,setSelectedConnection:a}):c==="password"?u.jsx("em",{children:"Password flow not supported yet"}):u.jsxs("em",{children:["Unsupported grant type: ",c]})}function yv(e){const{selectedConnection:t}=Pn();g.useEffect(()=>{e&&t&&e(t.id)},[e,t])}function wv({onSuccess:e}){yv(e)}const Iv=async(e,t)=>{const n=await Te().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function Ac({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s}){const a=Je(),[c,l]=g.useState(null),{provider:d}=ut(),{selectedConnection:f,setSelectedConnection:m,connections:p}=Pn();wv({onSuccess:s});const v=e||d,w=(c==null?void 0:c.displayName)??Un(v);if(g.useEffect(()=>{if(!f&&p&&p.length>0){const[O]=p;m(O)}Iv(a,v).then(O=>{l(O)}).catch(O=>{console.error("Error loading provider info."),Ye(O)})},[p,f,m,a,v]),!e&&!d)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(f)return o;if(c==null)return u.jsx("strong",{children:"Provider not found"});const I={provider:v,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:f,setSelectedConnection:m,providerName:w,providerInfo:c};return c.authType==="none"?u.jsx(Zg,{...I,children:o}):c.authType==="basic"?u.jsx(Gg,{...I,children:o}):c.authType==="apiKey"?u.jsx(Jg,{...I,children:o}):u.jsx(vv,{...I})}function _v(e,t=[]){let n=[];function r(o,s){const a=k.createContext(s),c=n.length;n=[...n,s];const l=f=>{var O;const{scope:m,children:p,...v}=f,w=((O=m==null?void 0:m[e])==null?void 0:O[c])||a,I=k.useMemo(()=>v,Object.values(v));return u.jsx(w.Provider,{value:I,children:p})};l.displayName=o+"Provider";function d(f,m){var w;const p=((w=m==null?void 0:m[e])==null?void 0:w[c])||a,v=k.useContext(p);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[l,d]}const i=()=>{const o=n.map(s=>k.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return k.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[r,bv(i,...t)]}function bv(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:c,scopeName:l})=>{const f=c(o)[`__scope${l}`];return{...a,...f}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Pc(e,t=[]){let n=[];function r(o,s){const a=k.createContext(s),c=n.length;n=[...n,s];function l(f){const{scope:m,children:p,...v}=f,w=(m==null?void 0:m[e][c])||a,I=k.useMemo(()=>v,Object.values(v));return u.jsx(w.Provider,{value:I,children:p})}function d(f,m){const p=(m==null?void 0:m[e][c])||a,v=k.useContext(p);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return l.displayName=o+"Provider",[l,d]}const i=()=>{const o=n.map(s=>k.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return k.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[r,xv(i,...t)]}function xv(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:c,scopeName:l})=>{const f=c(o)[`__scope${l}`];return{...a,...f}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Cv(e){const t=e+"CollectionProvider",[n,r]=Pc(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:v,children:w}=p,I=g.useRef(null),O=g.useRef(new Map).current;return u.jsx(i,{scope:v,itemMap:O,collectionRef:I,children:w})};s.displayName=t;const a=e+"CollectionSlot",c=g.forwardRef((p,v)=>{const{scope:w,children:I}=p,O=o(a,w),y=Jn(v,O.collectionRef);return u.jsx(kr,{ref:y,children:I})});c.displayName=a;const l=e+"CollectionItemSlot",d="data-radix-collection-item",f=g.forwardRef((p,v)=>{const{scope:w,children:I,...O}=p,y=g.useRef(null),x=Jn(v,y),b=o(l,w);return g.useEffect(()=>(b.itemMap.set(y,{ref:y,...O}),()=>void b.itemMap.delete(y))),u.jsx(kr,{[d]:"",ref:x,children:I})});f.displayName=l;function m(p){const v=o(e+"CollectionConsumer",p);return g.useCallback(()=>{const I=v.collectionRef.current;if(!I)return[];const O=Array.from(I.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((b,_)=>O.indexOf(b.ref.current)-O.indexOf(_.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},m,r]}var Ov=k.useId||(()=>{}),Ev=0;function Dc(e){const[t,n]=k.useState(Ov());return Mr(()=>{e||n(r=>r??String(Ev++))},[e]),e||(t?`radix-${t}`:"")}var Sv=k.createContext(void 0);function jc(e){const t=k.useContext(Sv);return e||t||"ltr"}var go="rovingFocusGroup.onEntryFocus",Nv={bubbles:!1,cancelable:!0},Xr="RovingFocusGroup",[Fo,Fc,Tv]=Cv(Xr),[Rv,Mc]=Pc(Xr,[Tv]),[Av,Pv]=Rv(Xr),kc=k.forwardRef((e,t)=>u.jsx(Fo.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Fo.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Dv,{...e,ref:t})})}));kc.displayName=Xr;var Dv=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:d=!1,...f}=e,m=k.useRef(null),p=Jn(t,m),v=jc(o),[w=null,I]=mi({prop:s,defaultProp:a,onChange:c}),[O,y]=k.useState(!1),x=pi(l),b=Fc(n),_=k.useRef(!1),[E,$]=k.useState(0);return k.useEffect(()=>{const T=m.current;if(T)return T.addEventListener(go,x),()=>T.removeEventListener(go,x)},[x]),u.jsx(Av,{scope:n,orientation:r,dir:v,loop:i,currentTabStopId:w,onItemFocus:k.useCallback(T=>I(T),[I]),onItemShiftTab:k.useCallback(()=>y(!0),[]),onFocusableItemAdd:k.useCallback(()=>$(T=>T+1),[]),onFocusableItemRemove:k.useCallback(()=>$(T=>T-1),[]),children:u.jsx(en.div,{tabIndex:O||E===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:xt(e.onMouseDown,()=>{_.current=!0}),onFocus:xt(e.onFocus,T=>{const J=!_.current;if(T.target===T.currentTarget&&J&&!O){const q=new CustomEvent(go,Nv);if(T.currentTarget.dispatchEvent(q),!q.defaultPrevented){const z=b().filter(ne=>ne.focusable),Y=z.find(ne=>ne.active),ee=z.find(ne=>ne.id===w),se=[Y,ee,...z].filter(Boolean).map(ne=>ne.ref.current);Kc(se,d)}}_.current=!1}),onBlur:xt(e.onBlur,()=>y(!1))})})}),Lc="RovingFocusGroupItem",$c=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=Dc(),c=o||a,l=Pv(Lc,n),d=l.currentTabStopId===c,f=Fc(n),{onFocusableItemAdd:m,onFocusableItemRemove:p}=l;return k.useEffect(()=>{if(r)return m(),()=>p()},[r,m,p]),u.jsx(Fo.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:u.jsx(en.span,{tabIndex:d?0:-1,"data-orientation":l.orientation,...s,ref:t,onMouseDown:xt(e.onMouseDown,v=>{r?l.onItemFocus(c):v.preventDefault()}),onFocus:xt(e.onFocus,()=>l.onItemFocus(c)),onKeyDown:xt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){l.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const w=Mv(v,l.orientation,l.dir);if(w!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let O=f().filter(y=>y.focusable).map(y=>y.ref.current);if(w==="last")O.reverse();else if(w==="prev"||w==="next"){w==="prev"&&O.reverse();const y=O.indexOf(v.currentTarget);O=l.loop?kv(O,y+1):O.slice(y+1)}setTimeout(()=>Kc(O))}})})})});$c.displayName=Lc;var jv={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Fv(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Mv(e,t,n){const r=Fv(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return jv[r]}function Kc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function kv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Lv=kc,$v=$c,wi="Tabs",[Kv,my]=_v(wi,[Mc]),Vc=Mc(),[Vv,Ii]=Kv(wi),Hc=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:c="automatic",...l}=e,d=jc(a),[f,m]=mi({prop:r,onChange:i,defaultProp:o});return u.jsx(Vv,{scope:n,baseId:Dc(),value:f,onValueChange:m,orientation:s,dir:d,activationMode:c,children:u.jsx(en.div,{dir:d,"data-orientation":s,...l,ref:t})})});Hc.displayName=wi;var Uc="TabsList",Bc=k.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=Ii(Uc,n),s=Vc(n);return u.jsx(Lv,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:u.jsx(en.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});Bc.displayName=Uc;var qc="TabsTrigger",Wc=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=Ii(qc,n),a=Vc(n),c=zc(s.baseId,r),l=Xc(s.baseId,r),d=r===s.value;return u.jsx($v,{asChild:!0,...a,focusable:!i,active:d,children:u.jsx(en.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":l,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...o,ref:t,onMouseDown:xt(e.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:xt(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:xt(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})})});Wc.displayName=qc;var Jc="TabsContent",Hv=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=Ii(Jc,n),c=zc(a.baseId,r),l=Xc(a.baseId,r),d=r===a.value,f=k.useRef(d);return k.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),u.jsx(hi,{present:i||d,children:({present:m})=>u.jsx(en.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:l,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&o})})});Hv.displayName=Jc;function zc(e,t){return`${e}-trigger-${t}`}function Xc(e,t){return`${e}-content-${t}`}var Uv=Hc,Bv=Bc,Gc=Wc;const qv=u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[u.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),u.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function Wv(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?qv:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:u.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function Jv(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.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"}),u.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const zv="_tabsRoot_lqugd_1",Xv="_tabsList_lqugd_6",Gv="_tabTrigger_lqugd_12",Yv="_danger_lqugd_29",zn={tabsRoot:zv,tabsList:Xv,tabTrigger:Gv,danger:Yv};function Yc({objectName:e,completed:t,pending:n,displayName:r}){return u.jsx(Gc,{value:e,className:zn.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Wv(t,n),u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsx("span",{children:r||e}),n&&u.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function Zv({completed:e,pending:t,displayName:n}){return u.jsxs(u.Fragment,{children:[u.jsx(fi,{style:{margin:"1rem 0"}}),u.jsx(Yc,{objectName:fn,completed:e,pending:t,displayName:n},"other-write")]})}function Qv(){return u.jsxs(u.Fragment,{children:[u.jsx(fi,{style:{margin:"3rem 0 1rem 0"}}),u.jsx(Gc,{value:Or,className:st(zn.tabTrigger,zn.danger),children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Jv(),u.jsx("span",{children:"Uninstall"})]})})]})}function ey({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,otherNavObject:i,showUninstallButton:o}){var s,a;return u.jsx(Uv,{value:e,className:zn.tabsRoot,onValueChange:n,children:u.jsxs(Bv,{className:zn.tabsList,children:[t.map(c=>{var l,d,f,m;return u.jsx(Yc,{objectName:c.name,displayName:c.displayName,completed:c.completed,pending:((d=(l=r==null?void 0:r[c.name])==null?void 0:l.read)==null?void 0:d.isOptionalFieldsModified)||((m=(f=r==null?void 0:r[c.name])==null?void 0:f.read)==null?void 0:m.isRequiredMapFieldsModified)||!1},c.name)}),i&&u.jsx(Zv,{completed:i.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:t.length?"Other":"Write"}),o&&u.jsx(Qv,{})]})})}function ty(e,t){return t===Or?{name:Or,completed:!1}:e.find(n=>n.name===t)}function ny({children:e}){var O;const{project:t}=De(),{installation:n,provider:r}=ut(),{hydratedRevision:i}=Dn(),{objectConfigurationsState:o}=di(),[s,a]=g.useState(""),c=(t==null?void 0:t.appName)||"",l=n==null?void 0:n.config,d=i&&Ws(l,i),f=d!==null,m=!!((O=i==null?void 0:i.content)!=null&&O.write),p=m?Js(l):void 0,v=g.useMemo(()=>{const y=[...d||[]];return p&&m&&y.push(p),y},[d,p,m]),w=ty(v,s),I=g.useCallback(()=>{const y=v.find(x=>w!==x&&!x.completed);y&&a(y.name)},[v,w]);return g.useEffect(()=>{!s&&v.length>0&&a(v[0].name)},[v,s,I]),u.jsx(ec.Provider,{value:I,children:u.jsx(Za.Provider,{value:w==null?void 0:w.name,children:u.jsxs(Xn,{style:{maxWidth:"55rem"},children:[u.jsxs(vn,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[u.jsxs("div",{style:{width:"20rem"},children:[u.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[Qt(r)," integration"]}),u.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),f&&u.jsx(ey,{value:s,readNavObjects:d,onValueChange:y=>a(y),objectConfigurationsState:o,otherNavObject:p,showUninstallButton:!!n})]}),e]}),u.jsx(Ec,{})]})})})}function ry({...e}){return u.jsx(ny,{...e})}const oy="_resetContainer_lkwv9_4",iy={resetContainer:oy};function sy(){const[e,t]=g.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}function ay({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var p;const{projectId:l}=De(),{errorState:d}=Zt(),{seed:f,reset:m}=sy();return(p=d[Se.INTEGRATION_LIST])!=null&&p.apiError?u.jsx(Lt,{message:"Something went wrong, couldn't find integration information"}):u.jsx("div",{className:iy.resetContainer,children:u.jsx(Ff,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:u.jsx(Bs,{groupRef:r,children:u.jsx(Ac,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:u.jsx(ip,{projectId:l,children:u.jsx(jg,{resetComponent:m,children:u.jsx(bh,{children:u.jsx(ry,{children:u.jsx(Ng,{})})})})})})})},f)})}function cy(){return u.jsxs(Xn,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[u.jsx($t,{}),u.jsx("p",{children:"Redirecting"})]})}function ly({redirectURL:e,children:t}){return g.useEffect(()=>{e&&window.location.replace(e)},[e]),e?u.jsx(cy,{}):t}function uy({provider:e}){const{appName:t}=De(),n=`You have successfully connected your ${Qt(e)} account to ${t}.`;return u.jsx(vi,{text:n})}function dy({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s}){return u.jsx(Bs,{provider:e,groupRef:r,children:u.jsx(Ac,{provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:s,children:u.jsx(ly,{redirectURL:o,children:u.jsx(uy,{provider:e})})})})}const fy=(e,t)=>{const n=Je(),{projectId:r}=De(),{integrations:i}=$s(),[o,s]=g.useState(!1),[a,c]=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 l=g.useMemo(()=>i==null?void 0:i.reduce((d,f)=>(f==null?void 0:f.name)===e?f:d,{}),[i,e]);return g.useEffect(()=>{l&&Te().installationApi.listInstallations({projectIdOrName:r,integrationId:l.id,groupRef:t},{headers:{"x-api-key":n}}).then(d=>{s(!0),c(d.length>0)}).catch(d=>{console.error("Error listing installations."),Ye(d),s(!0)})},[t,n,r,l]),{isLoaded:o,isIntegrationInstalled:a}};exports.AmpersandContext=Vs;exports.AmpersandProvider=Rf;exports.ConnectProvider=dy;exports.FieldMapping=lc;exports.InstallIntegration=ay;exports.useAmpersandProvider=Af;exports.useIsIntegrationInstalled=fy;