@amp-labs/react 2.0.5 → 2.0.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.
- package/build/amp-react.cjs.js +13 -13
- package/build/amp-react.es.js +1923 -1902
- package/build/index.d.ts +5 -5
- package/build/style.css +1 -1
- package/package.json +3 -3
package/build/amp-react.cjs.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),g=require("react");require("react-dom");function Al(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=Al(g),Es=g.createContext(null),Pl=Es.Provider,He=()=>{const e=g.useContext(Es);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var Ne=(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))(Ne||{});const Ss=g.createContext(void 0);function Zt(){const e=g.useContext(Ss);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Dl=(()=>{const e={};return Object.values(Ne).forEach(t=>{e[t]={}}),e})();function jl({children:e}){const[t,n]=g.useState(Dl),r=g.useCallback((d,p,m=!0)=>{n(f=>{const v={...f};return v[d]=v[d]||{},v[d][p]=m,v})},[n]),i=g.useCallback((d,p)=>{var m;return!!((m=t[d])!=null&&m[p])},[t]),o=g.useCallback((d,p)=>{var m;return(m=t[d])==null?void 0:m[p]},[t]),s=g.useCallback((d,p)=>{n(m=>{var v;const f={...m};return(v=f[d])==null||delete v[p],f})},[n]),a=g.useCallback(d=>{n(p=>{const m={...p};return m[d]={},m})},[n]),c=g.useCallback((d,p)=>{n(m=>{const f={...m};return f[d]=f[d]||{},p.forEach(v=>{f[d][v]=!0}),f})},[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(Ss.Provider,{value:l,children:e})}function Fl(){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 Ml="_box_1p7c5_1",Pi={box:Ml};function yn({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Pi.box} ${t}`:Pi.box,style:n,children:e})}const kl="_container_1wvzr_1",Di={container:kl};function Xn({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Di.container} ${t}`:Di.container,style:n,children:e})}const Ll="_errorBoxContainer_4sdb2_1",$l="_errorBox_4sdb2_1",Kl="_errorText_4sdb2_20",Qr={errorBoxContainer:Ll,errorBox:$l,errorText:Kl};function Lt({message:e}){return u.jsxs(Xn,{className:Qr.errorBoxContainer,children:[u.jsx(Fl,{}),u.jsx(yn,{className:Qr.errorBox,children:u.jsx("p",{className:Qr.errorText,children:e})})]})}const Vl="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ns{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Vl}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Rs}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 Hl=new Ns,Lr=class Lr{constructor(t=Hl){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 ql(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?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 Ts(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:Bl(a.body)||a.body instanceof URLSearchParams||Ul(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 Ul(e){return typeof Blob<"u"&&e instanceof Blob}function Bl(e){return typeof FormData<"u"&&e instanceof FormData}class Ts extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class ql extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class re 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 Rs(e,t=""){return Object.keys(e).map(n=>As(n,e[n],t)).filter(n=>n.length>0).join("&")}function As(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 As(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Rs(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 pn{constructor(t){this.raw=t}async value(){}}class Wl{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Jl(e){return zl(e)}function zl(e,t){return e==null?e:{fieldUsed:L(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:L(e,"keyFormat")?e.keyFormat:void 0}}function Xl(e){return Gl(e)}function Gl(e,t){return e==null?e:{name:e.name,valuePrefix:L(e,"valuePrefix")?e.valuePrefix:void 0}}function Yl(e){return Zl(e)}function Zl(e,t){return e==null?e:{name:e.name}}function Ql(e){return eu(e)}function eu(e,t){return e==null?e:{attachmentType:e.attachmentType,query:L(e,"query")?Yl(e.query):void 0,header:L(e,"header")?Xl(e.header):void 0,docsURL:L(e,"docsURL")?e.docsURL:void 0}}function tu(e){return nu(e)}function nu(e,t){return e}function ru(e){return ou(e)}function ou(e,t){return e==null?e:{days:L(e,"days")?e.days:void 0,fullHistory:L(e,"fullHistory")?e.fullHistory:void 0}}function iu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Ps(e){return su(e)}function su(e,t){return e==null?e:{defaultPeriod:ru(e.defaultPeriod)}}function au(e){if(e!==void 0)return e===null?null:{defaultPeriod:iu(e.defaultPeriod)}}function cu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function lu(e){if(e!==void 0)return e===null?null:{defaultPeriod:cu(e.defaultPeriod)}}function uu(e){return du(e)}function du(e,t){return e==null?e:{enabled:L(e,"enabled")?e.enabled:void 0}}function Ds(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function pu(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:lu(e.backfill)}}function fu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Mo(e.objects,pu)}}function mu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function hu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Mo(e.objects,mu)}}function gu(e){return vu(e)}function vu(e,t){return e==null?e:{apiKeyAsBasic:L(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:L(e,"apiKeyAsBasicOpts")?Jl(e.apiKeyAsBasicOpts):void 0,docsURL:L(e,"docsURL")?e.docsURL:void 0}}function yu(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function dr(e){return wu(e)}function wu(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 Iu(e){return _u(e)}function _u(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function bu(e){return xu(e)}function xu(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")?uu(e.proxy):void 0}}function js(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:Ds(e.proxy)}}function Cu(e){return Ou(e)}function Ou(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:bu(e.content)}}function Eu(e){return Su(e)}function Su(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 Fs(e){return Nu(e)}function Nu(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 Tu(e)}function Tu(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 Ru(e)}function Ru(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:wr(e.providerApp),group:Fs(e.group),consumer:Eu(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 Au(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:js(e.content)}}function Pu(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Au(e.config)}}function Du(e){return ju(e)}function ju(e,t){return e==null?e:{enabled:L(e,"enabled")?e.enabled:void 0}}function Fu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Mu(e){return ku(e)}function ku(e,t){return e==null?e:{mode:L(e,"mode")?e.mode:void 0,pageSize:L(e,"pageSize")?e.pageSize:void 0}}function Lu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function $u(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 Vu(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Hu(e){let t=!0;return t=t&&"mapToName"in e,t}function Ms(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 Uu(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 Bu(e)}function Bu(e,t){return e==null?e:{...Ku(e),...Ms(e)}}function Fi(e){if(e!==void 0)return e===null?null:$u(e)?Vu(e):Hu(e)?Uu(e):{}}function ks(e){return qu(e)}function qu(e,t){return e}function Wu(e){return Ju(e)}function Ju(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(ji):void 0,optionalFields:L(e,"optionalFields")?e.optionalFields.map(ji):void 0,optionalFieldsAuto:L(e,"optionalFieldsAuto")?ks(e.optionalFieldsAuto):void 0,backfill:L(e,"backfill")?Ps(e.backfill):void 0,delivery:L(e,"delivery")?Mu(e.delivery):void 0}}function zu(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(Fi),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Fi),optionalFieldsAuto:e.optionalFieldsAuto,backfill:au(e.backfill),delivery:Lu(e.delivery)}}function Xu(e){return Gu(e)}function Gu(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(Wu):void 0}}function Yu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(zu)}}function Zu(e){return Qu(e)}function Qu(e,t){return e==null?e:{objectName:e.objectName,inheritMappingFromRead:L(e,"inheritMappingFromRead")?e.inheritMappingFromRead:void 0}}function ed(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMappingFromRead:e.inheritMappingFromRead}}function td(e){return nd(e)}function nd(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(Zu):void 0}}function rd(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ed)}}function od(e){return id(e)}function id(e,t){return e==null?e:{name:e.name,displayName:L(e,"displayName")?e.displayName:void 0,provider:e.provider,read:L(e,"read")?Xu(e.read):void 0,write:L(e,"write")?td(e.write):void 0,proxy:L(e,"proxy")?Du(e.proxy):void 0}}function sd(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:Yu(e.read),write:rd(e.write),proxy:Fu(e.proxy)}}function ad(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:sd(e.content)}}function cd(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:ad(e.latestRevision)}}function ld(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function ud(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 dd(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function pd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function fd(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function md(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 hd(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:pd(e.basicAuth),oauth2ClientCredentials:fd(e.oauth2ClientCredentials),oauth2Password:md(e.oauth2Password)}}function gd(e){return vd(e)}function vd(e,t){return e==null?e:{enabled:L(e,"enabled")?e.enabled:void 0}}function yd(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 wd(e)}function wd(e,t){return e==null?e:{...yd(e),...Ms(e)}}function Id(e){return _d(e)}function _d(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")?ks(e.optionalFieldsAuto):void 0,allFields:L(e,"allFields")?e.allFields.map(eo):void 0,backfill:L(e,"backfill")?Ps(e.backfill):void 0}}function bd(e){return xd(e)}function xd(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(Id):void 0}}function Cd(e){return Od(e)}function Od(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function Ed(e){return Sd(e)}function Sd(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(Cd):void 0}}function Nd(e){return Td(e)}function Td(e,t){return e==null?e:{name:e.name,displayName:L(e,"displayName")?e.displayName:void 0,provider:e.provider,read:L(e,"read")?bd(e.read):void 0,write:L(e,"write")?Ed(e.write):void 0,proxy:L(e,"proxy")?gd(e.proxy):void 0}}function Rd(e){return Ad(e)}function Ad(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Nd(e.content)}}function Pd(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 Dd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:js(e.content)}}function jd(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:Pd(e.connection),config:Dd(e.config)}}function Ln(e){return Fd(e)}function Fd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:L(e,"group")?Fs(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:Cu(e.config)}}function Md(e){return kd(e)}function kd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:od(e.content)}}function Mi(e){return Ld(e)}function Ld(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:Md(e.latestRevision)}}function $d(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 Vd(e){return Hd(e)}function Hd(e,t){return e==null?e:{iconURL:L(e,"iconURL")?e.iconURL:void 0,logoURL:L(e,"logoURL")?e.logoURL:void 0}}function Ud(e){return Bd(e)}function Bd(e,t){return e==null?e:{regular:L(e,"regular")?Vd(e.regular):void 0,darkMode:L(e,"darkMode")?$d(e.darkMode):void 0}}function qd(e){return Wd(e)}function Wd(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 Jd(e){return zd(e)}function zd(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:qd(e.tokenMetadataFields),docsURL:L(e,"docsURL")?e.docsURL:void 0,authURLParams:L(e,"authURLParams")?e.authURLParams:void 0}}function Xd(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 Gd(e){return Yd(e)}function Yd(e,t){return e==null?e:{bulkWrite:Iu(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function ki(e){return Zd(e)}function Zd(e,t){return e==null?e:{name:e.name,authType:tu(e.authType),baseURL:e.baseURL,oauth2Opts:L(e,"oauth2Opts")?Jd(e.oauth2Opts):void 0,apiKeyOpts:L(e,"apiKeyOpts")?Ql(e.apiKeyOpts):void 0,basicOpts:L(e,"basicOpts")?gu(e.basicOpts):void 0,support:Gd(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")?Ud(e.media):void 0,labels:L(e,"labels")?e.labels:void 0}}function Qd(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:fu(e.read),write:hu(e.write),proxy:Ds(e.proxy)}}function ep(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Qd(e.content)}}function tp(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:ep(e.config)}}function np(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:tp(e.installation)}}function rp(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function op(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:rp(e.project)}}function ip(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 sp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:ip(e.providerApp)}}class ap extends Et{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:i,query:r},n);return new pn(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:hd(t.generateConnectionParams)},n);return new 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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("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 re("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 cp extends Et{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new re("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:Pu(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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("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 pn(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new re("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:jd(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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new re("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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new re("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:np(t.installationUpdate)},n);return new Ae(o,s=>Ln(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class lp extends Et{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("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:yu(t.batchUpsertIntegrationsRequest)},n);return new Ae(o,s=>s.map(Mi))}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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new re("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:cd(t.integration)},n);return new pn(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new re("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 pn(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("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(Mi))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class up extends Et{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new re("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:Xd(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new Ae(o):new Wl(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class dp extends Et{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new re("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:ld(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 re("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 pn(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new re("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:op(t.projectUpdate)},n);return new Ae(o,s=>dr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class pp extends Et{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new re("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=>ki(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,ki))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class fp extends Et{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new re("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:ud(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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("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 pn(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new re("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:sp(t.providerAppUpdate)},n);return new Ae(o,s=>wr(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class mp extends Et{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("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:dd(t.revision)},n);return new pn(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new re("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new re("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=>Rd(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class hp{constructor(t){this.connectionApi=new ap(t),this.installationApi=new cp(t),this.integrationApi=new lp(t),this.oAuthApi=new up(t),this.projectApi=new dp(t),this.providerApi=new pp(t),this.providerAppApi=new fp(t),this.revisionApi=new mp(t)}}const gp="2.0.5",vp="v1",pr="https://api.withampersand.com";function Ls(){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 pr;case"mock":return"http://127.0.0.1:4010";case"":return pr;default:return e??pr}}catch{return pr}}const yp=(e,t)=>`${e}/${t}`;function wp(){return yp(Ls(),vp)}const Ip=Ls(),_p=wp(),bp=new Ns({basePath:_p,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":gp}});let xp=new hp(bp);const Ce=()=>xp,ze=async(e,t)=>{var n;if(e instanceof Ts){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)}
|
|
3
|
-
component is wrapped with AmpersandProvider`);return e}const Np="
|
|
4
|
-
`).filter(n=>n.trim()!==""),Fp=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Us=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 dt(){const e=g.useContext(Us);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Mp({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:l}){const d=He(),{projectId:p}=Pe(),{integrations:m}=ko(),{setError:f,isError:v}=Zt(),{isIntegrationDeleted:w,setIntegrationDeleted:I}=Hs(),[C,y]=g.useState([]),[x,b]=g.useState(!0),_=(C==null?void 0:C[0])||null,E=g.useMemo(()=>Fp(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&&Ce().installationApi.listInstallations({projectIdOrName:p,integrationId:E.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(z=>{b(!1),y(z||[])}).catch(z=>{f(Ne.INSTALLATION_LIST,E.id),b(!1),console.error("Error retrieving installation information: ",z)})},[E,p,d,f,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(Ne.INSTALLATION_LIST,J)?u.jsx(Lt,{message:z}):u.jsx(Us.Provider,{value:q,children:x?u.jsx(zt,{}):e})}return u.jsx(Lt,{message:`Integration "${t}" not found`})}const Bs=g.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{},isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}}),wn=()=>{const e=g.useContext(Bs);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function qs({provider:e,groupRef:t,children:n}){const r=He(),{projectId:i,isLoading:o}=Pe(),[s,a]=g.useState(null),[c,l]=g.useState(null),[d,p]=g.useState(!0),{setError:m,isError:f}=Zt(),{provider:v}=dt(),{isIntegrationDeleted:w,setIntegrationDeleted:I}=Hs(),C=e||v;if(!C)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");g.useEffect(()=>{i&&r&&Ce().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:C},{headers:{"X-Api-Key":r??""}}).then(x=>{p(!1),a(x)}).catch(x=>{console.error(`Error retrieving existing OAuth connections for group ID ${t}.`),ze(x),p(!1),m(Ne.CONNECTION_LIST,i)})},[i,r,t,C,m]);const y=g.useMemo(()=>({connections:s,selectedConnection:c,setConnections:a,setSelectedConnection:l,isIntegrationDeleted:w,setIntegrationDeleted:I}),[s,c,a,l,w,I]);if(d||o)return u.jsx(zt,{});if(!i)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return f(Ne.CONNECTION_LIST,i)?u.jsx(Lt,{message:"Error retrieving existing connections"}):u.jsx(Bs.Provider,{value:y,children:n})}function Ws(){const[e,t]=g.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const kp="_resetContainer_lkwv9_4",Js={resetContainer:kp};var fr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lo(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]",p="[object Date]",m="[object Error]",f="[object Function]",v="[object GeneratorFunction]",w="[object Map]",I="[object Number]",C="[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]",fe="[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[fe]=R[S]=R[P]=!0,R[a]=R[c]=R[z]=R[d]=R[Y]=R[p]=R[m]=R[f]=R[w]=R[I]=R[y]=R[_]=R[E]=R[$]=R[q]=!1;var X=typeof fr=="object"&&fr&&fr.Object===Object&&fr,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,pe=function(){try{return A&&A.binding&&A.binding("util")}catch{}}(),V=pe&&pe.isTypedArray;function we(h,O){for(var N=-1,W=h==null?0:h.length,be=0,ce=[];++N<W;){var Te=h[N];O(Te,N,h)&&(ce[be++]=Te)}return ce}function De(h,O){for(var N=-1,W=O.length,be=h.length;++N<W;)h[be+N]=O[N];return h}function Ue(h,O){for(var N=-1,W=h==null?0:h.length;++N<W;)if(O(h[N],N,h))return!0;return!1}function je(h,O){for(var N=-1,W=Array(h);++N<h;)W[N]=O(N);return W}function me(h){return function(O){return h(O)}}function gt(h,O){return h.has(O)}function Be(h,O){return h==null?void 0:h[O]}function nt(h){var O=-1,N=Array(h.size);return h.forEach(function(W,be){N[++O]=[be,W]}),N}function vt(h,O){return function(N){return h(O(N))}}function yt(h){var O=-1,N=Array(h.size);return h.forEach(function(W){N[++O]=W}),N}var qe=Array.prototype,$e=Function.prototype,Fe=Object.prototype,Oe=K["__core-js_shared__"],wt=$e.toString,Xe=Fe.hasOwnProperty,Tt=function(){var h=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||"");return h?"Symbol(src)_1."+h:""}(),$t=Fe.toString,rt=RegExp("^"+wt.call(Xe).replace(M,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ee=ae?K.Buffer:void 0,Rt=K.Symbol,Kt=K.Uint8Array,At=Fe.propertyIsEnumerable,tn=qe.splice,Ze=Rt?Rt.toStringTag:void 0,Pt=Object.getOwnPropertySymbols,Vt=Ee?Ee.isBuffer:void 0,nn=vt(Object.keys,Object),Ht=_n(K,"DataView"),xe=_n(K,"Map"),Ge=_n(K,"Promise"),te=_n(K,"Set"),ue=_n(K,"WeakMap"),Me=_n(Object,"create"),Dt=sn(Ht),H=sn(xe),oe=sn(Ge),ie=sn(te),Re=sn(ue),ke=Rt?Rt.prototype:void 0,Qe=ke?ke.valueOf:void 0;function Ke(h){var O=-1,N=h==null?0:h.length;for(this.clear();++O<N;){var W=h[O];this.set(W[0],W[1])}}function We(){this.__data__=Me?Me(null):{},this.size=0}function et(h){var O=this.has(h)&&delete this.__data__[h];return this.size-=O?1:0,O}function _e(h){var O=this.__data__;if(Me){var N=O[h];return N===r?void 0:N}return Xe.call(O,h)?O[h]:void 0}function rn(h){var O=this.__data__;return Me?O[h]!==void 0:Xe.call(O,h)}function Gr(h,O){var N=this.__data__;return this.size+=this.has(h)?0:1,N[h]=Me&&O===void 0?r:O,this}Ke.prototype.clear=We,Ke.prototype.delete=et,Ke.prototype.get=_e,Ke.prototype.has=rn,Ke.prototype.set=Gr;function pt(h){var O=-1,N=h==null?0:h.length;for(this.clear();++O<N;){var W=h[O];this.set(W[0],W[1])}}function nr(){this.__data__=[],this.size=0}function rr(h){var O=this.__data__,N=sr(O,h);if(N<0)return!1;var W=O.length-1;return N==W?O.pop():tn.call(O,N,1),--this.size,!0}function or(h){var O=this.__data__,N=sr(O,h);return N<0?void 0:O[N][1]}function Ie(h){return sr(this.__data__,h)>-1}function It(h,O){var N=this.__data__,W=sr(N,h);return W<0?(++this.size,N.push([h,O])):N[W][1]=O,this}pt.prototype.clear=nr,pt.prototype.delete=rr,pt.prototype.get=or,pt.prototype.has=Ie,pt.prototype.set=It;function _t(h){var O=-1,N=h==null?0:h.length;for(this.clear();++O<N;){var W=h[O];this.set(W[0],W[1])}}function on(){this.size=0,this.__data__={hash:new Ke,map:new(xe||pt),string:new Ke}}function Yr(h){var O=ar(this,h).delete(h);return this.size-=O?1:0,O}function Fn(h){return ar(this,h).get(h)}function tl(h){return ar(this,h).has(h)}function nl(h,O){var N=ar(this,h),W=N.size;return N.set(h,O),this.size+=N.size==W?0:1,this}_t.prototype.clear=on,_t.prototype.delete=Yr,_t.prototype.get=Fn,_t.prototype.has=tl,_t.prototype.set=nl;function ir(h){var O=-1,N=h==null?0:h.length;for(this.__data__=new _t;++O<N;)this.add(h[O])}function rl(h){return this.__data__.set(h,r),this}function ol(h){return this.__data__.has(h)}ir.prototype.add=ir.prototype.push=rl,ir.prototype.has=ol;function Ut(h){var O=this.__data__=new pt(h);this.size=O.size}function il(){this.__data__=new pt,this.size=0}function sl(h){var O=this.__data__,N=O.delete(h);return this.size=O.size,N}function al(h){return this.__data__.get(h)}function cl(h){return this.__data__.has(h)}function ll(h,O){var N=this.__data__;if(N instanceof pt){var W=N.__data__;if(!xe||W.length<n-1)return W.push([h,O]),this.size=++N.size,this;N=this.__data__=new _t(W)}return N.set(h,O),this.size=N.size,this}Ut.prototype.clear=il,Ut.prototype.delete=sl,Ut.prototype.get=al,Ut.prototype.has=cl,Ut.prototype.set=ll;function ul(h,O){var N=cr(h),W=!N&&Ol(h),be=!N&&!W&&Zr(h),ce=!N&&!W&&!be&&Ri(h),Te=N||W||be||ce,Ve=Te?je(h.length,String):[],Je=Ve.length;for(var Se in h)Xe.call(h,Se)&&!(Te&&(Se=="length"||be&&(Se=="offset"||Se=="parent")||ce&&(Se=="buffer"||Se=="byteLength"||Se=="byteOffset")||Il(Se,Je)))&&Ve.push(Se);return Ve}function sr(h,O){for(var N=h.length;N--;)if(Ei(h[N][0],O))return N;return-1}function dl(h,O,N){var W=O(h);return cr(h)?W:De(W,N(h))}function Mn(h){return h==null?h===void 0?J:C:Ze&&Ze in Object(h)?yl(h):Cl(h)}function bi(h){return kn(h)&&Mn(h)==a}function xi(h,O,N,W,be){return h===O?!0:h==null||O==null||!kn(h)&&!kn(O)?h!==h&&O!==O:pl(h,O,N,W,xi,be)}function pl(h,O,N,W,be,ce){var Te=cr(h),Ve=cr(O),Je=Te?c:Bt(h),Se=Ve?c:Bt(O);Je=Je==a?y:Je,Se=Se==a?y:Se;var ot=Je==y,bt=Se==y,Ye=Je==Se;if(Ye&&Zr(h)){if(!Zr(O))return!1;Te=!0,ot=!1}if(Ye&&!ot)return ce||(ce=new Ut),Te||Ri(h)?Ci(h,O,N,W,be,ce):gl(h,O,Je,N,W,be,ce);if(!(N&i)){var ft=ot&&Xe.call(h,"__wrapped__"),mt=bt&&Xe.call(O,"__wrapped__");if(ft||mt){var qt=ft?h.value():h,jt=mt?O.value():O;return ce||(ce=new Ut),be(qt,jt,N,W,ce)}}return Ye?(ce||(ce=new Ut),vl(h,O,N,W,be,ce)):!1}function fl(h){if(!Ti(h)||bl(h))return!1;var O=Si(h)?rt:j;return O.test(sn(h))}function ml(h){return kn(h)&&Ni(h.length)&&!!R[Mn(h)]}function hl(h){if(!xl(h))return nn(h);var O=[];for(var N in Object(h))Xe.call(h,N)&&N!="constructor"&&O.push(N);return O}function Ci(h,O,N,W,be,ce){var Te=N&i,Ve=h.length,Je=O.length;if(Ve!=Je&&!(Te&&Je>Ve))return!1;var Se=ce.get(h);if(Se&&ce.get(O))return Se==O;var ot=-1,bt=!0,Ye=N&o?new ir:void 0;for(ce.set(h,O),ce.set(O,h);++ot<Ve;){var ft=h[ot],mt=O[ot];if(W)var qt=Te?W(mt,ft,ot,O,h,ce):W(ft,mt,ot,h,O,ce);if(qt!==void 0){if(qt)continue;bt=!1;break}if(Ye){if(!Ue(O,function(jt,an){if(!gt(Ye,an)&&(ft===jt||be(ft,jt,N,W,ce)))return Ye.push(an)})){bt=!1;break}}else if(!(ft===mt||be(ft,mt,N,W,ce))){bt=!1;break}}return ce.delete(h),ce.delete(O),bt}function gl(h,O,N,W,be,ce,Te){switch(N){case Y:if(h.byteLength!=O.byteLength||h.byteOffset!=O.byteOffset)return!1;h=h.buffer,O=O.buffer;case z:return!(h.byteLength!=O.byteLength||!ce(new Kt(h),new Kt(O)));case d:case p:case I:return Ei(+h,+O);case m:return h.name==O.name&&h.message==O.message;case _:case $:return h==O+"";case w:var Ve=nt;case E:var Je=W&i;if(Ve||(Ve=yt),h.size!=O.size&&!Je)return!1;var Se=Te.get(h);if(Se)return Se==O;W|=o,Te.set(h,O);var ot=Ci(Ve(h),Ve(O),W,be,ce,Te);return Te.delete(h),ot;case T:if(Qe)return Qe.call(h)==Qe.call(O)}return!1}function vl(h,O,N,W,be,ce){var Te=N&i,Ve=Oi(h),Je=Ve.length,Se=Oi(O),ot=Se.length;if(Je!=ot&&!Te)return!1;for(var bt=Je;bt--;){var Ye=Ve[bt];if(!(Te?Ye in O:Xe.call(O,Ye)))return!1}var ft=ce.get(h);if(ft&&ce.get(O))return ft==O;var mt=!0;ce.set(h,O),ce.set(O,h);for(var qt=Te;++bt<Je;){Ye=Ve[bt];var jt=h[Ye],an=O[Ye];if(W)var Ai=Te?W(an,jt,Ye,O,h,ce):W(jt,an,Ye,h,O,ce);if(!(Ai===void 0?jt===an||be(jt,an,N,W,ce):Ai)){mt=!1;break}qt||(qt=Ye=="constructor")}if(mt&&!qt){var lr=h.constructor,ur=O.constructor;lr!=ur&&"constructor"in h&&"constructor"in O&&!(typeof lr=="function"&&lr instanceof lr&&typeof ur=="function"&&ur instanceof ur)&&(mt=!1)}return ce.delete(h),ce.delete(O),mt}function Oi(h){return dl(h,Nl,wl)}function ar(h,O){var N=h.__data__;return _l(O)?N[typeof O=="string"?"string":"hash"]:N.map}function _n(h,O){var N=Be(h,O);return fl(N)?N:void 0}function yl(h){var O=Xe.call(h,Ze),N=h[Ze];try{h[Ze]=void 0;var W=!0}catch{}var be=$t.call(h);return W&&(O?h[Ze]=N:delete h[Ze]),be}var wl=Pt?function(h){return h==null?[]:(h=Object(h),we(Pt(h),function(O){return At.call(h,O)}))}:Tl,Bt=Mn;(Ht&&Bt(new Ht(new ArrayBuffer(1)))!=Y||xe&&Bt(new xe)!=w||Ge&&Bt(Ge.resolve())!=x||te&&Bt(new te)!=E||ue&&Bt(new ue)!=q)&&(Bt=function(h){var O=Mn(h),N=O==y?h.constructor:void 0,W=N?sn(N):"";if(W)switch(W){case Dt:return Y;case H:return w;case oe:return x;case ie:return E;case Re:return q}return O});function Il(h,O){return O=O??s,!!O&&(typeof h=="number"||D.test(h))&&h>-1&&h%1==0&&h<O}function _l(h){var O=typeof h;return O=="string"||O=="number"||O=="symbol"||O=="boolean"?h!=="__proto__":h===null}function bl(h){return!!Tt&&Tt in h}function xl(h){var O=h&&h.constructor,N=typeof O=="function"&&O.prototype||Fe;return h===N}function Cl(h){return $t.call(h)}function sn(h){if(h!=null){try{return wt.call(h)}catch{}try{return h+""}catch{}}return""}function Ei(h,O){return h===O||h!==h&&O!==O}var Ol=bi(function(){return arguments}())?bi:function(h){return kn(h)&&Xe.call(h,"callee")&&!At.call(h,"callee")},cr=Array.isArray;function El(h){return h!=null&&Ni(h.length)&&!Si(h)}var Zr=Vt||Rl;function Sl(h,O){return xi(h,O)}function Si(h){if(!Ti(h))return!1;var O=Mn(h);return O==f||O==v||O==l||O==b}function Ni(h){return typeof h=="number"&&h>-1&&h%1==0&&h<=s}function Ti(h){var O=typeof h;return h!=null&&(O=="object"||O=="function")}function kn(h){return h!=null&&typeof h=="object"}var Ri=V?me(V):ml;function Nl(h){return El(h)?ul(h):hl(h)}function Tl(){return[]}function Rl(){return!1}e.exports=Sl})(Cr,Cr.exports);var Lp=Cr.exports;const $p=Lo(Lp),fn="other",Or="uninstall-installation";function Xt(e){return!e.fieldName}function Kp(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Vp(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Xt(n)&&!!n.fieldName))||null}function Hp(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Xt(r)&&!!r.mapToName))||[]}function Up(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Xt(n)&&!!n.fieldName))||null}const zs=(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 Bp(e){return Xt(e)?e.mapToName:e.fieldName}const Xs=(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?!!zs(e,s.objectName):!1})}),n},Gs=e=>{var n;return{name:fn,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function qp(e,t){var o;const n=Xs(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?Gs(e):void 0;return i&&n.push(i),n}function Ys(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(Ne.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function $o(e,t){return $p(e,t)}const Wp=(e,t,n)=>{var f,v,w,I,C,y;if(!e)return null;const r=Kp(e,t),i=r&&Vp(r),o=r&&Up(r),s=r&&Hp(r),a=(r==null?void 0:r.allFields)||[],c=n==null?void 0:n.content,l=((w=(v=(f=c==null?void 0:c.read)==null?void 0:f.objects)==null?void 0:v[t])==null?void 0:w.selectedFields)||{},d=((y=(C=(I=c==null?void 0:c.read)==null?void 0:I.objects)==null?void 0:C[t])==null?void 0:y.selectedFieldMappings)||{},p={...l},m={...d};return{allFields:a,requiredFields:i,optionalFields:o,requiredMapFields:s,selectedOptionalFields:l,selectedFieldMappings:d,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:p,requiredMapFields:m}}},Jp=(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 Zs(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:Wp(r,t,n),write:Jp(i,n)}}const Qs=(e,t,n,r)=>{const i=Zs(e,n,t);r(n,i)},zp=(e,t,n)=>{const r=qp(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=Zs(e,o,t))}),n(i)},ea=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(Bp(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},ta=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 na(e,t){return t[e]||void 0}async function Ko({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 Ce().installationApi.createInstallation(l,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){ze(d,s)}}function $r(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Xp=(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)},Gp=(e,t,n,r)=>{const i=ea(e),o=ta(e),s=Xp(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},Yp=(e,t,n,r,i,o,s,a,c,l,d,p)=>{const m=Gp(c,o,a,r);return m?Ko({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:l,setInstallation:d,onInstallSuccess:p}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},ra=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},Zp=e=>{const t=e.content.write;return t==null?void 0:t.objects},Qp=(e,t,n)=>{if(!Zp(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=ra(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},ef=(e,t,n,r,i,o,s,a,c,l,d)=>{const p=Qp(a,s,r);return p?Ko({createConfig:p,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))},tf={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 oa({children:e,style:t}){return u.jsx(yn,{style:{...tf,...t},children:e})}var ia={exports:{}};/*!
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),g=require("react");require("react-dom");function jl(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=jl(g),Ss=g.createContext(null),Fl=Ss.Provider,He=()=>{const e=g.useContext(Ss);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var Ce=(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))(Ce||{});const Ns=g.createContext(void 0);function Yt(){const e=g.useContext(Ns);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Ml=(()=>{const e={};return Object.values(Ce).forEach(t=>{e[t]={}}),e})();function kl({children:e}){const[t,n]=g.useState(Ml),r=g.useCallback((d,p,m=!0)=>{n(f=>{const v={...f};return v[d]=v[d]||{},v[d][p]=m,v})},[n]),i=g.useCallback((d,p)=>{var m;return!!((m=t[d])!=null&&m[p])},[t]),o=g.useCallback((d,p)=>{var m;return(m=t[d])==null?void 0:m[p]},[t]),s=g.useCallback((d,p)=>{n(m=>{var v;const f={...m};return(v=f[d])==null||delete v[p],f})},[n]),a=g.useCallback(d=>{n(p=>{const m={...p};return m[d]={},m})},[n]),c=g.useCallback((d,p)=>{n(m=>{const f={...m};return f[d]=f[d]||{},p.forEach(v=>{f[d][v]=!0}),f})},[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(Ns.Provider,{value:l,children:e})}const Ll="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ts{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||As}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 Ts,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 Rs(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 Rs 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 re 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 As(e,t=""){return Object.keys(e).map(n=>Ps(n,e[n],t)).filter(n=>n.length>0).join("&")}function Ps(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 Ps(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?As(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function ko(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 pn{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 Ds(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 js(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:ko(e.objects,lu)}}function du(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function pu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:ko(e.objects,du)}}function fu(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 Fs(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:js(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 Ms(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:Ms(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:Fs(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 ks(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),...ks(e)}}function ji(e){if(e!==void 0)return e===null?null:Mu(e)?Lu(e):$u(e)?Ku(e):{}}function Ls(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")?Ls(e.optionalFieldsAuto):void 0,backfill:L(e,"backfill")?Ds(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 pd(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 fd(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),...ks(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")?Ls(e.optionalFieldsAuto):void 0,allFields:L(e,"allFields")?e.allFields.map(eo):void 0,backfill:L(e,"backfill")?Ds(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")?fd(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:Fs(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")?Ms(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")?fu(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:pu(e.write),proxy:js(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 ep(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function tp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:ep(e.project)}}function np(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function rp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:np(e.providerApp)}}class op extends Et{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:i,query:r},n);return new pn(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("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:pd(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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("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 re("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 ip extends Et{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new re("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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("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 pn(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new re("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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new re("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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new re("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 sp extends Et{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new re("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 pn(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new re("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 pn(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("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 ap extends Et{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new re("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 cp extends Et{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new re("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 re("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 pn(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new re("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:tp(t.projectUpdate)},n);return new Ae(o,s=>dr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class lp extends Et{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new re("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=>ko(o,Mi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class up extends Et{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new re("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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("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 pn(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new re("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:r,body:rp(t.providerAppUpdate)},n);return new Ae(o,s=>wr(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class dp extends Et{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("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 pn(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new re("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new re("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 pp{constructor(t){this.connectionApi=new op(t),this.installationApi=new ip(t),this.integrationApi=new sp(t),this.oAuthApi=new ap(t),this.projectApi=new cp(t),this.providerApi=new lp(t),this.providerAppApi=new up(t),this.revisionApi=new dp(t)}}const fp="2.0.7",mp="v1",pr="https://api.withampersand.com";function $s(){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 pr;case"mock":return"http://127.0.0.1:4010";case"":return pr;default:return e??pr}}catch{return pr}}const hp=(e,t)=>`${e}/${t}`;function gp(){return hp($s(),mp)}const vp=$s(),yp=gp(),wp=new Ts({basePath:yp,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":fp}});let Ip=new pp(wp);const Oe=()=>Ip,ze=async(e,t)=>{var n;if(e instanceof Rs){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)},Ks=g.createContext({integrations:null,isLoading:!0}),Lo=()=>{const e=g.useContext(Ks);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function _p({projectIdOrName:e,children:t}){const n=He(),{setError:r}=Yt(),[i,o]=g.useState(null),[s,a]=g.useState(!0);g.useEffect(()=>{Oe().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(l=>{a(!1),o(l||[])}).catch(l=>{console.error("Error retrieving integration information."),ze(l),a(!1),r(Ce.INTEGRATION_LIST,e)})},[e,n,r]);const c=g.useMemo(()=>({integrations:i,isLoading:s}),[i,s]);return u.jsx(Ks.Provider,{value:c,children:t})}const Vs=g.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Pe=()=>{const e=g.useContext(Vs);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function bp({projectIdOrName:e,children:t}){const n=He(),{setError:r}=Yt(),[i,o]=g.useState(null),[s,a]=g.useState(!0);g.useEffect(()=>{Oe().projectApi.getProject({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(l=>{a(!1),o(l)}).catch(l=>{console.error("Error loading Ampersand project."),ze(l),r(Ce.PROJECT,e),a(!1)})},[e,n,a,r]);const c=g.useMemo(()=>({projectId:(i==null?void 0:i.id)||"",projectIdOrName:e,project:i,appName:(i==null?void 0:i.appName)||"",isLoading:s}),[e,i,s]);return u.jsx(Vs.Provider,{value:c,children:t})}function xp(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(kl,{children:u.jsx(Fl,{value:t,children:u.jsx(bp,{projectIdOrName:o,children:u.jsx(_p,{projectIdOrName:o,children:i})})})})}const Hs=g.createContext(null);function Cp(){const e=g.useContext(Hs);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
3
|
+
component is wrapped with AmpersandProvider`);return e}function Op(){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 Ep="_box_1p7c5_1",ki={box:Ep};function Zt({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${ki.box} ${t}`:ki.box,style:n,children:e})}const Sp="_container_1wvzr_1",Li={container:Sp};function Pn({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Li.container} ${t}`:Li.container,style:n,children:e})}const Np="_errorBoxContainer_4sdb2_1",Tp="_errorBox_4sdb2_1",Rp="_errorText_4sdb2_20",to={errorBoxContainer:Np,errorBox:Tp,errorText:Rp};function Us({message:e}){return u.jsxs(Pn,{className:to.errorBoxContainer,children:[u.jsx(Op,{}),u.jsx(Zt,{className:to.errorBox,children:u.jsx("p",{className:to.errorText,children:e})})]})}const Ap="_loader_6ubm6_1",Pp="_rotate_6ubm6_1",Dp="_ball1_6ubm6_1",jp="_ball2_6ubm6_1",Fp={loader:Ap,rotate:Pp,ball1:Dp,ball2:jp};function Mp(){return u.jsx("span",{className:Fp.loader})}function Un(){return u.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:u.jsx(Mp,{})})}function Bs({children:e}){return u.jsx(Pn,{style:{maxWidth:"55rem"},children:u.jsx(Zt,{children:e})})}function $r(){return u.jsx(Bs,{children:u.jsx(Un,{})})}function Lt({message:e}){return u.jsx(Bs,{children:u.jsx(Us,{message:e})})}const qs=()=>{const[e,t]=g.useState(!1),n=g.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}};function Bn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Qt(e,t){return(t==null?void 0:t.displayName)??Bn(e)}const kp=e=>e.split(`
|
|
4
|
+
`).filter(n=>n.trim()!==""),Lp=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Ws=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 dt(){const e=g.useContext(Ws);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function $p({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:l}){const d=He(),{projectId:p}=Pe(),{integrations:m}=Lo(),{setError:f,isError:v}=Yt(),{isIntegrationDeleted:w,setIntegrationDeleted:I}=qs(),[C,y]=g.useState([]),[x,b]=g.useState(!0),_=(C==null?void 0:C[0])||null,E=g.useMemo(()=>Lp(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&&Oe().installationApi.listInstallations({projectIdOrName:p,integrationId:E.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(z=>{b(!1),y(z||[])}).catch(z=>{f(Ce.INSTALLATION_LIST,E.id),b(!1),console.error("Error retrieving installation information: ",z)})},[E,p,d,f,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(x)return u.jsx($r,{});if(E===null)return u.jsx(Lt,{message:`Integration "${t}" not found`});if(v(Ce.INSTALLATION_LIST,J)){const z=`Error retrieving installation information for integration "${(E==null?void 0:E.name)||"unknown"}"`;return u.jsx(Lt,{message:z})}return u.jsx(Ws.Provider,{value:q,children:e})}const Js=g.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{},isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}}),yn=()=>{const e=g.useContext(Js);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function zs({provider:e,groupRef:t,children:n}){const r=He(),{projectId:i,isLoading:o}=Pe(),[s,a]=g.useState(null),[c,l]=g.useState(null),[d,p]=g.useState(!0),{setError:m,isError:f}=Yt(),{provider:v}=dt(),{isIntegrationDeleted:w,setIntegrationDeleted:I}=qs(),C=e||v;if(!C)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");g.useEffect(()=>{i&&r&&Oe().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:C},{headers:{"X-Api-Key":r??""}}).then(x=>{p(!1),a(x)}).catch(x=>{console.error(`Error retrieving existing OAuth connections for group ID ${t}.`),ze(x),p(!1),m(Ce.CONNECTION_LIST,i)})},[i,r,t,C,m]);const y=g.useMemo(()=>({connections:s,selectedConnection:c,setConnections:a,setSelectedConnection:l,isIntegrationDeleted:w,setIntegrationDeleted:I}),[s,c,a,l,w,I]);if(d||o)return u.jsx($r,{});if(f(Ce.PROJECT,i))return u.jsx(Lt,{message:`Error loading project ${i}`});if(f(Ce.CONNECTION_LIST,i))return u.jsx(Lt,{message:"Error retrieving existing connections"});if(!i)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return u.jsx(Js.Provider,{value:y,children:n})}function Xs(){const[e,t]=g.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const Kp="_resetContainer_lkwv9_4",Gs={resetContainer:Kp};var fr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $o(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]",p="[object Date]",m="[object Error]",f="[object Function]",v="[object GeneratorFunction]",w="[object Map]",I="[object Number]",C="[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]",fe="[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[fe]=R[S]=R[P]=!0,R[a]=R[c]=R[z]=R[d]=R[Y]=R[p]=R[m]=R[f]=R[w]=R[I]=R[y]=R[_]=R[E]=R[$]=R[q]=!1;var X=typeof fr=="object"&&fr&&fr.Object===Object&&fr,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,pe=function(){try{return A&&A.binding&&A.binding("util")}catch{}}(),V=pe&&pe.isTypedArray;function we(h,O){for(var N=-1,W=h==null?0:h.length,be=0,ce=[];++N<W;){var Te=h[N];O(Te,N,h)&&(ce[be++]=Te)}return ce}function De(h,O){for(var N=-1,W=O.length,be=h.length;++N<W;)h[be+N]=O[N];return h}function Ue(h,O){for(var N=-1,W=h==null?0:h.length;++N<W;)if(O(h[N],N,h))return!0;return!1}function je(h,O){for(var N=-1,W=Array(h);++N<h;)W[N]=O(N);return W}function me(h){return function(O){return h(O)}}function gt(h,O){return h.has(O)}function Be(h,O){return h==null?void 0:h[O]}function nt(h){var O=-1,N=Array(h.size);return h.forEach(function(W,be){N[++O]=[be,W]}),N}function vt(h,O){return function(N){return h(O(N))}}function yt(h){var O=-1,N=Array(h.size);return h.forEach(function(W){N[++O]=W}),N}var qe=Array.prototype,$e=Function.prototype,Fe=Object.prototype,Ee=K["__core-js_shared__"],wt=$e.toString,Xe=Fe.hasOwnProperty,Tt=function(){var h=/[^.]+$/.exec(Ee&&Ee.keys&&Ee.keys.IE_PROTO||"");return h?"Symbol(src)_1."+h:""}(),$t=Fe.toString,rt=RegExp("^"+wt.call(Xe).replace(M,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Se=ae?K.Buffer:void 0,Rt=K.Symbol,Kt=K.Uint8Array,At=Fe.propertyIsEnumerable,tn=qe.splice,Ze=Rt?Rt.toStringTag:void 0,Pt=Object.getOwnPropertySymbols,Vt=Se?Se.isBuffer:void 0,nn=vt(Object.keys,Object),Ht=In(K,"DataView"),xe=In(K,"Map"),Ge=In(K,"Promise"),te=In(K,"Set"),ue=In(K,"WeakMap"),Me=In(Object,"create"),Dt=sn(Ht),H=sn(xe),oe=sn(Ge),ie=sn(te),Re=sn(ue),ke=Rt?Rt.prototype:void 0,Qe=ke?ke.valueOf:void 0;function Ke(h){var O=-1,N=h==null?0:h.length;for(this.clear();++O<N;){var W=h[O];this.set(W[0],W[1])}}function We(){this.__data__=Me?Me(null):{},this.size=0}function et(h){var O=this.has(h)&&delete this.__data__[h];return this.size-=O?1:0,O}function _e(h){var O=this.__data__;if(Me){var N=O[h];return N===r?void 0:N}return Xe.call(O,h)?O[h]:void 0}function rn(h){var O=this.__data__;return Me?O[h]!==void 0:Xe.call(O,h)}function Yr(h,O){var N=this.__data__;return this.size+=this.has(h)?0:1,N[h]=Me&&O===void 0?r:O,this}Ke.prototype.clear=We,Ke.prototype.delete=et,Ke.prototype.get=_e,Ke.prototype.has=rn,Ke.prototype.set=Yr;function pt(h){var O=-1,N=h==null?0:h.length;for(this.clear();++O<N;){var W=h[O];this.set(W[0],W[1])}}function nr(){this.__data__=[],this.size=0}function rr(h){var O=this.__data__,N=sr(O,h);if(N<0)return!1;var W=O.length-1;return N==W?O.pop():tn.call(O,N,1),--this.size,!0}function or(h){var O=this.__data__,N=sr(O,h);return N<0?void 0:O[N][1]}function Ie(h){return sr(this.__data__,h)>-1}function It(h,O){var N=this.__data__,W=sr(N,h);return W<0?(++this.size,N.push([h,O])):N[W][1]=O,this}pt.prototype.clear=nr,pt.prototype.delete=rr,pt.prototype.get=or,pt.prototype.has=Ie,pt.prototype.set=It;function _t(h){var O=-1,N=h==null?0:h.length;for(this.clear();++O<N;){var W=h[O];this.set(W[0],W[1])}}function on(){this.size=0,this.__data__={hash:new Ke,map:new(xe||pt),string:new Ke}}function Zr(h){var O=ar(this,h).delete(h);return this.size-=O?1:0,O}function Fn(h){return ar(this,h).get(h)}function ol(h){return ar(this,h).has(h)}function il(h,O){var N=ar(this,h),W=N.size;return N.set(h,O),this.size+=N.size==W?0:1,this}_t.prototype.clear=on,_t.prototype.delete=Zr,_t.prototype.get=Fn,_t.prototype.has=ol,_t.prototype.set=il;function ir(h){var O=-1,N=h==null?0:h.length;for(this.__data__=new _t;++O<N;)this.add(h[O])}function sl(h){return this.__data__.set(h,r),this}function al(h){return this.__data__.has(h)}ir.prototype.add=ir.prototype.push=sl,ir.prototype.has=al;function Ut(h){var O=this.__data__=new pt(h);this.size=O.size}function cl(){this.__data__=new pt,this.size=0}function ll(h){var O=this.__data__,N=O.delete(h);return this.size=O.size,N}function ul(h){return this.__data__.get(h)}function dl(h){return this.__data__.has(h)}function pl(h,O){var N=this.__data__;if(N instanceof pt){var W=N.__data__;if(!xe||W.length<n-1)return W.push([h,O]),this.size=++N.size,this;N=this.__data__=new _t(W)}return N.set(h,O),this.size=N.size,this}Ut.prototype.clear=cl,Ut.prototype.delete=ll,Ut.prototype.get=ul,Ut.prototype.has=dl,Ut.prototype.set=pl;function fl(h,O){var N=cr(h),W=!N&&Nl(h),be=!N&&!W&&Qr(h),ce=!N&&!W&&!be&&Ai(h),Te=N||W||be||ce,Ve=Te?je(h.length,String):[],Je=Ve.length;for(var Ne in h)Xe.call(h,Ne)&&!(Te&&(Ne=="length"||be&&(Ne=="offset"||Ne=="parent")||ce&&(Ne=="buffer"||Ne=="byteLength"||Ne=="byteOffset")||xl(Ne,Je)))&&Ve.push(Ne);return Ve}function sr(h,O){for(var N=h.length;N--;)if(Si(h[N][0],O))return N;return-1}function ml(h,O,N){var W=O(h);return cr(h)?W:De(W,N(h))}function Mn(h){return h==null?h===void 0?J:C:Ze&&Ze in Object(h)?_l(h):Sl(h)}function xi(h){return kn(h)&&Mn(h)==a}function Ci(h,O,N,W,be){return h===O?!0:h==null||O==null||!kn(h)&&!kn(O)?h!==h&&O!==O:hl(h,O,N,W,Ci,be)}function hl(h,O,N,W,be,ce){var Te=cr(h),Ve=cr(O),Je=Te?c:Bt(h),Ne=Ve?c:Bt(O);Je=Je==a?y:Je,Ne=Ne==a?y:Ne;var ot=Je==y,bt=Ne==y,Ye=Je==Ne;if(Ye&&Qr(h)){if(!Qr(O))return!1;Te=!0,ot=!1}if(Ye&&!ot)return ce||(ce=new Ut),Te||Ai(h)?Oi(h,O,N,W,be,ce):wl(h,O,Je,N,W,be,ce);if(!(N&i)){var ft=ot&&Xe.call(h,"__wrapped__"),mt=bt&&Xe.call(O,"__wrapped__");if(ft||mt){var qt=ft?h.value():h,jt=mt?O.value():O;return ce||(ce=new Ut),be(qt,jt,N,W,ce)}}return Ye?(ce||(ce=new Ut),Il(h,O,N,W,be,ce)):!1}function gl(h){if(!Ri(h)||Ol(h))return!1;var O=Ni(h)?rt:j;return O.test(sn(h))}function vl(h){return kn(h)&&Ti(h.length)&&!!R[Mn(h)]}function yl(h){if(!El(h))return nn(h);var O=[];for(var N in Object(h))Xe.call(h,N)&&N!="constructor"&&O.push(N);return O}function Oi(h,O,N,W,be,ce){var Te=N&i,Ve=h.length,Je=O.length;if(Ve!=Je&&!(Te&&Je>Ve))return!1;var Ne=ce.get(h);if(Ne&&ce.get(O))return Ne==O;var ot=-1,bt=!0,Ye=N&o?new ir:void 0;for(ce.set(h,O),ce.set(O,h);++ot<Ve;){var ft=h[ot],mt=O[ot];if(W)var qt=Te?W(mt,ft,ot,O,h,ce):W(ft,mt,ot,h,O,ce);if(qt!==void 0){if(qt)continue;bt=!1;break}if(Ye){if(!Ue(O,function(jt,an){if(!gt(Ye,an)&&(ft===jt||be(ft,jt,N,W,ce)))return Ye.push(an)})){bt=!1;break}}else if(!(ft===mt||be(ft,mt,N,W,ce))){bt=!1;break}}return ce.delete(h),ce.delete(O),bt}function wl(h,O,N,W,be,ce,Te){switch(N){case Y:if(h.byteLength!=O.byteLength||h.byteOffset!=O.byteOffset)return!1;h=h.buffer,O=O.buffer;case z:return!(h.byteLength!=O.byteLength||!ce(new Kt(h),new Kt(O)));case d:case p:case I:return Si(+h,+O);case m:return h.name==O.name&&h.message==O.message;case _:case $:return h==O+"";case w:var Ve=nt;case E:var Je=W&i;if(Ve||(Ve=yt),h.size!=O.size&&!Je)return!1;var Ne=Te.get(h);if(Ne)return Ne==O;W|=o,Te.set(h,O);var ot=Oi(Ve(h),Ve(O),W,be,ce,Te);return Te.delete(h),ot;case T:if(Qe)return Qe.call(h)==Qe.call(O)}return!1}function Il(h,O,N,W,be,ce){var Te=N&i,Ve=Ei(h),Je=Ve.length,Ne=Ei(O),ot=Ne.length;if(Je!=ot&&!Te)return!1;for(var bt=Je;bt--;){var Ye=Ve[bt];if(!(Te?Ye in O:Xe.call(O,Ye)))return!1}var ft=ce.get(h);if(ft&&ce.get(O))return ft==O;var mt=!0;ce.set(h,O),ce.set(O,h);for(var qt=Te;++bt<Je;){Ye=Ve[bt];var jt=h[Ye],an=O[Ye];if(W)var Pi=Te?W(an,jt,Ye,O,h,ce):W(jt,an,Ye,h,O,ce);if(!(Pi===void 0?jt===an||be(jt,an,N,W,ce):Pi)){mt=!1;break}qt||(qt=Ye=="constructor")}if(mt&&!qt){var lr=h.constructor,ur=O.constructor;lr!=ur&&"constructor"in h&&"constructor"in O&&!(typeof lr=="function"&&lr instanceof lr&&typeof ur=="function"&&ur instanceof ur)&&(mt=!1)}return ce.delete(h),ce.delete(O),mt}function Ei(h){return ml(h,Al,bl)}function ar(h,O){var N=h.__data__;return Cl(O)?N[typeof O=="string"?"string":"hash"]:N.map}function In(h,O){var N=Be(h,O);return gl(N)?N:void 0}function _l(h){var O=Xe.call(h,Ze),N=h[Ze];try{h[Ze]=void 0;var W=!0}catch{}var be=$t.call(h);return W&&(O?h[Ze]=N:delete h[Ze]),be}var bl=Pt?function(h){return h==null?[]:(h=Object(h),we(Pt(h),function(O){return At.call(h,O)}))}:Pl,Bt=Mn;(Ht&&Bt(new Ht(new ArrayBuffer(1)))!=Y||xe&&Bt(new xe)!=w||Ge&&Bt(Ge.resolve())!=x||te&&Bt(new te)!=E||ue&&Bt(new ue)!=q)&&(Bt=function(h){var O=Mn(h),N=O==y?h.constructor:void 0,W=N?sn(N):"";if(W)switch(W){case Dt:return Y;case H:return w;case oe:return x;case ie:return E;case Re:return q}return O});function xl(h,O){return O=O??s,!!O&&(typeof h=="number"||D.test(h))&&h>-1&&h%1==0&&h<O}function Cl(h){var O=typeof h;return O=="string"||O=="number"||O=="symbol"||O=="boolean"?h!=="__proto__":h===null}function Ol(h){return!!Tt&&Tt in h}function El(h){var O=h&&h.constructor,N=typeof O=="function"&&O.prototype||Fe;return h===N}function Sl(h){return $t.call(h)}function sn(h){if(h!=null){try{return wt.call(h)}catch{}try{return h+""}catch{}}return""}function Si(h,O){return h===O||h!==h&&O!==O}var Nl=xi(function(){return arguments}())?xi:function(h){return kn(h)&&Xe.call(h,"callee")&&!At.call(h,"callee")},cr=Array.isArray;function Tl(h){return h!=null&&Ti(h.length)&&!Ni(h)}var Qr=Vt||Dl;function Rl(h,O){return Ci(h,O)}function Ni(h){if(!Ri(h))return!1;var O=Mn(h);return O==f||O==v||O==l||O==b}function Ti(h){return typeof h=="number"&&h>-1&&h%1==0&&h<=s}function Ri(h){var O=typeof h;return h!=null&&(O=="object"||O=="function")}function kn(h){return h!=null&&typeof h=="object"}var Ai=V?me(V):vl;function Al(h){return Tl(h)?fl(h):yl(h)}function Pl(){return[]}function Dl(){return!1}e.exports=Rl})(Cr,Cr.exports);var Vp=Cr.exports;const Hp=$o(Vp),fn="other",Or="uninstall-installation";function zt(e){return!e.fieldName}function Up(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Bp(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!zt(n)&&!!n.fieldName))||null}function qp(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>zt(r)&&!!r.mapToName))||[]}function Wp(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!zt(n)&&!!n.fieldName))||null}const Ys=(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 Jp(e){return zt(e)?e.mapToName:e.fieldName}const Zs=(e,t)=>{var r,i,o;const n=[];return(o=(i=(r=t.content)==null?void 0:r.read)==null?void 0:i.objects)==null||o.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Bn(s==null?void 0:s.objectName),completed:e?!!Ys(e,s.objectName):!1})}),n},Qs=e=>{var n;return{name:fn,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function zp(e,t){var o;const n=Zs(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?Qs(e):void 0;return i&&n.push(i),n}function ea(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(Ce.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Ko(e,t){return Hp(e,t)}const Xp=(e,t,n)=>{var f,v,w,I,C,y;if(!e)return null;const r=Up(e,t),i=r&&Bp(r),o=r&&Wp(r),s=r&&qp(r),a=(r==null?void 0:r.allFields)||[],c=n==null?void 0:n.content,l=((w=(v=(f=c==null?void 0:c.read)==null?void 0:f.objects)==null?void 0:v[t])==null?void 0:w.selectedFields)||{},d=((y=(C=(I=c==null?void 0:c.read)==null?void 0:I.objects)==null?void 0:C[t])==null?void 0:y.selectedFieldMappings)||{},p={...l},m={...d};return{allFields:a,requiredFields:i,optionalFields:o,requiredMapFields:s,selectedOptionalFields:l,selectedFieldMappings:d,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:p,requiredMapFields:m}}},Gp=(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 ta(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:Xp(r,t,n),write:Gp(i,n)}}const na=(e,t,n,r)=>{const i=ta(e,n,t);r(n,i)},Yp=(e,t,n)=>{const r=zp(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=ta(e,o,t))}),n(i)},ra=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(Jp(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},oa=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 ia(e,t){return t[e]||void 0}async function Vo({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 Oe().installationApi.createInstallation(l,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){ze(d,s)}}function Kr(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Zp=(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)},Qp=(e,t,n,r)=>{const i=ra(e),o=oa(e),s=Zp(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 Kr(n)&&(a.content.proxy={enabled:!0}),a},ef=(e,t,n,r,i,o,s,a,c,l,d,p)=>{const m=Qp(c,o,a,r);return m?Vo({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:l,setInstallation:d,onInstallSuccess:p}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},sa=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},tf=e=>{const t=e.content.write;return t==null?void 0:t.objects},nf=(e,t,n)=>{if(!tf(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=sa(e),o={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return Kr(t)&&(o.content.proxy={enabled:!0}),o},rf=(e,t,n,r,i,o,s,a,c,l,d)=>{const p=nf(a,s,r);return p?Vo({createConfig:p,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))},of={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 aa({children:e,style:t}){return u.jsx(Zt,{style:{...of,...t},children:e})}var ca={exports:{}};/*!
|
|
5
5
|
Copyright (c) 2018 Jed Watson.
|
|
6
6
|
Licensed under the MIT License (MIT), see
|
|
7
7
|
http://jedwatson.github.io/classnames
|
|
8
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(o=i(o,r(a)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var a in o)t.call(o,a)&&o[a]&&(s=i(s,a));return s}function i(o,s){return s?o?o+" "+s:o+s:o}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(
|
|
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})()})(ca);var sf=ca.exports;const st=$o(sf),af="_button_lcw4f_1",cf="_buttonError_lcw4f_21",lf="_danger_lcw4f_35",uf="_ghost_lcw4f_41",no={button:af,buttonError:cf,danger:lf,ghost:uf};function ct({className:e,style:t,type:n,children:r,variant:i,...o}){const s=st(no.button,{[no.danger]:i==="danger",[no.ghost]:i==="ghost",[e||""]:!!e});return u.jsx("button",{type:n,className:s,style:t,...o,children:r})}const la=g.createContext({hydratedRevision:null,loading:!1}),Dn=()=>{const e=g.useContext(la);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function df({projectId:e,children:t}){var C;const{selectedConnection:n}=yn(),{integrationId:r,integrationObj:i}=dt(),[o,s]=g.useState(null),[a,c]=g.useState(!0),{isError:l,removeError:d,setError:p}=Yt(),m=He(),f=n==null?void 0:n.id,v=(C=i==null?void 0:i.latestRevision)==null?void 0:C.id,w=(i==null?void 0:i.name)||r;g.useEffect(()=>{e&&r&&v&&f&&m&&Oe().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:r,revisionId:v,connectionId:f},{headers:{"X-Api-Key":m??""}}).then(y=>{s(y),c(!1),d(Ce.HYDRATED_REVISION,w)}).catch(y=>{console.error(`Error loading integration ${w}.`),ze(y),c(!1),p(Ce.HYDRATED_REVISION,w)})},[e,r,v,f,m,d,p,w]);const I=g.useMemo(()=>({hydratedRevision:o,loading:a}),[o,a]);if(l(Ce.HYDRATED_REVISION,w)){const x=`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(Lt,{message:x})}return u.jsx(la.Provider,{value:I,children: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 yo(e,t){return yo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},yo(e,t)}function pf(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,yo(e,t)}var wo={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
|
|
15
|
+
*/var $i;function ff(){if($i)return he;$i=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,p=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,I=e?Symbol.for("react.fundamental"):60117,C=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 p:return _;default:switch(_=_&&_.$$typeof,_){case a:case d:case v:case f: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=f,he.Portal=n,he.Profiler=o,he.StrictMode=i,he.Suspense=p,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(_)===f},he.isPortal=function(_){return x(_)===n},he.isProfiler=function(_){return x(_)===o},he.isStrictMode=function(_){return x(_)===i},he.isSuspense=function(_){return x(_)===p},he.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===l||_===o||_===i||_===p||_===m||typeof _=="object"&&_!==null&&(_.$$typeof===v||_.$$typeof===f||_.$$typeof===s||_.$$typeof===a||_.$$typeof===d||_.$$typeof===I||_.$$typeof===C||_.$$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
|
|
22
|
+
*/var Ki;function mf(){return Ki||(Ki=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,p=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,I=e?Symbol.for("react.fundamental"):60117,C=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===p||A===m||typeof A=="object"&&A!==null&&(A.$$typeof===v||A.$$typeof===f||A.$$typeof===s||A.$$typeof===a||A.$$typeof===d||A.$$typeof===I||A.$$typeof===C||A.$$typeof===y||A.$$typeof===w)}function b(A){if(typeof A=="object"&&A!==null){var pe=A.$$typeof;switch(pe){case t:var V=A.type;switch(V){case c:case l:case r:case o:case i:case p:return V;default:var we=V&&V.$$typeof;switch(we){case a:case d:case v:case f:case s:return we;default:return pe}}case n:return pe}}}var _=c,E=l,$=a,T=s,J=t,q=d,z=r,Y=v,ee=f,U=n,se=o,ne=i,Q=p,de=!1;function fe(A){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),S(A)||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)===f}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)===p}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=fe,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 Vi;function ua(){return Vi||(Vi=1,process.env.NODE_ENV==="production"?mr.exports=ff():mr.exports=mf()),mr.exports}/*
|
|
23
23
|
object-assign
|
|
24
24
|
(c) Sindre Sorhus
|
|
25
25
|
@license MIT
|
|
26
|
-
*/var
|
|
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=p(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 fe(S){return!S.constructor||!S.constructor.name?m:S.constructor.name}return f.checkPropTypes=i,f.resetWarningCache=i.resetWarningCache,f.PropTypes=f,f},
|
|
26
|
+
*/var ro,Hi;function hf(){if(Hi)return ro;Hi=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 ro=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 p in a)t.call(a,p)&&(c[p]=a[p]);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},ro}var oo,Ui;function Ho(){if(Ui)return oo;Ui=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return oo=e,oo}var io,Bi;function da(){return Bi||(Bi=1,io=Function.call.bind(Object.prototype.hasOwnProperty)),io}var so,qi;function gf(){if(qi)return so;qi=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Ho(),n={},r=da();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 p;try{if(typeof o[d]!="function"){var m=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}p=o[d](s,d,c,a,null,t)}catch(v){p=v}if(p&&!(p instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof p+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),p instanceof Error&&!(p.message in n)){n[p.message]=!0;var f=l?l():"";e("Failed "+a+" type: "+p.message+(f??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},so=i,so}var ao,Wi;function vf(){if(Wi)return ao;Wi=1;var e=ua(),t=hf(),n=Ho(),r=da(),i=gf(),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 ao=function(a,c){var l=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function p(S){var P=S&&(l&&S[l]||S[d]);if(typeof P=="function")return P}var m="<<anonymous>>",f={array:C("array"),bigint:C("bigint"),bool:C("boolean"),func:C("function"),number:C("number"),object:C("object"),string:C("string"),symbol:C("symbol"),any:y(),arrayOf: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 pe=K+":"+G;!P[pe]&&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[pe]=!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 C(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=fe(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 pe=Q(A);return pe==="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 pe=Z.length>0?", expected one of type ["+Z.join(", ")+"]":"";return new w("Invalid "+G+" `"+K+"` supplied to "+("`"+X+"`"+pe+"."))}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=p(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 fe(S){return!S.constructor||!S.constructor.name?m:S.constructor.name}return f.checkPropTypes=i,f.resetWarningCache=i.resetWarningCache,f.PropTypes=f,f},ao}var co,Ji;function yf(){if(Ji)return co;Ji=1;var e=Ho();function t(){}function n(){}return n.resetWarningCache=t,co=function(){function r(s,a,c,l,d,p){if(p!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},co}if(process.env.NODE_ENV!=="production"){var wf=ua(),If=!0;wo.exports=vf()(wf.isElement,If)}else wo.exports=yf()();var _f=wo.exports;const F=$o(_f);var Io={exports:{}},ve={};/**
|
|
28
28
|
* @license React
|
|
29
29
|
* react-is.production.min.js
|
|
30
30
|
*
|
|
@@ -32,7 +32,7 @@ Valid keys: `+JSON.stringify(Object.keys(S),null," "));var A=ae(G,B,D,R,X+"."+B
|
|
|
32
32
|
*
|
|
33
33
|
* This source code is licensed under the MIT license found in the
|
|
34
34
|
* LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/var
|
|
35
|
+
*/var zi;function bf(){if(zi)return ve;zi=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"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),v;v=Symbol.for("react.module.reference");function w(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 l:case d:return I;default:switch(I=I&&I.$$typeof,I){case a:case s:case c:case m:case p:case o:return I;default:return C}}case t:return C}}}return ve.ContextConsumer=s,ve.ContextProvider=o,ve.Element=e,ve.ForwardRef=c,ve.Fragment=n,ve.Lazy=m,ve.Memo=p,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)===p},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===f||typeof I=="object"&&I!==null&&(I.$$typeof===m||I.$$typeof===p||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(S),null," "));var A=ae(G,B,D,R,X+"."+B
|
|
|
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 zi;function If(){return zi||(zi=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"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),v=!1,w=!1,I=!1,C=!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||C||V===f||v||w||I||typeof V=="object"&&V!==null&&(V.$$typeof===m||V.$$typeof===p||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 De=V.type;switch(De){case n:case i:case r:case l:case d:return De;default:var Ue=De&&De.$$typeof;switch(Ue){case a:case s:case c:case m:case p:case o:return Ue;default:return we}}case t:return we}}}var E=s,$=o,T=e,J=c,q=n,z=m,Y=p,ee=t,U=i,se=r,ne=l,Q=d,de=!1,fe=!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 fe||(fe=!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)===p}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 pe(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=pe,ye.isValidElementType=b,ye.typeOf=_}()),ye}process.env.NODE_ENV==="production"?wo.exports=wf():wo.exports=If();var Xi=wo.exports;const Gi=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Yi=(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 Yi(n.overflowY,t)||Yi(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,_f=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},bf=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:l,skipOverflowHiddenElements:d}=t,p=typeof l=="function"?l:ne=>ne!==l;if(!Gi(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,f=[];let v=e;for(;Gi(v)&&p(v);){if(v=_f(v),v===m){f.push(v);break}v!=null&&v===document.body&&co(v)&&!co(document.documentElement)||v!=null&&co(v,d)&&f.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:C,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<f.length;ne++){const Q=f[ne],{height:de,width:fe,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,pe="offsetWidth"in Q?Q.offsetWidth===0?0:fe/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(C,C+w,w,R,G,C+U,C+U+b,b),Z=Math.max(0,Z+y),B=Math.max(0,B+C);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+fe/2)+ae/2:c==="end"?U-P+G+ae:hr(j,P,fe,R,G+ae,U,U+b,b);const{scrollLeft:we,scrollTop:De}=Q;Z=V===0?0:Math.max(0,Math.min(De+Z/V,Q.scrollHeight-de/V+A)),B=pe===0?0:Math.max(0,Math.min(we+B/pe,Q.scrollWidth-fe/pe+ae)),ee+=De-Z,U+=we-B}se.push({el:Q,top:Z,left:B})}return se};var On=function(){return On=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},On.apply(this,arguments)};var xf=0;function Zi(e){return typeof e=="function"?e:it}function it(){}function la(e,t){if(e){var n=bf(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 Qi(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Ho(e,t){var n;function r(){n&&clearTimeout(n)}function i(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return i.cancel=r,i}function Le(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(o)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function xn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(i){typeof i=="function"?i(r):i&&(i.current=r)})}}function ua(){return String(xf++)}function Cf(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 es(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function da(e){return typeof e.type=="string"}function pa(e){return e.props}function Of(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Ef=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function gr(e){e===void 0&&(e={});var t={};return Ef.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 Sf(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=En(a,t<0,n,r,i);return c===-1?e>=o?-1:e:c}function En(e,t,n,r,i){i===void 0&&(i=!1);var o=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<o;a++)if(!r(n[a],a))return a;return i?En(t?o-1:0,t,n,r):-1}function Nr(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(Qi(i,e,n)||r&&Qi(i,n.document.activeElement,n))})}var Uo=it;process.env.NODE_ENV!=="production"&&(Uo=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 Nf=Ho(function(e){fa(e).textContent=""},500);function fa(e){var t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}function ma(e,t){if(!(!e||!t)){var n=fa(t);n.textContent=e,Nf(t)}}function Tf(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var ha=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,ga=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,va=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,ya=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,wa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Ia=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,_a=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,ba=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,xa=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Ca=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Oa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,_o=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Ea=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Sa=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Na=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Rf=Object.freeze({__proto__:null,blurButton:Ea,blurInput:xa,changeInput:Ca,clickButton:_o,clickItem:ba,controlledPropUpdatedSelectedItem:Sa,itemMouseEnter:va,keyDownArrowDown:br,keyDownArrowUp:_r,keyDownEnd:_a,keyDownEnter:wa,keyDownEscape:ya,keyDownHome:Ia,keyDownSpaceButton:Oa,mouseUp:ga,touchEnd:Na,unknown:ha}),Af=["refKey","ref"],Pf=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Df=["onKeyDown","onBlur","onChange","onInput","onChangeText"],jf=["refKey","ref"],Ff=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Mf=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+ua(),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=ha),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(){Zi(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(_,Af),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[$]=xn(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:wa})}}},Escape:function(x){x.preventDefault(),this.reset(le({type:ya},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=le({},o.keyDownHandlers,{" ":function(x){x.preventDefault(),this.toggleMenu({type:Oa})}}),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 $=En(0,!1,{length:E},this.isItemDisabled);this.setHighlightedIndex($,{type:Ia})}}},End:function(x){var b=this.getState(),_=b.isOpen;if(_){x.preventDefault();var E=this.getItemCount();if(!(E<=0||!_)){var $=En(E-1,!0,{length:E},this.isItemDisabled);this.setHighlightedIndex($,{type:_a})}}}}),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,Pf),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:Ea})}})},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,Df),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:Ca,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:xa})}})},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(_,jf),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[$]=xn(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:Of("getItemProps","item"):J,z=Mt(b,Ff);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:va}),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:ba})}),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),Zi(x)()})},o.openMenu=function(y){o.internalSetState({isOpen:!0},y)},o.closeMenu=function(y){o.internalSetState({isOpen:!1},y)},o.updateStatus=Ho(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=_,ma(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,p=s.initialIsOpen,m=p===void 0?d:p,f=s.initialInputValue,v=f===void 0?"":f,w=s.initialSelectedItem,I=w===void 0?null:w,C=o.getState({highlightedIndex:l,isOpen:m,inputValue:v,selectedItem:I});return C.selectedItem!=null&&o.props.initialInputValue===void 0&&(C.inputValue=o.props.itemToString(C.selectedItem)),o.state=C,o}lf(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,p=this.id,m=this.getRootProps,f=this.getToggleButtonProps,v=this.getLabelProps,w=this.getMenuProps,I=this.getInputProps,C=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:f,getLabelProps:v,getMenuProps:w,getInputProps:I,getItemProps:C,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:p,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&&ts(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){o.internalClearTimeouts()};else{var s=function(){o.isMouseDown=!0},a=function(f){o.isMouseDown=!1;var v=Nr(f.target,[o._rootNode,o._menuNode],o.props.environment);!v&&o.getState().isOpen&&o.reset({type:ga},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},c=function(){o.isTouchMove=!1},l=function(){o.isTouchMove=!0},d=function(f){var v=Nr(f.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!v&&o.getState().isOpen&&o.reset({type:Na},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},p=this.props.environment;p.addEventListener("mousedown",s),p.addEventListener("mouseup",a),p.addEventListener("touchstart",c),p.addEventListener("touchmove",l),p.addEventListener("touchend",d),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),p.removeEventListener("mousedown",s),p.removeEventListener("mouseup",a),p.removeEventListener("touchstart",c),p.removeEventListener("touchmove",l),p.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,p=c&&this.getState().isOpen&&!o.isOpen,m=c!==d;return p||m},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(Uo(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&ts(this._menuNode,this.getMenuProps)),Sr(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Sa,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=es(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=es(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&&kf(s,this.getRootProps),s;if(da(s))return g.cloneElement(s,this.getRootProps(pa(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(g.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Cf,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Sf(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:la},e.stateChangeTypes=Rf,e}();process.env.NODE_ENV!=="production"&&(Mf.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 ts(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 kf(e,t){var n=t.refKey,r=n!=="ref",i=!da(e);i&&!r&&!Xi.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+'"'),!Xi.isForwardRef(e)&&!pa(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Ta={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Lf(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){$f(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 $f(e,t,n,r){var i=t.props,o=t.type,s="on"+Bo(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](le({type:o},r))}function Kf(e,t){return t.changes}var ns=Ho(function(e,t){ma(e,t)},200),Vf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?g.useLayoutEffect:g.useEffect,Hf="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-"+ua():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 Uf(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 Bo(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Ra(e){var t=g.useRef(e);return t.current=e,t}function Bf(e,t,n,r){var i=g.useRef(),o=g.useRef(),s=g.useCallback(function(f,v){o.current=v,f=Er(f,v.props);var w=e(f,v),I=v.props.stateReducer(f,le({},v,{changes:w}));return I},[e]),a=g.useReducer(s,t,n),c=a[0],l=a[1],d=Ra(t),p=g.useCallback(function(f){return l(le({props:d.current},f))},[d]),m=o.current;return g.useEffect(function(){var f=Er(i.current,m==null?void 0:m.props),v=m&&i.current&&!r(f,c);v&&Lf(m,f,c),i.current=c},[c,m,r]),[c,p]}var Kn={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:Kf,scrollIntoView:la,environment:typeof window>"u"?void 0:window};function Wt(e,t,n){n===void 0&&(n=Ta);var r=e["default"+Bo(t)];return r!==void 0?r:n[t]}function Vn(e,t,n){n===void 0&&(n=Ta);var r=e[t];if(r!==void 0)return r;var i=e["initial"+Bo(t)];return i!==void 0?i:Wt(e,t,n)}function qf(e){var t=Vn(e,"selectedItem"),n=Vn(e,"isOpen"),r=Gf(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 Wf(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 Aa=function(){return it};process.env.NODE_ENV!=="production"&&(Aa=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 Jf(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);ns(s,i)}},n),g.useEffect(function(){return function(){ns.cancel(),Tf(i)}},[i])}function zf(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 Vf(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var Pa=it;process.env.NODE_ENV!=="production"&&(Pa=function(t){var n=t.props,r=t.state,i=g.useRef(n),o=Kr();g.useEffect(function(){o||(Uo(r,i.current,n),i.current=n)},[r,n,o])});function rs(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:Wt(e,"isOpen"),highlightedIndex:Wt(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Xf(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=Wt(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function Gf(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},Da=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 Yf(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:Wt(i,"isOpen"),selectedItem:Wt(i,"selectedItem"),inputValue:Wt(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return le({},e,o)}On(On({},Da),{items:F.array.isRequired,isItemDisabled:F.func});On(On({},Kn),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var qo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Wo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Jo=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,zo=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Xo=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Go=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Yo=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Zo=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Qo=process.env.NODE_ENV!=="production"?"__input_change__":8,Tr=process.env.NODE_ENV!=="production"?"__input_blur__":9,ei=process.env.NODE_ENV!=="production"?"__input_click__":10,ja=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Fa=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ti=process.env.NODE_ENV!=="production"?"__item_click__":13,Ma=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,ka=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,La=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,$a=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Ka=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,ni=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Va=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Ha=process.env.NODE_ENV!=="production"?"__function_reset__":21,ri=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Ua=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ri,FunctionCloseMenu:$a,FunctionOpenMenu:La,FunctionReset:Ha,FunctionSelectItem:ni,FunctionSetHighlightedIndex:Ka,FunctionSetInputValue:Va,FunctionToggleMenu:ka,InputBlur:Tr,InputChange:Qo,InputClick:ei,InputKeyDownArrowDown:qo,InputKeyDownArrowUp:Wo,InputKeyDownEnd:Xo,InputKeyDownEnter:Zo,InputKeyDownEscape:Jo,InputKeyDownHome:zo,InputKeyDownPageDown:Yo,InputKeyDownPageUp:Go,ItemClick:ti,ItemMouseMove:Fa,MenuMouseLeave:ja,ToggleButtonClick:Ma});function Zf(e){var t=qf(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 Qf=le({},Da,{items:F.array.isRequired,isItemDisabled:F.func,inputValue:F.string,defaultInputValue:F.string,initialInputValue:F.string,inputId:F.string,onInputValueChange:F.func});function em(e,t,n,r){var i=g.useRef(),o=Bf(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:ri,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Er(s,t),a]}var Ba=it;process.env.NODE_ENV!=="production"&&(Ba=function(t,n){F.checkPropTypes(Qf,t,"prop",n.name)});var tm=le({},Kn,{isItemDisabled:function(){return!1}});function nm(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case ti:s={isOpen:Wt(i,"isOpen"),highlightedIndex:bo(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case qo: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 Wo:e.isOpen?o?s=rs(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 Zo:s=rs(i,e.highlightedIndex);break;case Jo:s=le({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Go:s={highlightedIndex:un(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case Yo:s={highlightedIndex:un(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case zo:s={highlightedIndex:En(0,!1,i.items,i.isItemDisabled)};break;case Xo:s={highlightedIndex:En(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 Qo:s={isOpen:!0,highlightedIndex:bo(i),inputValue:t.inputValue};break;case ei:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Hn(i,e,0)};break;case ni:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case ri:s={inputValue:t.inputValue};break;default:return Yf(e,t,Ua)}return le({},e,s)}var rm=["onMouseLeave","refKey","ref"],om=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],im=["onClick","onPress","refKey","ref"],sm=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];oi.stateChangeTypes=Ua;function oi(e){e===void 0&&(e={}),Ba(e,oi);var t=le({},tm,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=em(nm,t,Zf,Xf),a=s[0],c=s[1],l=a.isOpen,d=a.highlightedIndex,p=a.selectedItem,m=a.inputValue,f=g.useRef(null),v=g.useRef({}),w=g.useRef(null),I=g.useRef(null),C=Kr(),y=Hf(t),x=g.useRef(),b=Ra({state:a,props:t}),_=g.useCallback(function(M){return v.current[y.getItemId(M)]},[y]);Jf(o,a,[l,d,p,m],i);var E=zf({menuElement:f.current,highlightedIndex:d,isOpen:l,itemRefs:v,scrollIntoView:r,getItemNodeFromIndex:_});Pa({props:t,state:a}),g.useEffect(function(){var M=Vn(t,"isOpen");M&&w.current&&w.current.focus()},[]),g.useEffect(function(){C||(x.current=n.length)});var $=Wf(i,g.useCallback(function(){b.current.state.isOpen&&c({type:Tr,selectItem:!1})},[c,b]),g.useMemo(function(){return[f,I,w]},[f.current,I.current,w.current])),T=Aa("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:qo,altKey:j.altKey})},ArrowUp:function(j){j.preventDefault(),c({type:Wo,altKey:j.altKey})},Home:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:zo}))},End:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Xo}))},Escape:function(j){var D=b.current.state;(D.isOpen||D.inputValue||D.selectedItem||D.highlightedIndex>-1)&&(j.preventDefault(),c({type:Jo}))},Enter:function(j){var D=b.current.state;!D.isOpen||j.which===229||(j.preventDefault(),c({type:Zo}))},PageUp:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Go}))},PageDown:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Yo}))}}},[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,rm),ae=j===void 0?{}:j,A=ae.suppressRefError,pe=A===void 0?!1:A;return T("getMenuProps",pe,K,f),le((D={},D[K]=xn(Z,function(V){f.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:ja})}),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,pe=R.onClick;R.onPress;var V=R.disabled,we=Mt(R,om);V!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var De=b.current,Ue=De.props,je=De.state,me=Uf(X,G,Ue.items,"Pass either item or index to getItemProps!"),gt=me[0],Be=me[1],nt=Ue.isItemDisabled(gt,Be),vt="onClick",yt=pe,qe=function(){$.isTouchEnd||Be===je.highlightedIndex||(E.current=!1,c({type:Fa,index:Be,disabled:nt}))},$e=function(){c({type:ti,index:Be})},Fe=function(wt){return wt.preventDefault()};return le((j={},j[Z]=xn(B,function(Oe){Oe&&(v.current[y.getItemId(Be)]=Oe)}),j["aria-disabled"]=nt,j["aria-selected"]=Be===je.highlightedIndex,j.id=y.getItemId(Be),j.role="option",j),!nt&&(D={},D[vt]=Le(yt,$e),D),{onMouseMove:Le(ae,qe),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,im),B=b.current.state,ae=function(){c({type:Ma})};return le((j={},j[G]=xn(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,pe=R.ref,V=Mt(R,sm),we=j===void 0?{}:j,De=we.suppressRefError,Ue=De===void 0?!1:De;T("getInputProps",Ue,A,w);var je=b.current.state,me=function(Fe){var Oe=Io(Fe);Oe&&J[Oe]&&J[Oe](Fe)},gt=function(Fe){c({type:Qo,inputValue:Fe.target.value})},Be=function(Fe){if(i!=null&&i.document&&je.isOpen&&!$.isMouseDown){var Oe=Fe.relatedTarget===null&&i.document.activeElement!==i.document.body;c({type:Tr,selectItem:!Oe})}},nt=function(){c({type:ei})},vt="onChange",yt={};if(!V.disabled){var qe;yt=(qe={},qe[vt]=Le(G,K,gt),qe.onKeyDown=Le(X,me),qe.onBlur=Le(Z,Be),qe.onClick=Le(B,nt),qe)}return le((D={},D[A]=xn(pe,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:ka})},[c]),ne=g.useCallback(function(){c({type:$a})},[c]),Q=g.useCallback(function(){c({type:La})},[c]),de=g.useCallback(function(M){c({type:Ka,highlightedIndex:M})},[c]),fe=g.useCallback(function(M){c({type:ni,selectedItem:M})},[c]),S=g.useCallback(function(M){c({type:Va,inputValue:M})},[c]),P=g.useCallback(function(){c({type:Ha})},[c]);return{getItemProps:Y,getLabelProps:q,getMenuProps:z,getInputProps:U,getToggleButtonProps:ee,toggleMenu:se,openMenu:Q,closeMenu:ne,setHighlightedIndex:de,setInputValue:S,selectItem:fe,reset:P,highlightedIndex:d,isOpen:l,selectedItem:p,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 am="_comboboxContainer_1phcp_1",cm="_label_1phcp_8",lm="_inputContainer_1phcp_12",um="_input_1phcp_12",dm="_toggleButton_1phcp_26",pm="_menu_1phcp_32",fm="_menuItem_1phcp_47",mm="_highlighted_1phcp_54",hm="_selected_1phcp_58",gm="_hidden_1phcp_62",Ft={comboboxContainer:am,label:cm,inputContainer:lm,input:um,toggleButton:dm,menu:pm,menuItem:fm,highlighted:mm,selected:hm,hidden:gm};function vm(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function ym({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(vm(b)))},{isOpen:l,getToggleButtonProps:d,getMenuProps:p,getInputProps:m,highlightedIndex:f,getItemProps:v,setInputValue:w}=oi({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)},C=()=>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:C,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}`,...p(),children:l&&o.map((b,_)=>u.jsx("li",{className:`${Ft.menuItem} ${f===_?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 Sn=Math.min,dn=Math.max,Rr=Math.round,vr=Math.floor,Gt=e=>({x:e,y:e}),wm={left:"right",right:"left",bottom:"top",top:"bottom"},Im={start:"end",end:"start"};function xo(e,t,n){return dn(e,Sn(t,n))}function Gn(e,t){return typeof e=="function"?e(t):e}function mn(e){return e.split("-")[0]}function Yn(e){return e.split("-")[1]}function qa(e){return e==="x"?"y":"x"}function ii(e){return e==="y"?"height":"width"}function Nn(e){return["top","bottom"].includes(mn(e))?"y":"x"}function si(e){return qa(Nn(e))}function _m(e,t,n){n===void 0&&(n=!1);const r=Yn(e),i=si(e),o=ii(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 bm(e){const t=Ar(e);return[Co(e),t,Co(t)]}function Co(e){return e.replace(/start|end/g,t=>Im[t])}function xm(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 Cm(e,t,n,r){const i=Yn(e);let o=xm(mn(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=>wm[t])}function Om(e){return{top:0,right:0,bottom:0,left:0,...e}}function Wa(e){return typeof e!="number"?Om(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 os(e,t,n){let{reference:r,floating:i}=e;const o=Nn(t),s=si(t),a=ii(s),c=mn(t),l=o==="y",d=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,m=r[a]/2-i[a]/2;let f;switch(c){case"top":f={x:d,y:r.y-i.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:p};break;case"left":f={x:r.x-i.width,y:p};break;default:f={x:r.x,y:r.y}}switch(Yn(t)){case"start":f[s]-=m*(n&&l?-1:1);break;case"end":f[s]+=m*(n&&l?-1:1);break}return f}const Em=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:p}=os(l,r,c),m=r,f={},v=0;for(let w=0;w<a.length;w++){const{name:I,fn:C}=a[w],{x:y,y:x,data:b,reset:_}=await C({x:d,y:p,initialPlacement:r,placement:m,strategy:i,middlewareData:f,rects:l,platform:s,elements:{reference:e,floating:t}});d=y??d,p=x??p,f={...f,[I]:{...f[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:p}=os(l,m,c)),w=-1)}return{x:d,y:p,placement:m,strategy:i,middlewareData:f}};async function Ja(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:p="floating",altBoundary:m=!1,padding:f=0}=Gn(t,e),v=Wa(f),I=a[m?p==="floating"?"reference":"floating":p],C=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=p==="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:(C.top-_.top+v.top)/b.y,bottom:(_.bottom-C.bottom+v.bottom)/b.y,left:(C.left-_.left+v.left)/b.x,right:(_.right-C.right+v.right)/b.x}}const Sm=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 p=Wa(d),m={x:n,y:r},f=si(i),v=ii(f),w=await s.getDimensions(l),I=f==="y",C=I?"top":"left",y=I?"bottom":"right",x=I?"clientHeight":"clientWidth",b=o.reference[v]+o.reference[f]-m[f]-o.floating[v],_=m[f]-o.reference[f],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(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=Sn(p[C],J),z=Sn(p[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{[f]:m[f]+Q,data:{[f]:se,centerOffset:U-se-Q,...ne&&{alignmentOffset:Q}},reset:ne}}}),Nm=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:p=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:w=!0,...I}=Gn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const C=mn(i),y=Nn(a),x=mn(a)===a,b=await(c.isRTL==null?void 0:c.isRTL(l.floating)),_=m||(x||!w?[Ar(a)]:bm(a)),E=v!=="none";!m&&E&&_.push(...Cm(a,w,v,b));const $=[a,..._],T=await Ja(t,I),J=[];let q=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&J.push(T[C]),p){const U=_m(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(f){case"bestFit":{var ee;const Q=(ee=q.filter(de=>{if(E){const fe=Nn(de.placement);return fe===y||fe==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(fe=>fe>0).reduce((fe,S)=>fe+S,0)]).sort((de,fe)=>de[1]-fe[1])[0])==null?void 0:ee[0];Q&&(ne=Q);break}case"initialPlacement":ne=a;break}if(i!==ne)return{reset:{placement:ne}}}return{}}}};async function Tm(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=mn(n),a=Yn(n),c=Nn(n)==="y",l=["left","top"].includes(s)?-1:1,d=o&&c?-1:1,p=Gn(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof v=="number"&&(f=a==="end"?v*-1:v),c?{x:f*d,y:m*l}:{x:m*l,y:f*d}}const Rm=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 Tm(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}}}}},Am=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:C,y}=I;return{x:C,y}}},...c}=Gn(e,t),l={x:n,y:r},d=await Ja(t,c),p=Nn(mn(i)),m=qa(p);let f=l[m],v=l[p];if(o){const I=m==="y"?"top":"left",C=m==="y"?"bottom":"right",y=f+d[I],x=f-d[C];f=xo(y,f,x)}if(s){const I=p==="y"?"top":"left",C=p==="y"?"bottom":"right",y=v+d[I],x=v-d[C];v=xo(y,v,x)}const w=a.fn({...t,[m]:f,[p]:v});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[m]:o,[p]:s}}}}}};function Vr(){return typeof window<"u"}function jn(e){return za(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=(za(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function za(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 is(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 Pm(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 ai(e){const t=ci(),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 Dm(e){let t=Yt(e);for(;St(t)&&!Tn(t);){if(ai(t))return t;if(Hr(t))return null;t=Yt(t)}return null}function ci(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Tn(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||is(e)&&e.host||Nt(e);return is(t)?t.host:t}function Xa(e){const t=Yt(e);return Tn(t)?e.ownerDocument?e.ownerDocument.body:e.body:St(t)&&Zn(t)?t:Xa(t)}function Bn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Xa(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 Ga(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 li(e){return Ct(e)?e:e.contextElement}function Cn(e){const t=li(e);if(!St(t))return Gt(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=Ga(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 jm=Gt(0);function Ya(e){const t=at(e);return!ci()||!t.visualViewport?jm:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==at(e)?!1:t}function hn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=li(e);let s=Gt(1);t&&(r?Ct(r)&&(s=Cn(r)):s=Cn(e));const a=Fm(o,n,r)?Ya(o):Gt(0);let c=(i.left+a.x)/s.x,l=(i.top+a.y)/s.y,d=i.width/s.x,p=i.height/s.y;if(o){const m=at(o),f=r&&Ct(r)?at(r):r;let v=m,w=Oo(v);for(;w&&r&&f!==v;){const I=Cn(w),C=w.getBoundingClientRect(),y=Ot(w),x=C.left+(w.clientLeft+parseFloat(y.paddingLeft))*I.x,b=C.top+(w.clientTop+parseFloat(y.paddingTop))*I.y;c*=I.x,l*=I.y,d*=I.x,p*=I.y,c+=x,l+=b,v=at(w),w=Oo(v)}}return Pr({width:d,height:p,x:c,y:l})}function Mm(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),p=St(r);if((p||!p&&!o)&&((jn(r)!=="body"||Zn(s))&&(c=Ur(r)),St(r))){const m=hn(r);l=Cn(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 km(e){return Array.from(e.getClientRects())}function Eo(e,t){const n=Ur(e).scrollLeft;return t?t.left+n:hn(Nt(e)).left+n}function Lm(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 $m(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=ci();(!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=hn(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=St(e)?Cn(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 ss(e,t,n){let r;if(t==="viewport")r=$m(e,n);else if(t==="document")r=Lm(Nt(e));else if(Ct(t))r=Km(t,n);else{const i=Ya(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Pr(r)}function Za(e,t){const n=Yt(e);return n===t||!Ct(n)||Tn(n)?!1:Ot(n).position==="fixed"||Za(n,t)}function Vm(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)&&!Tn(s);){const a=Ot(s),c=ai(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Zn(s)&&!c&&Za(e,s))?r=r.filter(d=>d!==s):i=a,s=Yt(s)}return t.set(e,r),r}function Hm(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Hr(t)?[]:Vm(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((l,d)=>{const p=ss(t,d,i);return l.top=dn(p.top,l.top),l.right=Sn(p.right,l.right),l.bottom=Sn(p.bottom,l.bottom),l.left=dn(p.left,l.left),l},ss(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Um(e){const{width:t,height:n}=Ga(e);return{width:t,height:n}}function Bm(e,t,n){const r=St(t),i=Nt(t),o=n==="fixed",s=hn(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 f=hn(t,!0,o,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else i&&(c.x=Eo(i));let l=0,d=0;if(i&&!r&&!o){const f=i.getBoundingClientRect();d=f.top+a.scrollTop,l=f.left+a.scrollLeft-Eo(i,f)}const p=s.left+a.scrollLeft-c.x-l,m=s.top+a.scrollTop-c.y-d;return{x:p,y:m,width:s.width,height:s.height}}function lo(e){return Ot(e).position==="static"}function as(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 Qa(e,t){const n=at(e);if(Hr(e))return n;if(!St(e)){let i=Yt(e);for(;i&&!Tn(i);){if(Ct(i)&&!lo(i))return i;i=Yt(i)}return n}let r=as(e,t);for(;r&&Pm(r)&&lo(r);)r=as(r,t);return r&&Tn(r)&&lo(r)&&!ai(r)?n:r||Dm(e)||n}const qm=async function(e){const t=this.getOffsetParent||Qa,n=this.getDimensions,r=await n(e.floating);return{reference:Bm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Wm(e){return Ot(e).direction==="rtl"}const Jm={convertOffsetParentRelativeRectToViewportRelativeRect:Mm,getDocumentElement:Nt,getClippingRect:Hm,getOffsetParent:Qa,getElementRects:qm,getClientRects:km,getDimensions:Um,getScale:Cn,isElement:Ct,isRTL:Wm};function zm(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:p,height:m}=e.getBoundingClientRect();if(a||t(),!p||!m)return;const f=vr(d),v=vr(i.clientWidth-(l+p)),w=vr(i.clientHeight-(d+m)),I=vr(l),y={rootMargin:-f+"px "+-v+"px "+-w+"px "+-I+"px",threshold:dn(0,Sn(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 Xm(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=li(e),d=i||o?[...l?Bn(l):[],...Bn(t)]:[];d.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),o&&C.addEventListener("resize",n)});const p=l&&a?zm(l,n):null;let m=-1,f=null;s&&(f=new ResizeObserver(C=>{let[y]=C;y&&y.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(t)})),n()}),l&&!c&&f.observe(l),f.observe(t));let v,w=c?hn(e):null;c&&I();function I(){const C=hn(e);w&&(C.x!==w.x||C.y!==w.y||C.width!==w.width||C.height!==w.height)&&n(),w=C,v=requestAnimationFrame(I)}return n(),()=>{var C;d.forEach(y=>{i&&y.removeEventListener("scroll",n),o&&y.removeEventListener("resize",n)}),p==null||p(),(C=f)==null||C.disconnect(),f=null,c&&cancelAnimationFrame(v)}}const Gm=Rm,Ym=Am,Zm=Nm,Qm=Sm,cs=(e,t,n)=>{const r=new Map,i={platform:Jm,...n},o={...i.platform,_c:r};return Em(e,t,{...i,platform:o})};/*
|
|
43
|
+
*/var Xi;function xf(){return Xi||(Xi=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"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),v=!1,w=!1,I=!1,C=!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||C||V===f||v||w||I||typeof V=="object"&&V!==null&&(V.$$typeof===m||V.$$typeof===p||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 De=V.type;switch(De){case n:case i:case r:case l:case d:return De;default:var Ue=De&&De.$$typeof;switch(Ue){case a:case s:case c:case m:case p:case o:return Ue;default:return we}}case t:return we}}}var E=s,$=o,T=e,J=c,q=n,z=m,Y=p,ee=t,U=i,se=r,ne=l,Q=d,de=!1,fe=!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 fe||(fe=!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)===p}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 pe(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=pe,ye.isValidElementType=b,ye.typeOf=_}()),ye}process.env.NODE_ENV==="production"?Io.exports=bf():Io.exports=xf();var Gi=Io.exports;const Yi=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Zi=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",lo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Zi(n.overflowY,t)||Zi(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,Cf=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Of=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:l,skipOverflowHiddenElements:d}=t,p=typeof l=="function"?l:ne=>ne!==l;if(!Yi(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,f=[];let v=e;for(;Yi(v)&&p(v);){if(v=Cf(v),v===m){f.push(v);break}v!=null&&v===document.body&&lo(v)&&!lo(document.documentElement)||v!=null&&lo(v,d)&&f.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:C,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<f.length;ne++){const Q=f[ne],{height:de,width:fe,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,pe="offsetWidth"in Q?Q.offsetWidth===0?0:fe/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(C,C+w,w,R,G,C+U,C+U+b,b),Z=Math.max(0,Z+y),B=Math.max(0,B+C);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+fe/2)+ae/2:c==="end"?U-P+G+ae:hr(j,P,fe,R,G+ae,U,U+b,b);const{scrollLeft:we,scrollTop:De}=Q;Z=V===0?0:Math.max(0,Math.min(De+Z/V,Q.scrollHeight-de/V+A)),B=pe===0?0:Math.max(0,Math.min(we+B/pe,Q.scrollWidth-fe/pe+ae)),ee+=De-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 Ef=0;function Qi(e){return typeof e=="function"?e:it}function it(){}function pa(e,t){if(e){var n=Of(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 es(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Uo(e,t){var n;function r(){n&&clearTimeout(n)}function i(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return i.cancel=r,i}function Le(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(o)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function bn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(i){typeof i=="function"?i(r):i&&(i.current=r)})}}function fa(){return String(Ef++)}function Sf(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 ts(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function ma(e){return typeof e.type=="string"}function ha(e){return e.props}function Nf(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Tf=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function gr(e){e===void 0&&(e={});var t={};return Tf.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 _o(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Rf(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&&(es(i,e,n)||r&&es(i,n.document.activeElement,n))})}var Bo=it;process.env.NODE_ENV!=="production"&&(Bo=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 Af=Uo(function(e){ga(e).textContent=""},500);function ga(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 va(e,t){if(!(!e||!t)){var n=ga(t);n.textContent=e,Af(t)}}function Pf(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var ya=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,wa=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Ia=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,_a=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,ba=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,xa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Ca=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Oa=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Ea=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Sa=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Na=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,bo=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Ta=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Ra=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Aa=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Df=Object.freeze({__proto__:null,blurButton:Ta,blurInput:Ea,changeInput:Sa,clickButton:bo,clickItem:Oa,controlledPropUpdatedSelectedItem:Ra,itemMouseEnter:Ia,keyDownArrowDown:br,keyDownArrowUp:_r,keyDownEnd:Ca,keyDownEnter:ba,keyDownEscape:_a,keyDownHome:xa,keyDownSpaceButton:Na,mouseUp:wa,touchEnd:Aa,unknown:ya}),jf=["refKey","ref"],Ff=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Mf=["onKeyDown","onBlur","onChange","onInput","onChangeText"],kf=["refKey","ref"],Lf=["onMouseMove","onMouseDown","onClick","onPress","index","item"],$f=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+fa(),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=ya),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(){Qi(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(_,jf),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[$]=bn(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:ba})}}},Escape:function(x){x.preventDefault(),this.reset(le({type:_a},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=le({},o.keyDownHandlers,{" ":function(x){x.preventDefault(),this.toggleMenu({type:Na})}}),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:xa})}}},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:Ca})}}}}),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,Ff),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=_o(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:bo}):o.internalSetTimeout(function(){return o.toggleMenu({type:bo})})},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:Ta})}})},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,Mf),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=_o(y);x&&o.inputKeyDownHandlers[x]&&o.inputKeyDownHandlers[x].call(o,y)},o.inputHandleChange=function(y){o.internalSetState({type:Sa,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:Ea})}})},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(_,kf),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[$]=bn(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:Nf("getItemProps","item"):J,z=Mt(b,Lf);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:Ia}),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:Oa})}),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),Qi(x)()})},o.openMenu=function(y){o.internalSetState({isOpen:!0},y)},o.closeMenu=function(y){o.internalSetState({isOpen:!1},y)},o.updateStatus=Uo(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=_,va(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,p=s.initialIsOpen,m=p===void 0?d:p,f=s.initialInputValue,v=f===void 0?"":f,w=s.initialSelectedItem,I=w===void 0?null:w,C=o.getState({highlightedIndex:l,isOpen:m,inputValue:v,selectedItem:I});return C.selectedItem!=null&&o.props.initialInputValue===void 0&&(C.inputValue=o.props.itemToString(C.selectedItem)),o.state=C,o}pf(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,p=this.id,m=this.getRootProps,f=this.getToggleButtonProps,v=this.getLabelProps,w=this.getMenuProps,I=this.getInputProps,C=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:f,getLabelProps:v,getMenuProps:w,getInputProps:I,getItemProps:C,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:p,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&&ns(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){o.internalClearTimeouts()};else{var s=function(){o.isMouseDown=!0},a=function(f){o.isMouseDown=!1;var v=Nr(f.target,[o._rootNode,o._menuNode],o.props.environment);!v&&o.getState().isOpen&&o.reset({type:wa},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},c=function(){o.isTouchMove=!1},l=function(){o.isTouchMove=!0},d=function(f){var v=Nr(f.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!v&&o.getState().isOpen&&o.reset({type:Aa},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},p=this.props.environment;p.addEventListener("mousedown",s),p.addEventListener("mouseup",a),p.addEventListener("touchstart",c),p.addEventListener("touchmove",l),p.addEventListener("touchend",d),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),p.removeEventListener("mousedown",s),p.removeEventListener("mouseup",a),p.removeEventListener("touchstart",c),p.removeEventListener("touchmove",l),p.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,p=c&&this.getState().isOpen&&!o.isOpen,m=c!==d;return p||m},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(Bo(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&ns(this._menuNode,this.getMenuProps)),Sr(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Ra,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=ts(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=ts(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&&Kf(s,this.getRootProps),s;if(ma(s))return g.cloneElement(s,this.getRootProps(ha(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:Sf,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Rf(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:pa},e.stateChangeTypes=Df,e}();process.env.NODE_ENV!=="production"&&($f.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 ns(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 Kf(e,t){var n=t.refKey,r=n!=="ref",i=!ma(e);i&&!r&&!Gi.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+'"'),!Gi.isForwardRef(e)&&!ha(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Pa={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Vf(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){Hf(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 Hf(e,t,n,r){var i=t.props,o=t.type,s="on"+qo(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](le({type:o},r))}function Uf(e,t){return t.changes}var rs=Uo(function(e,t){va(e,t)},200),Bf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?g.useLayoutEffect:g.useEffect,qf="useId"in g?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,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-"+fa():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 Wf(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 qo(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Da(e){var t=g.useRef(e);return t.current=e,t}function Jf(e,t,n,r){var i=g.useRef(),o=g.useRef(),s=g.useCallback(function(f,v){o.current=v,f=Er(f,v.props);var w=e(f,v),I=v.props.stateReducer(f,le({},v,{changes:w}));return I},[e]),a=g.useReducer(s,t,n),c=a[0],l=a[1],d=Da(t),p=g.useCallback(function(f){return l(le({props:d.current},f))},[d]),m=o.current;return g.useEffect(function(){var f=Er(i.current,m==null?void 0:m.props),v=m&&i.current&&!r(f,c);v&&Vf(m,f,c),i.current=c},[c,m,r]),[c,p]}var Kn={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:Uf,scrollIntoView:pa,environment:typeof window>"u"?void 0:window};function Wt(e,t,n){n===void 0&&(n=Pa);var r=e["default"+qo(t)];return r!==void 0?r:n[t]}function Vn(e,t,n){n===void 0&&(n=Pa);var r=e[t];if(r!==void 0)return r;var i=e["initial"+qo(t)];return i!==void 0?i:Wt(e,t,n)}function zf(e){var t=Vn(e,"selectedItem"),n=Vn(e,"isOpen"),r=Qf(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 Xf(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 ja=function(){return it};process.env.NODE_ENV!=="production"&&(ja=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 Gf(e,t,n,r){r===void 0&&(r={});var i=r.document,o=Vr();g.useEffect(function(){if(!(!e||o||!i)){var s=e(t);rs(s,i)}},n),g.useEffect(function(){return function(){rs.cancel(),Pf(i)}},[i])}function Yf(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 Bf(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var Fa=it;process.env.NODE_ENV!=="production"&&(Fa=function(t){var n=t.props,r=t.state,i=g.useRef(n),o=Vr();g.useEffect(function(){o||(Bo(r,i.current,n),i.current=n)},[r,n,o])});function os(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:Wt(e,"isOpen"),highlightedIndex:Wt(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Zf(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Vr(){var e=g.useRef(!0);return g.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function xo(e){var t=Wt(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function Qf(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},Ma=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 em(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:xo(i),isOpen:Wt(i,"isOpen"),selectedItem:Wt(i,"selectedItem"),inputValue:Wt(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return le({},e,o)}Cn(Cn({},Ma),{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 Wo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Jo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,zo=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Xo=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Go=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Yo=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Zo=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Qo=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,ei=process.env.NODE_ENV!=="production"?"__input_change__":8,Tr=process.env.NODE_ENV!=="production"?"__input_blur__":9,ti=process.env.NODE_ENV!=="production"?"__input_click__":10,ka=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,La=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ni=process.env.NODE_ENV!=="production"?"__item_click__":13,$a=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Ka=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Va=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Ha=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Ua=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,ri=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Ba=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,qa=process.env.NODE_ENV!=="production"?"__function_reset__":21,oi=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Wa=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:oi,FunctionCloseMenu:Ha,FunctionOpenMenu:Va,FunctionReset:qa,FunctionSelectItem:ri,FunctionSetHighlightedIndex:Ua,FunctionSetInputValue:Ba,FunctionToggleMenu:Ka,InputBlur:Tr,InputChange:ei,InputClick:ti,InputKeyDownArrowDown:Wo,InputKeyDownArrowUp:Jo,InputKeyDownEnd:Go,InputKeyDownEnter:Qo,InputKeyDownEscape:zo,InputKeyDownHome:Xo,InputKeyDownPageDown:Zo,InputKeyDownPageUp:Yo,ItemClick:ni,ItemMouseMove:La,MenuMouseLeave:ka,ToggleButtonClick:$a});function tm(e){var t=zf(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 nm=le({},Ma,{items:F.array.isRequired,isItemDisabled:F.func,inputValue:F.string,defaultInputValue:F.string,initialInputValue:F.string,inputId:F.string,onInputValueChange:F.func});function rm(e,t,n,r){var i=g.useRef(),o=Jf(e,t,n,r),s=o[0],a=o[1],c=Vr();return g.useEffect(function(){if(Sr(t,"selectedItem")){if(!c){var l=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);l&&a({type:oi,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Er(s,t),a]}var Ja=it;process.env.NODE_ENV!=="production"&&(Ja=function(t,n){F.checkPropTypes(nm,t,"prop",n.name)});var om=le({},Kn,{isItemDisabled:function(){return!1}});function im(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case ni:s={isOpen:Wt(i,"isOpen"),highlightedIndex:xo(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case Wo: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 Jo:e.isOpen?o?s=os(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 Qo:s=os(i,e.highlightedIndex);break;case zo:s=le({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Yo:s={highlightedIndex:un(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case Zo:s={highlightedIndex:un(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case Xo:s={highlightedIndex:On(0,!1,i.items,i.isItemDisabled)};break;case Go: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 ei:s={isOpen:!0,highlightedIndex:xo(i),inputValue:t.inputValue};break;case ti:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Hn(i,e,0)};break;case ri:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case oi:s={inputValue:t.inputValue};break;default:return em(e,t,Wa)}return le({},e,s)}var sm=["onMouseLeave","refKey","ref"],am=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],cm=["onClick","onPress","refKey","ref"],lm=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];ii.stateChangeTypes=Wa;function ii(e){e===void 0&&(e={}),Ja(e,ii);var t=le({},om,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=rm(im,t,tm,Zf),a=s[0],c=s[1],l=a.isOpen,d=a.highlightedIndex,p=a.selectedItem,m=a.inputValue,f=g.useRef(null),v=g.useRef({}),w=g.useRef(null),I=g.useRef(null),C=Vr(),y=qf(t),x=g.useRef(),b=Da({state:a,props:t}),_=g.useCallback(function(M){return v.current[y.getItemId(M)]},[y]);Gf(o,a,[l,d,p,m],i);var E=Yf({menuElement:f.current,highlightedIndex:d,isOpen:l,itemRefs:v,scrollIntoView:r,getItemNodeFromIndex:_});Fa({props:t,state:a}),g.useEffect(function(){var M=Vn(t,"isOpen");M&&w.current&&w.current.focus()},[]),g.useEffect(function(){C||(x.current=n.length)});var $=Xf(i,g.useCallback(function(){b.current.state.isOpen&&c({type:Tr,selectItem:!1})},[c,b]),g.useMemo(function(){return[f,I,w]},[f.current,I.current,w.current])),T=ja("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:Wo,altKey:j.altKey})},ArrowUp:function(j){j.preventDefault(),c({type:Jo,altKey:j.altKey})},Home:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Xo}))},End:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Go}))},Escape:function(j){var D=b.current.state;(D.isOpen||D.inputValue||D.selectedItem||D.highlightedIndex>-1)&&(j.preventDefault(),c({type:zo}))},Enter:function(j){var D=b.current.state;!D.isOpen||j.which===229||(j.preventDefault(),c({type:Qo}))},PageUp:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Yo}))},PageDown:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Zo}))}}},[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,sm),ae=j===void 0?{}:j,A=ae.suppressRefError,pe=A===void 0?!1:A;return T("getMenuProps",pe,K,f),le((D={},D[K]=bn(Z,function(V){f.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:ka})}),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,pe=R.onClick;R.onPress;var V=R.disabled,we=Mt(R,am);V!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var De=b.current,Ue=De.props,je=De.state,me=Wf(X,G,Ue.items,"Pass either item or index to getItemProps!"),gt=me[0],Be=me[1],nt=Ue.isItemDisabled(gt,Be),vt="onClick",yt=pe,qe=function(){$.isTouchEnd||Be===je.highlightedIndex||(E.current=!1,c({type:La,index:Be,disabled:nt}))},$e=function(){c({type:ni,index:Be})},Fe=function(wt){return wt.preventDefault()};return le((j={},j[Z]=bn(B,function(Ee){Ee&&(v.current[y.getItemId(Be)]=Ee)}),j["aria-disabled"]=nt,j["aria-selected"]=Be===je.highlightedIndex,j.id=y.getItemId(Be),j.role="option",j),!nt&&(D={},D[vt]=Le(yt,$e),D),{onMouseMove:Le(ae,qe),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,cm),B=b.current.state,ae=function(){c({type:$a})};return le((j={},j[G]=bn(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,pe=R.ref,V=Mt(R,lm),we=j===void 0?{}:j,De=we.suppressRefError,Ue=De===void 0?!1:De;T("getInputProps",Ue,A,w);var je=b.current.state,me=function(Fe){var Ee=_o(Fe);Ee&&J[Ee]&&J[Ee](Fe)},gt=function(Fe){c({type:ei,inputValue:Fe.target.value})},Be=function(Fe){if(i!=null&&i.document&&je.isOpen&&!$.isMouseDown){var Ee=Fe.relatedTarget===null&&i.document.activeElement!==i.document.body;c({type:Tr,selectItem:!Ee})}},nt=function(){c({type:ti})},vt="onChange",yt={};if(!V.disabled){var qe;yt=(qe={},qe[vt]=Le(G,K,gt),qe.onKeyDown=Le(X,me),qe.onBlur=Le(Z,Be),qe.onClick=Le(B,nt),qe)}return le((D={},D[A]=bn(pe,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:Ka})},[c]),ne=g.useCallback(function(){c({type:Ha})},[c]),Q=g.useCallback(function(){c({type:Va})},[c]),de=g.useCallback(function(M){c({type:Ua,highlightedIndex:M})},[c]),fe=g.useCallback(function(M){c({type:ri,selectedItem:M})},[c]),S=g.useCallback(function(M){c({type:Ba,inputValue:M})},[c]),P=g.useCallback(function(){c({type:qa})},[c]);return{getItemProps:Y,getLabelProps:q,getMenuProps:z,getInputProps:U,getToggleButtonProps:ee,toggleMenu:se,openMenu:Q,closeMenu:ne,setHighlightedIndex:de,setInputValue:S,selectItem:fe,reset:P,highlightedIndex:d,isOpen:l,selectedItem:p,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 um="_comboboxContainer_9s7ov_1",dm="_label_9s7ov_8",pm="_inputContainer_9s7ov_12",fm="_input_9s7ov_12",mm="_toggleButton_9s7ov_33",hm="_menu_9s7ov_39",gm="_menuItem_9s7ov_54",vm="_highlighted_9s7ov_61",ym="_selected_9s7ov_65",wm="_hidden_9s7ov_69",Ft={comboboxContainer:um,label:dm,inputContainer:pm,input:fm,toggleButton:mm,menu:hm,menuItem:gm,highlighted:vm,selected:ym,hidden:wm};function Im(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function _m({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(Im(b)))},{isOpen:l,getToggleButtonProps:d,getMenuProps:p,getInputProps:m,highlightedIndex:f,getItemProps:v,setInputValue:w}=ii({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)},C=()=>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:C,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}`,...p(),children:l&&o.map((b,_)=>u.jsx("li",{className:`${Ft.menuItem} ${f===_?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,Xt=e=>({x:e,y:e}),bm={left:"right",right:"left",bottom:"top",top:"bottom"},xm={start:"end",end:"start"};function Co(e,t,n){return dn(e,En(t,n))}function Gn(e,t){return typeof e=="function"?e(t):e}function mn(e){return e.split("-")[0]}function Yn(e){return e.split("-")[1]}function za(e){return e==="x"?"y":"x"}function si(e){return e==="y"?"height":"width"}function Sn(e){return["top","bottom"].includes(mn(e))?"y":"x"}function ai(e){return za(Sn(e))}function Cm(e,t,n){n===void 0&&(n=!1);const r=Yn(e),i=ai(e),o=si(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 Om(e){const t=Ar(e);return[Oo(e),t,Oo(t)]}function Oo(e){return e.replace(/start|end/g,t=>xm[t])}function Em(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 Sm(e,t,n,r){const i=Yn(e);let o=Em(mn(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Oo)))),o}function Ar(e){return e.replace(/left|right|bottom|top/g,t=>bm[t])}function Nm(e){return{top:0,right:0,bottom:0,left:0,...e}}function Xa(e){return typeof e!="number"?Nm(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 is(e,t,n){let{reference:r,floating:i}=e;const o=Sn(t),s=ai(t),a=si(s),c=mn(t),l=o==="y",d=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,m=r[a]/2-i[a]/2;let f;switch(c){case"top":f={x:d,y:r.y-i.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:p};break;case"left":f={x:r.x-i.width,y:p};break;default:f={x:r.x,y:r.y}}switch(Yn(t)){case"start":f[s]-=m*(n&&l?-1:1);break;case"end":f[s]+=m*(n&&l?-1:1);break}return f}const Tm=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:p}=is(l,r,c),m=r,f={},v=0;for(let w=0;w<a.length;w++){const{name:I,fn:C}=a[w],{x:y,y:x,data:b,reset:_}=await C({x:d,y:p,initialPlacement:r,placement:m,strategy:i,middlewareData:f,rects:l,platform:s,elements:{reference:e,floating:t}});d=y??d,p=x??p,f={...f,[I]:{...f[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:p}=is(l,m,c)),w=-1)}return{x:d,y:p,placement:m,strategy:i,middlewareData:f}};async function Ga(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:p="floating",altBoundary:m=!1,padding:f=0}=Gn(t,e),v=Xa(f),I=a[m?p==="floating"?"reference":"floating":p],C=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=p==="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:(C.top-_.top+v.top)/b.y,bottom:(_.bottom-C.bottom+v.bottom)/b.y,left:(C.left-_.left+v.left)/b.x,right:(_.right-C.right+v.right)/b.x}}const Rm=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 p=Xa(d),m={x:n,y:r},f=ai(i),v=si(f),w=await s.getDimensions(l),I=f==="y",C=I?"top":"left",y=I?"bottom":"right",x=I?"clientHeight":"clientWidth",b=o.reference[v]+o.reference[f]-m[f]-o.floating[v],_=m[f]-o.reference[f],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(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(p[C],J),z=En(p[y],J),Y=q,ee=$-w[v]-z,U=$/2-w[v]/2+T,se=Co(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{[f]:m[f]+Q,data:{[f]:se,centerOffset:U-se-Q,...ne&&{alignmentOffset:Q}},reset:ne}}}),Am=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:p=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:w=!0,...I}=Gn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const C=mn(i),y=Sn(a),x=mn(a)===a,b=await(c.isRTL==null?void 0:c.isRTL(l.floating)),_=m||(x||!w?[Ar(a)]:Om(a)),E=v!=="none";!m&&E&&_.push(...Sm(a,w,v,b));const $=[a,..._],T=await Ga(t,I),J=[];let q=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&J.push(T[C]),p){const U=Cm(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(f){case"bestFit":{var ee;const Q=(ee=q.filter(de=>{if(E){const fe=Sn(de.placement);return fe===y||fe==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(fe=>fe>0).reduce((fe,S)=>fe+S,0)]).sort((de,fe)=>de[1]-fe[1])[0])==null?void 0:ee[0];Q&&(ne=Q);break}case"initialPlacement":ne=a;break}if(i!==ne)return{reset:{placement:ne}}}return{}}}};async function Pm(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=mn(n),a=Yn(n),c=Sn(n)==="y",l=["left","top"].includes(s)?-1:1,d=o&&c?-1:1,p=Gn(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof v=="number"&&(f=a==="end"?v*-1:v),c?{x:f*d,y:m*l}:{x:m*l,y:f*d}}const Dm=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 Pm(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}}}}},jm=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:C,y}=I;return{x:C,y}}},...c}=Gn(e,t),l={x:n,y:r},d=await Ga(t,c),p=Sn(mn(i)),m=za(p);let f=l[m],v=l[p];if(o){const I=m==="y"?"top":"left",C=m==="y"?"bottom":"right",y=f+d[I],x=f-d[C];f=Co(y,f,x)}if(s){const I=p==="y"?"top":"left",C=p==="y"?"bottom":"right",y=v+d[I],x=v-d[C];v=Co(y,v,x)}const w=a.fn({...t,[m]:f,[p]:v});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[m]:o,[p]:s}}}}}};function Hr(){return typeof window<"u"}function jn(e){return Ya(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=(Ya(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ya(e){return Hr()?e instanceof Node||e instanceof at(e).Node:!1}function Ct(e){return Hr()?e instanceof Element||e instanceof at(e).Element:!1}function St(e){return Hr()?e instanceof HTMLElement||e instanceof at(e).HTMLElement:!1}function ss(e){return!Hr()||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 Fm(e){return["table","td","th"].includes(jn(e))}function Ur(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function ci(e){const t=li(),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 Mm(e){let t=Gt(e);for(;St(t)&&!Nn(t);){if(ci(t))return t;if(Ur(t))return null;t=Gt(t)}return null}function li(){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 Br(e){return Ct(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Gt(e){if(jn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ss(e)&&e.host||Nt(e);return ss(t)?t.host:t}function Za(e){const t=Gt(e);return Nn(t)?e.ownerDocument?e.ownerDocument.body:e.body:St(t)&&Zn(t)?t:Za(t)}function qn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Za(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=at(i);if(o){const a=Eo(s);return t.concat(s,s.visualViewport||[],Zn(i)?i:[],a&&n?qn(a):[])}return t.concat(i,qn(i,[],n))}function Eo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Qa(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 ui(e){return Ct(e)?e:e.contextElement}function xn(e){const t=ui(e);if(!St(t))return Xt(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=Qa(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 km=Xt(0);function ec(e){const t=at(e);return!li()||!t.visualViewport?km:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Lm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==at(e)?!1:t}function hn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=ui(e);let s=Xt(1);t&&(r?Ct(r)&&(s=xn(r)):s=xn(e));const a=Lm(o,n,r)?ec(o):Xt(0);let c=(i.left+a.x)/s.x,l=(i.top+a.y)/s.y,d=i.width/s.x,p=i.height/s.y;if(o){const m=at(o),f=r&&Ct(r)?at(r):r;let v=m,w=Eo(v);for(;w&&r&&f!==v;){const I=xn(w),C=w.getBoundingClientRect(),y=Ot(w),x=C.left+(w.clientLeft+parseFloat(y.paddingLeft))*I.x,b=C.top+(w.clientTop+parseFloat(y.paddingTop))*I.y;c*=I.x,l*=I.y,d*=I.x,p*=I.y,c+=x,l+=b,v=at(w),w=Eo(v)}}return Pr({width:d,height:p,x:c,y:l})}function $m(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=Nt(r),a=t?Ur(t.floating):!1;if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},l=Xt(1);const d=Xt(0),p=St(r);if((p||!p&&!o)&&((jn(r)!=="body"||Zn(s))&&(c=Br(r)),St(r))){const m=hn(r);l=xn(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 Km(e){return Array.from(e.getClientRects())}function So(e,t){const n=Br(e).scrollLeft;return t?t.left+n:hn(Nt(e)).left+n}function Vm(e){const t=Nt(e),n=Br(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+So(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 Hm(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=li();(!l||l&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}function Um(e,t){const n=hn(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=St(e)?xn(e):Xt(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 as(e,t,n){let r;if(t==="viewport")r=Hm(e,n);else if(t==="document")r=Vm(Nt(e));else if(Ct(t))r=Um(t,n);else{const i=ec(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Pr(r)}function tc(e,t){const n=Gt(e);return n===t||!Ct(n)||Nn(n)?!1:Ot(n).position==="fixed"||tc(n,t)}function Bm(e,t){const n=t.get(e);if(n)return n;let r=qn(e,[],!1).filter(a=>Ct(a)&&jn(a)!=="body"),i=null;const o=Ot(e).position==="fixed";let s=o?Gt(e):e;for(;Ct(s)&&!Nn(s);){const a=Ot(s),c=ci(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Zn(s)&&!c&&tc(e,s))?r=r.filter(d=>d!==s):i=a,s=Gt(s)}return t.set(e,r),r}function qm(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Ur(t)?[]:Bm(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((l,d)=>{const p=as(t,d,i);return l.top=dn(p.top,l.top),l.right=En(p.right,l.right),l.bottom=En(p.bottom,l.bottom),l.left=dn(p.left,l.left),l},as(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Wm(e){const{width:t,height:n}=Qa(e);return{width:t,height:n}}function Jm(e,t,n){const r=St(t),i=Nt(t),o=n==="fixed",s=hn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Xt(0);if(r||!r&&!o)if((jn(t)!=="body"||Zn(i))&&(a=Br(t)),r){const f=hn(t,!0,o,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else i&&(c.x=So(i));let l=0,d=0;if(i&&!r&&!o){const f=i.getBoundingClientRect();d=f.top+a.scrollTop,l=f.left+a.scrollLeft-So(i,f)}const p=s.left+a.scrollLeft-c.x-l,m=s.top+a.scrollTop-c.y-d;return{x:p,y:m,width:s.width,height:s.height}}function uo(e){return Ot(e).position==="static"}function cs(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 nc(e,t){const n=at(e);if(Ur(e))return n;if(!St(e)){let i=Gt(e);for(;i&&!Nn(i);){if(Ct(i)&&!uo(i))return i;i=Gt(i)}return n}let r=cs(e,t);for(;r&&Fm(r)&&uo(r);)r=cs(r,t);return r&&Nn(r)&&uo(r)&&!ci(r)?n:r||Mm(e)||n}const zm=async function(e){const t=this.getOffsetParent||nc,n=this.getDimensions,r=await n(e.floating);return{reference:Jm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Xm(e){return Ot(e).direction==="rtl"}const Gm={convertOffsetParentRelativeRectToViewportRelativeRect:$m,getDocumentElement:Nt,getClippingRect:qm,getOffsetParent:nc,getElementRects:zm,getClientRects:Km,getDimensions:Wm,getScale:xn,isElement:Ct,isRTL:Xm};function Ym(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:p,height:m}=e.getBoundingClientRect();if(a||t(),!p||!m)return;const f=vr(d),v=vr(i.clientWidth-(l+p)),w=vr(i.clientHeight-(d+m)),I=vr(l),y={rootMargin:-f+"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 Zm(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=ui(e),d=i||o?[...l?qn(l):[],...qn(t)]:[];d.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),o&&C.addEventListener("resize",n)});const p=l&&a?Ym(l,n):null;let m=-1,f=null;s&&(f=new ResizeObserver(C=>{let[y]=C;y&&y.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(t)})),n()}),l&&!c&&f.observe(l),f.observe(t));let v,w=c?hn(e):null;c&&I();function I(){const C=hn(e);w&&(C.x!==w.x||C.y!==w.y||C.width!==w.width||C.height!==w.height)&&n(),w=C,v=requestAnimationFrame(I)}return n(),()=>{var C;d.forEach(y=>{i&&y.removeEventListener("scroll",n),o&&y.removeEventListener("resize",n)}),p==null||p(),(C=f)==null||C.disconnect(),f=null,c&&cancelAnimationFrame(v)}}const Qm=Dm,eh=jm,th=Am,nh=Rm,ls=(e,t,n)=>{const r=new Map,i={platform:Gm,...n},o={...i.platform,_c:r};return Tm(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 eh="react-tooltip-core-styles",th="react-tooltip-base-styles",ls={core:!1,base:!1};function us({css:e,id:t=th,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||ls[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=eh),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)),ls[n]=!0}const ds=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[Gm(Number(i)),Zm({fallbackAxisSideDirection:"start"}),Ym({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(Qm({element:n,padding:5})),cs(e,t,{placement:r,strategy:o,middleware:c}).then(({x:l,y:d,placement:p,middlewareData:m})=>{var f,v;const w={left:`${l}px`,top:`${d}px`,border:a},{x:I,y:C}=(f=m.arrow)!==null&&f!==void 0?f:{x:0,y:0},y=(v={top:"bottom",right:"left",bottom:"top",left:"right"}[p.split("-")[0]])!==null&&v!==void 0?v:"bottom",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:C!=null?`${C}px`:"",right:"",bottom:"",...x,[y]:`-${4+b}px`},place:p}})):cs(e,t,{placement:"bottom",strategy:o,middleware:c}).then(({x:l,y:d,placement:p})=>({tooltipStyles:{left:`${l}px`,top:`${d}px`},tooltipArrowStyles:{},place:p}))},ps=(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},ms=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(!ms(e)||!ms(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]))},nh=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some(n=>{const r=t.getPropertyValue(n);return r==="auto"||r==="scroll"})},hs=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(nh(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},rh=typeof window<"u"?g.useLayoutEffect:g.useEffect,ht=e=>{e.current&&(clearTimeout(e.current),e.current=null)},oh="DEFAULT_TOOLTIP_ID",ih={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},sh=g.createContext({getTooltipData:()=>ih});function ec(e=oh){return g.useContext(sh).getTooltipData(e)}var bn={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},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 ah=({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:p="absolute",middlewares:m,wrapper:f,delayShow:v=0,delayHide:w=0,float:I=!1,hidden:C=!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:fe=!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),[pe,V]=g.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[we,De]=g.useState(!1),[Ue,je]=g.useState(!1),[me,gt]=g.useState(null),Be=g.useRef(!1),nt=g.useRef(null),{anchorRefs:vt,setActiveAnchor:yt}=ec(t),qe=g.useRef(!1),[$e,Fe]=g.useState([]),Oe=g.useRef(!1),wt=d||l.includes("click"),Xe=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 $t=T?{...T}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!T&&wt&&Object.assign($t,{mouseleave:!1,blur:!1,mouseout:!1});const rt=J?{...J}:{escape:b||!1,scroll:_||!1,resize:E||!1,clickOutsideAnchor:Xe||!1};q&&(Object.assign(Tt,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign($t,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(rt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),rh(()=>(Oe.current=!0,()=>{Oe.current=!1}),[]);const Ee=H=>{Oe.current&&(H&&je(!0),setTimeout(()=>{Oe.current&&(S==null||S(H),de===void 0&&De(H))},10))};g.useEffect(()=>{if(de===void 0)return()=>null;de&&je(!0);const H=setTimeout(()=>{De(de)},10);return()=>{clearTimeout(H)}},[de]),g.useEffect(()=>{if(we!==Be.current)if(ht(A),Be.current=we,we)ee==null||ee();else{const H=(oe=>{const ie=oe.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(oe=>So(oe,H)?oe:H)},Kt=(H=v)=>{ht(B),Ue?Ee(!0):B.current=setTimeout(()=>{Ee(!0)},H)},At=(H=w)=>{ht(ae),ae.current=setTimeout(()=>{qe.current||Ee(!1)},H)},tn=H=>{var oe;if(!H)return;const ie=(oe=H.currentTarget)!==null&&oe!==void 0?oe:H.target;if(!(ie!=null&&ie.isConnected))return M(null),void yt({current:null});v?Kt():Ee(!0),M(ie),yt({current:ie}),ht(ae)},Ze=()=>{x?At(w||100):w?At():Ee(!1),ht(B)},Pt=({x:H,y:oe})=>{var ie;const Re={getBoundingClientRect:()=>({x:H,y:oe,width:0,height:0,top:oe,left:H,right:H,bottom:oe})};ds({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:p,middlewares:m,border:j}).then(ke=>{Rt(ke)})},Vt=H=>{if(!H)return;const oe=H,ie={x:oe.clientX,y:oe.clientY};Pt(ie),nt.current=ie},nn=H=>{var oe;if(!we)return;const ie=H.target;ie.isConnected&&(!((oe=K.current)===null||oe===void 0)&&oe.contains(ie)||[document.querySelector(`[id='${o}']`),...$e].some(Re=>Re==null?void 0:Re.contains(ie))||(Ee(!1),ht(B)))},Ht=fs(tn,50),xe=fs(Ze,50),Ge=H=>{xe.cancel(),Ht(H)},te=()=>{Ht.cancel(),xe()},ue=g.useCallback(()=>{var H,oe;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&&ds({place:(oe=me==null?void 0:me.place)!==null&&oe!==void 0?oe:a,offset:c,elementReference:P,tooltipReference:K.current,tooltipArrowReference:Z.current,strategy:p,middlewares:m,border:j}).then(Re=>{Oe.current&&Rt(Re)})},[we,P,ne,z,a,me==null?void 0:me.place,c,p,Y,me==null?void 0:me.position,I]);g.useEffect(()=>{var H,oe;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=()=>{Ee(!1)},Qe=hs(P),Ke=hs(K.current);rt.scroll&&(window.addEventListener("scroll",ke),Qe==null||Qe.addEventListener("scroll",ke),Ke==null||Ke.addEventListener("scroll",ke));let We=null;rt.resize?window.addEventListener("resize",ke):P&&K.current&&(We=Xm(P,K.current,ue,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const et=Ie=>{Ie.key==="Escape"&&Ee(!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()},pt=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],nr=["click","dblclick","mousedown","mouseup"];Object.entries(Tt).forEach(([Ie,It])=>{It&&(pt.includes(Ie)?_e.push({event:Ie,listener:Ge}):nr.includes(Ie)&&_e.push({event:Ie,listener:rn}))}),Object.entries($t).forEach(([Ie,It])=>{It&&(pt.includes(Ie)?_e.push({event:Ie,listener:te}):nr.includes(Ie)&&_e.push({event:Ie,listener:Gr}))}),I&&_e.push({event:"pointermove",listener:Vt});const rr=()=>{qe.current=!0},or=()=>{qe.current=!1,Ze()};return x&&!Xe&&((H=K.current)===null||H===void 0||H.addEventListener("mouseenter",rr),(oe=K.current)===null||oe===void 0||oe.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):We==null||We(),rt.clickOutsideAnchor&&window.removeEventListener("click",nn),rt.escape&&window.removeEventListener("keydown",et),x&&!Xe&&((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,Ue,vt,$e,$,T,J,wt,v,w]),g.useEffect(()=>{var H,oe;let ie=(oe=(H=me==null?void 0:me.anchorSelect)!==null&&H!==void 0?H:s)!==null&&oe!==void 0?oe:"";!ie&&t&&(ie=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Re=new MutationObserver(ke=>{const Qe=[],Ke=[];ke.forEach(We=>{if(We.type==="attributes"&&We.attributeName==="data-tooltip-id"&&(We.target.getAttribute("data-tooltip-id")===t?Qe.push(We.target):We.oldValue===t&&Ke.push(We.target)),We.type==="childList"){if(P){const et=[...We.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),Ee(!1),M(null),ht(B),ht(ae),!0)})}if(ie)try{const et=[...We.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(We=>[...We.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 oe=document.querySelector(`[id='${o}']`),ie=[...$e,oe];P&&ie.includes(P)||M((H=$e[0])!==null&&H!==void 0?H:oe)},[o,$e,P]),g.useEffect(()=>(fe&&Ee(!0),()=>{ht(B),ht(ae)}),[]),g.useEffect(()=>{var H;let oe=(H=me==null?void 0:me.anchorSelect)!==null&&H!==void 0?H:s;if(!oe&&t&&(oe=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),oe)try{const ie=Array.from(document.querySelectorAll(oe));Fe(ie)}catch{Fe([])}},[t,s,me==null?void 0:me.anchorSelect]),g.useEffect(()=>{B.current&&(ht(B),Kt(v))},[v]);const Me=(G=me==null?void 0:me.content)!==null&&G!==void 0?G:ne,Dt=we&&Object.keys(pe.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?Kt(H.delay):Ee(!0)},close:H=>{H!=null&&H.delay?At(H.delay):Ee(!1)},activeAnchor:P,place:pe.place,isOpen:!!(Ue&&!C&&Me&&Dt)})),Ue&&!C&&Me?g.createElement(f,{id:t,role:X,className:st("react-tooltip",bn.tooltip,uo.tooltip,uo[i],n,`react-tooltip__place-${pe.place}`,bn[Dt?"show":"closing"],Dt?"react-tooltip__show":"react-tooltip__closing",p==="fixed"&&bn.fixed,x&&bn.clickable),onTransitionEnd:H=>{ht(A),we||H.propertyName!=="opacity"||(je(!1),gt(null),U==null||U())},style:{...z,...pe.tooltipStyles,opacity:D!==void 0&&Dt?D:void 0},ref:K},Me,g.createElement(f,{className:st("react-tooltip-arrow",bn.arrow,uo.arrow,r,y&&bn.noArrow),style:{...pe.tooltipArrowStyles,background:R?`linear-gradient(to right bottom, transparent 50%, ${R} 50%)`:void 0},ref:Z})):null},ch=({content:e})=>g.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),lh=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:p="div",children:m=null,events:f=["hover"],openOnClick:v=!1,positionStrategy:w="absolute",middlewares:I,delayShow:C=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:fe,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,pe]=g.useState(l),[V,we]=g.useState(c),[De,Ue]=g.useState(d),[je,me]=g.useState(C),[gt,Be]=g.useState(y),[nt,vt]=g.useState(x),[yt,qe]=g.useState(b),[$e,Fe]=g.useState(p),[Oe,wt]=g.useState(f),[Xe,Tt]=g.useState(w),[$t,rt]=g.useState(null),[Ee,Rt]=g.useState(null),Kt=g.useRef(de),{anchorRefs:At,activeAnchor:tn}=ec(e),Ze=xe=>xe==null?void 0:xe.getAttributeNames().reduce((Ge,te)=>{var ue;return te.startsWith("data-tooltip-")&&(Ge[te.replace(/^data-tooltip-/,"")]=(ue=xe==null?void 0:xe.getAttribute(te))!==null&&ue!==void 0?ue:null),Ge},{}),Pt=xe=>{const Ge={place:te=>{var ue;pe((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=>{Ue(te===null?d:Number(te))},wrapper:te=>{var ue;Fe((ue=te)!==null&&ue!==void 0?ue:p)},events:te=>{const ue=te==null?void 0:te.split(" ");wt(ue??f)},"position-strategy":te=>{var ue;Tt((ue=te)!==null&&ue!==void 0?ue:w)},"delay-show":te=>{me(te===null?C:Number(te))},"delay-hide":te=>{Be(te===null?y:Number(te))},float:te=>{vt(te===null?x:te==="true")},hidden:te=>{qe(te===null?b:te==="true")},"class-name":te=>{rt(te)}};Object.values(Ge).forEach(te=>te(null)),Object.entries(xe).forEach(([te,ue])=>{var Me;(Me=Ge[te])===null||Me===void 0||Me.call(Ge,ue)})};g.useEffect(()=>{Z(r)},[r]),g.useEffect(()=>{ae(i)},[i]),g.useEffect(()=>{pe(l)},[l]),g.useEffect(()=>{we(c)},[c]),g.useEffect(()=>{Ue(d)},[d]),g.useEffect(()=>{me(C)},[C]),g.useEffect(()=>{Be(y)},[y]),g.useEffect(()=>{vt(x)},[x]),g.useEffect(()=>{qe(b)},[b]),g.useEffect(()=>{Tt(w)},[w]),g.useEffect(()=>{Kt.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 Ge=new Set(At);let te=n;if(!te&&e&&(te=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),te)try{document.querySelectorAll(te).forEach(oe=>{Ge.add({current:oe})})}catch{console.warn(`[react-tooltip] "${te}" is not a valid CSS selector`)}const ue=document.querySelector(`[id='${t}']`);if(ue&&Ge.add({current:ue}),!Ge.size)return()=>null;const Me=(xe=Ee??ue)!==null&&xe!==void 0?xe:tn.current,Dt=new MutationObserver(oe=>{oe.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 oe=Ze(Me);Pt(oe),Dt.observe(Me,H)}return()=>{Dt.disconnect()}},[At,tn,Ee,t,n]),g.useEffect(()=>{U!=null&&U.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),fe&&!ps("border",`${fe}`)&&console.warn(`[react-tooltip] "${fe}" is not a valid \`border\`.`),U!=null&&U.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),S&&!ps("opacity",`${S}`)&&console.warn(`[react-tooltip] "${S}" is not a valid \`opacity\`.`)},[]);let Vt=m;const nn=g.useRef(null);if(o){const xe=o({content:(Ee==null?void 0:Ee.getAttribute("data-tooltip-content"))||K||null,activeAnchor:Ee});Vt=xe?g.createElement("div",{ref:nn,className:"react-tooltip-content-wrapper"},xe):null}else K&&(Vt=K);B&&(Vt=g.createElement(ch,{content:B}));const Ht={forwardRef:G,id:e,anchorId:t,anchorSelect:n,className:st(s,$t),classNameArrow:a,content:Vt,contentWrapperRef:nn,place:A,variant:V,offset:De,wrapper:$e,events:Oe,openOnClick:v,positionStrategy:Xe,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:fe,opacity:S,arrowColor:P,setIsOpen:M,afterShow:j,afterHide:D,disableTooltip:R,activeAnchor:Ee,setActiveAnchor:xe=>Rt(xe),role:X};return g.createElement(ah,{...Ht})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||us({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||us({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 uh(){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 dh({id:e,tooltipText:t}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:uh()}),u.jsx(lh,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const tc=g.createContext(null);function nc(){const e=g.useContext(tc);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const rc=g.createContext(()=>{});function ph(){const e=g.useContext(rc);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var oc=Symbol.for("immer-nothing"),gs=Symbol.for("immer-draftable"),lt=Symbol.for("immer-state"),fh=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=fh[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Rn=Object.getPrototypeOf;function An(e){return!!e&&!!e[lt]}function gn(e){var t;return e?ic(e)||Array.isArray(e)||!!e[gs]||!!((t=e.constructor)!=null&&t[gs])||qr(e)||Wr(e):!1}var mh=Object.prototype.constructor.toString();function ic(e){if(!e||typeof e!="object")return!1;const t=Rn(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===mh}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[lt];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 sc(e,t,n){const r=Br(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function hh(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=ic(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[lt];let i=Reflect.ownKeys(r);for(let o=0;o<i.length;o++){const s=i[o],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Rn(e),r)}else{const r=Rn(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function ui(e,t=!1){return Jr(e)||An(e)||!gn(e)||(Br(e)>1&&(e.set=e.add=e.clear=e.delete=gh),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>ui(r,!0))),e}function gh(){tt(2)}function Jr(e){return Object.isFrozen(e)}var vh={};function vn(e){const t=vh[e];return t||tt(0,e),t}var qn;function ac(){return qn}function yh(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function vs(e,t){t&&(vn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ro(e){Ao(e),e.drafts_.forEach(wh),e.drafts_=null}function Ao(e){e===qn&&(qn=e.parent_)}function ys(e){return qn=yh(qn,e)}function wh(e){const t=e[lt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function ws(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[lt].modified_&&(Ro(t),tt(4)),gn(e)&&(e=jr(t,e),t.parent_||Fr(t,e)),t.patches_&&vn("Patches").generateReplacementPatches_(n[lt].base_,e,t.patches_,t.inversePatches_)):e=jr(t,n,[]),Ro(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==oc?e:void 0}function jr(e,t,n){if(Jr(t))return t;const r=t[lt];if(!r)return Dr(t,(i,o)=>Is(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)=>Is(e,r,i,a,c,n,s)),Fr(e,i,!1),n&&e.patches_&&vn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Is(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&tt(5),An(i)){const a=o&&t&&t.type_!==3&&!No(t.assigned_,r)?o.concat(r):void 0,c=jr(e,i,a);if(sc(n,r,c),An(c))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(gn(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_&&ui(t,n)}function Ih(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ac(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=di;n&&(i=[r],o=Wn);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var di={get(e,t){if(t===lt)return e;const n=ln(e);if(!No(n,t))return _h(e,n,t);const r=n[t];return e.finalized_||!gn(r)?r:r===po(e.base_,t)?(fo(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=cc(ln(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=po(ln(e),t),o=i==null?void 0:i[lt];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(hh(n,i)&&(n!==void 0||No(e.base_,t)))return!0;fo(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 po(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,fo(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 Rn(e.base_)},setPrototypeOf(){tt(12)}},Wn={};Dr(di,(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),di.set.call(this,e[0],t,n,e[0])};function po(e,t){const n=e[lt];return(n?ln(n):e)[t]}function _h(e,t,n){var i;const r=cc(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function cc(e,t){if(!(t in e))return;let n=Rn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Rn(n)}}function Po(e){e.modified_||(e.modified_=!0,e.parent_&&Po(e.parent_))}function fo(e){e.copy_||(e.copy_=To(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var bh=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(gn(t)){const o=ys(this),s=Do(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?Ro(o):Ao(o)}return vs(o,r),ws(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===oc&&(i=void 0),this.autoFreeze_&&ui(i,!0),r){const o=[],s=[];vn("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){gn(e)||tt(8),An(e)&&(e=xh(e));const t=ys(this),n=Do(e,void 0);return n[lt].isManual_=!0,Ao(t),n}finishDraft(e,t){const n=e&&e[lt];(!n||!n.isManual_)&&tt(9);const{scope_:r}=n;return vs(r,t),ws(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=vn("Patches").applyPatches_;return An(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Do(e,t){const n=qr(e)?vn("MapSet").proxyMap_(e,t):Wr(e)?vn("MapSet").proxySet_(e,t):Ih(e,t);return(t?t.scope_:ac()).drafts_.push(n),n}function xh(e){return An(e)||tt(10,e),lc(e)}function lc(e){if(!gn(e)||Jr(e))return e;const t=e[lt];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)=>{sc(n,r,lc(i))}),t&&(t.finalized_=!1),n}var ut=new bh,$n=ut.produce;ut.produceWithPatches.bind(ut);ut.setAutoFreeze.bind(ut);ut.setUseStrictShallowCopy.bind(ut);ut.applyPatches.bind(ut);ut.createDraft.bind(ut);ut.finishDraft.bind(ut);const uc=g.createContext(void 0),Ch={};function pi(){const e=g.useContext(uc);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Oh({children:e}){const{installation:t}=dt(),{hydratedRevision:n,loading:r}=Dn(),[i,o]=g.useState(Ch),s=t==null?void 0:t.config;g.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&zp(n,s,o)},[n,r,s,i]);const a=g.useCallback((f,v)=>{o(w=>$n(w,I=>{I[f]=$n(I[f],v)}))},[o]),c=g.useCallback((f,v)=>{o(w=>$n(w,I=>{I[f]=v}))},[o]),l=g.useCallback(()=>{o($n(f=>{const v=f.other.write;v&&(v.isWriteModified=!1)}))},[o]),d=g.useCallback(f=>{o($n(v=>{var I;const w=(I=v[f])==null?void 0:I.read;w&&(w.isOptionalFieldsModified=!1,w.isRequiredMapFieldsModified=!1)}))},[o]),p=g.useCallback(f=>{f===fn?l():d(f)},[d,l]),m=g.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:p}),[i,c,p,a]);return u.jsx(uc.Provider,{value:m,children:e})}const In=()=>{const{appName:e}=Pe(),{objectConfigurationsState:t,setConfigureState:n}=pi(),{selectedObjectName:r}=nc(),i=na(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}};function Eh(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=!$o(o,r);e.read.isRequiredMapFieldsModified=a}}function dc(e,t,n,r){t(e,i=>Eh(i,n,r))}function pc({field:e,onSelectChange:t,allFields:n}){var m;const{configureState:r,selectedObjectName:i,setConfigureState:o}=In(),[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&&dc(i,o,e.mapToName,e._default),a(!1)},[e,o,i,l,r]);const d=g.useMemo(()=>n.map(f=>({id:f.fieldName,label:f.displayName,value:f.fieldName})),[n]),p=u.jsx(ym,{disabled:s,items:d,selectedValue:l||null,onSelectedItemChange:f=>{t({target:{name:e.mapToName,value:f==null?void 0:f.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(dh,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),p]},e.mapToName)}const Sh="_formControl_9qd8d_1",Nh="_formLabel_9qd8d_5",Th="_formLabelRequired_9qd8d_11",Rh="_formInput_9qd8d_16",Ah="_formInputInvalid_9qd8d_20",Ph="_formError_9qd8d_24",Dh="_disabled_9qd8d_30",cn={formControl:Sh,formLabel:Nh,formLabelRequired:Th,formInput:Rh,formInputInvalid:Ah,formError:Ph,disabled:Dh};function jh({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 Fh="_divider_1kmoj_1",_s={divider:Fh};function fi({className:e,style:t}){return u.jsx("hr",{className:e?`${_s.divider} ${e}`:_s.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 Mh(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=In(),{fieldMapping:r}=dt(),{isError:i,removeError:o}=Zt(),s=c=>{const{value:l,name:d}=c.target;l&&(e&&dc(e,n,d,l),i(Ne.MAPPING,d)&&o(Ne.MAPPING,d))},a=g.useMemo(()=>{var p;const c=((p=t==null?void 0:t.read)==null?void 0:p.requiredMapFields)||[],l=e&&r?Object.values(r[e]||{}).flat():[];return c.concat(l).reduce((m,f)=>m.find(w=>w.mapToName===f.mapToName)?m.map(w=>w.mapToName===f.mapToName?f:w):m.concat(f),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(jh,{id:c.mapToName,isInvalid:i(Ne.MAPPING,c.mapToName),errorMessage:"* required",children:u.jsx(pc,{allFields:((l=t==null?void 0:t.read)==null?void 0:l.allFields)||[],field:c,onSelectChange:s})},c.mapToName)})})]}):null}const kh={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function Lh({children:e,style:t}){return u.jsx(yn,{style:{...kh,...t},children:e})}function $h(){var d,p,m;const{project:e}=Pe(),{hydratedRevision:t}=Dn(),{selectedObjectName:n}=In(),{provider:r}=dt(),i=e==null?void 0:e.appName,o=Qt(r),s=(m=(p=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:p.objects)==null?void 0:m.find(f=>f.objectName===n),a=(s==null?void 0:s.displayName)||n&&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(Lh,{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 fc(...e){return t=>e.forEach(n=>Kh(n,t))}function Jn(...e){return k.useCallback(fc(...e),e)}function Vh(e,t=[]){let n=[];function r(o,s){const a=k.createContext(s),c=n.length;n=[...n,s];const l=p=>{var C;const{scope:m,children:f,...v}=p,w=((C=m==null?void 0:m[e])==null?void 0:C[c])||a,I=k.useMemo(()=>v,Object.values(v));return u.jsx(w.Provider,{value:I,children:f})};l.displayName=o+"Provider";function d(p,m){var w;const f=((w=m==null?void 0:m[e])==null?void 0:w[c])||a,v=k.useContext(f);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${p}\` 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,Hh(i,...t)]}function Hh(...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 p=c(o)[`__scope${l}`];return{...a,...p}},{});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 mi(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 hi({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=Uh({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=mi(n),c=k.useCallback(l=>{if(o){const p=typeof l=="function"?l(e):l;p!==e&&a(p)}else i(l)},[o,e,i,a]);return[s,c]}function Uh({defaultProp:e,onChange:t}){const n=k.useState(e),[r]=n,i=k.useRef(r),o=mi(t);return k.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function Bh(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 qh(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 Wh(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var gi=e=>{const{present:t,children:n}=e,r=Jh(t),i=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),o=Jn(r.ref,zh(i));return typeof n=="function"||r.isPresent?k.cloneElement(i,{ref:o}):null};gi.displayName="Presence";function Jh(e){const[t,n]=k.useState(),r=k.useRef({}),i=k.useRef(e),o=k.useRef("none"),s=e?"mounted":"unmounted",[a,c]=Wh(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,f=yr(l);e?c("MOUNT"):f==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(d&&m!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Mr(()=>{if(t){let l;const d=t.ownerDocument.defaultView??window,p=f=>{const w=yr(r.current).includes(f.animationName);if(f.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=f=>{f.target===t&&(o.current=yr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{d.clearTimeout(l),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}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 zh(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(Gh);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=Zh(n);return k.cloneElement(n,{...Yh(r,n.props),ref:t?fc(t,i):i})}return k.Children.count(n)>1?k.Children.only(null):null});jo.displayName="SlotClone";var Xh=({children:e})=>u.jsx(u.Fragment,{children:e});function Gh(e){return k.isValidElement(e)&&e.type===Xh}function Yh(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 Zh(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 Qh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],en=Qh.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}},{}),vi="Checkbox",[eg,my]=Vh(vi),[tg,ng]=eg(vi),mc=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:c="on",onCheckedChange:l,form:d,...p}=e,[m,f]=k.useState(null),v=Jn(t,b=>f(b)),w=k.useRef(!1),I=m?d||!!m.closest("form"):!0,[C=!1,y]=hi({prop:i,defaultProp:o,onChange:l}),x=k.useRef(C);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(tg,{scope:n,state:C,disabled:a,children:[u.jsx(en.button,{type:"button",role:"checkbox","aria-checked":Jt(C)?"mixed":C,"aria-required":s,"data-state":vc(C),"data-disabled":a?"":void 0,disabled:a,value:c,...p,ref:v,onKeyDown:xt(e.onKeyDown,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:xt(e.onClick,b=>{y(_=>Jt(_)?!0:!_),I&&(w.current=b.isPropagationStopped(),w.current||b.stopPropagation())})}),I&&u.jsx(rg,{control:m,bubbles:!w.current,name:r,value:c,checked:C,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Jt(o)?!1:o})]})});mc.displayName=vi;var hc="CheckboxIndicator",gc=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=ng(hc,n);return u.jsx(gi,{present:r||Jt(o.state)||o.state===!0,children:u.jsx(en.span,{"data-state":vc(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});gc.displayName=hc;var rg=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,s=k.useRef(null),a=Bh(n),c=qh(t);k.useEffect(()=>{const d=s.current,p=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(p,"checked").set;if(a!==n&&f){const v=new Event("click",{bubbles:r});d.indeterminate=Jt(n),f.call(d,Jt(n)?!1:n),d.dispatchEvent(v)}},[a,n,r]);const l=k.useRef(Jt(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 Jt(e){return e==="indeterminate"}function vc(e){return Jt(e)?"indeterminate":e?"checked":"unchecked"}var yc=mc,wc=gc;function Ic(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 og=["color"],_c=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Ic(e,og);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"],sg=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Ic(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 ag="_checkboxGroupContainer_75zr7_1",cg="_stack_75zr7_6",lg="_selectAllContainer_75zr7_11",ug="_fieldContainer_75zr7_18",dg="_checkbox_75zr7_1",Pn={checkboxGroupContainer:ag,stack:cg,selectAllContainer:lg,fieldContainer:ug,checkbox:dg};function bc({id:e,isChecked:t,label:n,onCheckedChange:r}){return u.jsxs("div",{className:Pn.fieldContainer,children:[u.jsx(yc,{className:Pn.checkbox,id:e,onCheckedChange:r,checked:t,children:u.jsx(wc,{children:u.jsx(_c,{})})}),u.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function xc({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return u.jsxs("div",{className:Pn.selectAllContainer,children:[u.jsx(yc,{className:Pn.checkbox,id:e,onCheckedChange:r,children:u.jsxs(wc,{children:[i&&u.jsx(sg,{}),t===!0&&u.jsx(_c,{})]})}),u.jsx("label",{htmlFor:e,children:n})]})}function Cc({children:e}){return u.jsx("div",{className:Pn.checkboxGroupContainer,children:e})}function Oc({children:e}){return u.jsx("div",{className:Pn.stack,children:e})}function pg(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=!$o(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function bs(e,t,n,r){t(e,i=>pg(i,n,r))}function fg(){var p,m;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=In(),i=(p=t==null?void 0:t.read)==null?void 0:p.selectedOptionalFields,o=(f,v)=>{f!=="indeterminate"&&r&&t&&bs(r,n,v,f)},s=(m=t==null?void 0:t.read)==null?void 0:m.optionalFields,a=f=>{r&&s&&s.forEach(v=>{Xt(v)||bs(r,n,v.fieldName,f)})},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(Cc,{children:[((s==null?void 0:s.length)||0)>=2&&u.jsx(xc,{id:"select-all-fields",isChecked:l,label:"Select all",onCheckedChange:a,isIndeterminate:d}),u.jsx(Oc,{children:s.map(f=>Xt(f)?null:u.jsx(bc,{id:f.fieldName,isChecked:!!(i!=null&&i[f==null?void 0:f.fieldName]),label:f.displayName,onCheckedChange:v=>o(v,f.fieldName)},f.fieldName))})]})]})}function mg(){return u.jsx(fg,{})}const hg={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 gg({children:e,style:t,...n}){return u.jsx("span",{style:{...hg,...t},...n,children:e})}function vg(){var r,i,o;const{configureState:e,selectedObjectName:t}=In(),{appName:n}=Pe();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(gg,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function yg(){return u.jsxs(u.Fragment,{children:[u.jsx($h,{}),u.jsx(vg,{}),u.jsx(Mh,{}),u.jsx(mg,{})]})}function wg(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=!$o(a,s);e.write.isWriteModified=l}}}function xs(e,t,n,r){t(e,i=>{wg(i,n,r)})}function Ig(){var p,m,f,v;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=In(),i=(p=n==null?void 0:n.write)==null?void 0:p.selectedNonConfigurableWriteFields,o=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects,s=(w,I)=>{w!=="indeterminate"&&t&&n&&xs(t,r,I,w)},a=w=>{var I,C;t&&n&&((C=(I=n==null?void 0:n.write)==null?void 0:I.writeObjects)==null||C.forEach(y=>{xs(t,r,y.objectName,w)}))},c=!!o,l=Object.keys(i||{}).length===((v=(f=n==null?void 0:n.write)==null?void 0:f.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(Cc,{children:[((o==null?void 0:o.length)||0)>=2&&u.jsx(xc,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:l,label:"Select all"}),u.jsx(Oc,{children:o.map(w=>u.jsx(bc,{id:w.objectName,onCheckedChange:I=>s(I,w.objectName),isChecked:!!(i!=null&&i[w.objectName]),label:w.displayName},w.objectName))})]})]})}function _g(){return u.jsx(Ig,{})}function Ec({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const r=He(),{projectId:i}=Pe(),{integrationId:o,installation:s,resetInstallations:a,setIntegrationDeleted:c,onUninstallSuccess:l}=dt(),[d,p]=g.useState(!1),m=!i||!o||!(s!=null&&s.id)||d,f=async()=>{if(!m){p(!0),console.warn("uninstalling installation",{projectId:i,integrationId:o,installationId:s.id});try{await Ce().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."),ze(I)}finally{p(!1)}}},v=d?"Uninstalling...":e,w=u.jsx(ct,{type:"button",onClick:f,disabled:m,variant:t,style:n,children:v});return s!=null&&s.id?w:null}function bg(){const{appName:e}=Pe(),{installation:t}=dt();return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t!=null&&t.id?u.jsxs("p",{children:["Once you uninstall this integration, all your configuration will be lost, and"," ",u.jsx("b",{children:e})," may stop working."]}):u.jsx("p",{children:"You've successfully uninstalled the integration."}),u.jsx(Ec,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function Sc({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var E,$,T;const{installation:o}=dt(),{hydratedRevision:s,loading:a}=Dn(),{configureState:c,selectedObjectName:l}=In(),d=o==null?void 0:o.config,p=d&&l&&!!zs(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),f=(T=c==null?void 0:c.write)==null?void 0:T.isWriteModified,C=a||n||!c||!l||!(m||f||r||l!==fn&&!p),y=l===fn,x=l===Or,b=u.jsx(ct,{type:"submit",disabled:C,children:r?"Install":"Save"}),_=u.jsx(ct,{type:"button",onClick:t,disabled:C,variant:"ghost",children:"Reset"});return n?u.jsx(zt,{}):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(yn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&u.jsx(oa,{children:typeof i=="string"?i:"Installation Failed."}),a&&u.jsx(zt,{}),s&&!x&&!y&&u.jsx(yg,{}),s&&!x&&y&&u.jsx(_g,{}),!a&&x&&u.jsx(bg,{})]})]})}const Nc=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o}=dt(),{hydratedRevision:s,loading:a}=Dn(),{selectedObjectName:c}=nc(),{selectedConnection:l}=wn(),d=He(),{projectId:p}=Pe(),{resetBoundary:m,setErrors:f,setError:v,getError:w}=Zt(),{resetConfigureState:I,objectConfigurationsState:C,resetPendingConfigurationState:y}=pi(),x=na(c||"",C),{onNextIncompleteTab:b}=ph(),_=g.useCallback(()=>{m(Ne.INSTALLATION_MUTATION)},[m]),E=g.useCallback(T=>T?J=>{v(Ne.INSTALLATION_MUTATION,T,J)}:J=>{console.error("objectName is required to set installation error: ",J)},[v]),$=g.useCallback(T=>T?w(Ne.INSTALLATION_MUTATION,T):"",[w]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:l,apiKey:d,projectId:p,resetBoundary:m,setErrors:f,setMutateInstallationError:E,getMutateInstallationError:$,resetMutateInstallationErrorState:_,resetConfigureState:I,objectConfigurationsState:C,resetPendingConfigurationState:y,configureState:x,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:b}},xg=void 0;function Cg(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:i,loading:o,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:l,resetBoundary:d,setErrors:p,setMutateInstallationError:m,getMutateInstallationError:f,resetMutateInstallationErrorState:v,resetConfigureState:w,objectConfigurationsState:I,resetPendingConfigurationState:C,configureState:y,onInstallSuccess:x,onNextIncompleteTab:b}=Nc(),[_,E]=g.useState(!1),$=s===fn,T=f(s),J=g.useCallback(()=>{d(Ne.MAPPING),i!=null&&i.content&&!o&&s&&Qs(i,xg,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}=Ys(ee,U,p);se.length>0||(s&&(a!=null&&a.id)&&c&&l&&e&&t&&n&&i?(E(!0),Yp(l,e,t,n,a.id,s,c,i,y,m(s),r,x).finally(()=>{E(!1),C(s),b()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},z=()=>{v(),s&&(a!=null&&a.id)&&c&&l&&e&&t&&n&&i?(E(!0),ef(l,e,t,n,a.id,c,i,y,m(s),r,x).finally(()=>{E(!1),C(s),b()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},Y=ee=>{ee.preventDefault(),$?z():q()};return u.jsx(Sc,{errorMsg:T,isCreateMode:!0,isLoading:_,onSave:Y,onReset:J})}function Og({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 Ce().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=>{ze(d,c)})}const Eg=(e,t,n,r,i,o)=>{const s=ea(e),a=ta(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},Sg=(e,t,n,r,i,o,s,a,c,l,d)=>{const p=Eg(o,r||"",a,a.schedule,c,a.backfill);return p?Og({updateConfig:p,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))},Ng=(e,t)=>{const r={content:{write:{objects:ra(e)}}};return $r(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},Tg=(e,t,n,r,i,o,s,a,c)=>{const l=Ng(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 Ce().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(p=>{a(p),c==null||c(p.id,p.config)}).catch(p=>{ze(p,s)})};function Rg({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:i,selectedObjectName:o,apiKey:s,projectId:a,resetBoundary:c,setErrors:l,setMutateInstallationError:d,getMutateInstallationError:p,resetConfigureState:m,resetPendingConfigurationState:f,configureState:v,onUpdateSuccess:w,onNextIncompleteTab:I}=Nc(),[C,y]=g.useState(!1),x=o===fn,b=p(o),{config:_}=e,E=g.useCallback(()=>{c(Ne.MAPPING),r!=null&&r.content&&!i&&o&&Qs(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}=Ys(z,Y,l);ee.length>0||(r&&e&&o&&s&&a&&$?(y(!0),Sg(a,t.id,e.id,o,s,v,n,$,r,d(o),w).finally(()=>{y(!1),f(o),I()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},J=()=>{e&&o&&s&&a&&r?(y(!0),Tg(a,t.id,e.id,s,v,r,d(o),n,w).finally(()=>{y(!1),f(o),I()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},q=z=>{z.preventDefault(),x?J():T()};return u.jsx(Sc,{errorMsg:b,onSave:q,onReset:E,isLoading:C})}function Ag(){const{integrationObj:e,installation:t}=dt();return e?t&&e?u.jsx(Rg,{installation:t,integrationObj:e}):u.jsx(Cg,{}):u.jsx(Lt,{message:"We can't load the integration"})}function Pg(){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 yi({text:e,children:t}){return u.jsx(Xn,{children:u.jsxs(yn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[u.jsx(Pg,{}),u.jsx("p",{children:e}),t]})})}const Dg=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function jg({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:i,apiKey:o,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:l}){const d=Dg(s,r);return d?Ko({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 Fg({provider:e}){const t=`You have successfully installed your ${Qt(e)} integration.`;return u.jsx(yi,{text:t,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(Ec,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Mg=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 kg({children:e,resetComponent:t}){var b;const{projectId:n}=Pe(),r=He(),{hydratedRevision:i,loading:o}=Dn(),{integrationObj:s,installation:a,groupRef:c,consumerRef:l,setInstallation:d,onInstallSuccess:p,isIntegrationDeleted:m}=dt(),{selectedConnection:f}=wn(),[v,w]=g.useState(!1),I=o||v,C=(b=i==null?void 0:i.content)==null?void 0:b.provider,y=Mg(i),x=_=>{console.error("Error when creating proxy installation:",_)};return g.useEffect(()=>{!I&&i&&y&&!a&&f&&r&&(s!=null&&s.id)&&(w(!0),jg({apiKey:r,projectId:n,integrationId:s==null?void 0:s.id,groupRef:c,consumerRef:l,connectionId:f==null?void 0:f.id,hydratedRevision:i,setError:x,setInstallation:d,onInstallSuccess:p}).then(()=>{w(!1)}).catch(_=>{w(!1),console.error("Error when creating proxy installation:",_)}))},[i,y,a,f,r,n,s==null?void 0:s.id,c,l,d,I,p]),m?u.jsx(yi,{text:"Integration successfully uninstalled.",children:u.jsx(ct,{type:"button",onClick:t,style:{width:"100%"},children:"Reinstall Integration"})}):s?I?u.jsx(zt,{}):y&&C&&a?u.jsx(Fg,{provider:C}):u.jsx("div",{children:e}):u.jsx(Lt,{message:"We can't load the integration"})}function Tc(){return u.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[u.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},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(yn,{children:[u.jsx("div",{style:{padding:"3rem 2rem"},children:e}),u.jsx(Tc,{})]})})}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(oa,{style:{marginTop:"2em"},children:e}):null}function wi({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(ct,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const Lg="_link_oo2kv_1",$g={link:Lg};function Rc({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return u.jsx("a",{className:st($g.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function Ac({url:e,providerDisplayName:t,credentialName:n}){return u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[u.jsx(Rc,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const Kg="_input_1g097_1",Vg="_inputError_1g097_17",Hg="_error_1g097_31",mo={input:Kg,inputError:Vg,error:Hg};function Ug({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 Bg="_textarea_1cwth_1",qg="_textareaError_1cwth_14",Wg="_error_1cwth_28",ho={textarea:Bg,textareaError:qg,error:Wg};function Jg({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:Ug,Textarea:Jg};function zg({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),p=c.length>0,m=i||!p,f=Qt(e,t),v=(w=t.apiKeyOpts)==null?void 0:w.docsURL;return u.jsx(wi,{providerName:f,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(Ac,{url:v,providerDisplayName:f,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(ct,{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=Pe(),[d,p]=g.useState(!1),[m,f]=g.useState(null),v=He();g.useEffect(()=>{if(e&&Ce&&d&&m!=null){const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:m};Ce().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:I},{headers:{"X-Api-Key":v??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),ze(C)})}},[v,e,d,r,n,o,i,l,c,m]);const w=I=>{f(I.apiKey),p(!0)};return a===null?u.jsx(Xg,{provider:e,providerInfo:t,handleSubmit:w,error:null}):s}function Yg({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var C;const[o,s]=g.useState(!1),a=()=>s(y=>!y),[c,l]=g.useState({username:"",password:""}),{username:d,password:p}=c,m=Qt(e,t),f=(C=t.basicOpts)==null?void 0:C.docsURL,v=d.length>0,w=i||!v,I=y=>{const{name:x,value:b}=y.currentTarget;l(_=>({..._,[x]:b}))};return u.jsx(wi,{providerName:m,handleSubmit:()=>{n({user:d,pass:p})},error:r,isButtonDisabled:w,children:u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[f&&u.jsx(Ac,{url:f,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(ct,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function Zg({...e}){return u.jsx(Yg,{...e})}function Qg({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const l=Pe(),[d,p]=g.useState(!1),[m,f]=g.useState(null),v=He();g.useEffect(()=>{if(e&&Ce&&d&&m!=null){const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m.user,password:m.pass}};Ce().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:I},{headers:{"X-Api-Key":v??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),ze(C)})}},[v,e,d,r,n,o,i,l,m,c]);const w=I=>{const{user:C,pass:y}=I;f({user:C,pass:y}),p(!0)};return a===null?u.jsx(Zg,{provider:e,providerInfo:t,handleSubmit:w,error:null}):s}function ev({...e}){return u.jsx(wi,{...e})}function tv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,setSelectedConnection:a,providerName:c}){const l=Pe(),d=He(),[p,m]=g.useState(!1);g.useEffect(()=>{if(e&&Ce&&p){const v={groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e};Ce().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."),ze(w)})}},[d,e,p,n,t,i,r,a,l]);const f=()=>{m(!0)};return s===null?u.jsx(ev,{handleSubmit:f,error:null,providerName:c}):o}const Pc=async(e,t,n,r,i,o,s,a)=>{var l,d;const c=await Ce().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 Ce().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(I=>I.provider===i),f=Qt(i,c);if(!m)throw new Error(`You must first set up a ${f} Provider App using the Ampersand Console.`);const v={connectOAuthParams:{providerWorkspaceRef:o,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:m.id,provider:i,enableCSRFProtection:!0}};return await Ce().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.`)},Cs=600,Os=600,nv="AUTHORIZATION_SUCCEEDED",rv="AUTHORIZATION_FAILED";function ov(e,t,n){return g.useCallback(async r=>{const i=await Ce().connectionApi.getConnection({projectIdOrName:e,connectionId:r},{headers:{"X-Api-Key":t??""}});n(i)},[e,t,n])}function iv(e,t,n,r){return g.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-Cs)/2,o=window.screenY+(window.outerHeight-Os)/2.5,s=`width=${Cs},height=${Os},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function sv(e,t){return g.useCallback(n=>{var r,i;if(n.origin===Ip){if(n.data.eventType===nv){const o=(r=n.data.data)==null?void 0:r.connection;o?e(o):console.error("Connection ID not found in event data: ",{event:n})}n.data.eventType===rv&&(console.error("OAuth failed: ",{event:n}),t==null||t(((i=n==null?void 0:n.data)==null?void 0:i.message)??"OAuth failed. Please try again."))}},[t,e])}function Dc({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i}){const o=He(),{projectId:s}=Pe(),[a,c]=g.useState(null),[l,d]=g.useState(null),{setSelectedConnection:p}=wn(),m=sv(c,r),f=iv(n,d,m,t),v=ov(s,o,p);return g.useEffect(()=>{t&&!l&&f()},[t,l,f,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,p,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 av({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(ct,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function cv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Pe(),a=He(),[c,l]=g.useState(null),[d,p]=g.useState(null),m=async()=>{p(null);try{const v=await Pc(s,t,r,a,e,void 0,n,i);l(v)}catch(v){console.error("Could not fetch OAuth popup URL."),ze(v),p(v.message??"Unexpected error")}},f=g.useCallback(v=>{p(v),l(null)},[]);return u.jsx(Dc,{windowTitle:`Connect to ${o}`,oauthUrl:c,onError:f,children:u.jsx(av,{handleSubmit:m,error:d,providerName:o})})}const lv="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function uv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return u.jsxs(Qn,{children:[u.jsx(er,{children:"Enter your Salesforce subdomain"}),u.jsx(Rc,{href:lv,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(ct,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function dv({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(ct,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const pv="salesforce";function fv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Pe(),a=He(),[c,l]=g.useState(""),[d,p]=g.useState(null),[m,f]=g.useState(null),v=async()=>{if(f(null),!c){f("Workspace is required");return}try{const C=await Pc(s,t,r,a,e,c,n,i);p(C)}catch(C){console.error(C),f((C==null?void 0:C.message)??"Unexpected error")}},w=g.useCallback(C=>{f(C),p(null)},[]),I=e===pv?u.jsx(uv,{handleSubmit:v,setWorkspace:l,error:m,isButtonDisabled:c.length===0}):u.jsx(dv,{handleSubmit:v,setWorkspace:l,error:m,isButtonDisabled:c.length===0,providerName:o});return u.jsx(Dc,{windowTitle:`Connect to ${o}`,oauthUrl:d,onError:w,children:I})}function mv({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(_=>!_),p=_=>{const{name:E,value:$}=_.currentTarget;l(T=>({...T,[E]:$}))},{clientSecret:m,clientId:f,workspace:v,scopes:w}=c,I=m.length>0,C=f.length>0,y=o?v.length>0:!0,x=n||!I||!C||!y,b=()=>{const _={clientId:f,clientSecret:m};o&&(_.workspace=v),i&&w.length>0&&(_.scopes=jp(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:_=>p(_)}),u.jsx(kt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:_=>p(_)}),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:_=>p(_)}),u.jsx(ct,{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:_=>p(_)})]}),u.jsx("br",{}),u.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:x,type:"submit",onClick:b,children:"Next"})]})}function hv({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c,setSelectedConnection:l}){const{projectId:d}=Pe(),p=He(),[m,f]=g.useState(null),v=async w=>{f(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}};Ce().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:I},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(C=>{l(C)}).catch(C=>{console.error("Error loading provider info."),ze(C),f("Error loading provider info")})};return c===null?u.jsx(mv,{providerName:t,handleSubmit:v,error:m,explicitScopesRequired:s,explicitWorkspaceRequired:a}):u.jsx(zt,{})}function gv({...e}){return u.jsx(hv,{...e})}const vv="authorizationCode",yv="authorizationCodePKCE",wv="clientCredentials";function Iv({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,p=Qt(e,t),m={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:p};return c===vv||c===yv?d?u.jsx(fv,{...m}):u.jsx(cv,{...m}):c===wv?u.jsx(gv,{...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 _v(e){const{selectedConnection:t}=wn();g.useEffect(()=>{e&&t&&e(t)},[e,t])}function bv({onSuccess:e}){_v(e)}const xv=async(e,t)=>{const n=await Ce().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function jc({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s,onDisconnectSuccess:a}){const c=He(),[l,d]=g.useState(null),{provider:p}=dt(),{selectedConnection:m,setSelectedConnection:f,connections:v}=wn();bv({onSuccess:s});const w=e||p,I=(l==null?void 0:l.displayName)??Un(w);if(g.useEffect(()=>{if(!m&&v&&v.length>0){const[y]=v;f(y)}xv(c,w).then(y=>{d(y)}).catch(y=>{console.error("Error loading provider info."),ze(y)})},[v,m,f,c,w]),!e&&!p)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(m)return o;if(l==null)return u.jsx("strong",{children:"Provider not found"});const C={provider:w,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:m,setSelectedConnection:f,providerName:I,providerInfo:l,onDisconnectSuccess:a};return l.authType==="none"?u.jsx(tv,{...C,children:o}):l.authType==="basic"?u.jsx(Qg,{...C,children:o}):l.authType==="apiKey"?u.jsx(Gg,{...C,children:o}):u.jsx(Iv,{...C})}function Cv(e,t=[]){let n=[];function r(o,s){const a=k.createContext(s),c=n.length;n=[...n,s];const l=p=>{var C;const{scope:m,children:f,...v}=p,w=((C=m==null?void 0:m[e])==null?void 0:C[c])||a,I=k.useMemo(()=>v,Object.values(v));return u.jsx(w.Provider,{value:I,children:f})};l.displayName=o+"Provider";function d(p,m){var w;const f=((w=m==null?void 0:m[e])==null?void 0:w[c])||a,v=k.useContext(f);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${p}\` 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,Ov(i,...t)]}function Ov(...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 p=c(o)[`__scope${l}`];return{...a,...p}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Fc(e,t=[]){let n=[];function r(o,s){const a=k.createContext(s),c=n.length;n=[...n,s];function l(p){const{scope:m,children:f,...v}=p,w=(m==null?void 0:m[e][c])||a,I=k.useMemo(()=>v,Object.values(v));return u.jsx(w.Provider,{value:I,children:f})}function d(p,m){const f=(m==null?void 0:m[e][c])||a,v=k.useContext(f);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${p}\` 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,Ev(i,...t)]}function Ev(...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 p=c(o)[`__scope${l}`];return{...a,...p}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Sv(e){const t=e+"CollectionProvider",[n,r]=Fc(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=f=>{const{scope:v,children:w}=f,I=g.useRef(null),C=g.useRef(new Map).current;return u.jsx(i,{scope:v,itemMap:C,collectionRef:I,children:w})};s.displayName=t;const a=e+"CollectionSlot",c=g.forwardRef((f,v)=>{const{scope:w,children:I}=f,C=o(a,w),y=Jn(v,C.collectionRef);return u.jsx(kr,{ref:y,children:I})});c.displayName=a;const l=e+"CollectionItemSlot",d="data-radix-collection-item",p=g.forwardRef((f,v)=>{const{scope:w,children:I,...C}=f,y=g.useRef(null),x=Jn(v,y),b=o(l,w);return g.useEffect(()=>(b.itemMap.set(y,{ref:y,...C}),()=>void b.itemMap.delete(y))),u.jsx(kr,{[d]:"",ref:x,children:I})});p.displayName=l;function m(f){const v=o(e+"CollectionConsumer",f);return g.useCallback(()=>{const I=v.collectionRef.current;if(!I)return[];const C=Array.from(I.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((b,_)=>C.indexOf(b.ref.current)-C.indexOf(_.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:c,ItemSlot:p},m,r]}var Nv=k.useId||(()=>{}),Tv=0;function Mc(e){const[t,n]=k.useState(Nv());return Mr(()=>{e||n(r=>r??String(Tv++))},[e]),e||(t?`radix-${t}`:"")}var Rv=k.createContext(void 0);function kc(e){const t=k.useContext(Rv);return e||t||"ltr"}var go="rovingFocusGroup.onEntryFocus",Av={bubbles:!1,cancelable:!0},Xr="RovingFocusGroup",[Fo,Lc,Pv]=Sv(Xr),[Dv,$c]=Fc(Xr,[Pv]),[jv,Fv]=Dv(Xr),Kc=k.forwardRef((e,t)=>u.jsx(Fo.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Fo.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Mv,{...e,ref:t})})}));Kc.displayName=Xr;var Mv=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,...p}=e,m=k.useRef(null),f=Jn(t,m),v=kc(o),[w=null,I]=hi({prop:s,defaultProp:a,onChange:c}),[C,y]=k.useState(!1),x=mi(l),b=Lc(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(jv,{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:C||E===0?-1:0,"data-orientation":r,...p,ref:f,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&&!C){const q=new CustomEvent(go,Av);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);Uc(se,d)}}_.current=!1}),onBlur:xt(e.onBlur,()=>y(!1))})})}),Vc="RovingFocusGroupItem",Hc=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=Mc(),c=o||a,l=Fv(Vc,n),d=l.currentTabStopId===c,p=Lc(n),{onFocusableItemAdd:m,onFocusableItemRemove:f}=l;return k.useEffect(()=>{if(r)return m(),()=>f()},[r,m,f]),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=$v(v,l.orientation,l.dir);if(w!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let C=p().filter(y=>y.focusable).map(y=>y.ref.current);if(w==="last")C.reverse();else if(w==="prev"||w==="next"){w==="prev"&&C.reverse();const y=C.indexOf(v.currentTarget);C=l.loop?Kv(C,y+1):C.slice(y+1)}setTimeout(()=>Uc(C))}})})})});Hc.displayName=Vc;var kv={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Lv(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function $v(e,t,n){const r=Lv(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return kv[r]}function Uc(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 Vv=Kc,Hv=Hc,Ii="Tabs",[Uv,hy]=Cv(Ii,[$c]),Bc=$c(),[Bv,_i]=Uv(Ii),qc=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:c="automatic",...l}=e,d=kc(a),[p,m]=hi({prop:r,onChange:i,defaultProp:o});return u.jsx(Bv,{scope:n,baseId:Mc(),value:p,onValueChange:m,orientation:s,dir:d,activationMode:c,children:u.jsx(en.div,{dir:d,"data-orientation":s,...l,ref:t})})});qc.displayName=Ii;var Wc="TabsList",Jc=k.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=_i(Wc,n),s=Bc(n);return u.jsx(Vv,{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})})});Jc.displayName=Wc;var zc="TabsTrigger",Xc=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=_i(zc,n),a=Bc(n),c=Yc(s.baseId,r),l=Zc(s.baseId,r),d=r===s.value;return u.jsx(Hv,{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,p=>{!i&&p.button===0&&p.ctrlKey===!1?s.onValueChange(r):p.preventDefault()}),onKeyDown:xt(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&s.onValueChange(r)}),onFocus:xt(e.onFocus,()=>{const p=s.activationMode!=="manual";!d&&!i&&p&&s.onValueChange(r)})})})});Xc.displayName=zc;var Gc="TabsContent",qv=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=_i(Gc,n),c=Yc(a.baseId,r),l=Zc(a.baseId,r),d=r===a.value,p=k.useRef(d);return k.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),u.jsx(gi,{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:p.current?"0s":void 0},children:m&&o})})});qv.displayName=Gc;function Yc(e,t){return`${e}-trigger-${t}`}function Zc(e,t){return`${e}-content-${t}`}var Wv=qc,Jv=Jc,Qc=Xc;const zv=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 Xv(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?zv: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 Gv(){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 Yv="_tabsRoot_lqugd_1",Zv="_tabsList_lqugd_6",Qv="_tabTrigger_lqugd_12",ey="_danger_lqugd_29",zn={tabsRoot:Yv,tabsList:Zv,tabTrigger:Qv,danger:ey};function el({objectName:e,completed:t,pending:n,displayName:r}){return u.jsx(Qc,{value:e,className:zn.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Xv(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 ty({completed:e,pending:t,displayName:n}){return u.jsxs(u.Fragment,{children:[u.jsx(fi,{style:{margin:"1rem 0"}}),u.jsx(el,{objectName:fn,completed:e,pending:t,displayName:n},"other-write")]})}function ny(){return u.jsxs(u.Fragment,{children:[u.jsx(fi,{style:{margin:"3rem 0 1rem 0"}}),u.jsx(Qc,{value:Or,className:st(zn.tabTrigger,zn.danger),children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Gv(),u.jsx("span",{children:"Uninstall"})]})})]})}function ry({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i,showUninstallButton:o}){var s,a;return u.jsx(Wv,{value:e,className:zn.tabsRoot,onValueChange:n,children:u.jsxs(Jv,{className:zn.tabsList,children:[t.map(c=>{var l,d,p,m;return u.jsx(el,{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=(p=r==null?void 0:r[c.name])==null?void 0:p.read)==null?void 0:m.isRequiredMapFieldsModified)||!1},c.name)}),i&&u.jsx(ty,{completed:i.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),o&&u.jsx(ny,{})]})})}function oy(e,t){return t===Or?{name:Or,completed:!1}:e.find(n=>n.name===t)}function iy({children:e}){var C;const{project:t}=Pe(),{installation:n,provider:r}=dt(),{hydratedRevision:i}=Dn(),{objectConfigurationsState:o}=pi(),[s,a]=g.useState(""),c=(t==null?void 0:t.appName)||"",l=n==null?void 0:n.config,d=i&&Xs(l,i),p=d!==null,m=!!((C=i==null?void 0:i.content)!=null&&C.write),f=m?Gs(l):void 0,v=g.useMemo(()=>{const y=[...d||[]];return f&&m&&y.push(f),y},[d,f,m]),w=oy(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(rc.Provider,{value:I,children:u.jsx(tc.Provider,{value:w==null?void 0:w.name,children:u.jsxs(Xn,{style:{maxWidth:"55rem"},children:[u.jsxs(yn,{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}),p&&u.jsx(ry,{value:s,readNavObjects:d,onValueChange:y=>a(y),objectConfigurationsState:o,writeNavObject:f,showUninstallButton:!!n})]}),e]}),u.jsx(Tc,{})]})})})}function sy({...e}){return u.jsx(iy,{...e})}function ay({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var w;const{projectId:l,isLoading:d}=Pe(),{isLoading:p}=ko(),{errorState:m}=Zt(),{seed:f,reset:v}=Ws();return d||p?u.jsx(zt,{}):(w=m[Ne.INTEGRATION_LIST])!=null&&w.apiError?u.jsx(Lt,{message:"Something went wrong, couldn't find integration information"}):u.jsx("div",{className:Js.resetContainer,children:u.jsx(Mp,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:u.jsx(qs,{groupRef:r,children:u.jsx(jc,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:u.jsx(cf,{projectId:l,children:u.jsx(kg,{resetComponent:v,children:u.jsx(Oh,{children:u.jsx(sy,{children:u.jsx(Ag,{})})})})})})})},f)})}function cy(){return u.jsxs(Xn,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[u.jsx(zt,{}),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({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i}){const o=He(),{projectId:s}=Pe(),{selectedConnection:a,setConnections:c}=wn(),[l,d]=g.useState(!1),p=!s||!a||!a.id||l,m=async()=>{if(!p){d(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id});try{await Ce().connectionApi.deleteConnection({projectIdOrName:s,connectionId:a==null?void 0:a.id},{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}),console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),Ce().connectionApi.listConnections({projectIdOrName:s},{headers:{"X-Api-Key":o??""}}).then(w=>{c(w),i()}).catch(w=>{ze(w)})}catch(w){console.error("Error deleting connection."),ze(w)}finally{d(!1)}}},f=l?"Disconnecting...":e;return u.jsx(ct,{type:"button",onClick:m,disabled:p,variant:t,style:n,children:f})}function dy({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Pe(),i=`You have successfully connected your ${Qt(e)} account to ${r}.`;return u.jsx(yi,{text:i,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(uy,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function py({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:l,reset:d}=Ws(),p=g.useCallback(m=>{s?s(m.id):c&&c(m)},[s,c]);return u.jsx("div",{className:Js.resetContainer,children:u.jsx(qs,{provider:e,groupRef:r,children:u.jsx(jc,{provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:p,onDisconnectSuccess:a,children:u.jsx(ly,{redirectURL:o,children:u.jsx(dy,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},l)}const fy=(e,t)=>{const n=He(),{projectId:r}=Pe(),{integrations:i}=ko(),[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,p)=>(p==null?void 0:p.name)===e?p:d,{}),[i,e]);return g.useEffect(()=>{l&&Ce().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."),ze(d),s(!0)})},[t,n,r,l]),{isLoaded:o,isIntegrationInstalled:a}};exports.AmpersandContext=Vs;exports.AmpersandProvider=Ep;exports.ConnectProvider=py;exports.FieldMapping=pc;exports.InstallIntegration=ay;exports.useAmpersandProvider=Sp;exports.useIsIntegrationInstalled=fy;
|
|
48
|
+
*/const rh="react-tooltip-core-styles",oh="react-tooltip-base-styles",us={core:!1,base:!1};function ds({css:e,id:t=oh,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||us[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=rh),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)),us[n]=!0}const ps=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[Qm(Number(i)),th({fallbackAxisSideDirection:"start"}),eh({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(nh({element:n,padding:5})),ls(e,t,{placement:r,strategy:o,middleware:c}).then(({x:l,y:d,placement:p,middlewareData:m})=>{var f,v;const w={left:`${l}px`,top:`${d}px`,border:a},{x:I,y:C}=(f=m.arrow)!==null&&f!==void 0?f:{x:0,y:0},y=(v={top:"bottom",right:"left",bottom:"top",left:"right"}[p.split("-")[0]])!==null&&v!==void 0?v:"bottom",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:C!=null?`${C}px`:"",right:"",bottom:"",...x,[y]:`-${4+b}px`},place:p}})):ls(e,t,{placement:"bottom",strategy:o,middleware:c}).then(({x:l,y:d,placement:p})=>({tooltipStyles:{left:`${l}px`,top:`${d}px`},tooltipArrowStyles:{},place:p}))},fs=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),ms=(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},hs=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",No=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,o)=>No(i,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!hs(e)||!hs(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>No(e[i],t[i]))},ih=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"})},gs=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(ih(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},sh=typeof window<"u"?g.useLayoutEffect:g.useEffect,ht=e=>{e.current&&(clearTimeout(e.current),e.current=null)},ah="DEFAULT_TOOLTIP_ID",ch={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},lh=g.createContext({getTooltipData:()=>ch});function rc(e=ah){return g.useContext(lh).getTooltipData(e)}var _n={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},po={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 uh=({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:p="absolute",middlewares:m,wrapper:f,delayShow:v=0,delayHide:w=0,float:I=!1,hidden:C=!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:fe=!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),[pe,V]=g.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[we,De]=g.useState(!1),[Ue,je]=g.useState(!1),[me,gt]=g.useState(null),Be=g.useRef(!1),nt=g.useRef(null),{anchorRefs:vt,setActiveAnchor:yt}=rc(t),qe=g.useRef(!1),[$e,Fe]=g.useState([]),Ee=g.useRef(!1),wt=d||l.includes("click"),Xe=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 $t=T?{...T}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!T&&wt&&Object.assign($t,{mouseleave:!1,blur:!1,mouseout:!1});const rt=J?{...J}:{escape:b||!1,scroll:_||!1,resize:E||!1,clickOutsideAnchor:Xe||!1};q&&(Object.assign(Tt,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign($t,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(rt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),sh(()=>(Ee.current=!0,()=>{Ee.current=!1}),[]);const Se=H=>{Ee.current&&(H&&je(!0),setTimeout(()=>{Ee.current&&(S==null||S(H),de===void 0&&De(H))},10))};g.useEffect(()=>{if(de===void 0)return()=>null;de&&je(!0);const H=setTimeout(()=>{De(de)},10);return()=>{clearTimeout(H)}},[de]),g.useEffect(()=>{if(we!==Be.current)if(ht(A),Be.current=we,we)ee==null||ee();else{const H=(oe=>{const ie=oe.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(oe=>No(oe,H)?oe:H)},Kt=(H=v)=>{ht(B),Ue?Se(!0):B.current=setTimeout(()=>{Se(!0)},H)},At=(H=w)=>{ht(ae),ae.current=setTimeout(()=>{qe.current||Se(!1)},H)},tn=H=>{var oe;if(!H)return;const ie=(oe=H.currentTarget)!==null&&oe!==void 0?oe:H.target;if(!(ie!=null&&ie.isConnected))return M(null),void yt({current:null});v?Kt():Se(!0),M(ie),yt({current:ie}),ht(ae)},Ze=()=>{x?At(w||100):w?At():Se(!1),ht(B)},Pt=({x:H,y:oe})=>{var ie;const Re={getBoundingClientRect:()=>({x:H,y:oe,width:0,height:0,top:oe,left:H,right:H,bottom:oe})};ps({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:p,middlewares:m,border:j}).then(ke=>{Rt(ke)})},Vt=H=>{if(!H)return;const oe=H,ie={x:oe.clientX,y:oe.clientY};Pt(ie),nt.current=ie},nn=H=>{var oe;if(!we)return;const ie=H.target;ie.isConnected&&(!((oe=K.current)===null||oe===void 0)&&oe.contains(ie)||[document.querySelector(`[id='${o}']`),...$e].some(Re=>Re==null?void 0:Re.contains(ie))||(Se(!1),ht(B)))},Ht=ms(tn,50),xe=ms(Ze,50),Ge=H=>{xe.cancel(),Ht(H)},te=()=>{Ht.cancel(),xe()},ue=g.useCallback(()=>{var H,oe;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&&ps({place:(oe=me==null?void 0:me.place)!==null&&oe!==void 0?oe:a,offset:c,elementReference:P,tooltipReference:K.current,tooltipArrowReference:Z.current,strategy:p,middlewares:m,border:j}).then(Re=>{Ee.current&&Rt(Re)})},[we,P,ne,z,a,me==null?void 0:me.place,c,p,Y,me==null?void 0:me.position,I]);g.useEffect(()=>{var H,oe;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=()=>{Se(!1)},Qe=gs(P),Ke=gs(K.current);rt.scroll&&(window.addEventListener("scroll",ke),Qe==null||Qe.addEventListener("scroll",ke),Ke==null||Ke.addEventListener("scroll",ke));let We=null;rt.resize?window.addEventListener("resize",ke):P&&K.current&&(We=Zm(P,K.current,ue,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const et=Ie=>{Ie.key==="Escape"&&Se(!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)},Yr=Ie=>{we&&(Ie==null?void 0:Ie.target)===P&&Ze()},pt=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],nr=["click","dblclick","mousedown","mouseup"];Object.entries(Tt).forEach(([Ie,It])=>{It&&(pt.includes(Ie)?_e.push({event:Ie,listener:Ge}):nr.includes(Ie)&&_e.push({event:Ie,listener:rn}))}),Object.entries($t).forEach(([Ie,It])=>{It&&(pt.includes(Ie)?_e.push({event:Ie,listener:te}):nr.includes(Ie)&&_e.push({event:Ie,listener:Yr}))}),I&&_e.push({event:"pointermove",listener:Vt});const rr=()=>{qe.current=!0},or=()=>{qe.current=!1,Ze()};return x&&!Xe&&((H=K.current)===null||H===void 0||H.addEventListener("mouseenter",rr),(oe=K.current)===null||oe===void 0||oe.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):We==null||We(),rt.clickOutsideAnchor&&window.removeEventListener("click",nn),rt.escape&&window.removeEventListener("keydown",et),x&&!Xe&&((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(Zr=>{var Fn;(Fn=Zr.current)===null||Fn===void 0||Fn.removeEventListener(_t,on)})})}},[P,ue,Ue,vt,$e,$,T,J,wt,v,w]),g.useEffect(()=>{var H,oe;let ie=(oe=(H=me==null?void 0:me.anchorSelect)!==null&&H!==void 0?H:s)!==null&&oe!==void 0?oe:"";!ie&&t&&(ie=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Re=new MutationObserver(ke=>{const Qe=[],Ke=[];ke.forEach(We=>{if(We.type==="attributes"&&We.attributeName==="data-tooltip-id"&&(We.target.getAttribute("data-tooltip-id")===t?Qe.push(We.target):We.oldValue===t&&Ke.push(We.target)),We.type==="childList"){if(P){const et=[...We.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),Se(!1),M(null),ht(B),ht(ae),!0)})}if(ie)try{const et=[...We.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(We=>[...We.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 oe=document.querySelector(`[id='${o}']`),ie=[...$e,oe];P&&ie.includes(P)||M((H=$e[0])!==null&&H!==void 0?H:oe)},[o,$e,P]),g.useEffect(()=>(fe&&Se(!0),()=>{ht(B),ht(ae)}),[]),g.useEffect(()=>{var H;let oe=(H=me==null?void 0:me.anchorSelect)!==null&&H!==void 0?H:s;if(!oe&&t&&(oe=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),oe)try{const ie=Array.from(document.querySelectorAll(oe));Fe(ie)}catch{Fe([])}},[t,s,me==null?void 0:me.anchorSelect]),g.useEffect(()=>{B.current&&(ht(B),Kt(v))},[v]);const Me=(G=me==null?void 0:me.content)!==null&&G!==void 0?G:ne,Dt=we&&Object.keys(pe.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?Kt(H.delay):Se(!0)},close:H=>{H!=null&&H.delay?At(H.delay):Se(!1)},activeAnchor:P,place:pe.place,isOpen:!!(Ue&&!C&&Me&&Dt)})),Ue&&!C&&Me?g.createElement(f,{id:t,role:X,className:st("react-tooltip",_n.tooltip,po.tooltip,po[i],n,`react-tooltip__place-${pe.place}`,_n[Dt?"show":"closing"],Dt?"react-tooltip__show":"react-tooltip__closing",p==="fixed"&&_n.fixed,x&&_n.clickable),onTransitionEnd:H=>{ht(A),we||H.propertyName!=="opacity"||(je(!1),gt(null),U==null||U())},style:{...z,...pe.tooltipStyles,opacity:D!==void 0&&Dt?D:void 0},ref:K},Me,g.createElement(f,{className:st("react-tooltip-arrow",_n.arrow,po.arrow,r,y&&_n.noArrow),style:{...pe.tooltipArrowStyles,background:R?`linear-gradient(to right bottom, transparent 50%, ${R} 50%)`:void 0},ref:Z})):null},dh=({content:e})=>g.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),ph=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:p="div",children:m=null,events:f=["hover"],openOnClick:v=!1,positionStrategy:w="absolute",middlewares:I,delayShow:C=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:fe,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,pe]=g.useState(l),[V,we]=g.useState(c),[De,Ue]=g.useState(d),[je,me]=g.useState(C),[gt,Be]=g.useState(y),[nt,vt]=g.useState(x),[yt,qe]=g.useState(b),[$e,Fe]=g.useState(p),[Ee,wt]=g.useState(f),[Xe,Tt]=g.useState(w),[$t,rt]=g.useState(null),[Se,Rt]=g.useState(null),Kt=g.useRef(de),{anchorRefs:At,activeAnchor:tn}=rc(e),Ze=xe=>xe==null?void 0:xe.getAttributeNames().reduce((Ge,te)=>{var ue;return te.startsWith("data-tooltip-")&&(Ge[te.replace(/^data-tooltip-/,"")]=(ue=xe==null?void 0:xe.getAttribute(te))!==null&&ue!==void 0?ue:null),Ge},{}),Pt=xe=>{const Ge={place:te=>{var ue;pe((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=>{Ue(te===null?d:Number(te))},wrapper:te=>{var ue;Fe((ue=te)!==null&&ue!==void 0?ue:p)},events:te=>{const ue=te==null?void 0:te.split(" ");wt(ue??f)},"position-strategy":te=>{var ue;Tt((ue=te)!==null&&ue!==void 0?ue:w)},"delay-show":te=>{me(te===null?C:Number(te))},"delay-hide":te=>{Be(te===null?y:Number(te))},float:te=>{vt(te===null?x:te==="true")},hidden:te=>{qe(te===null?b:te==="true")},"class-name":te=>{rt(te)}};Object.values(Ge).forEach(te=>te(null)),Object.entries(xe).forEach(([te,ue])=>{var Me;(Me=Ge[te])===null||Me===void 0||Me.call(Ge,ue)})};g.useEffect(()=>{Z(r)},[r]),g.useEffect(()=>{ae(i)},[i]),g.useEffect(()=>{pe(l)},[l]),g.useEffect(()=>{we(c)},[c]),g.useEffect(()=>{Ue(d)},[d]),g.useEffect(()=>{me(C)},[C]),g.useEffect(()=>{Be(y)},[y]),g.useEffect(()=>{vt(x)},[x]),g.useEffect(()=>{qe(b)},[b]),g.useEffect(()=>{Tt(w)},[w]),g.useEffect(()=>{Kt.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 Ge=new Set(At);let te=n;if(!te&&e&&(te=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),te)try{document.querySelectorAll(te).forEach(oe=>{Ge.add({current:oe})})}catch{console.warn(`[react-tooltip] "${te}" is not a valid CSS selector`)}const ue=document.querySelector(`[id='${t}']`);if(ue&&Ge.add({current:ue}),!Ge.size)return()=>null;const Me=(xe=Se??ue)!==null&&xe!==void 0?xe:tn.current,Dt=new MutationObserver(oe=>{oe.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 oe=Ze(Me);Pt(oe),Dt.observe(Me,H)}return()=>{Dt.disconnect()}},[At,tn,Se,t,n]),g.useEffect(()=>{U!=null&&U.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),fe&&!fs("border",`${fe}`)&&console.warn(`[react-tooltip] "${fe}" is not a valid \`border\`.`),U!=null&&U.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),S&&!fs("opacity",`${S}`)&&console.warn(`[react-tooltip] "${S}" is not a valid \`opacity\`.`)},[]);let Vt=m;const nn=g.useRef(null);if(o){const xe=o({content:(Se==null?void 0:Se.getAttribute("data-tooltip-content"))||K||null,activeAnchor:Se});Vt=xe?g.createElement("div",{ref:nn,className:"react-tooltip-content-wrapper"},xe):null}else K&&(Vt=K);B&&(Vt=g.createElement(dh,{content:B}));const Ht={forwardRef:G,id:e,anchorId:t,anchorSelect:n,className:st(s,$t),classNameArrow:a,content:Vt,contentWrapperRef:nn,place:A,variant:V,offset:De,wrapper:$e,events:Ee,openOnClick:v,positionStrategy:Xe,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:fe,opacity:S,arrowColor:P,setIsOpen:M,afterShow:j,afterHide:D,disableTooltip:R,activeAnchor:Se,setActiveAnchor:xe=>Rt(xe),role:X};return g.createElement(uh,{...Ht})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||ds({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||ds({css:`
|
|
49
|
+
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function fh(){return 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 mh({id:e,tooltipText:t}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:fh()}),u.jsx(ph,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const oc=g.createContext(null);function ic(){const e=g.useContext(oc);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const sc=g.createContext(()=>{});function hh(){const e=g.useContext(sc);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var ac=Symbol.for("immer-nothing"),vs=Symbol.for("immer-draftable"),lt=Symbol.for("immer-state"),gh=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=gh[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[lt]}function gn(e){var t;return e?cc(e)||Array.isArray(e)||!!e[vs]||!!((t=e.constructor)!=null&&t[vs])||Wr(e)||Jr(e):!1}var vh=Object.prototype.constructor.toString();function cc(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)===vh}function Dr(e,t){qr(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function qr(e){const t=e[lt];return t?t.type_:Array.isArray(e)?1:Wr(e)?2:Jr(e)?3:0}function To(e,t){return qr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function lc(e,t,n){const r=qr(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function yh(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Wr(e){return e instanceof Map}function Jr(e){return e instanceof Set}function ln(e){return e.copy_||e.base_}function Ro(e,t){if(Wr(e))return new Map(e);if(Jr(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=cc(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[lt];let i=Reflect.ownKeys(r);for(let o=0;o<i.length;o++){const s=i[o],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 di(e,t=!1){return zr(e)||Rn(e)||!gn(e)||(qr(e)>1&&(e.set=e.add=e.clear=e.delete=wh),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>di(r,!0))),e}function wh(){tt(2)}function zr(e){return Object.isFrozen(e)}var Ih={};function vn(e){const t=Ih[e];return t||tt(0,e),t}var Wn;function uc(){return Wn}function _h(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ys(e,t){t&&(vn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ao(e){Po(e),e.drafts_.forEach(bh),e.drafts_=null}function Po(e){e===Wn&&(Wn=e.parent_)}function ws(e){return Wn=_h(Wn,e)}function bh(e){const t=e[lt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Is(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[lt].modified_&&(Ao(t),tt(4)),gn(e)&&(e=jr(t,e),t.parent_||Fr(t,e)),t.patches_&&vn("Patches").generateReplacementPatches_(n[lt].base_,e,t.patches_,t.inversePatches_)):e=jr(t,n,[]),Ao(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ac?e:void 0}function jr(e,t,n){if(zr(t))return t;const r=t[lt];if(!r)return Dr(t,(i,o)=>_s(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)=>_s(e,r,i,a,c,n,s)),Fr(e,i,!1),n&&e.patches_&&vn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function _s(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&&!To(t.assigned_,r)?o.concat(r):void 0,c=jr(e,i,a);if(lc(n,r,c),Rn(c))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(gn(i)&&!zr(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_&&di(t,n)}function xh(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:uc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=pi;n&&(i=[r],o=Jn);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var pi={get(e,t){if(t===lt)return e;const n=ln(e);if(!To(n,t))return Ch(e,n,t);const r=n[t];return e.finalized_||!gn(r)?r:r===fo(e.base_,t)?(mo(e),e.copy_[t]=jo(r,e)):r},has(e,t){return t in ln(e)},ownKeys(e){return Reflect.ownKeys(ln(e))},set(e,t,n){const r=dc(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[lt];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(yh(n,i)&&(n!==void 0||To(e.base_,t)))return!0;mo(e),Do(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,mo(e),Do(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)}},Jn={};Dr(pi,(e,t)=>{Jn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Jn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&tt(13),Jn.set.call(this,e,t,void 0)};Jn.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&tt(14),pi.set.call(this,e[0],t,n,e[0])};function fo(e,t){const n=e[lt];return(n?ln(n):e)[t]}function Ch(e,t,n){var i;const r=dc(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function dc(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 Do(e){e.modified_||(e.modified_=!0,e.parent_&&Do(e.parent_))}function mo(e){e.copy_||(e.copy_=Ro(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Oh=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(gn(t)){const o=ws(this),s=jo(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?Ao(o):Po(o)}return ys(o,r),Is(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===ac&&(i=void 0),this.autoFreeze_&&di(i,!0),r){const o=[],s=[];vn("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){gn(e)||tt(8),Rn(e)&&(e=Eh(e));const t=ws(this),n=jo(e,void 0);return n[lt].isManual_=!0,Po(t),n}finishDraft(e,t){const n=e&&e[lt];(!n||!n.isManual_)&&tt(9);const{scope_:r}=n;return ys(r,t),Is(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=vn("Patches").applyPatches_;return Rn(e)?r(e,t):this.produce(e,i=>r(i,t))}};function jo(e,t){const n=Wr(e)?vn("MapSet").proxyMap_(e,t):Jr(e)?vn("MapSet").proxySet_(e,t):xh(e,t);return(t?t.scope_:uc()).drafts_.push(n),n}function Eh(e){return Rn(e)||tt(10,e),pc(e)}function pc(e){if(!gn(e)||zr(e))return e;const t=e[lt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ro(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ro(e,!0);return Dr(n,(r,i)=>{lc(n,r,pc(i))}),t&&(t.finalized_=!1),n}var ut=new Oh,$n=ut.produce;ut.produceWithPatches.bind(ut);ut.setAutoFreeze.bind(ut);ut.setUseStrictShallowCopy.bind(ut);ut.applyPatches.bind(ut);ut.createDraft.bind(ut);ut.finishDraft.bind(ut);const fc=g.createContext(void 0),Sh={};function fi(){const e=g.useContext(fc);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Nh({children:e}){const{installation:t}=dt(),{hydratedRevision:n,loading:r}=Dn(),[i,o]=g.useState(Sh),s=t==null?void 0:t.config;g.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&Yp(n,s,o)},[n,r,s,i]);const a=g.useCallback((f,v)=>{o(w=>$n(w,I=>{I[f]=$n(I[f],v)}))},[o]),c=g.useCallback((f,v)=>{o(w=>$n(w,I=>{I[f]=v}))},[o]),l=g.useCallback(()=>{o($n(f=>{const v=f.other.write;v&&(v.isWriteModified=!1)}))},[o]),d=g.useCallback(f=>{o($n(v=>{var I;const w=(I=v[f])==null?void 0:I.read;w&&(w.isOptionalFieldsModified=!1,w.isRequiredMapFieldsModified=!1)}))},[o]),p=g.useCallback(f=>{f===fn?l():d(f)},[d,l]),m=g.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:p}),[i,c,p,a]);return u.jsx(fc.Provider,{value:m,children:e})}const wn=()=>{const{appName:e}=Pe(),{objectConfigurationsState:t,setConfigureState:n}=fi(),{selectedObjectName:r}=ic(),i=ia(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}};function Th(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=!Ko(o,r);e.read.isRequiredMapFieldsModified=a}}function mc(e,t,n,r){t(e,i=>Th(i,n,r))}function hc({field:e,onSelectChange:t,allFields:n}){var m;const{configureState:r,selectedObjectName:i,setConfigureState:o}=wn(),[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&&mc(i,o,e.mapToName,e._default),a(!1)},[e,o,i,l,r]);const d=g.useMemo(()=>n.map(f=>({id:f.fieldName,label:f.displayName,value:f.fieldName})),[n]),p=u.jsx(_m,{disabled:s,items:d,selectedValue:l||null,onSelectedItemChange:f=>{t({target:{name:e.mapToName,value:f==null?void 0:f.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(mh,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),p]},e.mapToName)}const Rh="_formControl_9qd8d_1",Ah="_formLabel_9qd8d_5",Ph="_formLabelRequired_9qd8d_11",Dh="_formInput_9qd8d_16",jh="_formInputInvalid_9qd8d_20",Fh="_formError_9qd8d_24",Mh="_disabled_9qd8d_30",cn={formControl:Rh,formLabel:Ah,formLabelRequired:Ph,formInput:Dh,formInputInvalid:jh,formError:Fh,disabled:Mh};function kh({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 Lh="_divider_1kmoj_1",bs={divider:Lh};function mi({className:e,style:t}){return u.jsx("hr",{className:e?`${bs.divider} ${e}`:bs.divider,style:t})}function Xr({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(mi,{style:{width:"100%",marginLeft:"1rem"}})})]})}function $h(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=wn(),{fieldMapping:r}=dt(),{isError:i,removeError:o}=Yt(),s=c=>{const{value:l,name:d}=c.target;l&&(e&&mc(e,n,d,l),i(Ce.MAPPING,d)&&o(Ce.MAPPING,d))},a=g.useMemo(()=>{var p;const c=((p=t==null?void 0:t.read)==null?void 0:p.requiredMapFields)||[],l=e&&r?Object.values(r[e]||{}).flat():[];return c.concat(l).reduce((m,f)=>m.find(w=>w.mapToName===f.mapToName)?m.map(w=>w.mapToName===f.mapToName?f:w):m.concat(f),new Array).filter(zt)},[t,r,e]);return a!=null&&a.length?u.jsxs(u.Fragment,{children:[u.jsx(Xr,{string:"Map the following fields"}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:a.map(c=>{var l;return u.jsx(kh,{id:c.mapToName,isInvalid:i(Ce.MAPPING,c.mapToName),errorMessage:"* required",children:u.jsx(hc,{allFields:((l=t==null?void 0:t.read)==null?void 0:l.allFields)||[],field:c,onSelectChange:s})},c.mapToName)})})]}):null}const Kh={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function Vh({children:e,style:t}){return u.jsx(Zt,{style:{...Kh,...t},children:e})}function Hh(){var d,p,m;const{project:e}=Pe(),{hydratedRevision:t}=Dn(),{selectedObjectName:n}=wn(),{provider:r}=dt(),i=e==null?void 0:e.appName,o=Qt(r),s=(m=(p=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:p.objects)==null?void 0:m.find(f=>f.objectName===n),a=(s==null?void 0:s.displayName)||n&&Bn(n),c=s==null?void 0:s.mapToName,l=(s==null?void 0:s.mapToDisplayName)||c&&Bn(c);return l&&i&&o?u.jsx(Vh,{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 Uh(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function gc(...e){return t=>e.forEach(n=>Uh(n,t))}function zn(...e){return k.useCallback(gc(...e),e)}function Bh(e,t=[]){let n=[];function r(o,s){const a=k.createContext(s),c=n.length;n=[...n,s];const l=p=>{var C;const{scope:m,children:f,...v}=p,w=((C=m==null?void 0:m[e])==null?void 0:C[c])||a,I=k.useMemo(()=>v,Object.values(v));return u.jsx(w.Provider,{value:I,children:f})};l.displayName=o+"Provider";function d(p,m){var w;const f=((w=m==null?void 0:m[e])==null?void 0:w[c])||a,v=k.useContext(f);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${p}\` 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,qh(i,...t)]}function qh(...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 p=c(o)[`__scope${l}`];return{...a,...p}},{});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 hi(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 gi({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=Wh({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=hi(n),c=k.useCallback(l=>{if(o){const p=typeof l=="function"?l(e):l;p!==e&&a(p)}else i(l)},[o,e,i,a]);return[s,c]}function Wh({defaultProp:e,onChange:t}){const n=k.useState(e),[r]=n,i=k.useRef(r),o=hi(t);return k.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function Jh(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 zh(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 Xh(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var vi=e=>{const{present:t,children:n}=e,r=Gh(t),i=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),o=zn(r.ref,Yh(i));return typeof n=="function"||r.isPresent?k.cloneElement(i,{ref:o}):null};vi.displayName="Presence";function Gh(e){const[t,n]=k.useState(),r=k.useRef({}),i=k.useRef(e),o=k.useRef("none"),s=e?"mounted":"unmounted",[a,c]=Xh(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,f=yr(l);e?c("MOUNT"):f==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(d&&m!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Mr(()=>{if(t){let l;const d=t.ownerDocument.defaultView??window,p=f=>{const w=yr(r.current).includes(f.animationName);if(f.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=f=>{f.target===t&&(o.current=yr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{d.clearTimeout(l),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}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 Yh(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(Qh);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(Fo,{...r,ref:t,children:k.isValidElement(s)?k.cloneElement(s,void 0,a):null})}return u.jsx(Fo,{...r,ref:t,children:n})});kr.displayName="Slot";var Fo=k.forwardRef((e,t)=>{const{children:n,...r}=e;if(k.isValidElement(n)){const i=tg(n);return k.cloneElement(n,{...eg(r,n.props),ref:t?gc(t,i):i})}return k.Children.count(n)>1?k.Children.only(null):null});Fo.displayName="SlotClone";var Zh=({children:e})=>u.jsx(u.Fragment,{children:e});function Qh(e){return k.isValidElement(e)&&e.type===Zh}function eg(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 tg(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 ng=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],en=ng.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}},{}),yi="Checkbox",[rg,vy]=Bh(yi),[og,ig]=rg(yi),vc=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:c="on",onCheckedChange:l,form:d,...p}=e,[m,f]=k.useState(null),v=zn(t,b=>f(b)),w=k.useRef(!1),I=m?d||!!m.closest("form"):!0,[C=!1,y]=gi({prop:i,defaultProp:o,onChange:l}),x=k.useRef(C);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(og,{scope:n,state:C,disabled:a,children:[u.jsx(en.button,{type:"button",role:"checkbox","aria-checked":Jt(C)?"mixed":C,"aria-required":s,"data-state":Ic(C),"data-disabled":a?"":void 0,disabled:a,value:c,...p,ref:v,onKeyDown:xt(e.onKeyDown,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:xt(e.onClick,b=>{y(_=>Jt(_)?!0:!_),I&&(w.current=b.isPropagationStopped(),w.current||b.stopPropagation())})}),I&&u.jsx(sg,{control:m,bubbles:!w.current,name:r,value:c,checked:C,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Jt(o)?!1:o})]})});vc.displayName=yi;var yc="CheckboxIndicator",wc=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=ig(yc,n);return u.jsx(vi,{present:r||Jt(o.state)||o.state===!0,children:u.jsx(en.span,{"data-state":Ic(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});wc.displayName=yc;var sg=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,s=k.useRef(null),a=Jh(n),c=zh(t);k.useEffect(()=>{const d=s.current,p=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(p,"checked").set;if(a!==n&&f){const v=new Event("click",{bubbles:r});d.indeterminate=Jt(n),f.call(d,Jt(n)?!1:n),d.dispatchEvent(v)}},[a,n,r]);const l=k.useRef(Jt(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 Jt(e){return e==="indeterminate"}function Ic(e){return Jt(e)?"indeterminate":e?"checked":"unchecked"}var _c=vc,bc=wc;function xc(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var ag=["color"],Cc=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=xc(e,ag);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"}))}),cg=["color"],lg=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=xc(e,cg);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 ug="_checkboxGroupContainer_1ya1t_1",dg="_stack_1ya1t_6",pg="_selectAllContainer_1ya1t_11",fg="_fieldContainer_1ya1t_18",mg="_checkbox_1ya1t_1",An={checkboxGroupContainer:ug,stack:dg,selectAllContainer:pg,fieldContainer:fg,checkbox:mg};function Oc({id:e,isChecked:t,label:n,onCheckedChange:r}){return u.jsxs("div",{className:An.fieldContainer,children:[u.jsx(_c,{className:An.checkbox,id:e,onCheckedChange:r,checked:t,children:u.jsx(bc,{children:u.jsx(Cc,{})})}),u.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Ec({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return u.jsxs("div",{className:An.selectAllContainer,children:[u.jsx(_c,{className:An.checkbox,id:e,onCheckedChange:r,children:u.jsxs(bc,{children:[i&&u.jsx(lg,{}),t===!0&&u.jsx(Cc,{})]})}),u.jsx("label",{htmlFor:e,children:n})]})}function Sc({children:e}){return u.jsx("div",{className:An.checkboxGroupContainer,children:e})}function Nc({children:e}){return u.jsx("div",{className:An.stack,children:e})}function hg(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=!Ko(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function xs(e,t,n,r){t(e,i=>hg(i,n,r))}function gg(){var p,m;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=wn(),i=(p=t==null?void 0:t.read)==null?void 0:p.selectedOptionalFields,o=(f,v)=>{f!=="indeterminate"&&r&&t&&xs(r,n,v,f)},s=(m=t==null?void 0:t.read)==null?void 0:m.optionalFields,a=f=>{r&&s&&s.forEach(v=>{zt(v)||xs(r,n,v.fieldName,f)})},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(Xr,{string:`${e} reads the following optional fields`}),u.jsxs(Sc,{children:[((s==null?void 0:s.length)||0)>=2&&u.jsx(Ec,{id:"select-all-fields",isChecked:l,label:"Select all",onCheckedChange:a,isIndeterminate:d}),u.jsx(Nc,{children:s.map(f=>zt(f)?null:u.jsx(Oc,{id:f.fieldName,isChecked:!!(i!=null&&i[f==null?void 0:f.fieldName]),label:f.displayName,onCheckedChange:v=>o(v,f.fieldName)},f.fieldName))})]})]})}function vg(){return u.jsx(gg,{})}const yg={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 wg({children:e,style:t,...n}){return u.jsx("span",{style:{...yg,...t},...n,children:e})}function Ig(){var r,i,o;const{configureState:e,selectedObjectName:t}=wn(),{appName:n}=Pe();return u.jsxs(u.Fragment,{children:[u.jsx(Xr,{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=>zt(s)?null:u.jsx(wg,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function _g(){return u.jsxs(u.Fragment,{children:[u.jsx(Hh,{}),u.jsx(Ig,{}),u.jsx($h,{}),u.jsx(vg,{})]})}function bg(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=!Ko(a,s);e.write.isWriteModified=l}}}function Cs(e,t,n,r){t(e,i=>{bg(i,n,r)})}function xg(){var p,m,f,v;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=wn(),i=(p=n==null?void 0:n.write)==null?void 0:p.selectedNonConfigurableWriteFields,o=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects,s=(w,I)=>{w!=="indeterminate"&&t&&n&&Cs(t,r,I,w)},a=w=>{var I,C;t&&n&&((C=(I=n==null?void 0:n.write)==null?void 0:I.writeObjects)==null||C.forEach(y=>{Cs(t,r,y.objectName,w)}))},c=!!o,l=Object.keys(i||{}).length===((v=(f=n==null?void 0:n.write)==null?void 0:f.writeObjects)==null?void 0:v.length),d=!l&&Object.keys(i||{}).length>0;return c&&u.jsxs(u.Fragment,{children:[u.jsx(Xr,{string:`Allow ${e} to write to these objects`}),u.jsxs(Sc,{children:[((o==null?void 0:o.length)||0)>=2&&u.jsx(Ec,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:l,label:"Select all"}),u.jsx(Nc,{children:o.map(w=>u.jsx(Oc,{id:w.objectName,onCheckedChange:I=>s(I,w.objectName),isChecked:!!(i!=null&&i[w.objectName]),label:w.displayName},w.objectName))})]})]})}function Cg(){return u.jsx(xg,{})}function Tc({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const r=He(),{projectId:i}=Pe(),{integrationId:o,installation:s,resetInstallations:a,setIntegrationDeleted:c,onUninstallSuccess:l}=dt(),[d,p]=g.useState(!1),m=!i||!o||!(s!=null&&s.id)||d,f=async()=>{if(!m){p(!0),console.warn("uninstalling installation",{projectId:i,integrationId:o,installationId:s.id});try{await Oe().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."),ze(I)}finally{p(!1)}}},v=d?"Uninstalling...":e,w=u.jsx(ct,{type:"button",onClick:f,disabled:m,variant:t,style:n,children:v});return s!=null&&s.id?w:null}function Og(){const{appName:e}=Pe(),{installation:t}=dt();return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t!=null&&t.id?u.jsxs("p",{children:["Once you uninstall this integration, all your configuration will be lost, and"," ",u.jsx("b",{children:e})," may stop working."]}):u.jsx("p",{children:"You've successfully uninstalled the integration."}),u.jsx(Tc,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function Rc({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var E,$,T;const{installation:o}=dt(),{hydratedRevision:s,loading:a}=Dn(),{configureState:c,selectedObjectName:l}=wn(),d=o==null?void 0:o.config,p=d&&l&&!!Ys(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),f=(T=c==null?void 0:c.write)==null?void 0:T.isWriteModified,C=a||n||!c||!l||!(m||f||r||l!==fn&&!p),y=l===fn,x=l===Or,b=u.jsx(ct,{type:"submit",disabled:C,children:r?"Install":"Save"}),_=u.jsx(ct,{type:"button",onClick:t,disabled:C,variant:"ghost",children:"Reset"});return n?u.jsx(Un,{}):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(Zt,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&u.jsx(aa,{children:typeof i=="string"?i:"Installation Failed."}),a&&u.jsx(Un,{}),s&&!x&&!y&&u.jsx(_g,{}),s&&!x&&y&&u.jsx(Cg,{}),!a&&x&&u.jsx(Og,{})]})]})}const Ac=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o}=dt(),{hydratedRevision:s,loading:a}=Dn(),{selectedObjectName:c}=ic(),{selectedConnection:l}=yn(),d=He(),{projectId:p}=Pe(),{resetBoundary:m,setErrors:f,setError:v,getError:w}=Yt(),{resetConfigureState:I,objectConfigurationsState:C,resetPendingConfigurationState:y}=fi(),x=ia(c||"",C),{onNextIncompleteTab:b}=hh(),_=g.useCallback(()=>{m(Ce.INSTALLATION_MUTATION)},[m]),E=g.useCallback(T=>T?J=>{v(Ce.INSTALLATION_MUTATION,T,J)}:J=>{console.error("objectName is required to set installation error: ",J)},[v]),$=g.useCallback(T=>T?w(Ce.INSTALLATION_MUTATION,T):"",[w]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:l,apiKey:d,projectId:p,resetBoundary:m,setErrors:f,setMutateInstallationError:E,getMutateInstallationError:$,resetMutateInstallationErrorState:_,resetConfigureState:I,objectConfigurationsState:C,resetPendingConfigurationState:y,configureState:x,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:b}},Eg=void 0;function Sg(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:i,loading:o,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:l,resetBoundary:d,setErrors:p,setMutateInstallationError:m,getMutateInstallationError:f,resetMutateInstallationErrorState:v,resetConfigureState:w,objectConfigurationsState:I,resetPendingConfigurationState:C,configureState:y,onInstallSuccess:x,onNextIncompleteTab:b}=Ac(),[_,E]=g.useState(!1),$=s===fn,T=f(s),J=g.useCallback(()=>{d(Ce.MAPPING),i!=null&&i.content&&!o&&s&&na(i,Eg,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}=ea(ee,U,p);se.length>0||(s&&(a!=null&&a.id)&&c&&l&&e&&t&&n&&i?(E(!0),ef(l,e,t,n,a.id,s,c,i,y,m(s),r,x).finally(()=>{E(!1),C(s),b()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},z=()=>{v(),s&&(a!=null&&a.id)&&c&&l&&e&&t&&n&&i?(E(!0),rf(l,e,t,n,a.id,c,i,y,m(s),r,x).finally(()=>{E(!1),C(s),b()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},Y=ee=>{ee.preventDefault(),$?z():q()};return u.jsx(Rc,{errorMsg:T,isCreateMode:!0,isLoading:_,onSave:Y,onReset:J})}function Ng({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 Oe().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=>{ze(d,c)})}const Tg=(e,t,n,r,i,o)=>{const s=ra(e),a=oa(e),c={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,backfill:o}}}}};return Kr(i)&&(c.content||(c.content={}),c.content.proxy={enabled:!0}),c},Rg=(e,t,n,r,i,o,s,a,c,l,d)=>{const p=Tg(o,r||"",a,a.schedule,c,a.backfill);return p?Ng({updateConfig:p,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))},Ag=(e,t)=>{const r={content:{write:{objects:sa(e)}}};return Kr(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},Pg=(e,t,n,r,i,o,s,a,c)=>{const l=Ag(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 Oe().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(p=>{a(p),c==null||c(p.id,p.config)}).catch(p=>{ze(p,s)})};function Dg({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:i,selectedObjectName:o,apiKey:s,projectId:a,resetBoundary:c,setErrors:l,setMutateInstallationError:d,getMutateInstallationError:p,resetConfigureState:m,resetPendingConfigurationState:f,configureState:v,onUpdateSuccess:w,onNextIncompleteTab:I}=Ac(),[C,y]=g.useState(!1),x=o===fn,b=p(o),{config:_}=e,E=g.useCallback(()=>{c(Ce.MAPPING),r!=null&&r.content&&!i&&o&&na(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}=ea(z,Y,l);ee.length>0||(r&&e&&o&&s&&a&&$?(y(!0),Rg(a,t.id,e.id,o,s,v,n,$,r,d(o),w).finally(()=>{y(!1),f(o),I()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},J=()=>{e&&o&&s&&a&&r?(y(!0),Pg(a,t.id,e.id,s,v,r,d(o),n,w).finally(()=>{y(!1),f(o),I()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},q=z=>{z.preventDefault(),x?J():T()};return u.jsx(Rc,{errorMsg:b,onSave:q,onReset:E,isLoading:C})}function jg(){const{integrationObj:e,installation:t}=dt();return e?t&&e?u.jsx(Dg,{installation:t,integrationObj:e}):u.jsx(Sg,{}):u.jsx(Us,{message:"We can't load the integration"})}function Fg(){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 wi({text:e,children:t}){return u.jsx(Pn,{children:u.jsxs(Zt,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[u.jsx(Fg,{}),u.jsx("p",{children:e}),t]})})}const Mg=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function kg({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:i,apiKey:o,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:l}){const d=Mg(s,r);return d?Vo({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 Lg({provider:e}){const t=`You have successfully installed your ${Qt(e)} integration.`;return u.jsx(wi,{text:t,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(Tc,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const $g=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 Kg({children:e,resetComponent:t}){var b;const{projectId:n}=Pe(),r=He(),{hydratedRevision:i,loading:o}=Dn(),{integrationObj:s,installation:a,groupRef:c,consumerRef:l,setInstallation:d,onInstallSuccess:p,isIntegrationDeleted:m}=dt(),{selectedConnection:f}=yn(),[v,w]=g.useState(!1),I=o||v,C=(b=i==null?void 0:i.content)==null?void 0:b.provider,y=$g(i),x=_=>{console.error("Error when creating proxy installation:",_)};return g.useEffect(()=>{!I&&i&&y&&!a&&f&&r&&(s!=null&&s.id)&&(w(!0),kg({apiKey:r,projectId:n,integrationId:s==null?void 0:s.id,groupRef:c,consumerRef:l,connectionId:f==null?void 0:f.id,hydratedRevision:i,setError:x,setInstallation:d,onInstallSuccess:p}).then(()=>{w(!1)}).catch(_=>{w(!1),console.error("Error when creating proxy installation:",_)}))},[i,y,a,f,r,n,s==null?void 0:s.id,c,l,d,I,p]),m?u.jsx(wi,{text:"Integration successfully uninstalled.",children:u.jsx(ct,{type:"button",onClick:t,style:{width:"100%"},children:"Reinstall Integration"})}):s?I?u.jsx($r,{}):y&&C&&a?u.jsx(Lg,{provider:C}):u.jsx("div",{children:e}):u.jsx(Lt,{message:"We can't load the integration"})}function Pc(){return u.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[u.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},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(Pn,{children:u.jsxs(Zt,{children:[u.jsx("div",{style:{padding:"3rem 2rem"},children:e}),u.jsx(Pc,{})]})})}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(aa,{style:{marginTop:"2em"},children:e}):null}function Ii({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(ct,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const Vg="_link_oo2kv_1",Hg={link:Vg};function Dc({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return u.jsx("a",{className:st(Hg.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function jc({url:e,providerDisplayName:t,credentialName:n}){return u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[u.jsx(Dc,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const Ug="_input_10rzg_1",Bg="_inputError_10rzg_27",qg="_error_10rzg_43",ho={input:Ug,inputError:Bg,error:qg};function Wg({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?st(ho.inputError,ho.input):ho.input;return u.jsx("input",{id:e,type:t,className:st(o,n),...i})}const Jg="_textarea_18zl4_1",zg="_textareaError_18zl4_14",Xg="_error_18zl4_29",go={textarea:Jg,textareaError:zg,error:Xg};function Gg({className:e,isError:t=!1,...n}){const r=t?st(go.textareaError,go.textarea):go.textarea;return u.jsx("textarea",{className:st(e,r),...n})}const kt={Input:Wg,Textarea:Gg};function Yg({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),p=c.length>0,m=i||!p,f=Qt(e,t),v=(w=t.apiKeyOpts)==null?void 0:w.docsURL;return u.jsx(Ii,{providerName:f,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(jc,{url:v,providerDisplayName:f,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(ct,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function Zg({...e}){return u.jsx(Yg,{...e})}function Qg({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const l=Pe(),[d,p]=g.useState(!1),[m,f]=g.useState(null),v=He();g.useEffect(()=>{if(e&&Oe&&d&&m!=null){const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:m};Oe().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:I},{headers:{"X-Api-Key":v??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),ze(C)})}},[v,e,d,r,n,o,i,l,c,m]);const w=I=>{f(I.apiKey),p(!0)};return a===null?u.jsx(Zg,{provider:e,providerInfo:t,handleSubmit:w,error:null}):s}function ev({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var C;const[o,s]=g.useState(!1),a=()=>s(y=>!y),[c,l]=g.useState({username:"",password:""}),{username:d,password:p}=c,m=Qt(e,t),f=(C=t.basicOpts)==null?void 0:C.docsURL,v=d.length>0,w=i||!v,I=y=>{const{name:x,value:b}=y.currentTarget;l(_=>({..._,[x]:b}))};return u.jsx(Ii,{providerName:m,handleSubmit:()=>{n({user:d,pass:p})},error:r,isButtonDisabled:w,children:u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[f&&u.jsx(jc,{url:f,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(ct,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function tv({...e}){return u.jsx(ev,{...e})}function nv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const l=Pe(),[d,p]=g.useState(!1),[m,f]=g.useState(null),v=He();g.useEffect(()=>{if(e&&Oe&&d&&m!=null){const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m.user,password:m.pass}};Oe().connectionApi.generateConnection({projectIdOrName:l.projectId,generateConnectionParams:I},{headers:{"X-Api-Key":v??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),ze(C)})}},[v,e,d,r,n,o,i,l,m,c]);const w=I=>{const{user:C,pass:y}=I;f({user:C,pass:y}),p(!0)};return a===null?u.jsx(tv,{provider:e,providerInfo:t,handleSubmit:w,error:null}):s}function rv({...e}){return u.jsx(Ii,{...e})}function ov({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,setSelectedConnection:a,providerName:c}){const l=Pe(),d=He(),[p,m]=g.useState(!1);g.useEffect(()=>{if(e&&Oe&&p){const v={groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e};Oe().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."),ze(w)})}},[d,e,p,n,t,i,r,a,l]);const f=()=>{m(!0)};return s===null?u.jsx(rv,{handleSubmit:f,error:null,providerName:c}):o}const Fc=async(e,t,n,r,i,o,s,a)=>{var l,d;const c=await Oe().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 Oe().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(I=>I.provider===i),f=Qt(i,c);if(!m)throw new Error(`You must first set up a ${f} Provider App using the Ampersand Console.`);const v={connectOAuthParams:{providerWorkspaceRef:o,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:m.id,provider:i,enableCSRFProtection:!0}};return await Oe().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.`)},Os=600,Es=600,iv="AUTHORIZATION_SUCCEEDED",sv="AUTHORIZATION_FAILED";function av(e,t,n){return g.useCallback(async r=>{const i=await Oe().connectionApi.getConnection({projectIdOrName:e,connectionId:r},{headers:{"X-Api-Key":t??""}});n(i)},[e,t,n])}function cv(e,t,n,r){return g.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-Os)/2,o=window.screenY+(window.outerHeight-Es)/2.5,s=`width=${Os},height=${Es},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function lv(e,t){return g.useCallback(n=>{var r,i;if(n.origin===vp){if(n.data.eventType===iv){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===sv&&(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 Mc({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i}){const o=He(),{projectId:s}=Pe(),[a,c]=g.useState(null),[l,d]=g.useState(null),{setSelectedConnection:p}=yn(),m=lv(c,r),f=cv(n,d,m,t),v=av(s,o,p);return g.useEffect(()=>{t&&!l&&f()},[t,l,f,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,p,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 uv({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(ct,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function dv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Pe(),a=He(),[c,l]=g.useState(null),[d,p]=g.useState(null),m=async()=>{p(null);try{const v=await Fc(s,t,r,a,e,void 0,n,i);l(v)}catch(v){console.error("Could not fetch OAuth popup URL."),ze(v),p(v.message??"Unexpected error")}},f=g.useCallback(v=>{p(v),l(null)},[]);return u.jsx(Mc,{windowTitle:`Connect to ${o}`,oauthUrl:c,onError:f,children:u.jsx(uv,{handleSubmit:m,error:d,providerName:o})})}const pv="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function fv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return u.jsxs(Qn,{children:[u.jsx(er,{children:"Enter your Salesforce subdomain"}),u.jsx(Dc,{href:pv,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(ct,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function mv({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(ct,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const hv="salesforce";function gv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Pe(),a=He(),[c,l]=g.useState(""),[d,p]=g.useState(null),[m,f]=g.useState(null),v=async()=>{if(f(null),!c){f("Workspace is required");return}try{const C=await Fc(s,t,r,a,e,c,n,i);p(C)}catch(C){console.error(C),f((C==null?void 0:C.message)??"Unexpected error")}},w=g.useCallback(C=>{f(C),p(null)},[]),I=e===hv?u.jsx(fv,{handleSubmit:v,setWorkspace:l,error:m,isButtonDisabled:c.length===0}):u.jsx(mv,{handleSubmit:v,setWorkspace:l,error:m,isButtonDisabled:c.length===0,providerName:o});return u.jsx(Mc,{windowTitle:`Connect to ${o}`,oauthUrl:d,onError:w,children:I})}function vv({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(_=>!_),p=_=>{const{name:E,value:$}=_.currentTarget;l(T=>({...T,[E]:$}))},{clientSecret:m,clientId:f,workspace:v,scopes:w}=c,I=m.length>0,C=f.length>0,y=o?v.length>0:!0,x=n||!I||!C||!y,b=()=>{const _={clientId:f,clientSecret:m};o&&(_.workspace=v),i&&w.length>0&&(_.scopes=kp(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:_=>p(_)}),u.jsx(kt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:_=>p(_)}),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:_=>p(_)}),u.jsx(ct,{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:_=>p(_)})]}),u.jsx("br",{}),u.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:x,type:"submit",onClick:b,children:"Next"})]})}function yv({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c,setSelectedConnection:l}){const{projectId:d}=Pe(),p=He(),[m,f]=g.useState(null),v=async w=>{f(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}};Oe().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:I},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(C=>{l(C)}).catch(C=>{console.error("Error loading provider info."),ze(C),f("Error loading provider info")})};return c===null?u.jsx(vv,{providerName:t,handleSubmit:v,error:m,explicitScopesRequired:s,explicitWorkspaceRequired:a}):u.jsx(Un,{})}function wv({...e}){return u.jsx(yv,{...e})}const Iv="authorizationCode",_v="authorizationCodePKCE",bv="clientCredentials";function xv({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,p=Qt(e,t),m={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:p};return c===Iv||c===_v?d?u.jsx(gv,{...m}):u.jsx(dv,{...m}):c===bv?u.jsx(wv,{...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 Cv(e){const{selectedConnection:t}=yn();g.useEffect(()=>{e&&t&&e(t)},[e,t])}function Ov({onSuccess:e}){Cv(e)}const Ev=async(e,t)=>{const n=await Oe().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function kc({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s,onDisconnectSuccess:a}){const c=He(),[l,d]=g.useState(null),{provider:p}=dt(),{selectedConnection:m,setSelectedConnection:f,connections:v}=yn();Ov({onSuccess:s});const w=e||p,I=(l==null?void 0:l.displayName)??Bn(w);if(g.useEffect(()=>{if(!m&&v&&v.length>0){const[y]=v;f(y)}Ev(c,w).then(y=>{d(y)}).catch(y=>{console.error("Error loading provider info."),ze(y)})},[v,m,f,c,w]),!e&&!p)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(m)return o;if(l==null)return u.jsx("strong",{children:"Provider not found"});const C={provider:w,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:m,setSelectedConnection:f,providerName:I,providerInfo:l,onDisconnectSuccess:a};return l.authType==="none"?u.jsx(ov,{...C,children:o}):l.authType==="basic"?u.jsx(nv,{...C,children:o}):l.authType==="apiKey"?u.jsx(Qg,{...C,children:o}):u.jsx(xv,{...C})}function Sv(e,t=[]){let n=[];function r(o,s){const a=k.createContext(s),c=n.length;n=[...n,s];const l=p=>{var C;const{scope:m,children:f,...v}=p,w=((C=m==null?void 0:m[e])==null?void 0:C[c])||a,I=k.useMemo(()=>v,Object.values(v));return u.jsx(w.Provider,{value:I,children:f})};l.displayName=o+"Provider";function d(p,m){var w;const f=((w=m==null?void 0:m[e])==null?void 0:w[c])||a,v=k.useContext(f);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${p}\` 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,Nv(i,...t)]}function Nv(...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 p=c(o)[`__scope${l}`];return{...a,...p}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Lc(e,t=[]){let n=[];function r(o,s){const a=k.createContext(s),c=n.length;n=[...n,s];function l(p){const{scope:m,children:f,...v}=p,w=(m==null?void 0:m[e][c])||a,I=k.useMemo(()=>v,Object.values(v));return u.jsx(w.Provider,{value:I,children:f})}function d(p,m){const f=(m==null?void 0:m[e][c])||a,v=k.useContext(f);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${p}\` 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,Tv(i,...t)]}function Tv(...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 p=c(o)[`__scope${l}`];return{...a,...p}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Rv(e){const t=e+"CollectionProvider",[n,r]=Lc(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=f=>{const{scope:v,children:w}=f,I=g.useRef(null),C=g.useRef(new Map).current;return u.jsx(i,{scope:v,itemMap:C,collectionRef:I,children:w})};s.displayName=t;const a=e+"CollectionSlot",c=g.forwardRef((f,v)=>{const{scope:w,children:I}=f,C=o(a,w),y=zn(v,C.collectionRef);return u.jsx(kr,{ref:y,children:I})});c.displayName=a;const l=e+"CollectionItemSlot",d="data-radix-collection-item",p=g.forwardRef((f,v)=>{const{scope:w,children:I,...C}=f,y=g.useRef(null),x=zn(v,y),b=o(l,w);return g.useEffect(()=>(b.itemMap.set(y,{ref:y,...C}),()=>void b.itemMap.delete(y))),u.jsx(kr,{[d]:"",ref:x,children:I})});p.displayName=l;function m(f){const v=o(e+"CollectionConsumer",f);return g.useCallback(()=>{const I=v.collectionRef.current;if(!I)return[];const C=Array.from(I.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((b,_)=>C.indexOf(b.ref.current)-C.indexOf(_.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:c,ItemSlot:p},m,r]}var Av=k.useId||(()=>{}),Pv=0;function $c(e){const[t,n]=k.useState(Av());return Mr(()=>{e||n(r=>r??String(Pv++))},[e]),e||(t?`radix-${t}`:"")}var Dv=k.createContext(void 0);function Kc(e){const t=k.useContext(Dv);return e||t||"ltr"}var vo="rovingFocusGroup.onEntryFocus",jv={bubbles:!1,cancelable:!0},Gr="RovingFocusGroup",[Mo,Vc,Fv]=Rv(Gr),[Mv,Hc]=Lc(Gr,[Fv]),[kv,Lv]=Mv(Gr),Uc=k.forwardRef((e,t)=>u.jsx(Mo.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Mo.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx($v,{...e,ref:t})})}));Uc.displayName=Gr;var $v=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,...p}=e,m=k.useRef(null),f=zn(t,m),v=Kc(o),[w=null,I]=gi({prop:s,defaultProp:a,onChange:c}),[C,y]=k.useState(!1),x=hi(l),b=Vc(n),_=k.useRef(!1),[E,$]=k.useState(0);return k.useEffect(()=>{const T=m.current;if(T)return T.addEventListener(vo,x),()=>T.removeEventListener(vo,x)},[x]),u.jsx(kv,{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:C||E===0?-1:0,"data-orientation":r,...p,ref:f,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&&!C){const q=new CustomEvent(vo,jv);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);Wc(se,d)}}_.current=!1}),onBlur:xt(e.onBlur,()=>y(!1))})})}),Bc="RovingFocusGroupItem",qc=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=$c(),c=o||a,l=Lv(Bc,n),d=l.currentTabStopId===c,p=Vc(n),{onFocusableItemAdd:m,onFocusableItemRemove:f}=l;return k.useEffect(()=>{if(r)return m(),()=>f()},[r,m,f]),u.jsx(Mo.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=Hv(v,l.orientation,l.dir);if(w!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let C=p().filter(y=>y.focusable).map(y=>y.ref.current);if(w==="last")C.reverse();else if(w==="prev"||w==="next"){w==="prev"&&C.reverse();const y=C.indexOf(v.currentTarget);C=l.loop?Uv(C,y+1):C.slice(y+1)}setTimeout(()=>Wc(C))}})})})});qc.displayName=Bc;var Kv={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 Hv(e,t,n){const r=Vv(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Kv[r]}function Wc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Uv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Bv=Uc,qv=qc,_i="Tabs",[Wv,yy]=Sv(_i,[Hc]),Jc=Hc(),[Jv,bi]=Wv(_i),zc=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:c="automatic",...l}=e,d=Kc(a),[p,m]=gi({prop:r,onChange:i,defaultProp:o});return u.jsx(Jv,{scope:n,baseId:$c(),value:p,onValueChange:m,orientation:s,dir:d,activationMode:c,children:u.jsx(en.div,{dir:d,"data-orientation":s,...l,ref:t})})});zc.displayName=_i;var Xc="TabsList",Gc=k.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=bi(Xc,n),s=Jc(n);return u.jsx(Bv,{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})})});Gc.displayName=Xc;var Yc="TabsTrigger",Zc=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=bi(Yc,n),a=Jc(n),c=el(s.baseId,r),l=tl(s.baseId,r),d=r===s.value;return u.jsx(qv,{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,p=>{!i&&p.button===0&&p.ctrlKey===!1?s.onValueChange(r):p.preventDefault()}),onKeyDown:xt(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&s.onValueChange(r)}),onFocus:xt(e.onFocus,()=>{const p=s.activationMode!=="manual";!d&&!i&&p&&s.onValueChange(r)})})})});Zc.displayName=Yc;var Qc="TabsContent",zv=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=bi(Qc,n),c=el(a.baseId,r),l=tl(a.baseId,r),d=r===a.value,p=k.useRef(d);return k.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),u.jsx(vi,{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:p.current?"0s":void 0},children:m&&o})})});zv.displayName=Qc;function el(e,t){return`${e}-trigger-${t}`}function tl(e,t){return`${e}-content-${t}`}var Xv=zc,Gv=Gc,nl=Zc;const Yv=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 Zv(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?Yv: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 Qv(){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 ey="_tabsRoot_lqugd_1",ty="_tabsList_lqugd_6",ny="_tabTrigger_lqugd_12",ry="_danger_lqugd_29",Xn={tabsRoot:ey,tabsList:ty,tabTrigger:ny,danger:ry};function rl({objectName:e,completed:t,pending:n,displayName:r}){return u.jsx(nl,{value:e,className:Xn.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Zv(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 oy({completed:e,pending:t,displayName:n}){return u.jsxs(u.Fragment,{children:[u.jsx(mi,{style:{margin:"1rem 0"}}),u.jsx(rl,{objectName:fn,completed:e,pending:t,displayName:n},"other-write")]})}function iy(){return u.jsxs(u.Fragment,{children:[u.jsx(mi,{style:{margin:"3rem 0 1rem 0"}}),u.jsx(nl,{value:Or,className:st(Xn.tabTrigger,Xn.danger),children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Qv(),u.jsx("span",{children:"Uninstall"})]})})]})}function sy({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i,showUninstallButton:o}){var s,a;return u.jsx(Xv,{value:e,className:Xn.tabsRoot,onValueChange:n,children:u.jsxs(Gv,{className:Xn.tabsList,children:[t.map(c=>{var l,d,p,m;return u.jsx(rl,{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=(p=r==null?void 0:r[c.name])==null?void 0:p.read)==null?void 0:m.isRequiredMapFieldsModified)||!1},c.name)}),i&&u.jsx(oy,{completed:i.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),o&&u.jsx(iy,{})]})})}function ay(e,t){return t===Or?{name:Or,completed:!1}:e.find(n=>n.name===t)}function cy({children:e}){var C;const{project:t}=Pe(),{installation:n,provider:r}=dt(),{hydratedRevision:i}=Dn(),{objectConfigurationsState:o}=fi(),[s,a]=g.useState(""),c=(t==null?void 0:t.appName)||"",l=n==null?void 0:n.config,d=i&&Zs(l,i),p=d!==null,m=!!((C=i==null?void 0:i.content)!=null&&C.write),f=m?Qs(l):void 0,v=g.useMemo(()=>{const y=[...d||[]];return f&&m&&y.push(f),y},[d,f,m]),w=ay(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(sc.Provider,{value:I,children:u.jsx(oc.Provider,{value:w==null?void 0:w.name,children:u.jsxs(Pn,{style:{maxWidth:"55rem"},children:[u.jsxs(Zt,{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}),p&&u.jsx(sy,{value:s,readNavObjects:d,onValueChange:y=>a(y),objectConfigurationsState:o,writeNavObject:f,showUninstallButton:!!n})]}),e]}),u.jsx(Pc,{})]})})})}function ly({...e}){return u.jsx(cy,{...e})}function uy({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var C;const{projectId:l,projectIdOrName:d,isLoading:p}=Pe(),{isLoading:m}=Lo(),{isError:f,errorState:v}=Yt(),{seed:w,reset:I}=Xs();return p||m?u.jsx($r,{}):f(Ce.PROJECT,d)?u.jsx(Lt,{message:`Error loading project ${d}`}):f(Ce.INTEGRATION_LIST,d)?u.jsx(Lt,{message:"Error retrieving integrations for the project, double check the API key"}):(C=v[Ce.INTEGRATION_LIST])!=null&&C.apiError?u.jsx(Lt,{message:"Something went wrong, couldn't find integration information"}):u.jsx("div",{className:Gs.resetContainer,children:u.jsx($p,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:u.jsx(zs,{groupRef:r,children:u.jsx(kc,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:u.jsx(df,{projectId:l,children:u.jsx(Kg,{resetComponent:I,children:u.jsx(Nh,{children:u.jsx(ly,{children:u.jsx(jg,{})})})})})})})},w)})}function dy(){return u.jsxs(Pn,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[u.jsx(Un,{}),u.jsx("p",{children:"Redirecting"})]})}function py({redirectURL:e,children:t}){return g.useEffect(()=>{e&&window.location.replace(e)},[e]),e?u.jsx(dy,{}):t}function fy({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i}){const o=He(),{projectId:s}=Pe(),{selectedConnection:a,setConnections:c}=yn(),[l,d]=g.useState(!1),p=!s||!a||!a.id||l,m=async()=>{if(!p){d(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id});try{await Oe().connectionApi.deleteConnection({projectIdOrName:s,connectionId:a==null?void 0:a.id},{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}),console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),Oe().connectionApi.listConnections({projectIdOrName:s},{headers:{"X-Api-Key":o??""}}).then(w=>{c(w),i()}).catch(w=>{ze(w)})}catch(w){console.error("Error deleting connection."),ze(w)}finally{d(!1)}}},f=l?"Disconnecting...":e;return u.jsx(ct,{type:"button",onClick:m,disabled:p,variant:t,style:n,children:f})}function my({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Pe(),i=`You have successfully connected your ${Qt(e)} account to ${r}.`;return u.jsx(wi,{text:i,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(fy,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function hy({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:l,reset:d}=Xs(),p=g.useCallback(m=>{s?s(m.id):c&&c(m)},[s,c]);return u.jsx("div",{className:Gs.resetContainer,children:u.jsx(zs,{provider:e,groupRef:r,children:u.jsx(kc,{provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:p,onDisconnectSuccess:a,children:u.jsx(py,{redirectURL:o,children:u.jsx(my,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},l)}const gy=(e,t)=>{const n=He(),{projectId:r,isLoading:i}=Pe(),{integrations:o}=Lo(),[s,a]=g.useState(!1),[c,l]=g.useState(null);if(!n||!i&&!r)throw new Error("useIsIntegrationInstalled must be used within AmpersandProvider");if(!e)throw new Error("useIsIntegrationInstalled requires an integration name");if(!t)throw new Error("useIsIntegrationInstalled requires a groupRef");const p=g.useMemo(()=>o==null?void 0:o.reduce((m,f)=>(f==null?void 0:f.name)===e?f:m,{}),[o,e]);return g.useEffect(()=>{!p||i||Oe().installationApi.listInstallations({projectIdOrName:r,integrationId:p.id,groupRef:t},{headers:{"x-api-key":n}}).then(m=>{a(!0),l(m.length>0)}).catch(m=>{console.error("Error listing installations."),ze(m),a(!0)})},[t,n,r,p,i]),{isLoaded:s,isIntegrationInstalled:c}};exports.AmpersandContext=Hs;exports.AmpersandProvider=xp;exports.ConnectProvider=hy;exports.FieldMapping=hc;exports.InstallIntegration=uy;exports.useAmpersandProvider=Cp;exports.useIsIntegrationInstalled=gy;
|