@amp-labs/react 2.13.1 → 2.13.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,22 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),w=require("react");require("react-dom");function Lm(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 J=Lm(w),Bm="https://api.withampersand.com/v1".replace(/\/+$/,"");class Sa{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Bm}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||cd}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 $m=new Sa,Ao=class Ao{constructor(t=$m){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 Um(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?Ao.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 Oa(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(c=>i[c]===void 0?delete i[c]:{});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})},l={...a,body:Vm(a.body)||a.body instanceof URLSearchParams||qm(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:l}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Ao.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let mn=Ao;function qm(e){return typeof Blob<"u"&&e instanceof Blob}function Vm(e){return typeof FormData<"u"&&e instanceof FormData}class Oa extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Um extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ae extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function N(e,t){const n=e[t];return n!=null}function cd(e,t=""){return Object.keys(e).map(n=>ud(n,e[n],t)).filter(n=>n.length>0).join("&")}function ud(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 ud(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?cd(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Qe(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Ve{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Tr{constructor(t){this.raw=t}async value(){}}class tc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function zm(e){return Km(e)}function Km(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function Hm(e){return Jm(e)}function Jm(e,t){return e==null?e:{attachmentType:e.attachmentType,header:N(e,"header")?zm(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Wm(e){return Qm(e)}function Qm(e,t){return e==null?e:{fieldUsed:N(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:N(e,"keyFormat")?e.keyFormat:void 0}}function Gm(e){return Xm(e)}function Xm(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function Ym(e){return Zm(e)}function Zm(e,t){return e==null?e:{name:e.name}}function eg(e){return tg(e)}function tg(e,t){return e==null?e:{attachmentType:e.attachmentType,query:N(e,"query")?Ym(e.query):void 0,header:N(e,"header")?Gm(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function ng(e){return rg(e)}function rg(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,includeFullRecords:N(e,"includeFullRecords")?e.includeFullRecords:void 0}}function ig(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function og(e){return sg(e)}function sg(e,t){return e==null?e:{url:e.url,method:N(e,"method")?e.method:void 0,successStatusCodes:N(e,"successStatusCodes")?e.successStatusCodes:void 0}}const nc={ApiKey:"apiKey",Basic:"basic"};function ag(e){return lg(e)}function lg(e,t){return e}function cg(e){return ug(e)}function ug(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function dg(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function dd(e){return pg(e)}function pg(e,t){return e==null?e:{defaultPeriod:cg(e.defaultPeriod)}}function fg(e){if(e!==void 0)return e===null?null:{defaultPeriod:dg(e.defaultPeriod)}}function hg(e){return mg(e)}function mg(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function gg(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function pd(e){return yg(e)}function yg(e,t){return e==null?e:{fieldName:e.fieldName,operator:e.operator,value:N(e,"value")?e.value:void 0}}function _a(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,operator:e.operator,value:e.value}}function vg(e){return bg(e)}function bg(e,t){return e==null?e:{defaultPeriod:hg(e.defaultPeriod),filter:N(e,"filter")?e.filter.map(pd):void 0}}function fd(e){if(e!==void 0)return e===null?null:{defaultPeriod:gg(e.defaultPeriod),filter:e.filter===void 0?void 0:e.filter.map(_a)}}function wg(e){return xg(e)}function xg(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function hd(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Ig(e){return Cg(e)}function Cg(e,t){return e==null?e:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function Sg(e){if(e!==void 0)return e===null?null:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function Og(e){return _g(e)}function _g(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,prompt:N(e,"prompt")?e.prompt:void 0,mappedValues:N(e,"mappedValues")?e.mappedValues.map(Ig):void 0,fieldName:N(e,"fieldName")?e.fieldName:void 0}}function md(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,prompt:e.prompt,mappedValues:e.mappedValues===void 0?void 0:e.mappedValues.map(Sg),fieldName:e.fieldName}}function Eg(e){return Ng(e)}function Ng(e,t){return e}function Tg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,disabled:e.disabled,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(md),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:fd(e.backfill),filter:e.filter===void 0?void 0:e.filter.map(_a)}}function kg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qe(e.objects,Tg)}}function Rg(e){return Ag(e)}function Ag(e,t){return e==null?e:{enabled:e.enabled}}function gd(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fg(e){return Pg(e)}function Pg(e,t){return e==null?e:{stringValue:N(e,"stringValue")?e.stringValue:void 0,integerValue:N(e,"integerValue")?e.integerValue:void 0,booleanValue:N(e,"booleanValue")?e.booleanValue:void 0}}function jg(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const Mg={Always:"always",Never:"never"},Dg={Always:"always",Never:"never",IfEmpty:"ifEmpty"};function Lg(e){return Bg(e)}function Bg(e,t){return e==null?e:{default:N(e,"default")?Fg(e.default):void 0,writeOnCreate:N(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:N(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function yd(e){if(e!==void 0)return e===null?null:{default:jg(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function $g(e){let t=!0;return t=t&&"value"in e,t}function qg(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Vg(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Ug(e){let t=!0;return t=t&&"value"in e,t}function zg(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Kg(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Hg(e){let t=!0;return t=t&&"value"in e,t}function Jg(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Wg(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Qg(e){return Gg(e)}function Gg(e,t){return e==null?e:{...qg(e),...zg(e),...Jg(e)}}function vd(e){if(e!==void 0)return e===null?null:$g(e)?Vg(e):Ug(e)?Kg(e):Hg(e)?Wg(e):{}}function Xg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,deletionSettings:gd(e.deletionSettings),selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Qe(e.selectedValueDefaults,vd),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Qe(e.selectedFieldSettings,yd)}}function Yg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qe(e.objects,Xg)}}function Zg(e){return ey(e)}function ey(e,t){return e==null?e:{enabled:e.enabled}}function ty(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ny(e){return ry(e)}function ry(e,t){return e==null?e:{enabled:e.enabled}}function iy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function oy(e){return sy(e)}function sy(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:N(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:N(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function ay(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function ly(e){return cy(e)}function cy(e,t){return e==null?e:{apiKeyAsBasic:N(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:N(e,"apiKeyAsBasicOpts")?Wm(e.apiKeyAsBasicOpts):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function uy(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function zi(e){return dy(e)}function dy(e,t){return e==null?e:{supported:e.supported,defaultRecordLimit:N(e,"defaultRecordLimit")?e.defaultRecordLimit:void 0,objectRecordLimits:N(e,"objectRecordLimits")?e.objectRecordLimits:void 0}}function py(e){return fy(e)}function fy(e,t){return e==null?e:{_delete:zi(e.delete),create:zi(e.create),update:zi(e.update),upsert:zi(e.upsert)}}function hy(e){return my(e)}function my(e,t){return e==null?e:{value:e.value}}function gy(e){return yy(e)}function yy(e,t){return e==null?e:{brandingRemoval:N(e,"brandingRemoval")?hy(e.brandingRemoval):void 0}}function Ki(e){return vy(e)}function vy(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:N(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:N(e,"entitlements")?gy(e.entitlements):void 0}}function by(e){return wy(e)}function wy(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function xy(e){return Iy(e)}function Iy(e,t){return e==null?e:{objectName:e.objectName,schedule:N(e,"schedule")?e.schedule:void 0,disabled:N(e,"disabled")?e.disabled:void 0,destination:N(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:N(e,"selectedValueMappings")?e.selectedValueMappings:void 0,dynamicMappingsInput:N(e,"dynamicMappingsInput")?e.dynamicMappingsInput.map(Og):void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:N(e,"selectedFieldsAuto")?Eg(e.selectedFieldsAuto):void 0,backfill:N(e,"backfill")?vg(e.backfill):void 0,filter:N(e,"filter")?e.filter.map(pd):void 0}}function Cy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,disabled:e.disabled,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(md),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:fd(e.backfill),filter:e.filter===void 0?void 0:e.filter.map(_a)}}function Sy(e){return Oy(e)}function Oy(e,t){return e==null?e:{objects:Qe(e.objects,xy)}}function _y(e){if(e!==void 0)return e===null?null:{objects:Qe(e.objects,Cy)}}function Ey(e){return Ny(e)}function Ny(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:N(e,"createEvent")?Zg(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?oy(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?ny(e.deleteEvent):void 0,otherEvents:N(e,"otherEvents")?e.otherEvents:void 0}}function Ty(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:ty(e.createEvent),updateEvent:ay(e.updateEvent),deleteEvent:iy(e.deleteEvent),otherEvents:e.otherEvents}}function ky(e){return Ry(e)}function Ry(e,t){return e==null?e:{objects:Qe(e.objects,Ey)}}function Ay(e){if(e!==void 0)return e===null?null:{objects:Qe(e.objects,Ty)}}function Fy(e){return Py(e)}function Py(e,t){return e==null?e:{objectName:e.objectName,deletionSettings:N(e,"deletionSettings")?Rg(e.deletionSettings):void 0,selectedValueDefaults:N(e,"selectedValueDefaults")?Qe(e.selectedValueDefaults,Qg):void 0,selectedFieldSettings:N(e,"selectedFieldSettings")?Qe(e.selectedFieldSettings,Lg):void 0}}function jy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,deletionSettings:gd(e.deletionSettings),selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Qe(e.selectedValueDefaults,vd),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Qe(e.selectedFieldSettings,yd)}}function My(e){return Dy(e)}function Dy(e,t){return e==null?e:{objects:N(e,"objects")?Qe(e.objects,Fy):void 0}}function Ly(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qe(e.objects,jy)}}function By(e){return $y(e)}function $y(e,t){return e==null?e:{provider:e.provider,read:N(e,"read")?Sy(e.read):void 0,write:N(e,"write")?My(e.write):void 0,proxy:N(e,"proxy")?wg(e.proxy):void 0,subscribe:N(e,"subscribe")?ky(e.subscribe):void 0}}function qy(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:_y(e.read),write:Ly(e.write),proxy:hd(e.proxy),subscribe:Ay(e.subscribe)}}function Vy(e){return Uy(e)}function Uy(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:By(e.content)}}function zy(e){return Ky(e)}function Ky(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function bd(e){return Hy(e)}function Hy(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function Jy(e){return Wy(e)}function Wy(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Qy(e){return Gy(e)}function Gy(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Xy(e){return Yy(e)}function Yy(e,t){return e==null?e:{accessToken:N(e,"accessToken")?Jy(e.accessToken):void 0,refreshToken:N(e,"refreshToken")?Qy(e.refreshToken):void 0,scopes:N(e,"scopes")?e.scopes:void 0}}function so(e){return Zy(e)}function Zy(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:N(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:N(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function ev(e){return tv(e)}function tv(e,t){return e==null?e:{value:e.value,source:e.source,displayName:N(e,"displayName")?e.displayName:void 0}}function Ea(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function oi(e){return nv(e)}function nv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:N(e,"providerApp")?so(e.providerApp):void 0,group:bd(e.group),consumer:zy(e.consumer),providerWorkspaceRef:N(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:N(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:N(e,"oauth2AuthorizationCode")?Xy(e.oauth2AuthorizationCode):void 0,apiKey:N(e,"apiKey")?e.apiKey:void 0,providerMetadata:N(e,"providerMetadata")?Qe(e.providerMetadata,ev):void 0}}function wd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function xd(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Id(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 rv(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function iv(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function Cd(e){if(e!==void 0)return e===null?null:{accessToken:rv(e.accessToken),refreshToken:iv(e.refreshToken),scopes:e.scopes}}function ov(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Qe(e.providerMetadata,Ea),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:wd(e.basicAuth),oauth2ClientCredentials:xd(e.oauth2ClientCredentials),oauth2PasswordCredentials:Id(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Cd(e.oauth2AuthorizationCode)}}function sv(e){return av(e)}function av(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function lv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function cv(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:qy(e.content)}}function uv(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:cv(e.config)}}function dv(e){return pv(e)}function pv(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,useModule:N(e,"useModule")?e.useModule:void 0}}function fv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function hv(e){return mv(e)}function mv(e,t){return e==null?e:{mode:N(e,"mode")?e.mode:void 0,pageSize:N(e,"pageSize")?e.pageSize:void 0}}function gv(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function yv(e){let t=!0;return t=t&&"fieldName"in e,t}function vv(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function bv(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function wv(e){let t=!0;return t=t&&"mapToName"in e,t}function Sd(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:N(e,"default")?e.default:void 0,prompt:N(e,"prompt")?e.prompt:void 0}}function xv(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function rc(e){return Iv(e)}function Iv(e,t){return e==null?e:{...vv(e),...Sd(e)}}function ic(e){if(e!==void 0)return e===null?null:yv(e)?bv(e):wv(e)?xv(e):{}}function Od(e){return Cv(e)}function Cv(e,t){return e}function Sv(e){return Ov(e)}function Ov(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:N(e,"requiredFields")?e.requiredFields.map(rc):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(rc):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Od(e.optionalFieldsAuto):void 0,backfill:N(e,"backfill")?dd(e.backfill):void 0,delivery:N(e,"delivery")?hv(e.delivery):void 0,enabled:N(e,"enabled")?e.enabled:void 0}}function _v(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(ic),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(ic),optionalFieldsAuto:e.optionalFieldsAuto,backfill:fg(e.backfill),delivery:gv(e.delivery),enabled:e.enabled}}function Ev(e){return Nv(e)}function Nv(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Sv):void 0}}function Tv(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(_v)}}function kv(e){return Rv(e)}function Rv(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Av(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fv(e){return Pv(e)}function Pv(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,watchFieldsAuto:N(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:N(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function jv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Mv(e){return Dv(e)}function Dv(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:N(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:N(e,"createEvent")?sv(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?Fv(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?kv(e.deleteEvent):void 0,associationChangeEvent:N(e,"associationChangeEvent")?ng(e.associationChangeEvent):void 0,otherEvents:N(e,"otherEvents")?e.otherEvents:void 0}}function Lv(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:lv(e.createEvent),updateEvent:jv(e.updateEvent),deleteEvent:Av(e.deleteEvent),associationChangeEvent:ig(e.associationChangeEvent),otherEvents:e.otherEvents}}function Bv(e){return $v(e)}function $v(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Mv):void 0}}function qv(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Lv)}}function _d(e){return Vv(e)}function Vv(e,t){return e==null?e:{allowAnyFields:N(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Uv(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function zv(e){return Kv(e)}function Kv(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:N(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:N(e,"valueDefaults")?_d(e.valueDefaults):void 0}}function Hv(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Uv(e.valueDefaults)}}function Jv(e){return Wv(e)}function Wv(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(zv):void 0}}function Qv(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Hv)}}function Gv(e){return Xv(e)}function Xv(e,t){return e==null?e:{enabled:e.enabled}}function Yv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Zv(e){return eb(e)}function eb(e,t){return e==null?e:{enabled:e.enabled}}function tb(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function nb(e){return rb(e)}function rb(e,t){return e==null?e:{enabled:e.enabled}}function ib(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ob(e){return sb(e)}function sb(e,t){return e==null?e:{fieldCreated:N(e,"fieldCreated")?Zv(e.fieldCreated):void 0,fieldDeleted:N(e,"fieldDeleted")?nb(e.fieldDeleted):void 0,fieldChanged:N(e,"fieldChanged")?Gv(e.fieldChanged):void 0}}function ab(e){if(e!==void 0)return e===null?null:{fieldCreated:tb(e.fieldCreated),fieldDeleted:ib(e.fieldDeleted),fieldChanged:Yv(e.fieldChanged)}}function lb(e){return cb(e)}function cb(e,t){return e==null?e:{destination:e.destination,schedule:N(e,"schedule")?e.schedule:void 0,allObjects:ob(e.allObjects)}}function ub(e){if(e!==void 0)return e===null?null:{destination:e.destination,schedule:e.schedule,allObjects:ab(e.allObjects)}}function db(e){return pb(e)}function pb(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:N(e,"displayName")?e.displayName:void 0,module:N(e,"module")?e.module:void 0,read:N(e,"read")?Ev(e.read):void 0,write:N(e,"write")?Jv(e.write):void 0,proxy:N(e,"proxy")?dv(e.proxy):void 0,subscribe:N(e,"subscribe")?Bv(e.subscribe):void 0,watchSchema:N(e,"watchSchema")?lb(e.watchSchema):void 0}}function fb(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:Tv(e.read),write:Qv(e.write),proxy:fv(e.proxy),subscribe:qv(e.subscribe),watchSchema:ub(e.watchSchema)}}function hb(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:fb(e.content)}}function mb(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:hb(e.latestRevision)}}function gb(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function yb(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 vb(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function bb(e){return wb(e)}function wb(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function xb(e){return Ib(e)}function Ib(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:N(e,"prompt")?e.prompt:void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Cb(e){return Sb(e)}function Sb(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Ob(e){return _b(e)}function _b(e,t){return e==null?e:{headers:N(e,"headers")?e.headers.map(bb):void 0,queryParams:N(e,"queryParams")?e.queryParams.map(Cb):void 0,inputs:N(e,"inputs")?e.inputs.map(xb):void 0}}function Eb(e){return Nb(e)}function Nb(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Tb(e){return kb(e)}function kb(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:N(e,"valueType")?e.valueType:void 0,providerType:N(e,"providerType")?e.providerType:void 0,readOnly:N(e,"readOnly")?e.readOnly:void 0,isCustom:N(e,"isCustom")?e.isCustom:void 0,isRequired:N(e,"isRequired")?e.isRequired:void 0,values:N(e,"values")?e.values.map(Eb):void 0}}function Rb(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Qe(e.providerMetadata,Ea),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:wd(e.basicAuth),oauth2ClientCredentials:xd(e.oauth2ClientCredentials),oauth2PasswordCredentials:Id(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Cd(e.oauth2AuthorizationCode)}}function Ab(e){return Fb(e)}function Fb(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,useModule:N(e,"useModule")?e.useModule:void 0}}function Pb(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function ns(e){return jb(e)}function jb(e,t){return e==null?e:{...Pb(e),...Sd(e)}}function Mb(e){return Db(e)}function Db(e,t){return e==null?e:{error:N(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:N(e,"requiredFields")?e.requiredFields.map(ns):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(ns):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Od(e.optionalFieldsAuto):void 0,allFieldsMetadata:N(e,"allFieldsMetadata")?Qe(e.allFieldsMetadata,Tb):void 0,allFields:N(e,"allFields")?e.allFields.map(ns):void 0,backfill:N(e,"backfill")?dd(e.backfill):void 0}}function Lb(e){return Bb(e)}function Bb(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Mb):void 0}}function $b(e){return qb(e)}function qb(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:N(e,"valueDefaults")?_d(e.valueDefaults):void 0}}function Vb(e){return Ub(e)}function Ub(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map($b):void 0}}function zb(e){return Kb(e)}function Kb(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,module:N(e,"module")?e.module:void 0,provider:e.provider,read:N(e,"read")?Lb(e.read):void 0,write:N(e,"write")?Vb(e.write):void 0,proxy:N(e,"proxy")?Ab(e.proxy):void 0}}function Hb(e){return Jb(e)}function Jb(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:zb(e.content)}}function wr(e){return Wb(e)}function Wb(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:N(e,"group")?bd(e.group):void 0,healthStatus:e.healthStatus,lastOperationStatus:N(e,"lastOperationStatus")?e.lastOperationStatus:void 0,connection:oi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,config:Vy(e.config)}}function Qb(e){return Gb(e)}function Gb(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:db(e.content)}}function rs(e){return Xb(e)}function Xb(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Qb(e.latestRevision)}}function Yb(e){if(e!==void 0)return e===null?null:{op:e.op,path:e.path,value:e.value}}function Zb(e){return ew(e)}function ew(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function tw(e){return nw(e)}function nw(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function rw(e){return iw(e)}function iw(e,t){return e==null?e:{regular:N(e,"regular")?tw(e.regular):void 0,darkMode:N(e,"darkMode")?Zb(e.darkMode):void 0}}function ow(e){return sw(e)}function sw(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,prompt:N(e,"prompt")?e.prompt:void 0,defaultValue:N(e,"defaultValue")?e.defaultValue:void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function aw(e){return lw(e)}function lw(e,t){return e==null?e:{name:e.name,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function cw(e){return uw(e)}function uw(e,t){return e==null?e:{equals:e.equals}}function dw(e){return pw(e)}function pw(e,t){return e==null?e:{operators:cw(e.operators)}}function fw(e){return hw(e)}function hw(e,t){return e==null?e:{create:N(e,"create")?e.create:void 0,update:N(e,"update")?e.update:void 0,_delete:N(e,"delete")?e.delete:void 0,passThrough:N(e,"passThrough")?e.passThrough:void 0}}function Ed(e){return mw(e)}function mw(e,t){return e==null?e:{bulkWrite:by(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,_delete:e.delete,subscribeSupport:N(e,"subscribeSupport")?fw(e.subscribeSupport):void 0,batchWrite:N(e,"batchWrite")?py(e.batchWrite):void 0,search:dw(e.search)}}function gw(e){return yw(e)}function yw(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Ed(e.support)}}function vw(e){return bw(e)}function bw(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:N(e,"capture")?e.capture:void 0}}function ww(e){return xw(e)}function xw(e,t){return e==null?e:{workspaceRefField:N(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:N(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:N(e,"scopesField")?e.scopesField:void 0,otherFields:N(e,"otherFields")?e.otherFields.map(vw):void 0}}const is={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function Iw(e){return Cw(e)}function Cw(e,t){return e==null?e:{grantType:e.grantType,authURL:N(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:N(e,"audience")?e.audience:void 0,scopeMappings:N(e,"scopeMappings")?e.scopeMappings:void 0,tokenMetadataFields:ww(e.tokenMetadataFields),docsURL:N(e,"docsURL")?e.docsURL:void 0,authURLParams:N(e,"authURLParams")?e.authURLParams:void 0,accessTokenOpts:N(e,"accessTokenOpts")?Hm(e.accessTokenOpts):void 0}}function Sw(e){if(e!==void 0)return e===null?null:{projectId:e.projectId,provider:e.provider,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Qe(e.providerMetadata,Ea),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function Ow(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,action:e.action,changes:e.changes.map(Yb),installationId:e.installationId}}function _w(e){return Ew(e)}function Ew(e,t){return e==null?e:{input:N(e,"input")?e.input.map(ow):void 0,postAuthentication:N(e,"postAuthentication")?e.postAuthentication.map(aw):void 0}}function Nw(e){return Tw(e)}function Tw(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function oc(e){return kw(e)}function kw(e,t){return e==null?e:{name:e.name,authType:ag(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:N(e,"oauth2Opts")?Iw(e.oauth2Opts):void 0,apiKeyOpts:N(e,"apiKeyOpts")?eg(e.apiKeyOpts):void 0,basicOpts:N(e,"basicOpts")?ly(e.basicOpts):void 0,customOpts:N(e,"customOpts")?Ob(e.customOpts):void 0,support:Ed(e.support),providerOpts:e.providerOpts,authHealthCheck:N(e,"authHealthCheck")?og(e.authHealthCheck):void 0,displayName:N(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:N(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:N(e,"media")?rw(e.media):void 0,labels:N(e,"labels")?e.labels:void 0,subscribeOpts:N(e,"subscribeOpts")?Nw(e.subscribeOpts):void 0,modules:N(e,"modules")?Qe(e.modules,gw):void 0,metadata:N(e,"metadata")?_w(e.metadata):void 0}}function Rw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:ov(e.connection)}}function Aw(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:kg(e.read),write:Yg(e.write),proxy:hd(e.proxy)}}function Fw(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Aw(e.content)}}function Pw(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Fw(e.config)}}function jw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Pw(e.installation)}}function Mw(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function Dw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Mw(e.project)}}function Lw(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 Bw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Lw(e.providerApp)}}class $w extends mn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Tr(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Rb(t.generateConnectionParams)},n);return new Ve(o,s=>oi(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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Ve(o,s=>oi(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 ae("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={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ve(o,s=>s.map(oi))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}async updateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ae("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:i,query:r,body:Rw(t.updateConnectionRequest)},n);return new Ve(o,s=>oi(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class qw extends mn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ae("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:uv(t.installation)},n);return new Ve(o,s=>wr(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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ae("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Tr(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ae("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Ve(o,s=>wr(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Ve(o,s=>s.map(wr))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async listInstallationsForProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallationsForProject.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ve(o,s=>s.map(wr))}async listInstallationsForProject(t,n){return await(await this.listInstallationsForProjectRaw(t,n)).value()}async patchObjectConfigContentRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling patchObjectConfigContent.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling patchObjectConfigContent.");if(t.objectName===null||t.objectName===void 0)throw new ae("objectName","Required parameter requestParameters.objectName was null or undefined when calling patchObjectConfigContent.");if(t.patchObjectConfigContent===null||t.patchObjectConfigContent===void 0)throw new ae("patchObjectConfigContent","Required parameter requestParameters.patchObjectConfigContent was null or undefined when calling patchObjectConfigContent.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/objects/{objectName}/config-content".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{objectName}",encodeURIComponent(String(t.objectName))),method:"PATCH",headers:i,query:r,body:Ow(t.patchObjectConfigContent)},n);return new Ve(o,s=>wr(s))}async patchObjectConfigContent(t,n){return await(await this.patchObjectConfigContentRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ae("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ae("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:jw(t.installationUpdate)},n);return new Ve(o,s=>wr(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Vw extends mn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ae("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={};t.destructive!==void 0&&(r.destructive=t.destructive);const i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:uy(t.batchUpsertIntegrationsRequest)},n);return new Ve(o,s=>s.map(rs))}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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ae("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:mb(t.integration)},n);return new Tr(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Tr(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new ae("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getIntegration.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationIdOrName}".replace("{integrationIdOrName}",encodeURIComponent(String(t.integrationIdOrName))).replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ve(o,s=>rs(s))}async getIntegration(t,n){return await(await this.getIntegrationRaw(t,n)).value()}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ve(o,s=>s.map(rs))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Uw extends mn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ae("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:Sw(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new Ve(o):new tc(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:i,query:r},n);return this.isJsonMime(o.headers.get("content-type"))?new Ve(o):new tc(o)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class zw extends mn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ae("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:gb(t.project)},n);return new Ve(o,s=>Ki(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ve(o,s=>Ki(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const o=this.configuration.accessToken,s=await o("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Ve(i,o=>o.map(Ki))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ae("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:Dw(t.projectUpdate)},n);return new Ve(o,s=>Ki(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Kw extends mn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ae("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new Ve(o,s=>oc(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const o=this.configuration.accessToken,s=await o("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Ve(i,o=>Qe(o,oc))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Hw extends mn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ae("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:yb(t.providerApp)},n);return new Ve(o,s=>so(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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ae("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Tr(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Ve(o,s=>s.map(so))}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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ae("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ae("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:Bw(t.providerAppUpdate)},n);return new Ve(o,s=>so(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Jw extends mn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ae("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={};t.destructive!==void 0&&(r.destructive=t.destructive);const i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:vb(t.revision)},n);return new Tr(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ae("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Ve(o,s=>Hb(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var Br=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ww={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Qw=class{#e=Ww;#t=!1;setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&this.#t&&e!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:e}),this.#e=e,process.env.NODE_ENV!=="production"&&(this.#t=!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},rr=new Qw;function Gw(e){setTimeout(e,0)}var sr=typeof window>"u"||"Deno"in globalThis;function _t(){}function Xw(e,t){return typeof e=="function"?e(t):e}function Bs(e){return typeof e=="number"&&e>=0&&e!==1/0}function Nd(e,t){return Math.max(e+(t||0)-Date.now(),0)}function qn(e,t){return typeof e=="function"?e(t):e}function Jt(e,t){return typeof e=="function"?e(t):e}function sc(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Na(s,t.options))return!1}else if(!hi(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||o&&!o(t))}function ac(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(ar(t.options.mutationKey)!==ar(o))return!1}else if(!hi(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Na(e,t){return(t?.queryKeyHashFn||ar)(e)}function ar(e){return JSON.stringify(e,(t,n)=>qs(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function hi(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>hi(e[n],t[n])):!1}var Yw=Object.prototype.hasOwnProperty;function $s(e,t){if(e===t)return e;const n=lc(e)&&lc(t);if(!n&&!(qs(e)&&qs(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),s=o.length,a=n?new Array(s):{};let l=0;for(let c=0;c<s;c++){const u=n?c:o[c],p=e[u],h=t[u];if(p===h){a[u]=p,(n?c<i:Yw.call(e,u))&&l++;continue}if(p===null||h===null||typeof p!="object"||typeof h!="object"){a[u]=h;continue}const f=$s(p,h);a[u]=f,f===p&&l++}return i===s&&l===i?e:a}function fo(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function lc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function qs(e){if(!cc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!cc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function cc(e){return Object.prototype.toString.call(e)==="[object Object]"}function Zw(e){return new Promise(t=>{rr.setTimeout(t,e)})}function Vs(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return $s(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return $s(e,t)}return t}function ex(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function tx(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ho=Symbol();function Td(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===ho&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ho?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function kd(e,t){return typeof e=="function"?e(...t):!!e}var nx=class extends Br{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!sr&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Ta=new nx;function Us(){let e,t;const n=new Promise((i,o)=>{e=i,t=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var rx=Gw;function ix(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=rx;const o=a=>{t?e.push(a):i(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{o(()=>{a(...l)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var it=ix(),ox=class extends Br{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!sr&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},mo=new ox;function sx(e){return Math.min(1e3*2**e,3e4)}function Rd(e){return(e??"online")==="online"?mo.isOnline():!0}var zs=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Ad(e){let t=!1,n=0,r;const i=Us(),o=()=>i.status!=="pending",s=v=>{if(!o()){const y=new zs(v);h(y),e.onCancel?.(y)}},a=()=>{t=!0},l=()=>{t=!1},c=()=>Ta.isFocused()&&(e.networkMode==="always"||mo.isOnline())&&e.canRun(),u=()=>Rd(e.networkMode)&&e.canRun(),p=v=>{o()||(r?.(),i.resolve(v))},h=v=>{o()||(r?.(),i.reject(v))},f=()=>new Promise(v=>{r=y=>{(o()||c())&&v(y)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),m=()=>{if(o())return;let v;const y=n===0?e.initialPromise:void 0;try{v=y??e.fn()}catch(x){v=Promise.reject(x)}Promise.resolve(v).then(p).catch(x=>{if(o())return;const g=e.retry??(sr?0:3),b=e.retryDelay??sx,I=typeof b=="function"?b(n,x):b,O=g===!0||typeof g=="number"&&n<g||typeof g=="function"&&g(n,x);if(t||!O){h(x);return}n++,e.onFail?.(n,x),Zw(I).then(()=>c()?void 0:f()).then(()=>{t?h(x):m()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r?.(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?m():f().then(m),i)}}var Fd=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Bs(this.gcTime)&&(this.#e=rr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(sr?1/0:300*1e3))}clearGcTimeout(){this.#e&&(rr.clearTimeout(this.#e),this.#e=void 0)}},ax=class extends Fd{#e;#t;#n;#i;#r;#s;#a;constructor(e){super(),this.#a=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#n=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=uc(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#s,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=uc(this.options);t.data!==void 0&&(this.setData(t.data,{updatedAt:t.dataUpdatedAt,manual:!0}),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=Vs(this.state.data,e,this.options);return this.#o({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#o({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(_t).catch(_t):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Jt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ho||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>qn(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Nd(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#a?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const a=this.observers.find(l=>l.options.queryFn);a&&this.setOptions(a.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,r=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#a=!0,n.signal)})},i=()=>{const a=Td(this.options,t),c=(()=>{const u={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(u),u})();return this.#a=!1,this.options.persister?this.options.persister(a,c,this):a(c)},s=(()=>{const a={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(a),a})();this.options.behavior?.onFetch(s,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&this.#o({type:"fetch",meta:s.fetchOptions?.meta}),this.#r=Ad({initialPromise:t?.initialPromise,fn:s.fetchFn,onCancel:a=>{a instanceof zs&&a.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(a,l)=>{this.#o({type:"failed",failureCount:a,error:l})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0});try{const a=await this.#r.start();if(a===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(a),this.#n.config.onSuccess?.(a,this),this.#n.config.onSettled?.(a,this.state.error,this),a}catch(a){if(a instanceof zs){if(a.silent)return this.#r.promise;if(a.revert){if(this.state.data===void 0)throw a;return this.state.data}}throw this.#o({type:"error",error:a}),this.#n.config.onError?.(a,this),this.#n.config.onSettled?.(this.state.data,a,this),a}finally{this.scheduleGc()}}#o(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Pd(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?r:void 0,r;case"error":const i=e.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),it.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Pd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Rd(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function uc(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var lx=class extends Br{constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.#a=Us(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#i=void 0;#r;#s;#a;#o;#m;#p;#f;#c;#u;#l;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),dc(this.#t,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ks(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ks(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#x(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Jt(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#I(),this.#t.setOptions(this.options),t._defaulted&&!fo(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&pc(this.#t,n,this.options,t)&&this.#d(),this.updateResult(),r&&(this.#t!==n||Jt(this.options.enabled,this.#t)!==Jt(t.enabled,this.#t)||qn(this.options.staleTime,this.#t)!==qn(t.staleTime,this.#t))&&this.#g();const i=this.#y();r&&(this.#t!==n||Jt(this.options.enabled,this.#t)!==Jt(t.enabled,this.#t)||i!==this.#l)&&this.#v(i)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ux(this,n)&&(this.#i=n,this.#s=this.options,this.#r=this.#t.state),n}getCurrentResult(){return this.#i}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#d(e){this.#I();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(_t)),t}#g(){this.#w();const e=qn(this.options.staleTime,this.#t);if(sr||this.#i.isStale||!Bs(e))return;const n=Nd(this.#i.dataUpdatedAt,e)+1;this.#c=rr.setTimeout(()=>{this.#i.isStale||this.updateResult()},n)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#l=e,!(sr||Jt(this.options.enabled,this.#t)===!1||!Bs(this.#l)||this.#l===0)&&(this.#u=rr.setInterval(()=>{(this.options.refetchIntervalInBackground||Ta.isFocused())&&this.#d()},this.#l))}#b(){this.#g(),this.#v(this.#y())}#w(){this.#c&&(rr.clearTimeout(this.#c),this.#c=void 0)}#x(){this.#u&&(rr.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#t,r=this.options,i=this.#i,o=this.#r,s=this.#s,l=e!==n?e.state:this.#n,{state:c}=e;let u={...c},p=!1,h;if(t._optimisticResults){const k=this.hasListeners(),A=!k&&dc(e,t),F=k&&pc(e,n,t,r);(A||F)&&(u={...u,...Pd(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:m,status:v}=u;h=u.data;let y=!1;if(t.placeholderData!==void 0&&h===void 0&&v==="pending"){let k;i?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(k=i.data,y=!0):k=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,k!==void 0&&(v="success",h=Vs(i?.data,k,t),p=!0)}if(t.select&&h!==void 0&&!y)if(i&&h===o?.data&&t.select===this.#m)h=this.#p;else try{this.#m=t.select,h=t.select(h),h=Vs(i?.data,h,t),this.#p=h,this.#o=null}catch(k){this.#o=k}this.#o&&(f=this.#o,h=this.#p,m=Date.now(),v="error");const x=u.fetchStatus==="fetching",g=v==="pending",b=v==="error",I=g&&x,O=h!==void 0,R={status:v,fetchStatus:u.fetchStatus,isPending:g,isSuccess:v==="success",isError:b,isInitialLoading:I,isLoading:I,data:h,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:m,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:x,isRefetching:x&&!g,isLoadingError:b&&!O,isPaused:u.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:b&&O,isStale:ka(e,t),refetch:this.refetch,promise:this.#a,isEnabled:Jt(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=j=>{R.status==="error"?j.reject(R.error):R.data!==void 0&&j.resolve(R.data)},A=()=>{const j=this.#a=R.promise=Us();k(j)},F=this.#a;switch(F.status){case"pending":e.queryHash===n.queryHash&&k(F);break;case"fulfilled":(R.status==="error"||R.data!==F.value)&&A();break;case"rejected":(R.status!=="error"||R.error!==F.reason)&&A();break}}return R}updateResult(){const e=this.#i,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#s=this.options,this.#r.data!==void 0&&(this.#f=this.#t),fo(t,e))return;this.#i=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#h.size)return!0;const o=new Set(i??this.#h);return this.options.throwOnError&&o.add("error"),Object.keys(this.#i).some(s=>{const a=s;return this.#i[a]!==e[a]&&o.has(a)})};this.#C({listeners:n()})}#I(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#C(e){it.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function cx(e,t){return Jt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function dc(e,t){return cx(e,t)||e.state.data!==void 0&&Ks(e,t,t.refetchOnMount)}function Ks(e,t,n){if(Jt(t.enabled,e)!==!1&&qn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ka(e,t)}return!1}function pc(e,t,n,r){return(e!==t||Jt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ka(e,n)}function ka(e,t){return Jt(t.enabled,e)!==!1&&e.isStaleByTime(qn(t.staleTime,e))}function ux(e,t){return!fo(e.getCurrentResult(),t)}function fc(e){return{onFetch:(t,n)=>{const r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let u=!1;const p=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},h=Td(t.options,t.fetchOptions),f=async(m,v,y)=>{if(u)return Promise.reject();if(v==null&&m.pages.length)return Promise.resolve(m);const g=(()=>{const _={client:t.client,queryKey:t.queryKey,pageParam:v,direction:y?"backward":"forward",meta:t.options.meta};return p(_),_})(),b=await h(g),{maxPages:I}=t.options,O=y?tx:ex;return{pages:O(m.pages,b,I),pageParams:O(m.pageParams,v,I)}};if(i&&o.length){const m=i==="backward",v=m?dx:hc,y={pages:o,pageParams:s},x=v(r,y);a=await f(y,x,m)}else{const m=e??o.length;do{const v=l===0?s[0]??r.initialPageParam:hc(r,a);if(l>0&&v==null)break;a=await f(a,v),l++}while(l<m)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=c}}}function hc(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function dx(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var px=class extends Fd{#e;#t;#n;#i;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||jd(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=Ad({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,s)=>{this.#r({type:"failed",failureCount:o,error:s})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",i=!this.#i.canStart();try{if(r)t();else{this.#r({type:"pending",variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,n);const s=await this.options.onMutate?.(e,n);s!==this.state.context&&this.#r({type:"pending",context:s,variables:e,isPaused:i})}const o=await this.#i.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#r({type:"success",data:o}),o}catch(o){try{throw await this.#n.config.onError?.(o,e,this.state.context,this,n),await this.options.onError?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,o,e,this.state.context,n),o}finally{this.#r({type:"error",error:o})}}finally{this.#n.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),it.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function jd(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var fx=class extends Br{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new px({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Hi(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Hi(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Hi(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(i=>i.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Hi(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){it.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>ac(t,n))}findAll(e={}){return this.getAll().filter(t=>ac(e,t))}notify(e){it.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return it.batch(()=>Promise.all(e.map(t=>t.continue().catch(_t))))}};function Hi(e){return e.options.scope?.id}var hx=class extends Br{#e;#t=void 0;#n;#i;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),fo(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&ar(n.mutationKey)!==ar(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#s(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#s()}mutate(t,n){return this.#i=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){const t=this.#n?.state??jd();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#s(t){it.batch(()=>{if(this.#i&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};t?.type==="success"?(this.#i.onSuccess?.(t.data,n,r,i),this.#i.onSettled?.(t.data,null,n,r,i)):t?.type==="error"&&(this.#i.onError?.(t.error,n,r,i),this.#i.onSettled?.(void 0,t.error,n,r,i))}this.listeners.forEach(n=>{n(this.#t)})})}},mx=class extends Br{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,i=t.queryHash??Na(r,t);let o=this.get(i);return o||(o=new ax({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){it.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>sc(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>sc(e,n)):t}notify(e){it.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){it.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){it.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},gx=class{#e;#t;#n;#i;#r;#s;#a;#o;constructor(e={}){this.#e=e.queryCache||new mx,this.#t=e.mutationCache||new fx,this.#n=e.defaultOptions||{},this.#i=new Map,this.#r=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#a=Ta.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=mo.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(qn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=this.#e.get(r.queryHash)?.state.data,s=Xw(t,o);if(s!==void 0)return this.#e.build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return it.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;it.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return it.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=it.batch(()=>this.#e.findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(_t).catch(_t)}invalidateQueries(e,t={}){return it.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=it.batch(()=>this.#e.findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(_t)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(_t)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(qn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_t).catch(_t)}fetchInfiniteQuery(e){return e.behavior=fc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_t).catch(_t)}ensureInfiniteQueryData(e){return e.behavior=fc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return mo.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#i.set(ar(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{hi(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(ar(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{hi(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Na(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ho&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Md=J.createContext(void 0),Ze=e=>{const t=J.useContext(Md);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},yx=({client:e,children:t})=>(J.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),d.jsx(Md.Provider,{value:e,children:t})),Dd=J.createContext(!1),vx=()=>J.useContext(Dd);Dd.Provider;function bx(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var wx=J.createContext(bx()),xx=()=>J.useContext(wx),Ix=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Cx=e=>{J.useEffect(()=>{e.clearReset()},[e])},Sx=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||kd(n,[e.error,r])),Ox=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},_x=(e,t)=>e.isLoading&&e.isFetching&&!t,Ex=(e,t)=>e?.suspense&&t.isPending,mc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Nx(e,t,n){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=vx(),i=xx(),o=Ze(),s=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=r?"isRestoring":"optimistic",Ox(s),Ix(s,i),Cx(i);const a=!o.getQueryCache().get(s.queryHash),[l]=J.useState(()=>new t(o,s)),c=l.getOptimisticResult(s),u=!r&&e.subscribed!==!1;if(J.useSyncExternalStore(J.useCallback(p=>{const h=u?l.subscribe(it.batchCalls(p)):_t;return l.updateResult(),h},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),J.useEffect(()=>{l.setOptions(s)},[s,l]),Ex(s,c))throw mc(s,l,i);if(Sx({result:c,errorResetBoundary:i,throwOnError:s.throwOnError,query:o.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw c.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(s,c),s.experimental_prefetchInRender&&!sr&&_x(c,r)&&(a?mc(s,l,i):o.getQueryCache().get(s.queryHash)?.promise)?.catch(_t).finally(()=>{l.updateResult()}),s.notifyOnChangeProps?c:l.trackResult(c)}function pr(e,t){return Nx(e,lx)}function Nn(e,t){const n=Ze(),[r]=J.useState(()=>new hx(n,e));J.useEffect(()=>{r.setOptions(e)},[r,e]);const i=J.useSyncExternalStore(J.useCallback(s=>r.subscribe(it.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=J.useCallback((s,a)=>{r.mutate(s,a).catch(_t)},[r]);if(i.error&&kd(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}const Ld=w.createContext(null),Tx=Ld.Provider,Bd=()=>w.useContext(Ld);var Ie=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e.VALUE_MAPPING="valueMappingError",e))(Ie||{});const $d=w.createContext(void 0);function vn(){const e=w.useContext($d);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const kx=(()=>{const e={};return Object.values(Ie).forEach(t=>{e[t]={}}),e})();function Rx({children:e}){const[t,n]=w.useState(kx),r=w.useCallback((u,p,h=!0)=>{n(f=>{const m={...f};return m[u]=m[u]||{},m[u][p]=h,m})},[n]),i=w.useCallback((u,p)=>!!t[u]?.[p],[t]),o=w.useCallback((u,p)=>t[u]?.[p],[t]),s=w.useCallback((u,p)=>{n(h=>{const f={...h};return delete f[u]?.[p],f})},[n]),a=w.useCallback(u=>{n(p=>{const h={...p};return h[u]={},h})},[n]),l=w.useCallback((u,p)=>{n(h=>{const f={...h};return f[u]=f[u]||{},p.forEach(m=>{f[u][m]=!0}),f})},[n]),c=w.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:a,setErrors:l,getError:o}),[t,n,r,i,s,a,l,o]);return d.jsx($d.Provider,{value:c,children:e})}new TextEncoder;const Hs=new TextDecoder;function Ax(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function Fx(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:Hs.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=Hs.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return Ax(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class Px extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(t,n){super(t,n),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class er extends Px{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}function jx(e){return typeof e=="object"&&e!==null}const Mx=e=>{if(!jx(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t};function Dx(e){if(typeof e!="string")throw new er("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new er("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new er("Invalid JWT");if(!t)throw new er("JWTs must contain a payload");let r;try{r=Fx(t)}catch{throw new er("Failed to base64url decode the payload")}let i;try{i=JSON.parse(Hs.decode(r))}catch{throw new er("Failed to parse the decoded payload as JSON")}if(!Mx(i))throw new er("Invalid JWT Claims Set");return i}const Js="amp-labs_jwt_",Lx=600*1e3,gc=(e,t)=>`${e}:${t}`,yc=e=>`${Js}${e}`,qd=w.createContext(null),Bx=e=>{try{const t=Dx(e);return t.exp&&typeof t.exp=="number"?t.exp*1e3:null}catch(t){return console.warn("Failed to decode JWT token:",t),null}};function $x({getTokenCallback:e,children:t}){const[n,r]=w.useState(new Map);w.useEffect(()=>{try{const l=new Map,c=Date.now();Object.keys(sessionStorage).forEach(u=>{if(u.startsWith(Js)){const p=u.replace(Js,""),h=sessionStorage.getItem(u);if(h)try{const f=JSON.parse(h);f.expiresAt>c?l.set(p,f):sessionStorage.removeItem(u)}catch{sessionStorage.removeItem(u)}}}),l.size>0&&r(l)}catch{console.warn("Failed to load JWT tokens from sessionStorage")}},[]);const i=w.useCallback((l,c)=>{const u=gc(l,c),p=Date.now(),h=n.get(u);if(h&&h.expiresAt>p)return h.token;n.delete(u);const f=yc(u),m=sessionStorage.getItem(f);if(m)try{const v=JSON.parse(m);if(v.expiresAt>p)return r(y=>new Map(y).set(u,v)),v.token;sessionStorage.removeItem(f)}catch{sessionStorage.removeItem(f)}return null},[n]),o=w.useCallback(async(l,c,u)=>{const p=gc(l,c),f=await Bx(u)||Date.now()+Lx,m={token:u,expiresAt:f};r(v=>new Map(v).set(p,m));try{sessionStorage.setItem(yc(p),JSON.stringify(m))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=w.useCallback(async({consumerRef:l,groupRef:c})=>{const u=i(l,c);if(u)return u;if(!e)throw new Error("JWT token callback not provided");try{const p=await e({consumerRef:l,groupRef:c});return await o(l,c,p),p}catch(p){throw console.error("Failed to get JWT token:",p),new Error("Failed to get JWT token")}},[e,i,o]),a={getToken:e?s:void 0};return d.jsx(qd.Provider,{value:a,children:t})}const qx=()=>{const e=w.useContext(qd);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},Ra=w.createContext(null);function Ke(){const e=w.useContext(Ra);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
2
- component is wrapped with AmpersandProvider`);return e}const Vx=new gx({defaultOptions:{queries:{retry:(e,t)=>{if(t instanceof Oa){const n=t.response.status;if(n>=400&&n<500)return!1}return e<3}}}});function Ux(e){const{options:{apiKey:t,projectId:n,project:r,getToken:i},children:o}=e,s=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!s)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t&&!i)throw new Error("Cannot use AmpersandProvider without an apiKey or getToken.");if(t&&i)throw new Error("Cannot use AmpersandProvider with both apiKey and getToken.");const a={options:e.options,projectIdOrName:s};return d.jsx(yx,{client:Vx,children:d.jsx(Ra.Provider,{value:a,children:d.jsx(Rx,{children:d.jsx($x,{getTokenCallback:i||null,children:d.jsx(Tx,{value:t||null,children:o})})})})})}var Vd=Symbol.for("immer-nothing"),vc=Symbol.for("immer-draftable"),Bt=Symbol.for("immer-state"),zx=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Rt(e,...t){if(process.env.NODE_ENV!=="production"){const n=zx[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 mi=Object.getPrototypeOf;function kr(e){return!!e&&!!e[Bt]}function lr(e){return e?Ud(e)||Array.isArray(e)||!!e[vc]||!!e.constructor?.[vc]||Ci(e)||Po(e):!1}var Kx=Object.prototype.constructor.toString(),bc=new WeakMap;function Ud(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=bc.get(n);return r===void 0&&(r=Function.toString.call(n),bc.set(n,r)),r===Kx}function go(e,t,n=!0){Fo(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Fo(e){const t=e[Bt];return t?t.type_:Array.isArray(e)?1:Ci(e)?2:Po(e)?3:0}function Ws(e,t){return Fo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function zd(e,t,n){const r=Fo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Hx(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ci(e){return e instanceof Map}function Po(e){return e instanceof Set}function nr(e){return e.copy_||e.base_}function Qs(e,t){if(Ci(e))return new Map(e);if(Po(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ud(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Bt];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(mi(e),r)}else{const r=mi(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function Aa(e,t=!1){return jo(e)||kr(e)||!lr(e)||(Fo(e)>1&&Object.defineProperties(e,{set:Ji,add:Ji,clear:Ji,delete:Ji}),Object.freeze(e),t&&Object.values(e).forEach(n=>Aa(n,!0))),e}function Jx(){Rt(2)}var Ji={value:Jx};function jo(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Wx={};function cr(e){const t=Wx[e];return t||Rt(0,e),t}var gi;function Kd(){return gi}function Qx(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function wc(e,t){t&&(cr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Gs(e){Xs(e),e.drafts_.forEach(Gx),e.drafts_=null}function Xs(e){e===gi&&(gi=e.parent_)}function xc(e){return gi=Qx(gi,e)}function Gx(e){const t=e[Bt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ic(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Bt].modified_&&(Gs(t),Rt(4)),lr(e)&&(e=yo(t,e),t.parent_||vo(t,e)),t.patches_&&cr("Patches").generateReplacementPatches_(n[Bt].base_,e,t.patches_,t.inversePatches_)):e=yo(t,n,[]),Gs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Vd?e:void 0}function yo(e,t,n){if(jo(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[Bt];if(!i)return go(t,(o,s)=>Cc(e,i,t,o,s,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return vo(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const o=i.copy_;let s=o,a=!1;i.type_===3&&(s=new Set(o),o.clear(),a=!0),go(s,(l,c)=>Cc(e,i,o,l,c,n,a),r),vo(e,o,!1),n&&e.patches_&&cr("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Cc(e,t,n,r,i,o,s){if(i==null||typeof i!="object"&&!s)return;const a=jo(i);if(!(a&&!s)){if(process.env.NODE_ENV!=="production"&&i===n&&Rt(5),kr(i)){const l=o&&t&&t.type_!==3&&!Ws(t.assigned_,r)?o.concat(r):void 0,c=yo(e,i,l);if(zd(n,r,c),kr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(lr(i)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&a)return;yo(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Ci(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&vo(e,i)}}}function vo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Aa(t,n)}function Xx(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Kd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=Fa;n&&(i=[r],o=yi);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var Fa={get(e,t){if(t===Bt)return e;const n=nr(e);if(!Ws(n,t))return Yx(e,n,t);const r=n[t];return e.finalized_||!lr(r)?r:r===os(e.base_,t)?(ss(e),e.copy_[t]=Zs(r,e)):r},has(e,t){return t in nr(e)},ownKeys(e){return Reflect.ownKeys(nr(e))},set(e,t,n){const r=Hd(nr(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=os(nr(e),t),o=i?.[Bt];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Hx(n,i)&&(n!==void 0||Ws(e.base_,t)))return!0;ss(e),Ys(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 os(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ss(e),Ys(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=nr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Rt(11)},getPrototypeOf(e){return mi(e.base_)},setPrototypeOf(){Rt(12)}},yi={};go(Fa,(e,t)=>{yi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});yi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Rt(13),yi.set.call(this,e,t,void 0)};yi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Rt(14),Fa.set.call(this,e[0],t,n,e[0])};function os(e,t){const n=e[Bt];return(n?nr(n):e)[t]}function Yx(e,t,n){const r=Hd(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function Hd(e,t){if(!(t in e))return;let n=mi(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=mi(n)}}function Ys(e){e.modified_||(e.modified_=!0,e.parent_&&Ys(e.parent_))}function ss(e){e.copy_||(e.copy_=Qs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Zx=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const s=this;return function(l=o,...c){return s.produce(l,u=>n.call(this,u,...c))}}typeof n!="function"&&Rt(6),r!==void 0&&typeof r!="function"&&Rt(7);let i;if(lr(t)){const o=xc(this),s=Zs(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?Gs(o):Xs(o)}return wc(o,r),Ic(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Vd&&(i=void 0),this.autoFreeze_&&Aa(i,!0),r){const o=[],s=[];cr("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else Rt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,l=>t(l,...a));let r,i;return[this.produce(t,n,(s,a)=>{r=s,i=a}),r,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){lr(e)||Rt(8),kr(e)&&(e=eI(e));const t=xc(this),n=Zs(e,void 0);return n[Bt].isManual_=!0,Xs(t),n}finishDraft(e,t){const n=e&&e[Bt];(!n||!n.isManual_)&&Rt(9);const{scope_:r}=n;return wc(r,t),Ic(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}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=cr("Patches").applyPatches_;return kr(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Zs(e,t){const n=Ci(e)?cr("MapSet").proxyMap_(e,t):Po(e)?cr("MapSet").proxySet_(e,t):Xx(e,t);return(t?t.scope_:Kd()).drafts_.push(n),n}function eI(e){return kr(e)||Rt(10,e),Jd(e)}function Jd(e){if(!lr(e)||jo(e))return e;const t=e[Bt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Qs(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Qs(e,!0);return go(n,(i,o)=>{zd(n,i,Jd(o))},r),t&&(t.finalized_=!1),n}var tI=new Zx,ct=tI.produce,$n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var si={exports:{}};si.exports;var Sc;function nI(){return Sc||(Sc=1,(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,a="[object Arguments]",l="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",p="[object Date]",h="[object Error]",f="[object Function]",m="[object GeneratorFunction]",v="[object Map]",y="[object Number]",x="[object Null]",g="[object Object]",b="[object Promise]",I="[object Proxy]",O="[object RegExp]",_="[object Set]",R="[object String]",k="[object Symbol]",A="[object Undefined]",F="[object WeakMap]",j="[object ArrayBuffer]",L="[object DataView]",H="[object Float32Array]",P="[object Float64Array]",B="[object Int8Array]",X="[object Int16Array]",le="[object Int32Array]",fe="[object Uint8Array]",ge="[object Uint8ClampedArray]",C="[object Uint16Array]",W="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,S=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,V={};V[H]=V[P]=V[B]=V[X]=V[le]=V[fe]=V[ge]=V[C]=V[W]=!0,V[a]=V[l]=V[j]=V[u]=V[L]=V[p]=V[h]=V[f]=V[v]=V[y]=V[g]=V[O]=V[_]=V[R]=V[F]=!1;var Y=typeof $n=="object"&&$n&&$n.Object===Object&&$n,ie=typeof self=="object"&&self&&self.Object===Object&&self,ne=Y||ie||Function("return this")(),se=t&&!t.nodeType&&t,ee=se&&!0&&e&&!e.nodeType&&e,me=ee&&ee.exports===se,q=me&&Y.process,ye=(function(){try{return q&&q.binding&&q.binding("util")}catch{}})(),Z=ye&&ye.isTypedArray;function $e(E,T){for(var z=-1,oe=E==null?0:E.length,qe=0,ve=[];++z<oe;){var Je=E[z];T(Je,z,E)&&(ve[qe++]=Je)}return ve}function Fe(E,T){for(var z=-1,oe=T.length,qe=E.length;++z<oe;)E[qe+z]=T[z];return E}function Ae(E,T){for(var z=-1,oe=E==null?0:E.length;++z<oe;)if(T(E[z],z,E))return!0;return!1}function We(E,T){for(var z=-1,oe=Array(E);++z<E;)oe[z]=T(z);return oe}function et(E){return function(T){return E(T)}}function tt(E,T){return E.has(T)}function xe(E,T){return E?.[T]}function at(E){var T=-1,z=Array(E.size);return E.forEach(function(oe,qe){z[++T]=[qe,oe]}),z}function It(E,T){return function(z){return E(T(z))}}function dt(E){var T=-1,z=Array(E.size);return E.forEach(function(oe){z[++T]=oe}),z}var Ge=Array.prototype,D=Function.prototype,K=Object.prototype,M=ne["__core-js_shared__"],re=D.toString,ce=K.hasOwnProperty,Ue=(function(){var E=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||"");return E?"Symbol(src)_1."+E:""})(),Ct=K.toString,pt=RegExp("^"+re.call(ce).replace($,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),gt=me?ne.Buffer:void 0,Pe=ne.Symbol,Oe=ne.Uint8Array,St=K.propertyIsEnumerable,ft=Ge.splice,Et=Pe?Pe.toStringTag:void 0,An=Object.getOwnPropertySymbols,Fn=gt?gt.isBuffer:void 0,Pn=It(Object.keys,Object),dn=br(ne,"DataView"),Yt=br(ne,"Map"),jn=br(ne,"Promise"),ze=br(ne,"Set"),nt=br(ne,"WeakMap"),de=br(Object,"create"),Ce=Yn(dn),Ot=Yn(Yt),xn=Yn(jn),te=Yn(ze),pe=Yn(nt),ue=Pe?Pe.prototype:void 0,Se=ue?ue.valueOf:void 0;function Me(E){var T=-1,z=E==null?0:E.length;for(this.clear();++T<z;){var oe=E[T];this.set(oe[0],oe[1])}}function Vt(){this.__data__=de?de(null):{},this.size=0}function Ut(E){var T=this.has(E)&&delete this.__data__[E];return this.size-=T?1:0,T}function ht(E){var T=this.__data__;if(de){var z=T[E];return z===r?void 0:z}return ce.call(T,E)?T[E]:void 0}function Nt(E){var T=this.__data__;return de?T[E]!==void 0:ce.call(T,E)}function De(E,T){var z=this.__data__;return this.size+=this.has(E)?0:1,z[E]=de&&T===void 0?r:T,this}Me.prototype.clear=Vt,Me.prototype.delete=Ut,Me.prototype.get=ht,Me.prototype.has=Nt,Me.prototype.set=De;function yt(E){var T=-1,z=E==null?0:E.length;for(this.clear();++T<z;){var oe=E[T];this.set(oe[0],oe[1])}}function Zo(){this.__data__=[],this.size=0}function es(E){var T=this.__data__,z=Bi(T,E);if(z<0)return!1;var oe=T.length-1;return z==oe?T.pop():ft.call(T,z,1),--this.size,!0}function ji(E){var T=this.__data__,z=Bi(T,E);return z<0?void 0:T[z][1]}function Mi(E){return Bi(this.__data__,E)>-1}function Di(E,T){var z=this.__data__,oe=Bi(z,E);return oe<0?(++this.size,z.push([E,T])):z[oe][1]=T,this}yt.prototype.clear=Zo,yt.prototype.delete=es,yt.prototype.get=ji,yt.prototype.has=Mi,yt.prototype.set=Di;function pn(E){var T=-1,z=E==null?0:E.length;for(this.clear();++T<z;){var oe=E[T];this.set(oe[0],oe[1])}}function Li(){this.size=0,this.__data__={hash:new Me,map:new(Yt||yt),string:new Me}}function _e(E){var T=$i(this,E).delete(E);return this.size-=T?1:0,T}function Zt(E){return $i(this,E).get(E)}function Jr(E){return $i(this,E).has(E)}function Xn(E,T){var z=$i(this,E),oe=z.size;return z.set(E,T),this.size+=z.size==oe?0:1,this}pn.prototype.clear=Li,pn.prototype.delete=_e,pn.prototype.get=Zt,pn.prototype.has=Jr,pn.prototype.set=Xn;function vr(E){var T=-1,z=E==null?0:E.length;for(this.__data__=new pn;++T<z;)this.add(E[T])}function Wr(E){return this.__data__.set(E,r),this}function dm(E){return this.__data__.has(E)}vr.prototype.add=vr.prototype.push=Wr,vr.prototype.has=dm;function Mn(E){var T=this.__data__=new yt(E);this.size=T.size}function pm(){this.__data__=new yt,this.size=0}function fm(E){var T=this.__data__,z=T.delete(E);return this.size=T.size,z}function hm(E){return this.__data__.get(E)}function mm(E){return this.__data__.has(E)}function gm(E,T){var z=this.__data__;if(z instanceof yt){var oe=z.__data__;if(!Yt||oe.length<n-1)return oe.push([E,T]),this.size=++z.size,this;z=this.__data__=new pn(oe)}return z.set(E,T),this.size=z.size,this}Mn.prototype.clear=pm,Mn.prototype.delete=fm,Mn.prototype.get=hm,Mn.prototype.has=mm,Mn.prototype.set=gm;function ym(E,T){var z=qi(E),oe=!z&&Am(E),qe=!z&&!oe&&ts(E),ve=!z&&!oe&&!qe&&Zl(E),Je=z||oe||qe||ve,lt=Je?We(E.length,String):[],mt=lt.length;for(var He in E)ce.call(E,He)&&!(Je&&(He=="length"||qe&&(He=="offset"||He=="parent")||ve&&(He=="buffer"||He=="byteLength"||He=="byteOffset")||Em(He,mt)))&&lt.push(He);return lt}function Bi(E,T){for(var z=E.length;z--;)if(Ql(E[z][0],T))return z;return-1}function vm(E,T,z){var oe=T(E);return qi(E)?oe:Fe(oe,z(E))}function Qr(E){return E==null?E===void 0?A:x:Et&&Et in Object(E)?Om(E):Rm(E)}function Kl(E){return Gr(E)&&Qr(E)==a}function Hl(E,T,z,oe,qe){return E===T?!0:E==null||T==null||!Gr(E)&&!Gr(T)?E!==E&&T!==T:bm(E,T,z,oe,Hl,qe)}function bm(E,T,z,oe,qe,ve){var Je=qi(E),lt=qi(T),mt=Je?l:Dn(E),He=lt?l:Dn(T);mt=mt==a?g:mt,He=He==a?g:He;var Pt=mt==g,en=He==g,vt=mt==He;if(vt&&ts(E)){if(!ts(T))return!1;Je=!0,Pt=!1}if(vt&&!Pt)return ve||(ve=new Mn),Je||Zl(E)?Jl(E,T,z,oe,qe,ve):Cm(E,T,mt,z,oe,qe,ve);if(!(z&i)){var zt=Pt&&ce.call(E,"__wrapped__"),Kt=en&&ce.call(T,"__wrapped__");if(zt||Kt){var Ln=zt?E.value():E,In=Kt?T.value():T;return ve||(ve=new Mn),qe(Ln,In,z,oe,ve)}}return vt?(ve||(ve=new Mn),Sm(E,T,z,oe,qe,ve)):!1}function wm(E){if(!Yl(E)||Tm(E))return!1;var T=Gl(E)?pt:S;return T.test(Yn(E))}function xm(E){return Gr(E)&&Xl(E.length)&&!!V[Qr(E)]}function Im(E){if(!km(E))return Pn(E);var T=[];for(var z in Object(E))ce.call(E,z)&&z!="constructor"&&T.push(z);return T}function Jl(E,T,z,oe,qe,ve){var Je=z&i,lt=E.length,mt=T.length;if(lt!=mt&&!(Je&&mt>lt))return!1;var He=ve.get(E);if(He&&ve.get(T))return He==T;var Pt=-1,en=!0,vt=z&o?new vr:void 0;for(ve.set(E,T),ve.set(T,E);++Pt<lt;){var zt=E[Pt],Kt=T[Pt];if(oe)var Ln=Je?oe(Kt,zt,Pt,T,E,ve):oe(zt,Kt,Pt,E,T,ve);if(Ln!==void 0){if(Ln)continue;en=!1;break}if(vt){if(!Ae(T,function(In,Zn){if(!tt(vt,Zn)&&(zt===In||qe(zt,In,z,oe,ve)))return vt.push(Zn)})){en=!1;break}}else if(!(zt===Kt||qe(zt,Kt,z,oe,ve))){en=!1;break}}return ve.delete(E),ve.delete(T),en}function Cm(E,T,z,oe,qe,ve,Je){switch(z){case L:if(E.byteLength!=T.byteLength||E.byteOffset!=T.byteOffset)return!1;E=E.buffer,T=T.buffer;case j:return!(E.byteLength!=T.byteLength||!ve(new Oe(E),new Oe(T)));case u:case p:case y:return Ql(+E,+T);case h:return E.name==T.name&&E.message==T.message;case O:case R:return E==T+"";case v:var lt=at;case _:var mt=oe&i;if(lt||(lt=dt),E.size!=T.size&&!mt)return!1;var He=Je.get(E);if(He)return He==T;oe|=o,Je.set(E,T);var Pt=Jl(lt(E),lt(T),oe,qe,ve,Je);return Je.delete(E),Pt;case k:if(Se)return Se.call(E)==Se.call(T)}return!1}function Sm(E,T,z,oe,qe,ve){var Je=z&i,lt=Wl(E),mt=lt.length,He=Wl(T),Pt=He.length;if(mt!=Pt&&!Je)return!1;for(var en=mt;en--;){var vt=lt[en];if(!(Je?vt in T:ce.call(T,vt)))return!1}var zt=ve.get(E);if(zt&&ve.get(T))return zt==T;var Kt=!0;ve.set(E,T),ve.set(T,E);for(var Ln=Je;++en<mt;){vt=lt[en];var In=E[vt],Zn=T[vt];if(oe)var ec=Je?oe(Zn,In,vt,T,E,ve):oe(In,Zn,vt,E,T,ve);if(!(ec===void 0?In===Zn||qe(In,Zn,z,oe,ve):ec)){Kt=!1;break}Ln||(Ln=vt=="constructor")}if(Kt&&!Ln){var Vi=E.constructor,Ui=T.constructor;Vi!=Ui&&"constructor"in E&&"constructor"in T&&!(typeof Vi=="function"&&Vi instanceof Vi&&typeof Ui=="function"&&Ui instanceof Ui)&&(Kt=!1)}return ve.delete(E),ve.delete(T),Kt}function Wl(E){return vm(E,jm,_m)}function $i(E,T){var z=E.__data__;return Nm(T)?z[typeof T=="string"?"string":"hash"]:z.map}function br(E,T){var z=xe(E,T);return wm(z)?z:void 0}function Om(E){var T=ce.call(E,Et),z=E[Et];try{E[Et]=void 0;var oe=!0}catch{}var qe=Ct.call(E);return oe&&(T?E[Et]=z:delete E[Et]),qe}var _m=An?function(E){return E==null?[]:(E=Object(E),$e(An(E),function(T){return St.call(E,T)}))}:Mm,Dn=Qr;(dn&&Dn(new dn(new ArrayBuffer(1)))!=L||Yt&&Dn(new Yt)!=v||jn&&Dn(jn.resolve())!=b||ze&&Dn(new ze)!=_||nt&&Dn(new nt)!=F)&&(Dn=function(E){var T=Qr(E),z=T==g?E.constructor:void 0,oe=z?Yn(z):"";if(oe)switch(oe){case Ce:return L;case Ot:return v;case xn:return b;case te:return _;case pe:return F}return T});function Em(E,T){return T=T??s,!!T&&(typeof E=="number"||U.test(E))&&E>-1&&E%1==0&&E<T}function Nm(E){var T=typeof E;return T=="string"||T=="number"||T=="symbol"||T=="boolean"?E!=="__proto__":E===null}function Tm(E){return!!Ue&&Ue in E}function km(E){var T=E&&E.constructor,z=typeof T=="function"&&T.prototype||K;return E===z}function Rm(E){return Ct.call(E)}function Yn(E){if(E!=null){try{return re.call(E)}catch{}try{return E+""}catch{}}return""}function Ql(E,T){return E===T||E!==E&&T!==T}var Am=Kl((function(){return arguments})())?Kl:function(E){return Gr(E)&&ce.call(E,"callee")&&!St.call(E,"callee")},qi=Array.isArray;function Fm(E){return E!=null&&Xl(E.length)&&!Gl(E)}var ts=Fn||Dm;function Pm(E,T){return Hl(E,T)}function Gl(E){if(!Yl(E))return!1;var T=Qr(E);return T==f||T==m||T==c||T==I}function Xl(E){return typeof E=="number"&&E>-1&&E%1==0&&E<=s}function Yl(E){var T=typeof E;return E!=null&&(T=="object"||T=="function")}function Gr(E){return E!=null&&typeof E=="object"}var Zl=Z?et(Z):xm;function jm(E){return Fm(E)?ym(E):Im(E)}function Mm(){return[]}function Dm(){return!1}e.exports=Pm})(si,si.exports)),si.exports}var rI=nI();const Wd=$r(rI),Ye=async(e,t)=>{if(e instanceof Oa){const{status:n,statusText:r}=e.response;console.error(n===500?"Internal Server Error (500):":n===400?"Bad Request (400):":`Error (${n}):`,r);try{const o=await e.response.clone().json(),s=o?.causes?.join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),w=require("react");require("react-dom");function Lm(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 J=Lm(w),Bm="https://api.withampersand.com/v1".replace(/\/+$/,"");class Sa{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Bm}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||ud}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 qm=new Sa,Ro=class Ro{constructor(t=qm){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 Um(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?Ro.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 Oa(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(c=>i[c]===void 0?delete i[c]:{});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})},l={...a,body:Vm(a.body)||a.body instanceof URLSearchParams||$m(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:l}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Ro.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let mn=Ro;function $m(e){return typeof Blob<"u"&&e instanceof Blob}function Vm(e){return typeof FormData<"u"&&e instanceof FormData}class Oa extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Um extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ae extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function N(e,t){const n=e[t];return n!=null}function ud(e,t=""){return Object.keys(e).map(n=>dd(n,e[n],t)).filter(n=>n.length>0).join("&")}function dd(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 dd(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?ud(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Ge(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Ve{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Nr{constructor(t){this.raw=t}async value(){}}class nc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function zm(e){return Km(e)}function Km(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function Hm(e){return Jm(e)}function Jm(e,t){return e==null?e:{attachmentType:e.attachmentType,header:N(e,"header")?zm(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Wm(e){return Qm(e)}function Qm(e,t){return e==null?e:{fieldUsed:N(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:N(e,"keyFormat")?e.keyFormat:void 0}}function Gm(e){return Xm(e)}function Xm(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function Ym(e){return Zm(e)}function Zm(e,t){return e==null?e:{name:e.name}}function eg(e){return tg(e)}function tg(e,t){return e==null?e:{attachmentType:e.attachmentType,query:N(e,"query")?Ym(e.query):void 0,header:N(e,"header")?Gm(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function ng(e){return rg(e)}function rg(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,includeFullRecords:N(e,"includeFullRecords")?e.includeFullRecords:void 0}}function ig(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function og(e){return sg(e)}function sg(e,t){return e==null?e:{url:e.url,method:N(e,"method")?e.method:void 0,successStatusCodes:N(e,"successStatusCodes")?e.successStatusCodes:void 0}}const rc={ApiKey:"apiKey",Basic:"basic"};function ag(e){return lg(e)}function lg(e,t){return e}function cg(e){return ug(e)}function ug(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function dg(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function pd(e){return pg(e)}function pg(e,t){return e==null?e:{defaultPeriod:cg(e.defaultPeriod)}}function fg(e){if(e!==void 0)return e===null?null:{defaultPeriod:dg(e.defaultPeriod)}}function hg(e){return mg(e)}function mg(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function gg(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function fd(e){return yg(e)}function yg(e,t){return e==null?e:{fieldName:e.fieldName,operator:e.operator,value:N(e,"value")?e.value:void 0}}function _a(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,operator:e.operator,value:e.value}}function vg(e){return bg(e)}function bg(e,t){return e==null?e:{defaultPeriod:hg(e.defaultPeriod),filter:N(e,"filter")?e.filter.map(fd):void 0}}function hd(e){if(e!==void 0)return e===null?null:{defaultPeriod:gg(e.defaultPeriod),filter:e.filter===void 0?void 0:e.filter.map(_a)}}function wg(e){return xg(e)}function xg(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function md(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Ig(e){return Cg(e)}function Cg(e,t){return e==null?e:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function Sg(e){if(e!==void 0)return e===null?null:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function Og(e){return _g(e)}function _g(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,prompt:N(e,"prompt")?e.prompt:void 0,mappedValues:N(e,"mappedValues")?e.mappedValues.map(Ig):void 0,fieldName:N(e,"fieldName")?e.fieldName:void 0}}function gd(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,prompt:e.prompt,mappedValues:e.mappedValues===void 0?void 0:e.mappedValues.map(Sg),fieldName:e.fieldName}}function Eg(e){return Ng(e)}function Ng(e,t){return e}function Tg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,disabled:e.disabled,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(gd),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:hd(e.backfill),filter:e.filter===void 0?void 0:e.filter.map(_a)}}function kg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ge(e.objects,Tg)}}function Rg(e){return Ag(e)}function Ag(e,t){return e==null?e:{enabled:e.enabled}}function yd(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fg(e){return Pg(e)}function Pg(e,t){return e==null?e:{stringValue:N(e,"stringValue")?e.stringValue:void 0,integerValue:N(e,"integerValue")?e.integerValue:void 0,booleanValue:N(e,"booleanValue")?e.booleanValue:void 0}}function jg(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const Mg={Always:"always",Never:"never"},Dg={Always:"always",Never:"never",IfEmpty:"ifEmpty"};function Lg(e){return Bg(e)}function Bg(e,t){return e==null?e:{default:N(e,"default")?Fg(e.default):void 0,writeOnCreate:N(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:N(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function vd(e){if(e!==void 0)return e===null?null:{default:jg(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function qg(e){let t=!0;return t=t&&"value"in e,t}function $g(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Vg(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Ug(e){let t=!0;return t=t&&"value"in e,t}function zg(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Kg(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Hg(e){let t=!0;return t=t&&"value"in e,t}function Jg(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Wg(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Qg(e){return Gg(e)}function Gg(e,t){return e==null?e:{...$g(e),...zg(e),...Jg(e)}}function bd(e){if(e!==void 0)return e===null?null:qg(e)?Vg(e):Ug(e)?Kg(e):Hg(e)?Wg(e):{}}function Xg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,deletionSettings:yd(e.deletionSettings),selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Ge(e.selectedValueDefaults,bd),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Ge(e.selectedFieldSettings,vd)}}function Yg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ge(e.objects,Xg)}}function Zg(e){return ey(e)}function ey(e,t){return e==null?e:{enabled:e.enabled}}function ty(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ny(e){return ry(e)}function ry(e,t){return e==null?e:{enabled:e.enabled}}function iy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function oy(e){return sy(e)}function sy(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:N(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:N(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function ay(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function ly(e){return cy(e)}function cy(e,t){return e==null?e:{apiKeyAsBasic:N(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:N(e,"apiKeyAsBasicOpts")?Wm(e.apiKeyAsBasicOpts):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function uy(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Ui(e){return dy(e)}function dy(e,t){return e==null?e:{supported:e.supported,defaultRecordLimit:N(e,"defaultRecordLimit")?e.defaultRecordLimit:void 0,objectRecordLimits:N(e,"objectRecordLimits")?e.objectRecordLimits:void 0}}function py(e){return fy(e)}function fy(e,t){return e==null?e:{_delete:Ui(e.delete),create:Ui(e.create),update:Ui(e.update),upsert:Ui(e.upsert)}}function hy(e){return my(e)}function my(e,t){return e==null?e:{value:e.value}}function gy(e){return yy(e)}function yy(e,t){return e==null?e:{brandingRemoval:N(e,"brandingRemoval")?hy(e.brandingRemoval):void 0}}function zi(e){return vy(e)}function vy(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:N(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:N(e,"entitlements")?gy(e.entitlements):void 0}}function by(e){return wy(e)}function wy(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function xy(e){return Iy(e)}function Iy(e,t){return e==null?e:{objectName:e.objectName,schedule:N(e,"schedule")?e.schedule:void 0,disabled:N(e,"disabled")?e.disabled:void 0,destination:N(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:N(e,"selectedValueMappings")?e.selectedValueMappings:void 0,dynamicMappingsInput:N(e,"dynamicMappingsInput")?e.dynamicMappingsInput.map(Og):void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:N(e,"selectedFieldsAuto")?Eg(e.selectedFieldsAuto):void 0,backfill:N(e,"backfill")?vg(e.backfill):void 0,filter:N(e,"filter")?e.filter.map(fd):void 0}}function Cy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,disabled:e.disabled,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(gd),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:hd(e.backfill),filter:e.filter===void 0?void 0:e.filter.map(_a)}}function Sy(e){return Oy(e)}function Oy(e,t){return e==null?e:{objects:Ge(e.objects,xy)}}function _y(e){if(e!==void 0)return e===null?null:{objects:Ge(e.objects,Cy)}}function Ey(e){return Ny(e)}function Ny(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:N(e,"createEvent")?Zg(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?oy(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?ny(e.deleteEvent):void 0,otherEvents:N(e,"otherEvents")?e.otherEvents:void 0}}function Ty(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:ty(e.createEvent),updateEvent:ay(e.updateEvent),deleteEvent:iy(e.deleteEvent),otherEvents:e.otherEvents}}function ky(e){return Ry(e)}function Ry(e,t){return e==null?e:{objects:Ge(e.objects,Ey)}}function Ay(e){if(e!==void 0)return e===null?null:{objects:Ge(e.objects,Ty)}}function Fy(e){return Py(e)}function Py(e,t){return e==null?e:{objectName:e.objectName,deletionSettings:N(e,"deletionSettings")?Rg(e.deletionSettings):void 0,selectedValueDefaults:N(e,"selectedValueDefaults")?Ge(e.selectedValueDefaults,Qg):void 0,selectedFieldSettings:N(e,"selectedFieldSettings")?Ge(e.selectedFieldSettings,Lg):void 0}}function jy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,deletionSettings:yd(e.deletionSettings),selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Ge(e.selectedValueDefaults,bd),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Ge(e.selectedFieldSettings,vd)}}function My(e){return Dy(e)}function Dy(e,t){return e==null?e:{objects:N(e,"objects")?Ge(e.objects,Fy):void 0}}function Ly(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ge(e.objects,jy)}}function By(e){return qy(e)}function qy(e,t){return e==null?e:{provider:e.provider,read:N(e,"read")?Sy(e.read):void 0,write:N(e,"write")?My(e.write):void 0,proxy:N(e,"proxy")?wg(e.proxy):void 0,subscribe:N(e,"subscribe")?ky(e.subscribe):void 0}}function $y(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:_y(e.read),write:Ly(e.write),proxy:md(e.proxy),subscribe:Ay(e.subscribe)}}function Vy(e){return Uy(e)}function Uy(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:By(e.content)}}function zy(e){return Ky(e)}function Ky(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function wd(e){return Hy(e)}function Hy(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function Jy(e){return Wy(e)}function Wy(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Qy(e){return Gy(e)}function Gy(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Xy(e){return Yy(e)}function Yy(e,t){return e==null?e:{accessToken:N(e,"accessToken")?Jy(e.accessToken):void 0,refreshToken:N(e,"refreshToken")?Qy(e.refreshToken):void 0,scopes:N(e,"scopes")?e.scopes:void 0}}function oo(e){return Zy(e)}function Zy(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:N(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:N(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function ev(e){return tv(e)}function tv(e,t){return e==null?e:{value:e.value,source:e.source,displayName:N(e,"displayName")?e.displayName:void 0}}function Ea(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function oi(e){return nv(e)}function nv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:N(e,"providerApp")?oo(e.providerApp):void 0,group:wd(e.group),consumer:zy(e.consumer),providerWorkspaceRef:N(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:N(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:N(e,"oauth2AuthorizationCode")?Xy(e.oauth2AuthorizationCode):void 0,apiKey:N(e,"apiKey")?e.apiKey:void 0,providerMetadata:N(e,"providerMetadata")?Ge(e.providerMetadata,ev):void 0}}function xd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Id(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Cd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function rv(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function iv(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function Sd(e){if(e!==void 0)return e===null?null:{accessToken:rv(e.accessToken),refreshToken:iv(e.refreshToken),scopes:e.scopes}}function ov(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ge(e.providerMetadata,Ea),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:xd(e.basicAuth),oauth2ClientCredentials:Id(e.oauth2ClientCredentials),oauth2PasswordCredentials:Cd(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Sd(e.oauth2AuthorizationCode)}}function sv(e){return av(e)}function av(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function lv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function cv(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:$y(e.content)}}function uv(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:cv(e.config)}}function dv(e){return pv(e)}function pv(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,useModule:N(e,"useModule")?e.useModule:void 0}}function fv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function hv(e){return mv(e)}function mv(e,t){return e==null?e:{mode:N(e,"mode")?e.mode:void 0,pageSize:N(e,"pageSize")?e.pageSize:void 0}}function gv(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function yv(e){let t=!0;return t=t&&"fieldName"in e,t}function vv(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function bv(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function wv(e){let t=!0;return t=t&&"mapToName"in e,t}function Od(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:N(e,"default")?e.default:void 0,prompt:N(e,"prompt")?e.prompt:void 0}}function xv(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function ic(e){return Iv(e)}function Iv(e,t){return e==null?e:{...vv(e),...Od(e)}}function oc(e){if(e!==void 0)return e===null?null:yv(e)?bv(e):wv(e)?xv(e):{}}function _d(e){return Cv(e)}function Cv(e,t){return e}function Sv(e){return Ov(e)}function Ov(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:N(e,"requiredFields")?e.requiredFields.map(ic):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(ic):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?_d(e.optionalFieldsAuto):void 0,backfill:N(e,"backfill")?pd(e.backfill):void 0,delivery:N(e,"delivery")?hv(e.delivery):void 0,enabled:N(e,"enabled")?e.enabled:void 0}}function _v(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(oc),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(oc),optionalFieldsAuto:e.optionalFieldsAuto,backfill:fg(e.backfill),delivery:gv(e.delivery),enabled:e.enabled}}function Ev(e){return Nv(e)}function Nv(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Sv):void 0}}function Tv(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(_v)}}function kv(e){return Rv(e)}function Rv(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Av(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fv(e){return Pv(e)}function Pv(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,watchFieldsAuto:N(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:N(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function jv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Mv(e){return Dv(e)}function Dv(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:N(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:N(e,"createEvent")?sv(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?Fv(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?kv(e.deleteEvent):void 0,associationChangeEvent:N(e,"associationChangeEvent")?ng(e.associationChangeEvent):void 0,otherEvents:N(e,"otherEvents")?e.otherEvents:void 0}}function Lv(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:lv(e.createEvent),updateEvent:jv(e.updateEvent),deleteEvent:Av(e.deleteEvent),associationChangeEvent:ig(e.associationChangeEvent),otherEvents:e.otherEvents}}function Bv(e){return qv(e)}function qv(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Mv):void 0}}function $v(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Lv)}}function Ed(e){return Vv(e)}function Vv(e,t){return e==null?e:{allowAnyFields:N(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Uv(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function zv(e){return Kv(e)}function Kv(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:N(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:N(e,"valueDefaults")?Ed(e.valueDefaults):void 0}}function Hv(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Uv(e.valueDefaults)}}function Jv(e){return Wv(e)}function Wv(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(zv):void 0}}function Qv(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Hv)}}function Gv(e){return Xv(e)}function Xv(e,t){return e==null?e:{enabled:e.enabled}}function Yv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Zv(e){return eb(e)}function eb(e,t){return e==null?e:{enabled:e.enabled}}function tb(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function nb(e){return rb(e)}function rb(e,t){return e==null?e:{enabled:e.enabled}}function ib(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ob(e){return sb(e)}function sb(e,t){return e==null?e:{fieldCreated:N(e,"fieldCreated")?Zv(e.fieldCreated):void 0,fieldDeleted:N(e,"fieldDeleted")?nb(e.fieldDeleted):void 0,fieldChanged:N(e,"fieldChanged")?Gv(e.fieldChanged):void 0}}function ab(e){if(e!==void 0)return e===null?null:{fieldCreated:tb(e.fieldCreated),fieldDeleted:ib(e.fieldDeleted),fieldChanged:Yv(e.fieldChanged)}}function lb(e){return cb(e)}function cb(e,t){return e==null?e:{destination:e.destination,schedule:N(e,"schedule")?e.schedule:void 0,allObjects:ob(e.allObjects)}}function ub(e){if(e!==void 0)return e===null?null:{destination:e.destination,schedule:e.schedule,allObjects:ab(e.allObjects)}}function db(e){return pb(e)}function pb(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:N(e,"displayName")?e.displayName:void 0,module:N(e,"module")?e.module:void 0,read:N(e,"read")?Ev(e.read):void 0,write:N(e,"write")?Jv(e.write):void 0,proxy:N(e,"proxy")?dv(e.proxy):void 0,subscribe:N(e,"subscribe")?Bv(e.subscribe):void 0,watchSchema:N(e,"watchSchema")?lb(e.watchSchema):void 0}}function fb(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:Tv(e.read),write:Qv(e.write),proxy:fv(e.proxy),subscribe:$v(e.subscribe),watchSchema:ub(e.watchSchema)}}function hb(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:fb(e.content)}}function mb(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:hb(e.latestRevision)}}function gb(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function yb(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 vb(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function bb(e){return wb(e)}function wb(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function xb(e){return Ib(e)}function Ib(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:N(e,"prompt")?e.prompt:void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Cb(e){return Sb(e)}function Sb(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Ob(e){return _b(e)}function _b(e,t){return e==null?e:{headers:N(e,"headers")?e.headers.map(bb):void 0,queryParams:N(e,"queryParams")?e.queryParams.map(Cb):void 0,inputs:N(e,"inputs")?e.inputs.map(xb):void 0}}function Eb(e){return Nb(e)}function Nb(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Tb(e){return kb(e)}function kb(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:N(e,"valueType")?e.valueType:void 0,providerType:N(e,"providerType")?e.providerType:void 0,readOnly:N(e,"readOnly")?e.readOnly:void 0,isCustom:N(e,"isCustom")?e.isCustom:void 0,isRequired:N(e,"isRequired")?e.isRequired:void 0,values:N(e,"values")?e.values.map(Eb):void 0}}function Rb(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ge(e.providerMetadata,Ea),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:xd(e.basicAuth),oauth2ClientCredentials:Id(e.oauth2ClientCredentials),oauth2PasswordCredentials:Cd(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Sd(e.oauth2AuthorizationCode)}}function Ab(e){return Fb(e)}function Fb(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,useModule:N(e,"useModule")?e.useModule:void 0}}function Pb(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function ns(e){return jb(e)}function jb(e,t){return e==null?e:{...Pb(e),...Od(e)}}function Mb(e){return Db(e)}function Db(e,t){return e==null?e:{error:N(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:N(e,"requiredFields")?e.requiredFields.map(ns):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(ns):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?_d(e.optionalFieldsAuto):void 0,allFieldsMetadata:N(e,"allFieldsMetadata")?Ge(e.allFieldsMetadata,Tb):void 0,allFields:N(e,"allFields")?e.allFields.map(ns):void 0,backfill:N(e,"backfill")?pd(e.backfill):void 0}}function Lb(e){return Bb(e)}function Bb(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Mb):void 0}}function qb(e){return $b(e)}function $b(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:N(e,"valueDefaults")?Ed(e.valueDefaults):void 0}}function Vb(e){return Ub(e)}function Ub(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(qb):void 0}}function zb(e){return Kb(e)}function Kb(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,module:N(e,"module")?e.module:void 0,provider:e.provider,read:N(e,"read")?Lb(e.read):void 0,write:N(e,"write")?Vb(e.write):void 0,proxy:N(e,"proxy")?Ab(e.proxy):void 0}}function Hb(e){return Jb(e)}function Jb(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:zb(e.content)}}function wr(e){return Wb(e)}function Wb(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:N(e,"group")?wd(e.group):void 0,healthStatus:e.healthStatus,lastOperationStatus:N(e,"lastOperationStatus")?e.lastOperationStatus:void 0,connection:oi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,config:Vy(e.config)}}function Qb(e){return Gb(e)}function Gb(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:db(e.content)}}function rs(e){return Xb(e)}function Xb(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Qb(e.latestRevision)}}function Yb(e){if(e!==void 0)return e===null?null:{op:e.op,path:e.path,value:e.value}}function Zb(e){return ew(e)}function ew(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function tw(e){return nw(e)}function nw(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function rw(e){return iw(e)}function iw(e,t){return e==null?e:{regular:N(e,"regular")?tw(e.regular):void 0,darkMode:N(e,"darkMode")?Zb(e.darkMode):void 0}}function ow(e){return sw(e)}function sw(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,prompt:N(e,"prompt")?e.prompt:void 0,defaultValue:N(e,"defaultValue")?e.defaultValue:void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function aw(e){return lw(e)}function lw(e,t){return e==null?e:{name:e.name,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function cw(e){return uw(e)}function uw(e,t){return e==null?e:{equals:e.equals}}function dw(e){return pw(e)}function pw(e,t){return e==null?e:{operators:cw(e.operators)}}function fw(e){return hw(e)}function hw(e,t){return e==null?e:{create:N(e,"create")?e.create:void 0,update:N(e,"update")?e.update:void 0,_delete:N(e,"delete")?e.delete:void 0,passThrough:N(e,"passThrough")?e.passThrough:void 0}}function Nd(e){return mw(e)}function mw(e,t){return e==null?e:{bulkWrite:by(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,_delete:e.delete,subscribeSupport:N(e,"subscribeSupport")?fw(e.subscribeSupport):void 0,batchWrite:N(e,"batchWrite")?py(e.batchWrite):void 0,search:dw(e.search)}}function gw(e){return yw(e)}function yw(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Nd(e.support)}}function vw(e){return bw(e)}function bw(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:N(e,"capture")?e.capture:void 0}}function ww(e){return xw(e)}function xw(e,t){return e==null?e:{workspaceRefField:N(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:N(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:N(e,"scopesField")?e.scopesField:void 0,otherFields:N(e,"otherFields")?e.otherFields.map(vw):void 0}}const is={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function Iw(e){return Cw(e)}function Cw(e,t){return e==null?e:{grantType:e.grantType,authURL:N(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:N(e,"audience")?e.audience:void 0,scopeMappings:N(e,"scopeMappings")?e.scopeMappings:void 0,tokenMetadataFields:ww(e.tokenMetadataFields),docsURL:N(e,"docsURL")?e.docsURL:void 0,authURLParams:N(e,"authURLParams")?e.authURLParams:void 0,accessTokenOpts:N(e,"accessTokenOpts")?Hm(e.accessTokenOpts):void 0}}function Sw(e){if(e!==void 0)return e===null?null:{projectId:e.projectId,provider:e.provider,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ge(e.providerMetadata,Ea),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function Ow(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,action:e.action,changes:e.changes.map(Yb),installationId:e.installationId}}function _w(e){return Ew(e)}function Ew(e,t){return e==null?e:{input:N(e,"input")?e.input.map(ow):void 0,postAuthentication:N(e,"postAuthentication")?e.postAuthentication.map(aw):void 0}}function Nw(e){return Tw(e)}function Tw(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function sc(e){return kw(e)}function kw(e,t){return e==null?e:{name:e.name,authType:ag(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:N(e,"oauth2Opts")?Iw(e.oauth2Opts):void 0,apiKeyOpts:N(e,"apiKeyOpts")?eg(e.apiKeyOpts):void 0,basicOpts:N(e,"basicOpts")?ly(e.basicOpts):void 0,customOpts:N(e,"customOpts")?Ob(e.customOpts):void 0,support:Nd(e.support),providerOpts:e.providerOpts,authHealthCheck:N(e,"authHealthCheck")?og(e.authHealthCheck):void 0,displayName:N(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:N(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:N(e,"media")?rw(e.media):void 0,labels:N(e,"labels")?e.labels:void 0,subscribeOpts:N(e,"subscribeOpts")?Nw(e.subscribeOpts):void 0,modules:N(e,"modules")?Ge(e.modules,gw):void 0,metadata:N(e,"metadata")?_w(e.metadata):void 0}}function Rw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:ov(e.connection)}}function Aw(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:kg(e.read),write:Yg(e.write),proxy:md(e.proxy)}}function Fw(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Aw(e.content)}}function Pw(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Fw(e.config)}}function jw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Pw(e.installation)}}function Mw(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function Dw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Mw(e.project)}}function Lw(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 Bw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Lw(e.providerApp)}}class qw extends mn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Nr(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Rb(t.generateConnectionParams)},n);return new Ve(o,s=>oi(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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Ve(o,s=>oi(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 ae("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={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ve(o,s=>s.map(oi))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}async updateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ae("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:i,query:r,body:Rw(t.updateConnectionRequest)},n);return new Ve(o,s=>oi(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class $w extends mn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ae("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:uv(t.installation)},n);return new Ve(o,s=>wr(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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ae("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Nr(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ae("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Ve(o,s=>wr(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Ve(o,s=>s.map(wr))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async listInstallationsForProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallationsForProject.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ve(o,s=>s.map(wr))}async listInstallationsForProject(t,n){return await(await this.listInstallationsForProjectRaw(t,n)).value()}async patchObjectConfigContentRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling patchObjectConfigContent.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling patchObjectConfigContent.");if(t.objectName===null||t.objectName===void 0)throw new ae("objectName","Required parameter requestParameters.objectName was null or undefined when calling patchObjectConfigContent.");if(t.patchObjectConfigContent===null||t.patchObjectConfigContent===void 0)throw new ae("patchObjectConfigContent","Required parameter requestParameters.patchObjectConfigContent was null or undefined when calling patchObjectConfigContent.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/objects/{objectName}/config-content".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{objectName}",encodeURIComponent(String(t.objectName))),method:"PATCH",headers:i,query:r,body:Ow(t.patchObjectConfigContent)},n);return new Ve(o,s=>wr(s))}async patchObjectConfigContent(t,n){return await(await this.patchObjectConfigContentRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ae("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ae("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:jw(t.installationUpdate)},n);return new Ve(o,s=>wr(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Vw extends mn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ae("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={};t.destructive!==void 0&&(r.destructive=t.destructive);const i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:uy(t.batchUpsertIntegrationsRequest)},n);return new Ve(o,s=>s.map(rs))}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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ae("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:mb(t.integration)},n);return new Nr(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Nr(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new ae("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getIntegration.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationIdOrName}".replace("{integrationIdOrName}",encodeURIComponent(String(t.integrationIdOrName))).replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ve(o,s=>rs(s))}async getIntegration(t,n){return await(await this.getIntegrationRaw(t,n)).value()}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ve(o,s=>s.map(rs))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Uw extends mn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ae("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:Sw(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new Ve(o):new nc(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:i,query:r},n);return this.isJsonMime(o.headers.get("content-type"))?new Ve(o):new nc(o)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class zw extends mn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ae("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:gb(t.project)},n);return new Ve(o,s=>zi(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ve(o,s=>zi(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const o=this.configuration.accessToken,s=await o("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Ve(i,o=>o.map(zi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ae("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:Dw(t.projectUpdate)},n);return new Ve(o,s=>zi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Kw extends mn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ae("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new Ve(o,s=>sc(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const o=this.configuration.accessToken,s=await o("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Ve(i,o=>Ge(o,sc))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Hw extends mn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ae("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:yb(t.providerApp)},n);return new Ve(o,s=>oo(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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ae("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Nr(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Ve(o,s=>s.map(oo))}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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ae("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ae("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:Bw(t.providerAppUpdate)},n);return new Ve(o,s=>oo(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Jw extends mn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ae("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={};t.destructive!==void 0&&(r.destructive=t.destructive);const i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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:vb(t.revision)},n);return new Nr(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ae("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}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 Ve(o,s=>Hb(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var Lr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ww={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Qw=class{#e=Ww;#t=!1;setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&this.#t&&e!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:e}),this.#e=e,process.env.NODE_ENV!=="production"&&(this.#t=!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},rr=new Qw;function Gw(e){setTimeout(e,0)}var sr=typeof window>"u"||"Deno"in globalThis;function _t(){}function Xw(e,t){return typeof e=="function"?e(t):e}function Bs(e){return typeof e=="number"&&e>=0&&e!==1/0}function Td(e,t){return Math.max(e+(t||0)-Date.now(),0)}function $n(e,t){return typeof e=="function"?e(t):e}function Wt(e,t){return typeof e=="function"?e(t):e}function ac(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Na(s,t.options))return!1}else if(!hi(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||o&&!o(t))}function lc(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(ar(t.options.mutationKey)!==ar(o))return!1}else if(!hi(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Na(e,t){return(t?.queryKeyHashFn||ar)(e)}function ar(e){return JSON.stringify(e,(t,n)=>$s(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function hi(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>hi(e[n],t[n])):!1}var Yw=Object.prototype.hasOwnProperty;function qs(e,t){if(e===t)return e;const n=cc(e)&&cc(t);if(!n&&!($s(e)&&$s(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),s=o.length,a=n?new Array(s):{};let l=0;for(let c=0;c<s;c++){const u=n?c:o[c],p=e[u],h=t[u];if(p===h){a[u]=p,(n?c<i:Yw.call(e,u))&&l++;continue}if(p===null||h===null||typeof p!="object"||typeof h!="object"){a[u]=h;continue}const f=qs(p,h);a[u]=f,f===p&&l++}return i===s&&l===i?e:a}function po(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function cc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function $s(e){if(!uc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!uc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function uc(e){return Object.prototype.toString.call(e)==="[object Object]"}function Zw(e){return new Promise(t=>{rr.setTimeout(t,e)})}function Vs(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return qs(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return qs(e,t)}return t}function ex(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function tx(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var fo=Symbol();function kd(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===fo&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===fo?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Rd(e,t){return typeof e=="function"?e(...t):!!e}var nx=class extends Lr{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!sr&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Ta=new nx;function Us(){let e,t;const n=new Promise((i,o)=>{e=i,t=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var rx=Gw;function ix(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=rx;const o=a=>{t?e.push(a):i(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{o(()=>{a(...l)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var it=ix(),ox=class extends Lr{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!sr&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},ho=new ox;function sx(e){return Math.min(1e3*2**e,3e4)}function Ad(e){return(e??"online")==="online"?ho.isOnline():!0}var zs=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Fd(e){let t=!1,n=0,r;const i=Us(),o=()=>i.status!=="pending",s=m=>{if(!o()){const g=new zs(m);h(g),e.onCancel?.(g)}},a=()=>{t=!0},l=()=>{t=!1},c=()=>Ta.isFocused()&&(e.networkMode==="always"||ho.isOnline())&&e.canRun(),u=()=>Ad(e.networkMode)&&e.canRun(),p=m=>{o()||(r?.(),i.resolve(m))},h=m=>{o()||(r?.(),i.reject(m))},f=()=>new Promise(m=>{r=g=>{(o()||c())&&m(g)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),y=()=>{if(o())return;let m;const g=n===0?e.initialPromise:void 0;try{m=g??e.fn()}catch(x){m=Promise.reject(x)}Promise.resolve(m).then(p).catch(x=>{if(o())return;const b=e.retry??(sr?0:3),v=e.retryDelay??sx,I=typeof v=="function"?v(n,x):v,O=b===!0||typeof b=="number"&&n<b||typeof b=="function"&&b(n,x);if(t||!O){h(x);return}n++,e.onFail?.(n,x),Zw(I).then(()=>c()?void 0:f()).then(()=>{t?h(x):y()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r?.(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?y():f().then(y),i)}}var Pd=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Bs(this.gcTime)&&(this.#e=rr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(sr?1/0:300*1e3))}clearGcTimeout(){this.#e&&(rr.clearTimeout(this.#e),this.#e=void 0)}},ax=class extends Pd{#e;#t;#n;#i;#r;#s;#a;constructor(e){super(),this.#a=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#n=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=dc(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#s,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=dc(this.options);t.data!==void 0&&(this.setData(t.data,{updatedAt:t.dataUpdatedAt,manual:!0}),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=Vs(this.state.data,e,this.options);return this.#o({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#o({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(_t).catch(_t):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Wt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===fo||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>$n(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Td(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#a?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const a=this.observers.find(l=>l.options.queryFn);a&&this.setOptions(a.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,r=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#a=!0,n.signal)})},i=()=>{const a=kd(this.options,t),c=(()=>{const u={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(u),u})();return this.#a=!1,this.options.persister?this.options.persister(a,c,this):a(c)},s=(()=>{const a={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(a),a})();this.options.behavior?.onFetch(s,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&this.#o({type:"fetch",meta:s.fetchOptions?.meta}),this.#r=Fd({initialPromise:t?.initialPromise,fn:s.fetchFn,onCancel:a=>{a instanceof zs&&a.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(a,l)=>{this.#o({type:"failed",failureCount:a,error:l})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0});try{const a=await this.#r.start();if(a===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(a),this.#n.config.onSuccess?.(a,this),this.#n.config.onSettled?.(a,this.state.error,this),a}catch(a){if(a instanceof zs){if(a.silent)return this.#r.promise;if(a.revert){if(this.state.data===void 0)throw a;return this.state.data}}throw this.#o({type:"error",error:a}),this.#n.config.onError?.(a,this),this.#n.config.onSettled?.(this.state.data,a,this),a}finally{this.scheduleGc()}}#o(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...jd(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?r:void 0,r;case"error":const i=e.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),it.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function jd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ad(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function dc(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var lx=class extends Lr{constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.#a=Us(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#i=void 0;#r;#s;#a;#o;#m;#p;#f;#c;#u;#l;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),pc(this.#t,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ks(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ks(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#x(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Wt(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#I(),this.#t.setOptions(this.options),t._defaulted&&!po(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&fc(this.#t,n,this.options,t)&&this.#d(),this.updateResult(),r&&(this.#t!==n||Wt(this.options.enabled,this.#t)!==Wt(t.enabled,this.#t)||$n(this.options.staleTime,this.#t)!==$n(t.staleTime,this.#t))&&this.#g();const i=this.#y();r&&(this.#t!==n||Wt(this.options.enabled,this.#t)!==Wt(t.enabled,this.#t)||i!==this.#l)&&this.#v(i)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ux(this,n)&&(this.#i=n,this.#s=this.options,this.#r=this.#t.state),n}getCurrentResult(){return this.#i}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#d(e){this.#I();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(_t)),t}#g(){this.#w();const e=$n(this.options.staleTime,this.#t);if(sr||this.#i.isStale||!Bs(e))return;const n=Td(this.#i.dataUpdatedAt,e)+1;this.#c=rr.setTimeout(()=>{this.#i.isStale||this.updateResult()},n)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#l=e,!(sr||Wt(this.options.enabled,this.#t)===!1||!Bs(this.#l)||this.#l===0)&&(this.#u=rr.setInterval(()=>{(this.options.refetchIntervalInBackground||Ta.isFocused())&&this.#d()},this.#l))}#b(){this.#g(),this.#v(this.#y())}#w(){this.#c&&(rr.clearTimeout(this.#c),this.#c=void 0)}#x(){this.#u&&(rr.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#t,r=this.options,i=this.#i,o=this.#r,s=this.#s,l=e!==n?e.state:this.#n,{state:c}=e;let u={...c},p=!1,h;if(t._optimisticResults){const T=this.hasListeners(),A=!T&&pc(e,t),F=T&&fc(e,n,t,r);(A||F)&&(u={...u,...jd(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:y,status:m}=u;h=u.data;let g=!1;if(t.placeholderData!==void 0&&h===void 0&&m==="pending"){let T;i?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(T=i.data,g=!0):T=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,T!==void 0&&(m="success",h=Vs(i?.data,T,t),p=!0)}if(t.select&&h!==void 0&&!g)if(i&&h===o?.data&&t.select===this.#m)h=this.#p;else try{this.#m=t.select,h=t.select(h),h=Vs(i?.data,h,t),this.#p=h,this.#o=null}catch(T){this.#o=T}this.#o&&(f=this.#o,h=this.#p,y=Date.now(),m="error");const x=u.fetchStatus==="fetching",b=m==="pending",v=m==="error",I=b&&x,O=h!==void 0,R={status:m,fetchStatus:u.fetchStatus,isPending:b,isSuccess:m==="success",isError:v,isInitialLoading:I,isLoading:I,data:h,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:y,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:x,isRefetching:x&&!b,isLoadingError:v&&!O,isPaused:u.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:v&&O,isStale:ka(e,t),refetch:this.refetch,promise:this.#a,isEnabled:Wt(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const T=j=>{R.status==="error"?j.reject(R.error):R.data!==void 0&&j.resolve(R.data)},A=()=>{const j=this.#a=R.promise=Us();T(j)},F=this.#a;switch(F.status){case"pending":e.queryHash===n.queryHash&&T(F);break;case"fulfilled":(R.status==="error"||R.data!==F.value)&&A();break;case"rejected":(R.status!=="error"||R.error!==F.reason)&&A();break}}return R}updateResult(){const e=this.#i,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#s=this.options,this.#r.data!==void 0&&(this.#f=this.#t),po(t,e))return;this.#i=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#h.size)return!0;const o=new Set(i??this.#h);return this.options.throwOnError&&o.add("error"),Object.keys(this.#i).some(s=>{const a=s;return this.#i[a]!==e[a]&&o.has(a)})};this.#C({listeners:n()})}#I(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#C(e){it.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function cx(e,t){return Wt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function pc(e,t){return cx(e,t)||e.state.data!==void 0&&Ks(e,t,t.refetchOnMount)}function Ks(e,t,n){if(Wt(t.enabled,e)!==!1&&$n(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ka(e,t)}return!1}function fc(e,t,n,r){return(e!==t||Wt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ka(e,n)}function ka(e,t){return Wt(t.enabled,e)!==!1&&e.isStaleByTime($n(t.staleTime,e))}function ux(e,t){return!po(e.getCurrentResult(),t)}function hc(e){return{onFetch:(t,n)=>{const r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let u=!1;const p=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},h=kd(t.options,t.fetchOptions),f=async(y,m,g)=>{if(u)return Promise.reject();if(m==null&&y.pages.length)return Promise.resolve(y);const b=(()=>{const E={client:t.client,queryKey:t.queryKey,pageParam:m,direction:g?"backward":"forward",meta:t.options.meta};return p(E),E})(),v=await h(b),{maxPages:I}=t.options,O=g?tx:ex;return{pages:O(y.pages,v,I),pageParams:O(y.pageParams,m,I)}};if(i&&o.length){const y=i==="backward",m=y?dx:mc,g={pages:o,pageParams:s},x=m(r,g);a=await f(g,x,y)}else{const y=e??o.length;do{const m=l===0?s[0]??r.initialPageParam:mc(r,a);if(l>0&&m==null)break;a=await f(a,m),l++}while(l<y)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=c}}}function mc(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function dx(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var px=class extends Pd{#e;#t;#n;#i;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Md(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=Fd({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,s)=>{this.#r({type:"failed",failureCount:o,error:s})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",i=!this.#i.canStart();try{if(r)t();else{this.#r({type:"pending",variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,n);const s=await this.options.onMutate?.(e,n);s!==this.state.context&&this.#r({type:"pending",context:s,variables:e,isPaused:i})}const o=await this.#i.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#r({type:"success",data:o}),o}catch(o){try{throw await this.#n.config.onError?.(o,e,this.state.context,this,n),await this.options.onError?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,o,e,this.state.context,n),o}finally{this.#r({type:"error",error:o})}}finally{this.#n.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),it.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function Md(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var fx=class extends Lr{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new px({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Ki(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Ki(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Ki(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(i=>i.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Ki(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){it.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>lc(t,n))}findAll(e={}){return this.getAll().filter(t=>lc(e,t))}notify(e){it.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return it.batch(()=>Promise.all(e.map(t=>t.continue().catch(_t))))}};function Ki(e){return e.options.scope?.id}var hx=class extends Lr{#e;#t=void 0;#n;#i;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),po(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&ar(n.mutationKey)!==ar(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#s(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#s()}mutate(t,n){return this.#i=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){const t=this.#n?.state??Md();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#s(t){it.batch(()=>{if(this.#i&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};t?.type==="success"?(this.#i.onSuccess?.(t.data,n,r,i),this.#i.onSettled?.(t.data,null,n,r,i)):t?.type==="error"&&(this.#i.onError?.(t.error,n,r,i),this.#i.onSettled?.(void 0,t.error,n,r,i))}this.listeners.forEach(n=>{n(this.#t)})})}},mx=class extends Lr{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,i=t.queryHash??Na(r,t);let o=this.get(i);return o||(o=new ax({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){it.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>ac(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>ac(e,n)):t}notify(e){it.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){it.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){it.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},gx=class{#e;#t;#n;#i;#r;#s;#a;#o;constructor(e={}){this.#e=e.queryCache||new mx,this.#t=e.mutationCache||new fx,this.#n=e.defaultOptions||{},this.#i=new Map,this.#r=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#a=Ta.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=ho.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime($n(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=this.#e.get(r.queryHash)?.state.data,s=Xw(t,o);if(s!==void 0)return this.#e.build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return it.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;it.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return it.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=it.batch(()=>this.#e.findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(_t).catch(_t)}invalidateQueries(e,t={}){return it.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=it.batch(()=>this.#e.findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(_t)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(_t)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime($n(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_t).catch(_t)}fetchInfiniteQuery(e){return e.behavior=hc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_t).catch(_t)}ensureInfiniteQueryData(e){return e.behavior=hc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ho.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#i.set(ar(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{hi(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(ar(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{hi(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Na(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===fo&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Dd=J.createContext(void 0),Ze=e=>{const t=J.useContext(Dd);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},yx=({client:e,children:t})=>(J.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),d.jsx(Dd.Provider,{value:e,children:t})),Ld=J.createContext(!1),vx=()=>J.useContext(Ld);Ld.Provider;function bx(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var wx=J.createContext(bx()),xx=()=>J.useContext(wx),Ix=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Cx=e=>{J.useEffect(()=>{e.clearReset()},[e])},Sx=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Rd(n,[e.error,r])),Ox=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},_x=(e,t)=>e.isLoading&&e.isFetching&&!t,Ex=(e,t)=>e?.suspense&&t.isPending,gc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Nx(e,t,n){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=vx(),i=xx(),o=Ze(),s=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=r?"isRestoring":"optimistic",Ox(s),Ix(s,i),Cx(i);const a=!o.getQueryCache().get(s.queryHash),[l]=J.useState(()=>new t(o,s)),c=l.getOptimisticResult(s),u=!r&&e.subscribed!==!1;if(J.useSyncExternalStore(J.useCallback(p=>{const h=u?l.subscribe(it.batchCalls(p)):_t;return l.updateResult(),h},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),J.useEffect(()=>{l.setOptions(s)},[s,l]),Ex(s,c))throw gc(s,l,i);if(Sx({result:c,errorResetBoundary:i,throwOnError:s.throwOnError,query:o.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw c.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(s,c),s.experimental_prefetchInRender&&!sr&&_x(c,r)&&(a?gc(s,l,i):o.getQueryCache().get(s.queryHash)?.promise)?.catch(_t).finally(()=>{l.updateResult()}),s.notifyOnChangeProps?c:l.trackResult(c)}function pr(e,t){return Nx(e,lx)}function Nn(e,t){const n=Ze(),[r]=J.useState(()=>new hx(n,e));J.useEffect(()=>{r.setOptions(e)},[r,e]);const i=J.useSyncExternalStore(J.useCallback(s=>r.subscribe(it.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=J.useCallback((s,a)=>{r.mutate(s,a).catch(_t)},[r]);if(i.error&&Rd(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}const Bd=w.createContext(null),Tx=Bd.Provider,qd=()=>w.useContext(Bd);var Ie=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e.VALUE_MAPPING="valueMappingError",e))(Ie||{});const $d=w.createContext(void 0);function vn(){const e=w.useContext($d);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const kx=(()=>{const e={};return Object.values(Ie).forEach(t=>{e[t]={}}),e})();function Rx({children:e}){const[t,n]=w.useState(kx),r=w.useCallback((u,p,h=!0)=>{n(f=>{const y={...f};return y[u]=y[u]||{},y[u][p]=h,y})},[n]),i=w.useCallback((u,p)=>!!t[u]?.[p],[t]),o=w.useCallback((u,p)=>t[u]?.[p],[t]),s=w.useCallback((u,p)=>{n(h=>{const f={...h};return delete f[u]?.[p],f})},[n]),a=w.useCallback(u=>{n(p=>{const h={...p};return h[u]={},h})},[n]),l=w.useCallback((u,p)=>{n(h=>{const f={...h};return f[u]=f[u]||{},p.forEach(y=>{f[u][y]=!0}),f})},[n]),c=w.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:a,setErrors:l,getError:o}),[t,n,r,i,s,a,l,o]);return d.jsx($d.Provider,{value:c,children:e})}new TextEncoder;const Hs=new TextDecoder;function Ax(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function Fx(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:Hs.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=Hs.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return Ax(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class Px extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(t,n){super(t,n),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class er extends Px{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}function jx(e){return typeof e=="object"&&e!==null}const Mx=e=>{if(!jx(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t};function Dx(e){if(typeof e!="string")throw new er("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new er("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new er("Invalid JWT");if(!t)throw new er("JWTs must contain a payload");let r;try{r=Fx(t)}catch{throw new er("Failed to base64url decode the payload")}let i;try{i=JSON.parse(Hs.decode(r))}catch{throw new er("Failed to parse the decoded payload as JSON")}if(!Mx(i))throw new er("Invalid JWT Claims Set");return i}const Js="amp-labs_jwt_",Lx=600*1e3,yc=(e,t)=>`${e}:${t}`,vc=e=>`${Js}${e}`,Vd=w.createContext(null),Bx=e=>{try{const t=Dx(e);return t.exp&&typeof t.exp=="number"?t.exp*1e3:null}catch(t){return console.warn("Failed to decode JWT token:",t),null}};function qx({getTokenCallback:e,children:t}){const[n,r]=w.useState(new Map);w.useEffect(()=>{try{const l=new Map,c=Date.now();Object.keys(sessionStorage).forEach(u=>{if(u.startsWith(Js)){const p=u.replace(Js,""),h=sessionStorage.getItem(u);if(h)try{const f=JSON.parse(h);f.expiresAt>c?l.set(p,f):sessionStorage.removeItem(u)}catch{sessionStorage.removeItem(u)}}}),l.size>0&&r(l)}catch{console.warn("Failed to load JWT tokens from sessionStorage")}},[]);const i=w.useCallback((l,c)=>{const u=yc(l,c),p=Date.now(),h=n.get(u);if(h&&h.expiresAt>p)return h.token;n.delete(u);const f=vc(u),y=sessionStorage.getItem(f);if(y)try{const m=JSON.parse(y);if(m.expiresAt>p)return r(g=>new Map(g).set(u,m)),m.token;sessionStorage.removeItem(f)}catch{sessionStorage.removeItem(f)}return null},[n]),o=w.useCallback(async(l,c,u)=>{const p=yc(l,c),f=await Bx(u)||Date.now()+Lx,y={token:u,expiresAt:f};r(m=>new Map(m).set(p,y));try{sessionStorage.setItem(vc(p),JSON.stringify(y))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=w.useCallback(async({consumerRef:l,groupRef:c})=>{const u=i(l,c);if(u)return u;if(!e)throw new Error("JWT token callback not provided");try{const p=await e({consumerRef:l,groupRef:c});return await o(l,c,p),p}catch(p){throw console.error("Failed to get JWT token:",p),new Error("Failed to get JWT token")}},[e,i,o]),a={getToken:e?s:void 0};return d.jsx(Vd.Provider,{value:a,children:t})}const $x=()=>{const e=w.useContext(Vd);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},Ra=w.createContext(null);function He(){const e=w.useContext(Ra);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
2
+ component is wrapped with AmpersandProvider`);return e}const Vx=new gx({defaultOptions:{queries:{retry:(e,t)=>{if(t instanceof Oa){const n=t.response.status;if(n>=400&&n<500)return!1}return e<3}}}});function Ux(e){const{options:{apiKey:t,projectId:n,project:r,getToken:i},children:o}=e,s=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!s)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t&&!i)throw new Error("Cannot use AmpersandProvider without an apiKey or getToken.");if(t&&i)throw new Error("Cannot use AmpersandProvider with both apiKey and getToken.");const a={options:e.options,projectIdOrName:s};return d.jsx(yx,{client:Vx,children:d.jsx(Ra.Provider,{value:a,children:d.jsx(Rx,{children:d.jsx(qx,{getTokenCallback:i||null,children:d.jsx(Tx,{value:t||null,children:o})})})})})}var Ud=Symbol.for("immer-nothing"),bc=Symbol.for("immer-draftable"),Bt=Symbol.for("immer-state"),zx=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Rt(e,...t){if(process.env.NODE_ENV!=="production"){const n=zx[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 mi=Object.getPrototypeOf;function Tr(e){return!!e&&!!e[Bt]}function lr(e){return e?zd(e)||Array.isArray(e)||!!e[bc]||!!e.constructor?.[bc]||Ii(e)||Fo(e):!1}var Kx=Object.prototype.constructor.toString(),wc=new WeakMap;function zd(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=wc.get(n);return r===void 0&&(r=Function.toString.call(n),wc.set(n,r)),r===Kx}function mo(e,t,n=!0){Ao(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Ao(e){const t=e[Bt];return t?t.type_:Array.isArray(e)?1:Ii(e)?2:Fo(e)?3:0}function Ws(e,t){return Ao(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Kd(e,t,n){const r=Ao(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Hx(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ii(e){return e instanceof Map}function Fo(e){return e instanceof Set}function nr(e){return e.copy_||e.base_}function Qs(e,t){if(Ii(e))return new Map(e);if(Fo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=zd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Bt];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(mi(e),r)}else{const r=mi(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function Aa(e,t=!1){return Po(e)||Tr(e)||!lr(e)||(Ao(e)>1&&Object.defineProperties(e,{set:Hi,add:Hi,clear:Hi,delete:Hi}),Object.freeze(e),t&&Object.values(e).forEach(n=>Aa(n,!0))),e}function Jx(){Rt(2)}var Hi={value:Jx};function Po(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Wx={};function cr(e){const t=Wx[e];return t||Rt(0,e),t}var gi;function Hd(){return gi}function Qx(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function xc(e,t){t&&(cr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Gs(e){Xs(e),e.drafts_.forEach(Gx),e.drafts_=null}function Xs(e){e===gi&&(gi=e.parent_)}function Ic(e){return gi=Qx(gi,e)}function Gx(e){const t=e[Bt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Cc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Bt].modified_&&(Gs(t),Rt(4)),lr(e)&&(e=go(t,e),t.parent_||yo(t,e)),t.patches_&&cr("Patches").generateReplacementPatches_(n[Bt].base_,e,t.patches_,t.inversePatches_)):e=go(t,n,[]),Gs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ud?e:void 0}function go(e,t,n){if(Po(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[Bt];if(!i)return mo(t,(o,s)=>Sc(e,i,t,o,s,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return yo(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const o=i.copy_;let s=o,a=!1;i.type_===3&&(s=new Set(o),o.clear(),a=!0),mo(s,(l,c)=>Sc(e,i,o,l,c,n,a),r),yo(e,o,!1),n&&e.patches_&&cr("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Sc(e,t,n,r,i,o,s){if(i==null||typeof i!="object"&&!s)return;const a=Po(i);if(!(a&&!s)){if(process.env.NODE_ENV!=="production"&&i===n&&Rt(5),Tr(i)){const l=o&&t&&t.type_!==3&&!Ws(t.assigned_,r)?o.concat(r):void 0,c=go(e,i,l);if(Kd(n,r,c),Tr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(lr(i)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&a)return;go(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Ii(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&yo(e,i)}}}function yo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Aa(t,n)}function Xx(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Hd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=Fa;n&&(i=[r],o=yi);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var Fa={get(e,t){if(t===Bt)return e;const n=nr(e);if(!Ws(n,t))return Yx(e,n,t);const r=n[t];return e.finalized_||!lr(r)?r:r===os(e.base_,t)?(ss(e),e.copy_[t]=Zs(r,e)):r},has(e,t){return t in nr(e)},ownKeys(e){return Reflect.ownKeys(nr(e))},set(e,t,n){const r=Jd(nr(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=os(nr(e),t),o=i?.[Bt];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Hx(n,i)&&(n!==void 0||Ws(e.base_,t)))return!0;ss(e),Ys(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 os(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ss(e),Ys(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=nr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Rt(11)},getPrototypeOf(e){return mi(e.base_)},setPrototypeOf(){Rt(12)}},yi={};mo(Fa,(e,t)=>{yi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});yi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Rt(13),yi.set.call(this,e,t,void 0)};yi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Rt(14),Fa.set.call(this,e[0],t,n,e[0])};function os(e,t){const n=e[Bt];return(n?nr(n):e)[t]}function Yx(e,t,n){const r=Jd(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function Jd(e,t){if(!(t in e))return;let n=mi(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=mi(n)}}function Ys(e){e.modified_||(e.modified_=!0,e.parent_&&Ys(e.parent_))}function ss(e){e.copy_||(e.copy_=Qs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Zx=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const s=this;return function(l=o,...c){return s.produce(l,u=>n.call(this,u,...c))}}typeof n!="function"&&Rt(6),r!==void 0&&typeof r!="function"&&Rt(7);let i;if(lr(t)){const o=Ic(this),s=Zs(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?Gs(o):Xs(o)}return xc(o,r),Cc(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Ud&&(i=void 0),this.autoFreeze_&&Aa(i,!0),r){const o=[],s=[];cr("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else Rt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,l=>t(l,...a));let r,i;return[this.produce(t,n,(s,a)=>{r=s,i=a}),r,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){lr(e)||Rt(8),Tr(e)&&(e=eI(e));const t=Ic(this),n=Zs(e,void 0);return n[Bt].isManual_=!0,Xs(t),n}finishDraft(e,t){const n=e&&e[Bt];(!n||!n.isManual_)&&Rt(9);const{scope_:r}=n;return xc(r,t),Cc(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}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=cr("Patches").applyPatches_;return Tr(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Zs(e,t){const n=Ii(e)?cr("MapSet").proxyMap_(e,t):Fo(e)?cr("MapSet").proxySet_(e,t):Xx(e,t);return(t?t.scope_:Hd()).drafts_.push(n),n}function eI(e){return Tr(e)||Rt(10,e),Wd(e)}function Wd(e){if(!lr(e)||Po(e))return e;const t=e[Bt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Qs(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Qs(e,!0);return mo(n,(i,o)=>{Kd(n,i,Wd(o))},r),t&&(t.finalized_=!1),n}var tI=new Zx,ct=tI.produce,qn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Br(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var si={exports:{}};si.exports;var Oc;function nI(){return Oc||(Oc=1,(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,a="[object Arguments]",l="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",p="[object Date]",h="[object Error]",f="[object Function]",y="[object GeneratorFunction]",m="[object Map]",g="[object Number]",x="[object Null]",b="[object Object]",v="[object Promise]",I="[object Proxy]",O="[object RegExp]",E="[object Set]",R="[object String]",T="[object Symbol]",A="[object Undefined]",F="[object WeakMap]",j="[object ArrayBuffer]",L="[object DataView]",H="[object Float32Array]",P="[object Float64Array]",B="[object Int8Array]",X="[object Int16Array]",le="[object Int32Array]",fe="[object Uint8Array]",ge="[object Uint8ClampedArray]",C="[object Uint16Array]",W="[object Uint32Array]",q=/[\\^$.*+?()[\]{}|]/g,S=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,V={};V[H]=V[P]=V[B]=V[X]=V[le]=V[fe]=V[ge]=V[C]=V[W]=!0,V[a]=V[l]=V[j]=V[u]=V[L]=V[p]=V[h]=V[f]=V[m]=V[g]=V[b]=V[O]=V[E]=V[R]=V[F]=!1;var Y=typeof qn=="object"&&qn&&qn.Object===Object&&qn,ie=typeof self=="object"&&self&&self.Object===Object&&self,ne=Y||ie||Function("return this")(),se=t&&!t.nodeType&&t,ee=se&&!0&&e&&!e.nodeType&&e,me=ee&&ee.exports===se,$=me&&Y.process,ye=(function(){try{return $&&$.binding&&$.binding("util")}catch{}})(),Z=ye&&ye.isTypedArray;function qe(_,k){for(var z=-1,oe=_==null?0:_.length,$e=0,ve=[];++z<oe;){var We=_[z];k(We,z,_)&&(ve[$e++]=We)}return ve}function Fe(_,k){for(var z=-1,oe=k.length,$e=_.length;++z<oe;)_[$e+z]=k[z];return _}function Ae(_,k){for(var z=-1,oe=_==null?0:_.length;++z<oe;)if(k(_[z],z,_))return!0;return!1}function Qe(_,k){for(var z=-1,oe=Array(_);++z<_;)oe[z]=k(z);return oe}function et(_){return function(k){return _(k)}}function tt(_,k){return _.has(k)}function xe(_,k){return _?.[k]}function at(_){var k=-1,z=Array(_.size);return _.forEach(function(oe,$e){z[++k]=[$e,oe]}),z}function It(_,k){return function(z){return _(k(z))}}function dt(_){var k=-1,z=Array(_.size);return _.forEach(function(oe){z[++k]=oe}),z}var Xe=Array.prototype,D=Function.prototype,K=Object.prototype,M=ne["__core-js_shared__"],re=D.toString,ce=K.hasOwnProperty,Ue=(function(){var _=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||"");return _?"Symbol(src)_1."+_:""})(),Ct=K.toString,pt=RegExp("^"+re.call(ce).replace(q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),gt=me?ne.Buffer:void 0,Pe=ne.Symbol,Oe=ne.Uint8Array,St=K.propertyIsEnumerable,ft=Xe.splice,Et=Pe?Pe.toStringTag:void 0,An=Object.getOwnPropertySymbols,Fn=gt?gt.isBuffer:void 0,Pn=It(Object.keys,Object),dn=br(ne,"DataView"),Zt=br(ne,"Map"),jn=br(ne,"Promise"),ze=br(ne,"Set"),nt=br(ne,"WeakMap"),de=br(Object,"create"),Ce=Yn(dn),Ot=Yn(Zt),xn=Yn(jn),te=Yn(ze),pe=Yn(nt),ue=Pe?Pe.prototype:void 0,Se=ue?ue.valueOf:void 0;function je(_){var k=-1,z=_==null?0:_.length;for(this.clear();++k<z;){var oe=_[k];this.set(oe[0],oe[1])}}function Vt(){this.__data__=de?de(null):{},this.size=0}function Ut(_){var k=this.has(_)&&delete this.__data__[_];return this.size-=k?1:0,k}function ht(_){var k=this.__data__;if(de){var z=k[_];return z===r?void 0:z}return ce.call(k,_)?k[_]:void 0}function Nt(_){var k=this.__data__;return de?k[_]!==void 0:ce.call(k,_)}function Me(_,k){var z=this.__data__;return this.size+=this.has(_)?0:1,z[_]=de&&k===void 0?r:k,this}je.prototype.clear=Vt,je.prototype.delete=Ut,je.prototype.get=ht,je.prototype.has=Nt,je.prototype.set=Me;function yt(_){var k=-1,z=_==null?0:_.length;for(this.clear();++k<z;){var oe=_[k];this.set(oe[0],oe[1])}}function Zo(){this.__data__=[],this.size=0}function es(_){var k=this.__data__,z=Li(k,_);if(z<0)return!1;var oe=k.length-1;return z==oe?k.pop():ft.call(k,z,1),--this.size,!0}function Pi(_){var k=this.__data__,z=Li(k,_);return z<0?void 0:k[z][1]}function ji(_){return Li(this.__data__,_)>-1}function Mi(_,k){var z=this.__data__,oe=Li(z,_);return oe<0?(++this.size,z.push([_,k])):z[oe][1]=k,this}yt.prototype.clear=Zo,yt.prototype.delete=es,yt.prototype.get=Pi,yt.prototype.has=ji,yt.prototype.set=Mi;function pn(_){var k=-1,z=_==null?0:_.length;for(this.clear();++k<z;){var oe=_[k];this.set(oe[0],oe[1])}}function Di(){this.size=0,this.__data__={hash:new je,map:new(Zt||yt),string:new je}}function _e(_){var k=Bi(this,_).delete(_);return this.size-=k?1:0,k}function en(_){return Bi(this,_).get(_)}function Hr(_){return Bi(this,_).has(_)}function Xn(_,k){var z=Bi(this,_),oe=z.size;return z.set(_,k),this.size+=z.size==oe?0:1,this}pn.prototype.clear=Di,pn.prototype.delete=_e,pn.prototype.get=en,pn.prototype.has=Hr,pn.prototype.set=Xn;function vr(_){var k=-1,z=_==null?0:_.length;for(this.__data__=new pn;++k<z;)this.add(_[k])}function Jr(_){return this.__data__.set(_,r),this}function dm(_){return this.__data__.has(_)}vr.prototype.add=vr.prototype.push=Jr,vr.prototype.has=dm;function Mn(_){var k=this.__data__=new yt(_);this.size=k.size}function pm(){this.__data__=new yt,this.size=0}function fm(_){var k=this.__data__,z=k.delete(_);return this.size=k.size,z}function hm(_){return this.__data__.get(_)}function mm(_){return this.__data__.has(_)}function gm(_,k){var z=this.__data__;if(z instanceof yt){var oe=z.__data__;if(!Zt||oe.length<n-1)return oe.push([_,k]),this.size=++z.size,this;z=this.__data__=new pn(oe)}return z.set(_,k),this.size=z.size,this}Mn.prototype.clear=pm,Mn.prototype.delete=fm,Mn.prototype.get=hm,Mn.prototype.has=mm,Mn.prototype.set=gm;function ym(_,k){var z=qi(_),oe=!z&&Am(_),$e=!z&&!oe&&ts(_),ve=!z&&!oe&&!$e&&ec(_),We=z||oe||$e||ve,lt=We?Qe(_.length,String):[],mt=lt.length;for(var Je in _)ce.call(_,Je)&&!(We&&(Je=="length"||$e&&(Je=="offset"||Je=="parent")||ve&&(Je=="buffer"||Je=="byteLength"||Je=="byteOffset")||Em(Je,mt)))&&lt.push(Je);return lt}function Li(_,k){for(var z=_.length;z--;)if(Gl(_[z][0],k))return z;return-1}function vm(_,k,z){var oe=k(_);return qi(_)?oe:Fe(oe,z(_))}function Wr(_){return _==null?_===void 0?A:x:Et&&Et in Object(_)?Om(_):Rm(_)}function Hl(_){return Qr(_)&&Wr(_)==a}function Jl(_,k,z,oe,$e){return _===k?!0:_==null||k==null||!Qr(_)&&!Qr(k)?_!==_&&k!==k:bm(_,k,z,oe,Jl,$e)}function bm(_,k,z,oe,$e,ve){var We=qi(_),lt=qi(k),mt=We?l:Dn(_),Je=lt?l:Dn(k);mt=mt==a?b:mt,Je=Je==a?b:Je;var Pt=mt==b,tn=Je==b,vt=mt==Je;if(vt&&ts(_)){if(!ts(k))return!1;We=!0,Pt=!1}if(vt&&!Pt)return ve||(ve=new Mn),We||ec(_)?Wl(_,k,z,oe,$e,ve):Cm(_,k,mt,z,oe,$e,ve);if(!(z&i)){var zt=Pt&&ce.call(_,"__wrapped__"),Kt=tn&&ce.call(k,"__wrapped__");if(zt||Kt){var Ln=zt?_.value():_,In=Kt?k.value():k;return ve||(ve=new Mn),$e(Ln,In,z,oe,ve)}}return vt?(ve||(ve=new Mn),Sm(_,k,z,oe,$e,ve)):!1}function wm(_){if(!Zl(_)||Tm(_))return!1;var k=Xl(_)?pt:S;return k.test(Yn(_))}function xm(_){return Qr(_)&&Yl(_.length)&&!!V[Wr(_)]}function Im(_){if(!km(_))return Pn(_);var k=[];for(var z in Object(_))ce.call(_,z)&&z!="constructor"&&k.push(z);return k}function Wl(_,k,z,oe,$e,ve){var We=z&i,lt=_.length,mt=k.length;if(lt!=mt&&!(We&&mt>lt))return!1;var Je=ve.get(_);if(Je&&ve.get(k))return Je==k;var Pt=-1,tn=!0,vt=z&o?new vr:void 0;for(ve.set(_,k),ve.set(k,_);++Pt<lt;){var zt=_[Pt],Kt=k[Pt];if(oe)var Ln=We?oe(Kt,zt,Pt,k,_,ve):oe(zt,Kt,Pt,_,k,ve);if(Ln!==void 0){if(Ln)continue;tn=!1;break}if(vt){if(!Ae(k,function(In,Zn){if(!tt(vt,Zn)&&(zt===In||$e(zt,In,z,oe,ve)))return vt.push(Zn)})){tn=!1;break}}else if(!(zt===Kt||$e(zt,Kt,z,oe,ve))){tn=!1;break}}return ve.delete(_),ve.delete(k),tn}function Cm(_,k,z,oe,$e,ve,We){switch(z){case L:if(_.byteLength!=k.byteLength||_.byteOffset!=k.byteOffset)return!1;_=_.buffer,k=k.buffer;case j:return!(_.byteLength!=k.byteLength||!ve(new Oe(_),new Oe(k)));case u:case p:case g:return Gl(+_,+k);case h:return _.name==k.name&&_.message==k.message;case O:case R:return _==k+"";case m:var lt=at;case E:var mt=oe&i;if(lt||(lt=dt),_.size!=k.size&&!mt)return!1;var Je=We.get(_);if(Je)return Je==k;oe|=o,We.set(_,k);var Pt=Wl(lt(_),lt(k),oe,$e,ve,We);return We.delete(_),Pt;case T:if(Se)return Se.call(_)==Se.call(k)}return!1}function Sm(_,k,z,oe,$e,ve){var We=z&i,lt=Ql(_),mt=lt.length,Je=Ql(k),Pt=Je.length;if(mt!=Pt&&!We)return!1;for(var tn=mt;tn--;){var vt=lt[tn];if(!(We?vt in k:ce.call(k,vt)))return!1}var zt=ve.get(_);if(zt&&ve.get(k))return zt==k;var Kt=!0;ve.set(_,k),ve.set(k,_);for(var Ln=We;++tn<mt;){vt=lt[tn];var In=_[vt],Zn=k[vt];if(oe)var tc=We?oe(Zn,In,vt,k,_,ve):oe(In,Zn,vt,_,k,ve);if(!(tc===void 0?In===Zn||$e(In,Zn,z,oe,ve):tc)){Kt=!1;break}Ln||(Ln=vt=="constructor")}if(Kt&&!Ln){var $i=_.constructor,Vi=k.constructor;$i!=Vi&&"constructor"in _&&"constructor"in k&&!(typeof $i=="function"&&$i instanceof $i&&typeof Vi=="function"&&Vi instanceof Vi)&&(Kt=!1)}return ve.delete(_),ve.delete(k),Kt}function Ql(_){return vm(_,jm,_m)}function Bi(_,k){var z=_.__data__;return Nm(k)?z[typeof k=="string"?"string":"hash"]:z.map}function br(_,k){var z=xe(_,k);return wm(z)?z:void 0}function Om(_){var k=ce.call(_,Et),z=_[Et];try{_[Et]=void 0;var oe=!0}catch{}var $e=Ct.call(_);return oe&&(k?_[Et]=z:delete _[Et]),$e}var _m=An?function(_){return _==null?[]:(_=Object(_),qe(An(_),function(k){return St.call(_,k)}))}:Mm,Dn=Wr;(dn&&Dn(new dn(new ArrayBuffer(1)))!=L||Zt&&Dn(new Zt)!=m||jn&&Dn(jn.resolve())!=v||ze&&Dn(new ze)!=E||nt&&Dn(new nt)!=F)&&(Dn=function(_){var k=Wr(_),z=k==b?_.constructor:void 0,oe=z?Yn(z):"";if(oe)switch(oe){case Ce:return L;case Ot:return m;case xn:return v;case te:return E;case pe:return F}return k});function Em(_,k){return k=k??s,!!k&&(typeof _=="number"||U.test(_))&&_>-1&&_%1==0&&_<k}function Nm(_){var k=typeof _;return k=="string"||k=="number"||k=="symbol"||k=="boolean"?_!=="__proto__":_===null}function Tm(_){return!!Ue&&Ue in _}function km(_){var k=_&&_.constructor,z=typeof k=="function"&&k.prototype||K;return _===z}function Rm(_){return Ct.call(_)}function Yn(_){if(_!=null){try{return re.call(_)}catch{}try{return _+""}catch{}}return""}function Gl(_,k){return _===k||_!==_&&k!==k}var Am=Hl((function(){return arguments})())?Hl:function(_){return Qr(_)&&ce.call(_,"callee")&&!St.call(_,"callee")},qi=Array.isArray;function Fm(_){return _!=null&&Yl(_.length)&&!Xl(_)}var ts=Fn||Dm;function Pm(_,k){return Jl(_,k)}function Xl(_){if(!Zl(_))return!1;var k=Wr(_);return k==f||k==y||k==c||k==I}function Yl(_){return typeof _=="number"&&_>-1&&_%1==0&&_<=s}function Zl(_){var k=typeof _;return _!=null&&(k=="object"||k=="function")}function Qr(_){return _!=null&&typeof _=="object"}var ec=Z?et(Z):xm;function jm(_){return Fm(_)?ym(_):Im(_)}function Mm(){return[]}function Dm(){return!1}e.exports=Pm})(si,si.exports)),si.exports}var rI=nI();const Qd=Br(rI),Ke=async(e,t)=>{if(e instanceof Oa){const{status:n,statusText:r}=e.response;console.error(n===500?"Internal Server Error (500):":n===400?"Bad Request (400):":`Error (${n}):`,r);try{const o=await e.response.clone().json(),s=o?.causes?.join(`
3
3
  `)||o?.detail;s?(console.error("[Error Message]",s),o?.remedy&&console.error("[Remedy]",o.remedy)):console.error("Unexpected error response:",o);const a=`${s} ${o?.remedy?`
4
4
 
5
- [Remedy] ${o.remedy}`:""}`;t&&t(a)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)};function Si(e,t){const n=wt(e,t),{projectIdOrName:r}=Ke(),{setError:i,removeError:o}=vn(),s=pr({queryKey:["amp","integrations",r],queryFn:async()=>{if(!r)throw new Error("Project ID or name is required");return(await n()).integrationApi.listIntegrations({projectIdOrName:r})},enabled:!!r});return w.useEffect(()=>{s.isError?(Ye(s.error),i(Ie.INTEGRATION_LIST,r)):o(Ie.INTEGRATION_LIST,r)},[s.isError,s.error,r,i,o]),s}const Pa=(e,t,n)=>{const r=wt(t,n),{projectIdOrName:i}=Ke(),{data:o,isError:s,error:a}=Si(t,n),l=o?.find(u=>u.name===e)?.id,c=pr({queryKey:["amp","installations",i,l,t],queryFn:async()=>{if(!i)throw new Error("Project ID is required");if(!l)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await r()).installationApi.listInstallations({projectIdOrName:i,integrationId:l,groupRef:t})},enabled:!s&&!!i&&!!l&&!!t&&!!o&&o.length>0});return{...c,isError:c.isError||s,error:c.error||a}},an=()=>{const{setError:e}=vn(),t=wt(),{projectIdOrName:n}=Ke(),r=pr({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return w.useEffect(()=>{r.isError&&e(Ie.PROJECT,n)},[r.isError,n,e]),{...r,projectIdOrName:n,appName:r.data?.name,projectId:r.data?.id}};function ln(){const{integrationNameOrId:e,groupRef:t}=Jn(),n=Pa(e,t),{isPending:r,isFetching:i,isError:o,isSuccess:s,error:a,data:l}=n;return{installation:l?.[0],isPending:r,isFetching:i,isError:o,isSuccess:s,error:a}}function fr(e){return!e.fieldName}function iI(e){return e?.requiredFields?.filter(t=>!fr(t)&&!!t.fieldName)||null}function ja(e){return e?.optionalFields?.filter(t=>!fr(t)&&!!t.fieldName)||null}function Qd(e){return e?.requiredFields?.filter(n=>fr(n)&&!!n.mapToName)||[]}function Gd(e){return e?.optionalFields?.filter(n=>fr(n)&&!!n.mapToName)||[]}const hr=e=>{const t=Si(),r=t.data?.find(i=>i.name===e||i.id===e);return{...t,data:r,provider:r?.provider}},Ma=()=>{const{groupRef:e,integrationNameOrId:t}=Jn(),{provider:n}=hr(t),r=La({groupRef:e,provider:n}),{isPending:i,isFetching:o,isError:s,isSuccess:a,error:l,data:c}=r;return{connection:c?.[0],error:l,isPending:i,isFetching:o,isError:s,isSuccess:a}},Xd=()=>{const e=wt(),{connection:t,isPending:n,isFetching:r}=Ma(),{projectIdOrName:i}=Ke(),{integrationNameOrId:o}=Jn(),{data:s}=hr(o),a=t?.id,l=s?.id,c=s?.latestRevision?.id;return pr({queryKey:["amp","hydratedRevision",i,l,c,a],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!l)throw new Error("integrationId is required");if(!c)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await e()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:l,revisionId:c,connectionId:a})},enabled:!!i&&!!l&&!!c&&!!a&&!(n||r)})};function Tn(){const e=Xd(),{isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,data:a}=e,l=a?.content,c=w.useMemo(()=>({getReadObjects:()=>l?.read?.objects??[],getReadObject:u=>{const p=l?.read?.objects?.find(m=>m.objectName===u);if(!p)return console.error(`Object ${u} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null,getRequiredMapFields:()=>null,getOptionalMapFields:()=>null};const h=(m="raw")=>m==="mappings"?Qd(p)??[]:m==="no-mappings"?iI(p)??[]:p.requiredFields??[],f=(m="raw")=>m==="mappings"?Gd(p)??[]:m==="no-mappings"?ja(p)??[]:p.optionalFields??[];return{object:p,getRequiredFields:h,getOptionalFields:f,getRequiredMapFields:()=>h("mappings"),getOptionalMapFields:()=>f("mappings")}},getWriteObject:u=>{const p=l?.write?.objects?.find(h=>h.objectName===u);return p?{object:p}:(console.error(`Object ${u} not found`),{object:null})},getCustomerFieldsForObject:u=>{const p=l?.read?.objects?.find(h=>h.objectName===u);return p?{allFields:p.allFieldsMetadata??{},getField:h=>{const f=p.allFieldsMetadata?.[h];return f||(console.error(`Field ${h} not found`),null)}}:(console.error(`Object ${u} not found`),{allFields:null,getField:()=>null})}}),[l?.read?.objects,l?.write?.objects]);return{data:a,isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,...c}}function oI(e){const[t,n]=w.useState(e),r=w.useRef(void 0),{data:i}=Tn(),{installation:o}=ln(),s=w.useCallback(()=>t,[t]),a=w.useCallback((f,m)=>{m.provider=m.provider||i?.content?.provider||"";const v=m.read||{objects:{}},y=v.objects||{},x=y[f]||{};return x.objectName=x.objectName||f,y[f]=x,v.objects=y,m.read=v,{read:v,objects:y,obj:x}},[i?.content?.provider]),l=w.useCallback(f=>{n(m=>ct(m,v=>{v.read?.objects?.[f]&&delete v.read.objects[f],v.write?.objects?.[f]&&delete v.write.objects[f]}))},[]),c=w.useCallback(f=>({object:t.read?.objects?.[f],setEnableRead:()=>{n(m=>ct(m,v=>{const{obj:y}=a(f,v);y.disabled=!1}))},setDisableRead:()=>{n(m=>ct(m,v=>{const{obj:y}=a(f,v);y.disabled=!0}))},getSelectedField:m=>!!t.read?.objects?.[f]?.selectedFields?.[m],setSelectedField:({fieldName:m,selected:v})=>{n(y=>ct(y,x=>{const{obj:g}=a(f,x);g.selectedFields=g.selectedFields||{},g.selectedFields[m]=v,g.selectedFields[m]===!1&&delete g.selectedFields[m]}))},getFieldMapping:m=>t.read?.objects?.[f]?.selectedFieldMappings?.[m],setFieldMapping:({fieldName:m,mapToName:v})=>{n(y=>ct(y,x=>{const{obj:g}=a(f,x);g.selectedFieldMappings=g.selectedFieldMappings||{},g.selectedFieldMappings[v]=m}))},deleteFieldMapping:m=>{n(v=>ct(v,y=>{const x=y.read?.objects?.[f]?.selectedFieldMappings;x&&m in x&&delete x[m]}))}}),[t.read?.objects,a]),u=w.useCallback(f=>{const m=t.write?.objects?.[f],v=g=>{const b=g.write||{},I=b.objects||{},O=I[f]||{objectName:f};return I[f]=O,b.objects=I,g.write=b,{write:b,objects:I,obj:O}},y=(g,b)=>m?.selectedFieldSettings?.[g]?.[b],x=(g,b,I)=>{n(O=>ct(O,_=>{const{obj:R}=v(_);R.selectedFieldSettings={...R.selectedFieldSettings,[g]:{...R.selectedFieldSettings?.[g],[b]:I}}}))};return{object:m,setEnableWrite:()=>{n(g=>ct(g,b=>{const{obj:I}=v(b);I.objectName=f}))},setDisableWrite:()=>{n(g=>ct(g,b=>{const{objects:I}=v(b);delete I[f]}))},getWriteObject:()=>t.write?.objects?.[f],getSelectedFieldSettings:g=>m?.selectedFieldSettings?.[g],setSelectedFieldSettings:({fieldName:g,settings:b})=>{n(I=>ct(I,O=>{const{obj:_}=v(O),R=_.selectedFieldSettings||{};_.selectedFieldSettings={...R,[g]:b},b===void 0&&delete _.selectedFieldSettings[g]}))},getDefaultValues:g=>y(g,"default"),setDefaultValues:({fieldName:g,value:b})=>x(g,"default",b),getWriteOnCreateSetting:g=>y(g,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:g,value:b})=>x(g,"writeOnCreate",b),getWriteOnUpdateSetting:g=>y(g,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:g,value:b})=>x(g,"writeOnUpdate",b),setEnableDeletion:()=>{n(g=>ct(g,b=>{const{obj:I}=v(b);I.deletionSettings={enabled:!0}}))},setDisableDeletion:()=>{n(g=>ct(g,b=>{const{obj:I}=v(b);I.deletionSettings={enabled:!1}}))}}},[t.write?.objects]),p=w.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(f=>ct(f,m=>{m.proxy={enabled:!0}}))},setDisableProxy:()=>{n(f=>ct(f,m=>{m.proxy={enabled:!1}}))},getProxyEnabled:()=>t.proxy?.enabled||!1}),[t.proxy]),h=w.useCallback(()=>{n(f=>ct(f,m=>{Object.assign(m,o?.config?.content)}))},[o?.config?.content]);return w.useEffect(()=>{o&&(console.debug("Installation found",{installation:o}),r.current?Wd(r.current,o)||(console.debug("Installation changed, resetting config",{previous:r.current,current:o}),h(),r.current=o):(r.current=o,h()))},[o,h]),{draft:t,get:s,reset:h,setDraft:n,removeObject:l,readObject:c,writeObject:u,proxy:p}}const Da=w.createContext(null);function sI({children:e,initialConfig:t}){const n=oI(t);return d.jsx(Da.Provider,{value:n,children:e})}function Mo(){const e=w.useContext(Da);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function aI(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=w.useContext(Da);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const Yd=w.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Jn(){const e=w.useContext(Yd);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function Do({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o}){const s=w.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o}),[t,n,r,i,o]);return d.jsx(Yd.Provider,{value:s,children:d.jsx(sI,{initialConfig:{},children:e})})}class ea{constructor(t){this.connectionApi=new $w(t),this.installationApi=new qw(t),this.integrationApi=new Vw(t),this.oAuthApi=new Uw(t),this.projectApi=new zw(t),this.providerApi=new Kw(t),this.providerAppApi=new Hw(t),this.revisionApi=new Jw(t)}}const Zd="2.13.1",lI="v1",Wi="https://api.withampersand.com";function ep(){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 Wi;case"mock":return"http://127.0.0.1:4010";case"":return Wi;default:return e??Wi}}catch{return Wi}}const cI=(e,t)=>`${e}/${t}`;function uI(){return cI(ep(),lI)}const tp=ep(),np=uI(),dI=new Sa({basePath:np,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Zd}});new ea(dI);const pI=e=>({header:"X-Api-Key",value:e}),fI=e=>{try{return{header:"Authorization",value:`Bearer ${e}`}}catch(t){throw console.error("Failed to get JWT token for API authentication:",t),new Error("Failed to authenticate with JWT token")}},Oc=(e,t)=>new Sa({basePath:np,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Zd,[e]:t}});function wt(e,t){const n=Bd(),{getToken:r}=qx(),i=Jn(),o=t||i.consumerRef,s=e||i.groupRef;return w.useCallback(async()=>{if(n){const l=pI(n),c=Oc(l.header,l.value);return new ea(c)}if(r){if(!o||!s)throw console.error("Unable to create JWT API service without consumerRef or groupRef.",{consumerRef:o,groupRef:s}),new Error("Unable to create JWT API service without consumerRef or groupRef. Provide via InstallationProvider or useAPI parameters.");const l=await r({consumerRef:o,groupRef:s}),c=fI(l),u=Oc(c.header,c.value);return new ea(u)}throw console.error("Unable to create API service without API key or JWT token."),new Error("Unable to create API service without API key or JWT token.")},[n,r,o,s])}const La=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Ke(),r=wt();return pr({queryKey:["amp","connections",n,e,t],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!e)throw new Error("Group reference not found.");if(!t)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:n,groupRef:e,provider:t})},retry:3,enabled:!!n&&!!e&&!!t})};function hI({height:e="48",width:t="48"}){return d.jsxs("svg",{width:t,height:e,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.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"}),d.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const mI="_box_1p7c5_1",_c={box:mI};function kn({children:e,className:t,style:n}){return d.jsx("div",{className:t?`${_c.box} ${t}`:_c.box,style:n,children:e})}const gI="_container_1wvzr_1",Ec={container:gI};function qr({children:e,className:t,style:n}){return d.jsx("div",{className:t?`${Ec.container} ${t}`:Ec.container,style:n,children:e})}const yI="_errorBoxContainer_19655_1",vI="_errorBox_19655_1",bI="_errorIconWrapper_19655_23",wI="_errorText_19655_34",ao={errorBoxContainer:yI,errorBox:vI,errorIconWrapper:bI,errorText:wI};function rp({message:e}){return d.jsxs(kn,{className:ao.errorBox,children:[d.jsx("div",{className:ao.errorIconWrapper,children:d.jsx(hI,{width:"20",height:"20"})}),d.jsx("p",{className:ao.errorText,children:e})]})}function ip({message:e,children:t}){return d.jsxs(qr,{className:ao.errorBoxContainer,children:[d.jsx(rp,{message:e}),t]})}const xI="_loader_6ubm6_1",II={loader:xI};function CI(){return d.jsx("span",{className:II.loader})}function vi(){return d.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:d.jsx(CI,{})})}function op({children:e}){return d.jsx(qr,{style:{maxWidth:"55rem"},children:d.jsx(kn,{children:e})})}function mr(){return d.jsx(op,{children:d.jsx(vi,{})})}function ot({message:e,children:t}){return d.jsx(op,{children:d.jsx(ip,{message:e,children:t})})}function Ba(e,t){try{return process.env[e]}catch{return t}}function Xt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function SI(e,t){return t?.displayName??Xt(e)}const OI=e=>e.split(`
6
- `).filter(n=>n.trim()!==""),_I=(e,t)=>t?.length===0||!e?null:t.find(n=>n.name===e)??null;function EI(e){return!e||typeof e!="string"?"id_"+Math.random().toString(36).substr(2,9):e.toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").replace(/^[^a-z]/,"id-").substring(0,50)}const NI=()=>{const[e,t]=w.useState(!1),n=w.useCallback(()=>{t(!0)},[t]),r=w.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},sp=w.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{},resetComponent:()=>{}});function st(){const e=w.useContext(sp);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function ap({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,fieldMapping:c,resetComponent:u}){const{data:p}=Si(),{setError:h,isError:f,removeError:m}=vn(),{isIntegrationDeleted:v,setIntegrationDeleted:y,resetIntegrationDeleted:x}=NI(),g=w.useMemo(()=>_I(t,p||[]),[t,p]),{data:b,isLoading:I,isError:O,error:_}=Pa(t,i),R=b?.[0]||null;w.useEffect(()=>{x()},[t,n,r,i,o,c]),w.useEffect(()=>{g===null&&p?.length&&console.error(`Integration "${t}" not found in integration list`)},[t,g,p]),w.useEffect(()=>{O?(h(Ie.INSTALLATION_LIST,g?.id||""),Ye(_)):m(Ie.INSTALLATION_LIST,g?.id||"")},[O,g,h,m,_]);const k=Ze(),A=w.useCallback(()=>{k.invalidateQueries({queryKey:["amp","installations"]})},[k]),F=w.useCallback(H=>{k.setQueryData(["amp","installations"],[H]),k.invalidateQueries({queryKey:["amp","installations"]})},[k]),j=g?.id||"",L=w.useMemo(()=>({integrationId:g?.id||"",provider:g?.provider||"",integrationObj:g,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:R||void 0,setInstallation:F,resetInstallations:A,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,isIntegrationDeleted:v,setIntegrationDeleted:y,fieldMapping:c,resetComponent:u}),[g,n,r,i,o,R,F,A,s,a,l,v,y,c,u]);if(I)return d.jsx(mr,{});if(g===null)return d.jsx(ot,{message:`Integration "${t}" not found`});if(f(Ie.INSTALLATION_LIST,j)){const H=`Error retrieving installation information for integration "${g?.name||"unknown"}"`;return d.jsx(ot,{message:H})}return d.jsx(sp.Provider,{value:L,children:e})}const lp=w.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),cn=()=>{const e=w.useContext(lp);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function $a({groupRef:e,provider:t,children:n}){const r=Ze(),{setError:i,isError:o}=vn(),{projectIdOrName:s,isLoading:a}=an(),{integrationId:l,groupRef:c}=st(),{provider:u}=hr(l),{data:p,isLoading:h,isError:f,error:m}=La({groupRef:e||c,provider:u||t}),v=p?.[0],y=w.useCallback(b=>{r.setQueryData(["amp","connections"],()=>b),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),x=w.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);w.useEffect(()=>{f?(i(Ie.CONNECTION_LIST,s,!0),Ye(m)):i(Ie.CONNECTION_LIST,s,!1)},[f,i,s,m]);const g=w.useMemo(()=>({connections:p||null,isConnectionsLoading:h,selectedConnection:v||null,setConnections:y,setSelectedConnection:x}),[p,h,v,y,x]);if(h||a)return d.jsx(mr,{});if(s&&o(Ie.PROJECT,s))return d.jsx(ot,{message:`Error loading project ${s}`});if(s&&o(Ie.CONNECTION_LIST,s))return d.jsx(ot,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID or Project Name not found. ConnectionsProvider must be used within AmpersandProvider");return d.jsx(lp.Provider,{value:g,children:n})}const cp=()=>{const e=wt(),t=Ze(),[n,r]=w.useState(null);return{...Nn({mutationKey:["createInstallation"],mutationFn:async o=>(await e()).installationApi.createInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error creating installation"),Ye(o,r)}}),errorMsg:n}};function TI(e){return typeof e.provider=="string"}function kI(e){return TI(e)?{data:e}:{error:new Error("Config must have a provider field for creation")}}function qa(){const{projectIdOrName:e}=Ke(),{groupRef:t,integrationNameOrId:n}=Jn(),{data:r}=hr(n),{connection:i}=Ma(),{installation:o}=ln(),s=Ze(),{mutate:a,isIdle:l,isPending:c,error:u,errorMsg:p}=cp();return{createInstallation:({config:f,onSuccess:m,onError:v,onSettled:y})=>{if(o){const I=new Error("Installation already created. Try updating instead.");v?.(I),y?.();return}if(!r){const I=new Error("No integration found");v?.(I),y?.();return}const x={...f,provider:f.provider||r.provider||""},g=kI(x);if(g.error||!g.data){v?.(g.error||new Error("Invalid configuration data")),y?.();return}const b={projectIdOrName:e,integrationId:r?.id,installation:{groupRef:t,connectionId:i?.id,config:{content:g.data}}};return a(b,{onSuccess:I=>{m?.(I)},onError:I=>{v?.(I)},onSettled:()=>{y?.(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:l,isPending:c,error:u,errorMsg:p}}const up=()=>{const e=wt(),t=Ze(),[n,r]=w.useState(null);return{...Nn({mutationKey:["updateInstallation"],mutationFn:async o=>(await e()).installationApi.updateInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error updating installation"),Ye(o,r)}}),errorMsg:n}};function dp(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=Jn(),{data:n}=hr(t),{installation:r}=ln(),i=Ze(),{mutate:o,isIdle:s,isPending:a,error:l,errorMsg:c}=up();return{updateInstallation:({config:p,onSuccess:h,onError:f,onSettled:m})=>{if(!r){const x=new Error("Installation not created yet. Try creating the installation first.");f?.(x),m?.();return}if(!n){const x=new Error("No integration found");f?.(x),m?.();return}const v=[];if(p?.write?.objects){const x=Object.keys(p.write.objects).length,g=Object.keys(r?.config?.content?.write?.objects||{}).length;(x>0||x===0&&g>0)&&v.push("config.content.write.objects")}if(p?.read?.objects){const x=Object.keys(p.read.objects);v.push(...x.map(g=>`config.content.read.objects.${g}`))}const y={projectIdOrName:e,integrationId:n?.id,installationId:r.id,installationUpdate:{updateMask:v,installation:{config:{content:p}}}};return o(y,{onSuccess:x=>{h?.(x)},onError:x=>{f?.(x)},onSettled:()=>{m?.(),i.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:l,errorMsg:c}}const RI=()=>{const e=wt(),t=Ze(),[n,r]=w.useState(null);return{...Nn({mutationKey:["deleteInstallation"],mutationFn:async o=>(await e()).installationApi.deleteInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error deleting installation"),Ye(o,r)}}),errorMsg:n}};function AI(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=Jn(),{data:n}=hr(t),{installation:r}=ln(),i=Ze(),{mutate:o,isIdle:s,isPending:a,error:l,errorMsg:c}=RI();return{deleteInstallation:({onSuccess:p,onError:h,onSettled:f})=>{if(!r){const m=new Error("Installation not found. Not able to delete installation.");h?.(m),f?.();return}if(!n){const m=new Error("No integration found");h?.(m),f?.();return}return o({projectIdOrName:e,integrationId:n?.id,installationId:r.id},{onSuccess:()=>{p?.()},onError:m=>{h?.(m)},onSettled:()=>{f?.(),i.invalidateQueries({queryKey:["amp","installations"]}),i.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:l,errorMsg:c}}function Va(){const[e,t]=w.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}class Lo extends w.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Ampersand Error Boundary caught an error:",t),console.error("[Error Info]:",n),this.props.onError?.(t,n)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:d.jsx(ot,{message:this.state.error?.message||"Something went wrong. Please try again later."}):this.props.children}}const pp=e=>{const t=wt(),{provider:n}=st(),r=e||n;return pr({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},ut=e=>{const t=pp(e),{data:n}=t,{provider:r}=st(),i=n&&SI(n?.name,n);return{...t,providerName:i,selectedProvider:e||r}};var Qt=(e=>(e[e.Connect=0]="Connect",e[e.SelectObjects=1]="SelectObjects",e[e.ConfigureObjects=2]="ConfigureObjects",e[e.Review=3]="Review",e[e.Success=4]="Success",e))(Qt||{});const FI={0:"Connect",1:"Select Objects",2:"Configure",3:"Review"},Nc=4;function PI(e,t){switch(t.type){case"SET_STEP":return{...e,currentStep:t.step};case"NEXT_STEP":return{...e,currentStep:Math.min(e.currentStep+1,4)};case"PREV_STEP":return{...e,currentStep:Math.max(e.currentStep-1,0)};case"SET_SELECTED_OBJECTS":return{...e,selectedObjects:t.objects,currentObjectIndex:0};case"SET_CURRENT_OBJECT_INDEX":return{...e,currentObjectIndex:t.index};case"NEXT_OBJECT":return{...e,currentObjectIndex:Math.min(e.currentObjectIndex+1,e.selectedObjects.length-1)};case"PREV_OBJECT":return{...e,currentObjectIndex:Math.max(e.currentObjectIndex-1,0)};case"SET_SUBMITTING":return{...e,isSubmitting:t.isSubmitting};case"SET_SUBMISSION_ERROR":return{...e,submissionError:t.error};default:return e}}const jI={currentStep:0,selectedObjects:[],currentObjectIndex:0,isSubmitting:!1,submissionError:null},fp=w.createContext(null);function MI({children:e}){const[t,n]=w.useReducer(PI,jI),r=w.useCallback(y=>n({type:"SET_STEP",step:y}),[]),i=w.useCallback(()=>n({type:"NEXT_STEP"}),[]),o=w.useCallback(()=>n({type:"PREV_STEP"}),[]),s=w.useCallback(y=>n({type:"SET_SELECTED_OBJECTS",objects:y}),[]),a=w.useCallback(()=>n({type:"NEXT_OBJECT"}),[]),l=w.useCallback(()=>n({type:"PREV_OBJECT"}),[]),c=w.useCallback(y=>n({type:"SET_CURRENT_OBJECT_INDEX",index:y}),[]),u=w.useCallback(y=>n({type:"SET_SUBMITTING",isSubmitting:y}),[]),p=w.useCallback(y=>n({type:"SET_SUBMISSION_ERROR",error:y}),[]),h=t.currentObjectIndex===0,f=t.currentObjectIndex===t.selectedObjects.length-1,m=t.selectedObjects[t.currentObjectIndex],v=w.useMemo(()=>({state:t,goToStep:r,nextStep:i,prevStep:o,setSelectedObjects:s,nextObject:a,prevObject:l,setCurrentObjectIndex:c,setSubmitting:u,setSubmissionError:p,isFirstObject:h,isLastObject:f,currentObjectName:m}),[t,r,i,o,s,a,l,c,u,p,h,f,m]);return d.jsx(fp.Provider,{value:v,children:e})}function un(){const e=w.useContext(fp);if(!e)throw new Error("useWizard must be used within a WizardProvider");return e}var as={exports:{}};var Tc;function DI(){return Tc||(Tc=1,(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})()})(as)),as.exports}var LI=DI();const Gt=$r(LI),BI="_button_kwfiu_1",$I="_danger_kwfiu_42",qI="_ghost_kwfiu_47",ls={button:BI,danger:$I,ghost:qI};function je({className:e,style:t,type:n,children:r,variant:i,...o}){const s=Gt(ls.button,{[ls.danger]:i==="danger",[ls.ghost]:i==="ghost",[e||""]:!!e});return d.jsx("button",{type:n,className:s,style:t,...o,children:r})}const VI="_navigation_oq8uj_1",UI="_backButton_oq8uj_10",zI="_nextButton_oq8uj_14",cs={navigation:VI,backButton:UI,nextButton:zI};function bo({onNext:e,onBack:t,nextLabel:n,backLabel:r="Back",nextDisabled:i=!1,showBack:o=!0,showNext:s=!0}){const{state:a,nextStep:l,prevStep:c}=un(),{currentStep:u}=a,p=t||c,h=e||l,f=u===Qt.Connect;return d.jsxs("div",{className:cs.navigation,children:[o&&!f?d.jsx(je,{type:"button",variant:"ghost",className:cs.backButton,onClick:p,children:r}):d.jsx("div",{}),s&&d.jsx(je,{type:"button",className:cs.nextButton,onClick:h,disabled:i,children:n||"Next"})]})}const KI="_input_1ymb7_1",HI="_inputError_1ymb7_27",us={input:KI,inputError:HI};function hp({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?Gt(us.inputError,us.input):us.input;return d.jsx("input",{id:e,type:t,className:Gt(o,n),...i})}function kc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mp(...e){return t=>{let n=!1;const r=e.map(i=>{const o=kc(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():kc(e[i],null)}}}}function Rr(...e){return J.useCallback(mp(...e),e)}function Bo(e,t=[]){let n=[];function r(o,s){const a=J.createContext(s),l=n.length;n=[...n,s];const c=p=>{const{scope:h,children:f,...m}=p,v=h?.[e]?.[l]||a,y=J.useMemo(()=>m,Object.values(m));return d.jsx(v.Provider,{value:y,children:f})};c.displayName=o+"Provider";function u(p,h){const f=h?.[e]?.[l]||a,m=J.useContext(f);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>J.createContext(s));return function(a){const l=a?.[e]||o;return J.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,JI(i,...t)]}function JI(...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:l,scopeName:c})=>{const p=l(o)[`__scope${c}`];return{...a,...p}},{});return J.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function rn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}var bi=globalThis?.document?J.useLayoutEffect:()=>{},WI=J[" useInsertionEffect ".trim().toString()]||bi;function Ua({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,s]=QI({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const u=J.useRef(e!==void 0);J.useEffect(()=>{const p=u.current;p!==a&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=J.useCallback(u=>{if(a){const p=GI(u)?u(e):u;p!==e&&s.current?.(p)}else o(u)},[a,e,o,s]);return[l,c]}function QI({defaultProp:e,onChange:t}){const[n,r]=J.useState(e),i=J.useRef(n),o=J.useRef(t);return WI(()=>{o.current=t},[t]),J.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function GI(e){return typeof e=="function"}function XI(e){const t=J.useRef({value:e,previous:e});return J.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function YI(e){const[t,n]=J.useState(void 0);return bi(()=>{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 l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.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 ZI(e,t){return J.useReducer((n,r)=>t[n][r]??n,e)}var za=e=>{const{present:t,children:n}=e,r=eC(t),i=typeof n=="function"?n({present:r.isPresent}):J.Children.only(n),o=Rr(r.ref,tC(i));return typeof n=="function"||r.isPresent?J.cloneElement(i,{ref:o}):null};za.displayName="Presence";function eC(e){const[t,n]=J.useState(),r=J.useRef(null),i=J.useRef(e),o=J.useRef("none"),s=e?"mounted":"unmounted",[a,l]=ZI(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return J.useEffect(()=>{const c=Qi(r.current);o.current=a==="mounted"?c:"none"},[a]),bi(()=>{const c=r.current,u=i.current;if(u!==e){const h=o.current,f=Qi(c);e?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),bi(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,p=f=>{const v=Qi(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&v&&(l("ANIMATION_END"),!i.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},h=f=>{f.target===t&&(o.current=Qi(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:J.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Qi(e){return e?.animationName||"none"}function tC(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ta(e){const t=nC(e),n=J.forwardRef((r,i)=>{const{children:o,...s}=r,a=J.Children.toArray(o),l=a.find(iC);if(l){const c=l.props.children,u=a.map(p=>p===l?J.Children.count(c)>1?J.Children.only(null):J.isValidElement(c)?c.props.children:null:p);return d.jsx(t,{...s,ref:i,children:J.isValidElement(c)?J.cloneElement(c,void 0,u):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function nC(e){const t=J.forwardRef((n,r)=>{const{children:i,...o}=n;if(J.isValidElement(i)){const s=sC(i),a=oC(o,i.props);return i.type!==J.Fragment&&(a.ref=r?mp(r,s):s),J.cloneElement(i,a)}return J.Children.count(i)>1?J.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rC=Symbol("radix.slottable");function iC(e){return J.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rC}function oC(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)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function sC(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var aC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rn=aC.reduce((e,t)=>{const n=ta(`Primitive.${t}`),r=J.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),$o="Checkbox",[lC]=Bo($o),[cC,Ka]=lC($o);function uC(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:o,form:s,name:a,onCheckedChange:l,required:c,value:u="on",internal_do_not_use_render:p}=e,[h,f]=Ua({prop:n,defaultProp:i??!1,onChange:l,caller:$o}),[m,v]=J.useState(null),[y,x]=J.useState(null),g=J.useRef(!1),b=m?!!s||!!m.closest("form"):!0,I={checked:h,disabled:o,setChecked:f,control:m,setControl:v,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:g,required:c,defaultChecked:Vn(i)?!1:i,isFormControl:b,bubbleInput:y,setBubbleInput:x};return d.jsx(cC,{scope:t,...I,children:dC(p)?p(I):r})}var gp="CheckboxTrigger",yp=J.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{const{control:o,value:s,disabled:a,checked:l,required:c,setControl:u,setChecked:p,hasConsumerStoppedPropagationRef:h,isFormControl:f,bubbleInput:m}=Ka(gp,e),v=Rr(i,u),y=J.useRef(l);return J.useEffect(()=>{const x=o?.form;if(x){const g=()=>p(y.current);return x.addEventListener("reset",g),()=>x.removeEventListener("reset",g)}},[o,p]),d.jsx(Rn.button,{type:"button",role:"checkbox","aria-checked":Vn(l)?"mixed":l,"aria-required":c,"data-state":xp(l),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:v,onKeyDown:rn(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:rn(n,x=>{p(g=>Vn(g)?!0:!g),m&&f&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})})});yp.displayName=gp;var Ha=J.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:l,onCheckedChange:c,form:u,...p}=e;return d.jsx(uC,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:a,required:s,onCheckedChange:c,name:r,form:u,value:l,internal_do_not_use_render:({isFormControl:h})=>d.jsxs(d.Fragment,{children:[d.jsx(yp,{...p,ref:t,__scopeCheckbox:n}),h&&d.jsx(wp,{__scopeCheckbox:n})]})})});Ha.displayName=$o;var vp="CheckboxIndicator",Ja=J.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=Ka(vp,n);return d.jsx(za,{present:r||Vn(o.checked)||o.checked===!0,children:d.jsx(Rn.span,{"data-state":xp(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Ja.displayName=vp;var bp="CheckboxBubbleInput",wp=J.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:s,required:a,disabled:l,name:c,value:u,form:p,bubbleInput:h,setBubbleInput:f}=Ka(bp,e),m=Rr(n,f),v=XI(o),y=YI(r);J.useEffect(()=>{const g=h;if(!g)return;const b=window.HTMLInputElement.prototype,O=Object.getOwnPropertyDescriptor(b,"checked").set,_=!i.current;if(v!==o&&O){const R=new Event("click",{bubbles:_});g.indeterminate=Vn(o),O.call(g,Vn(o)?!1:o),g.dispatchEvent(R)}},[h,v,o,i]);const x=J.useRef(Vn(o)?!1:o);return d.jsx(Rn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??x.current,required:a,disabled:l,name:c,value:u,form:p,...t,tabIndex:-1,ref:m,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});wp.displayName=bp;function dC(e){return typeof e=="function"}function Vn(e){return e==="indeterminate"}function xp(e){return Vn(e)?"indeterminate":e?"checked":"unchecked"}function Vr(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 pC=["color"],Ip=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Vr(e,pC);return w.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}),w.createElement("path",{d:"M8.14645 3.14645C8.34171 2.95118 8.65829 2.95118 8.85355 3.14645L12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L8.85355 11.8536C8.65829 12.0488 8.34171 12.0488 8.14645 11.8536C7.95118 11.6583 7.95118 11.3417 8.14645 11.1464L11.2929 8H2.5C2.22386 8 2 7.77614 2 7.5C2 7.22386 2.22386 7 2.5 7H11.2929L8.14645 3.85355C7.95118 3.65829 7.95118 3.34171 8.14645 3.14645Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),fC=["color"],Cp=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Vr(e,fC);return w.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}),w.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),hC=["color"],mC=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Vr(e,hC);return w.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}),w.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),gC=["color"],Sp=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Vr(e,gC);return w.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}),w.createElement("path",{d:"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),yC=["color"],vC=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Vr(e,yC);return w.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}),w.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),bC=["color"],Wa=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Vr(e,bC);return w.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}),w.createElement("path",{d:"M4.81812 4.68161C4.99386 4.85734 4.99386 5.14227 4.81812 5.318L3.08632 7.0498H11.9135L10.1817 5.318C10.006 5.14227 10.006 4.85734 10.1817 4.68161C10.3575 4.50587 10.6424 4.50587 10.8181 4.68161L13.3181 7.18161C13.4939 7.35734 13.4939 7.64227 13.3181 7.818L10.8181 10.318C10.6424 10.4937 10.3575 10.4937 10.1817 10.318C10.006 10.1423 10.006 9.85734 10.1817 9.68161L11.9135 7.9498H3.08632L4.81812 9.68161C4.99386 9.85734 4.99386 10.1423 4.81812 10.318C4.64239 10.4937 4.35746 10.4937 4.18173 10.318L1.68173 7.818C1.50599 7.64227 1.50599 7.35734 1.68173 7.18161L4.18173 4.68161C4.35746 4.50587 4.64239 4.50587 4.81812 4.68161Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const wC="_checkboxGroupContainer_hqfeu_1",xC="_stack_hqfeu_6",IC="_selectAllContainer_hqfeu_10",CC="_fieldContainer_hqfeu_17",SC="_checkbox_hqfeu_1",Ar={checkboxGroupContainer:wC,stack:xC,selectAllContainer:IC,fieldContainer:CC,checkbox:SC};function OC({id:e,isChecked:t,label:n,onCheckedChange:r}){return d.jsxs("div",{className:Ar.fieldContainer,children:[d.jsx(Ha,{className:Ar.checkbox,id:e,onCheckedChange:r,checked:t,children:d.jsx(Ja,{children:d.jsx(Cp,{})})}),d.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function _C({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return d.jsxs("div",{className:Ar.selectAllContainer,children:[d.jsx(Ha,{className:Ar.checkbox,id:e,onCheckedChange:r,checked:i?"indeterminate":t,children:d.jsxs(Ja,{children:[i&&d.jsx(mC,{}),t===!0&&d.jsx(Cp,{})]})}),d.jsx("label",{htmlFor:e,children:n})]})}function EC({children:e}){return d.jsx("div",{className:Ar.checkboxGroupContainer,children:e})}function NC({children:e}){return d.jsx("div",{className:Ar.stack,children:e})}const TC="_paginationContainer_1p51x_1",kC="_pageInfo_1p51x_7",RC="_searchContainer_1p51x_13",AC="_searchInput_1p51x_17",FC="_noResults_1p51x_21",Xr={paginationContainer:TC,pageInfo:kC,searchContainer:RC,searchInput:AC,noResults:FC};function Qa({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:i=!0,searchPlaceholder:o="Search fields...",itemName:s="fields"}){const[a,l]=w.useState(1),[c,u]=w.useState(""),p=e.filter(I=>I.label.toLowerCase().includes(c.toLowerCase())),h=Math.ceil(p.length/n),f=(a-1)*n,m=f+n,v=p.slice(f,m),y=I=>{u(I),l(1)},x=I=>{p.forEach(O=>{t(O.id,I)})},g=p.length>0&&p.every(I=>I.isChecked),b=p.some(I=>I.isChecked);return d.jsxs(EC,{children:[i&&d.jsx("div",{className:Xr.searchContainer,children:d.jsx(hp,{id:"field-search",type:"text",placeholder:o,value:c,onChange:I=>y(I.target.value),className:Xr.searchInput})}),r&&e.length>=2&&d.jsx(_C,{id:"select-all-fields",isChecked:g,label:`Select all ${p.length} ${c?"matching ":""}${s}`,onCheckedChange:x,isIndeterminate:b&&!g}),d.jsx(NC,{children:v.map(I=>d.jsx(OC,{id:I.id,isChecked:I.isChecked,label:I.label,onCheckedChange:O=>t(I.id,O===!0)},I.id))}),h>1&&d.jsxs("div",{className:Xr.paginationContainer,children:[d.jsx(je,{type:"button",onClick:()=>l(I=>Math.max(1,I-1)),disabled:a===1,variant:"ghost",children:"<"}),d.jsxs("span",{className:Xr.pageInfo,children:[a," of ",h]}),d.jsx(je,{type:"button",onClick:()=>l(I=>Math.min(h,I+1)),disabled:a===h,variant:"ghost",children:">"})]}),p.length===0&&c&&d.jsxs("div",{className:Xr.noResults,children:["No ",s,' found matching "',c,'"']})]})}const PC="_sectionTitle_1e9ty_1",jC="_helperText_1e9ty_10",Rc={sectionTitle:PC,helperText:jC};function wo({title:e,description:t}){return d.jsxs(d.Fragment,{children:[d.jsx("h3",{className:Rc.sectionTitle,children:e}),d.jsx("p",{className:Rc.helperText,children:t})]})}function MC({providerDisplayName:e,appName:t,optionalFieldItems:n,onItemChange:r}){return d.jsxs(d.Fragment,{children:[d.jsx(wo,{title:"Additional Fields",description:`Would you like to share any optional ${e} fields with ${t}?`}),d.jsx(Qa,{items:n,onItemChange:r})]})}function Op(e){return"fieldName"in e}function na(e){return Op(e)?e.fieldName:""}function _p(e){return Op(e)?e.displayName||e.fieldName:""}function DC(e,t){return qo(e,t)[0]}function Ac(e,t){const n=qo(e,t);return n[n.length-1]}function qo(e,t){const n=e.getReadObject(t);if(!n)return["fields"];const r=[],i=(n.getRequiredFields("no-mappings")?.length??0)>0,o=!!n.object?.mapToName;return(i||o)&&r.push("fields"),((n.getRequiredMapFields()?.length??0)>0||(n.getOptionalMapFields()?.length??0)>0)&&r.push("mappings"),(n.getOptionalFields("no-mappings")?.length??0)>0&&r.push("additional"),r.length>0?r:["fields"]}const LC="_configureObjects_1di5e_1",BC="_objectConfigPanel_1di5e_10",$C="_objectName_1di5e_18",qC="_objectDescription_1di5e_26",VC="_empty_1di5e_33",UC="_mappingDisabledInput_1di5e_47",zC="_mappingDisabledInputText_1di5e_62",nn={configureObjects:LC,objectConfigPanel:BC,objectName:$C,objectDescription:qC,empty:VC,mappingDisabledInput:UC,mappingDisabledInputText:zC},KC="_fieldSection_186dk_1",HC="_fieldCardGrid_186dk_6",JC="_fieldCard_186dk_6",WC="_fieldCardDisabled_186dk_29",QC="_fieldCardName_186dk_41",GC="_noFields_186dk_47",XC="_objectMappingInline_186dk_58",YC="_objectMappingArrow_186dk_65",Cn={fieldSection:KC,fieldCardGrid:HC,fieldCard:JC,fieldCardDisabled:WC,fieldCardName:QC,noFields:GC,objectMappingInline:XC,objectMappingArrow:YC};function ZC({objectDisplayName:e,providerDisplayName:t,appName:n,hasObjectMapping:r,objectMapToDisplayName:i,isMappingBidirectional:o,hasRequiredFields:s,requiredFields:a,hasFieldsContent:l}){return d.jsxs(d.Fragment,{children:[r&&d.jsxs("div",{className:Cn.fieldSection,children:[d.jsx(wo,{title:"Object Mapping",description:`This ${t} object is mapped to the corresponding ${n} object.`}),d.jsxs("div",{className:Cn.objectMappingInline,children:[d.jsx("div",{className:nn.mappingDisabledInput,children:d.jsx("span",{className:nn.mappingDisabledInputText,children:e})}),d.jsx("div",{className:Cn.objectMappingArrow,children:o?d.jsx(Wa,{}):d.jsx(Ip,{})}),d.jsx("div",{className:nn.mappingDisabledInput,children:d.jsx("span",{className:nn.mappingDisabledInputText,children:i})})]})]}),s&&d.jsxs("div",{className:Cn.fieldSection,children:[d.jsx(wo,{title:"Included Fields",description:"These fields are always read and require no configuration."}),d.jsx("div",{className:Cn.fieldCardGrid,children:a.map(c=>{const u=na(c),p=_p(c);return d.jsx("div",{className:`${Cn.fieldCard} ${Cn.fieldCardDisabled}`,children:d.jsx("span",{className:Cn.fieldCardName,children:p})},u)})})]}),!l&&d.jsxs("p",{className:Cn.noFields,children:["No configurable fields for ",e,"."]})]})}const eS="_trigger_1dvzj_1",tS="_tooltip_1dvzj_10",Fc={trigger:eS,tooltip:tS};function Ep({text:e}){return d.jsxs("span",{className:Fc.trigger,children:[d.jsx(vC,{}),d.jsx("span",{className:Fc.tooltip,children:e})]})}const nS="_mappingRow_7xcae_2",rS="_mappingField_7xcae_15",iS="_mappingSelect_7xcae_23",oS="_requiredAsterisk_7xcae_36",sS="_mappingArrow_7xcae_41",xr={mappingRow:nS,mappingField:rS,mappingSelect:iS,requiredAsterisk:oS,mappingArrow:sS};function Pc({objectName:e,mapping:t,required:n,bidirectional:r,customerFieldOptions:i,configHandlers:o}){const s=o.getFieldMapping(t.mapToName)??"";return d.jsxs("div",{className:xr.mappingRow,children:[d.jsx("div",{className:xr.mappingField,children:d.jsxs("select",{id:`mapping-${e}-${t.mapToName}`,className:xr.mappingSelect,value:s,onChange:a=>{const l=a.target.value;l?o.setFieldMapping({fieldName:l,mapToName:t.mapToName}):o.deleteFieldMapping(t.mapToName)},children:[d.jsx("option",{value:"",children:"Select a field..."}),i.map(a=>d.jsx("option",{value:a.fieldName,children:a.displayName},a.fieldName))]})}),d.jsx("div",{className:xr.mappingArrow,children:r?d.jsx(Wa,{}):d.jsx(Ip,{})}),d.jsx("div",{className:xr.mappingField,children:d.jsxs("div",{className:nn.mappingDisabledInput,children:[d.jsxs("span",{className:nn.mappingDisabledInputText,children:[t.mapToDisplayName??t.mapToName,n&&d.jsx("span",{className:xr.requiredAsterisk,children:"*"})]}),t.prompt&&d.jsx(Ep,{text:t.prompt})]})})]})}const aS="_mappingContent_pg19z_1",lS="_mappingColumnHeaders_pg19z_5",cS="_mappingColumnTitle_pg19z_13",uS="_mappingColumnArrow_pg19z_21",Yr={mappingContent:aS,mappingColumnHeaders:lS,mappingColumnTitle:cS,mappingColumnArrow:uS};function dS({objectName:e,providerDisplayName:t,appName:n,isMappingBidirectional:r,requiredMapFields:i,optionalMapFields:o,customerFieldOptions:s,configHandlers:a}){return d.jsxs(d.Fragment,{children:[d.jsx(wo,{title:"Field Mappings",description:`Map ${t} fields to the corresponding ${n} fields for read${r?" and write":""}.`}),d.jsxs("div",{className:Yr.mappingContent,children:[d.jsxs("div",{className:Yr.mappingColumnHeaders,children:[d.jsxs("span",{className:Yr.mappingColumnTitle,children:[t," Field"]}),d.jsx("span",{className:Yr.mappingColumnArrow}),d.jsxs("span",{className:Yr.mappingColumnTitle,children:[n," Field"]})]}),i.map(l=>d.jsx(Pc,{objectName:e,mapping:l,required:!0,bidirectional:r,customerFieldOptions:s,configHandlers:a},l.mapToName)),o.map(l=>d.jsx(Pc,{objectName:e,mapping:l,required:!1,bidirectional:r,customerFieldOptions:s,configHandlers:a},l.mapToName))]})]})}const pS="_objectTabs_bcy6q_1",fS="_objectTab_bcy6q_1",hS="_objectTabActive_bcy6q_34",mS="_objectTabLabel_bcy6q_38",gS="_objectTabDots_bcy6q_45",yS="_dot_bcy6q_50",vS="_dotComplete_bcy6q_56",bS="_dotActive_bcy6q_60",wS="_dotPending_bcy6q_64",Sn={objectTabs:pS,objectTab:fS,objectTabActive:hS,objectTabLabel:mS,objectTabDots:gS,dot:yS,dotComplete:vS,dotActive:bS,dotPending:wS};function xS({currentPageIndex:e,onTabClick:t}){const n=Tn(),{state:r}=un(),{selectedObjects:i,currentObjectIndex:o}=r,s=w.useMemo(()=>i.map((a,l)=>{const c=qo(n,a),u=n.getReadObject(a)?.object?.displayName||a,p=c.map((h,f)=>l<o?"complete":l===o?f<e?"complete":f===e?"active":"pending":"pending");return{objName:a,displayName:u,dots:p,objIndex:l}}),[i,n,o,e]);return d.jsx("div",{className:Sn.objectTabs,children:s.map(a=>d.jsxs("button",{type:"button",className:`${Sn.objectTab}${a.objIndex===o?` ${Sn.objectTabActive}`:""}`,disabled:a.objIndex>o,onClick:()=>t(a.objIndex),children:[d.jsx("span",{className:Sn.objectTabLabel,children:a.displayName}),d.jsx("span",{className:Sn.objectTabDots,children:a.dots.map((l,c)=>d.jsx("span",{className:`${Sn.dot} ${l==="complete"?Sn.dotComplete:l==="active"?Sn.dotActive:Sn.dotPending}`},c))})]},a.objName))})}function IS(){const e=Tn(),{state:t,isFirstObject:n,isLastObject:r,currentObjectName:i,nextObject:o,prevObject:s,nextStep:a,prevStep:l,setCurrentObjectIndex:c}=un(),{selectedObjects:u,currentObjectIndex:p}=t,[h,f]=w.useState("fields"),m=w.useRef(null),v=w.useRef(i);w.useEffect(()=>{i!==v.current&&(v.current=i,m.current!==null?(f(m.current),m.current=null):i&&f(DC(e,i)))},[i,e]);const y=w.useMemo(()=>i?e.getReadObject(i):null,[e,i]),x=w.useMemo(()=>{const A=y?.getRequiredMapFields()?.length??0,F=y?.getOptionalMapFields()?.length??0;return A>0||F>0},[y]),g=w.useMemo(()=>(y?.getOptionalFields("no-mappings")?.length??0)>0,[y]),b=w.useMemo(()=>{const A=(y?.getRequiredFields("no-mappings")?.length??0)>0,F=!!y?.object?.mapToName;return A||F},[y]),I=w.useCallback(()=>{if(h==="fields"){if(x){f("mappings");return}if(g){f("additional");return}}else if(h==="mappings"&&g){f("additional");return}r?a():o()},[h,x,g,r,a,o]),O=w.useCallback(()=>{if(h==="additional"){if(x){f("mappings");return}if(b){f("fields");return}}else if(h==="mappings"&&b){f("fields");return}if(n)l();else{const A=p-1,F=u[A];F&&(m.current=Ac(e,F)),s()}},[h,x,b,n,l,p,u,e,s]),R=w.useMemo(()=>i?qo(e,i):[],[e,i]).indexOf(h),k=w.useCallback(A=>{if(A>=p)return;const F=u[A];F&&(m.current=Ac(e,F)),c(A)},[p,u,e,c]);return{subPage:h,currentPageIndex:R,currentManifestObject:y,hasFieldsContent:b,handleNext:I,handleBack:O,handleTabClick:k}}function CS(){const e=Tn(),t=Mo(),{provider:n}=st(),{providerName:r}=ut(),{appName:i}=an(),{currentObjectName:o}=un(),{subPage:s,currentPageIndex:a,currentManifestObject:l,hasFieldsContent:c,handleNext:u,handleBack:p,handleTabClick:h}=IS(),f=w.useMemo(()=>l?.getRequiredFields("no-mappings")??[],[l]),m=w.useMemo(()=>l?.getOptionalFields("no-mappings")??[],[l]),v=w.useMemo(()=>l?.getRequiredMapFields()??[],[l]),y=w.useMemo(()=>l?.getOptionalMapFields()??[],[l]),x=w.useMemo(()=>o?e.getCustomerFieldsForObject(o).allFields??{}:{},[e,o]),g=f.length>0,b=l?.object?.mapToName,I=l?.object?.mapToDisplayName||b,O=!!b,_=!!o&&!!t.writeObject(o).object,R=w.useMemo(()=>o?t.readObject(o):null,[t,o]),k=w.useMemo(()=>Object.entries(x).map(([B,X])=>({fieldName:B,displayName:X.displayName||B})),[x]),A=w.useCallback((B,X)=>{R?.setSelectedField({fieldName:B,selected:X})},[R]),F=w.useMemo(()=>m.map(B=>({id:na(B),label:_p(B),isChecked:R?.getSelectedField(na(B))??!1})),[m,R]),j=w.useMemo(()=>v.every(B=>!!R?.getFieldMapping(B.mapToName)),[v,R]);if(!o||!l)return d.jsx("div",{className:nn.empty,children:"No objects to configure."});const L=l.object?.displayName||o,H=i||"Your App",P=r||n||"Provider";return d.jsxs("div",{className:nn.configureObjects,children:[d.jsx(xS,{currentPageIndex:a,onTabClick:h}),d.jsxs("div",{className:nn.objectConfigPanel,children:[d.jsx("h2",{className:nn.objectName,children:L}),d.jsxs("p",{className:nn.objectDescription,children:["Confirm which ",P," fields ",H," can read",_?" and write":"","."]}),s==="fields"&&d.jsx(ZC,{objectDisplayName:L,providerDisplayName:P,appName:H,hasObjectMapping:O,objectMapToDisplayName:I,isMappingBidirectional:_,hasRequiredFields:g,requiredFields:f,hasFieldsContent:c}),s==="mappings"&&R&&d.jsx(dS,{objectName:o,providerDisplayName:P,appName:H,isMappingBidirectional:_,requiredMapFields:v,optionalMapFields:y,customerFieldOptions:k,configHandlers:R}),s==="additional"&&d.jsx(MC,{providerDisplayName:P,appName:H,optionalFieldItems:F,onItemChange:A})]}),d.jsx(bo,{onBack:p,onNext:u,backLabel:"Back",nextLabel:"Next",nextDisabled:s==="mappings"&&!j})]})}function SS(){const{state:e,goToStep:t}=un();return w.useEffect(()=>{e.selectedObjects.length===0&&t(Qt.SelectObjects)},[e.selectedObjects.length,t]),e.selectedObjects.length===0?null:d.jsx(CS,{})}function Np(){return d.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),d.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ga({text:e,children:t}){return d.jsx(qr,{children:d.jsxs(kn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[d.jsx(Np,{}),d.jsx("p",{children:e}),t]})})}const OS={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 Oi({children:e,style:t}){return d.jsx(kn,{style:{...OS,...t},children:e})}function bn({error:e}){return e?d.jsx(Oi,{style:{marginTop:"2em"},children:e}):null}function _S(){return d.jsx("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d.jsxs("g",{opacity:"0.5",children:[d.jsx("path",{d:"M14.2821 11.0004C14.2821 12.8154 12.8154 14.2821 11.0004 14.2821C9.18542 14.2821 7.71875 12.8154 7.71875 11.0004C7.71875 9.18542 9.18542 7.71875 11.0004 7.71875C12.8154 7.71875 14.2821 9.18542 14.2821 11.0004Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M10.9999 18.581C14.2357 18.581 17.2515 16.6743 19.3507 13.3743C20.1757 12.0818 20.1757 9.90932 19.3507 8.61682C17.2515 5.31682 14.2357 3.41016 10.9999 3.41016C7.76402 3.41016 4.74819 5.31682 2.64902 8.61682C1.82402 9.90932 1.82402 12.0818 2.64902 13.3743C4.74819 16.6743 7.76402 18.581 10.9999 18.581Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function ES(){return d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[d.jsx("path",{d:"M13.3187 8.68036L8.68036 13.3187C8.06528 12.7036 7.71973 11.8694 7.71973 10.9995C7.71973 10.5688 7.80456 10.1423 7.96939 9.7444C8.13421 9.34648 8.3758 8.98491 8.68036 8.68036C8.98491 8.3758 9.34648 8.13421 9.7444 7.96939C10.1423 7.80456 10.5688 7.71973 10.9995 7.71973C11.8694 7.71973 12.7036 8.06528 13.3187 8.68036Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M16.3349 5.28895C14.7307 4.07895 12.8974 3.41895 10.9999 3.41895C7.76402 3.41895 4.74819 5.32561 2.64902 8.62561C1.82402 9.91811 1.82402 12.0906 2.64902 13.3831C3.37319 14.5198 4.21652 15.5006 5.13319 16.2889M7.71819 17.9023C8.76319 18.3423 9.87236 18.5806 10.9999 18.5806C14.2357 18.5806 17.2515 16.6739 19.3507 13.3739C20.1757 12.0814 20.1757 9.90895 19.3507 8.61645C19.0482 8.13978 18.7182 7.69061 18.379 7.26895",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M14.2172 11.6413C14.093 12.2808 13.7806 12.8685 13.32 13.3291C12.8594 13.7897 12.2716 14.1022 11.6322 14.2263M8.68051 13.3188L1.83301 20.1663M20.1663 1.83301L13.3188 8.68051",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function NS({id:e,name:t,placeholder:n="Password",onChange:r,value:i,className:o,isError:s}){const[a,l]=w.useState(!1),c=()=>l(u=>!u);return d.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[d.jsx(En.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:i,className:o,isError:s}),d.jsx(je,{type:"button","aria-label":a?"Hide password":"Show password",style:{height:"2.5rem",width:"2.5rem",display:"flex",alignItems:"center",justifyContent:"center"},onClick:c,variant:"ghost",children:d.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?d.jsx(ES,{}):d.jsx(_S,{})})})]})}const TS="_textarea_18zl4_1",kS="_textareaError_18zl4_14",ds={textarea:TS,textareaError:kS};function RS({className:e,isError:t=!1,...n}){const r=t?Gt(ds.textareaError,ds.textarea):ds.textarea;return d.jsx("textarea",{className:Gt(e,r),...n})}const En={Input:hp,Textarea:RS,PasswordInput:NS},AS=()=>{const{projectIdOrName:e}=Ke(),t=wt();return pr({queryKey:["project",e,"entitlements"],queryFn:async()=>{if(!e)throw new Error("Project ID is required");return(await t()).projectApi.getProject({projectIdOrName:e,includeEntitlements:!0})},enabled:!!e})};function Tp(){const{data:e}=AS();return e?.entitlements?.brandingRemoval?.value===!0?null:d.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:[d.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),d.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:d.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})})]})}function Wn({children:e}){return d.jsx(qr,{children:d.jsxs(kn,{children:[d.jsx("div",{style:{padding:"3rem 2rem"},children:e}),d.jsx(Tp,{})]})})}function Qn({children:e}){return d.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function FS({children:e}){return d.jsx("p",{style:{padding:".5em 0"},children:e})}const PS="_link_oo2kv_1",jS={link:PS};function kp({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return d.jsx("a",{className:Gt(jS.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function MS(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const DS=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,LS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,BS={};function jc(e,t){return(BS.jsx?LS:DS).test(e)}const $S=/[ \t\n\f\r]/g;function qS(e){return typeof e=="object"?e.type==="text"?Mc(e.value):!1:Mc(e)}function Mc(e){return e.replace($S,"")===""}class _i{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}_i.prototype.normal={};_i.prototype.property={};_i.prototype.space=void 0;function Rp(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new _i(n,r,t)}function ra(e){return e.toLowerCase()}class Ft{constructor(t,n){this.attribute=n,this.property=t}}Ft.prototype.attribute="";Ft.prototype.booleanish=!1;Ft.prototype.boolean=!1;Ft.prototype.commaOrSpaceSeparated=!1;Ft.prototype.commaSeparated=!1;Ft.prototype.defined=!1;Ft.prototype.mustUseProperty=!1;Ft.prototype.number=!1;Ft.prototype.overloadedBoolean=!1;Ft.prototype.property="";Ft.prototype.spaceSeparated=!1;Ft.prototype.space=void 0;let VS=0;const be=gr(),Xe=gr(),ia=gr(),Q=gr(),Le=gr(),_r=gr(),jt=gr();function gr(){return 2**++VS}const oa=Object.freeze(Object.defineProperty({__proto__:null,boolean:be,booleanish:Xe,commaOrSpaceSeparated:jt,commaSeparated:_r,number:Q,overloadedBoolean:ia,spaceSeparated:Le},Symbol.toStringTag,{value:"Module"})),ps=Object.keys(oa);class Xa extends Ft{constructor(t,n,r,i){let o=-1;if(super(t,n),Dc(this,"space",i),typeof r=="number")for(;++o<ps.length;){const s=ps[o];Dc(this,ps[o],(r&oa[s])===oa[s])}}}Xa.prototype.defined=!0;function Dc(e,t,n){n&&(e[t]=n)}function Ur(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Xa(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[ra(r)]=r,n[ra(o.attribute)]=r}return new _i(t,n,e.space)}const Ap=Ur({properties:{ariaActiveDescendant:null,ariaAtomic:Xe,ariaAutoComplete:null,ariaBusy:Xe,ariaChecked:Xe,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:Le,ariaCurrent:null,ariaDescribedBy:Le,ariaDetails:null,ariaDisabled:Xe,ariaDropEffect:Le,ariaErrorMessage:null,ariaExpanded:Xe,ariaFlowTo:Le,ariaGrabbed:Xe,ariaHasPopup:null,ariaHidden:Xe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Le,ariaLevel:Q,ariaLive:null,ariaModal:Xe,ariaMultiLine:Xe,ariaMultiSelectable:Xe,ariaOrientation:null,ariaOwns:Le,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:Xe,ariaReadOnly:Xe,ariaRelevant:null,ariaRequired:Xe,ariaRoleDescription:Le,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:Xe,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Fp(e,t){return t in e?e[t]:t}function Pp(e,t){return Fp(e,t.toLowerCase())}const US=Ur({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_r,acceptCharset:Le,accessKey:Le,action:null,allow:null,allowFullScreen:be,allowPaymentRequest:be,allowUserMedia:be,alt:null,as:null,async:be,autoCapitalize:null,autoComplete:Le,autoFocus:be,autoPlay:be,blocking:Le,capture:null,charSet:null,checked:be,cite:null,className:Le,cols:Q,colSpan:null,content:null,contentEditable:Xe,controls:be,controlsList:Le,coords:Q|_r,crossOrigin:null,data:null,dateTime:null,decoding:null,default:be,defer:be,dir:null,dirName:null,disabled:be,download:ia,draggable:Xe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:be,formTarget:null,headers:Le,height:Q,hidden:ia,high:Q,href:null,hrefLang:null,htmlFor:Le,httpEquiv:Le,id:null,imageSizes:null,imageSrcSet:null,inert:be,inputMode:null,integrity:null,is:null,isMap:be,itemId:null,itemProp:Le,itemRef:Le,itemScope:be,itemType:Le,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:be,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:be,muted:be,name:null,nonce:null,noModule:be,noValidate:be,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:be,optimum:Q,pattern:null,ping:Le,placeholder:null,playsInline:be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:be,referrerPolicy:null,rel:Le,required:be,reversed:be,rows:Q,rowSpan:Q,sandbox:Le,scope:null,scoped:be,seamless:be,selected:be,shadowRootClonable:be,shadowRootDelegatesFocus:be,shadowRootMode:null,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:Xe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:be,useMap:null,value:Xe,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Le,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:be,declare:be,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:be,noHref:be,noShade:be,noWrap:be,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:Xe,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:be,disableRemotePlayback:be,prefix:null,property:null,results:Q,security:null,unselectable:null},space:"html",transform:Pp}),zS=Ur({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:jt,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:Le,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:be,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:_r,g2:_r,glyphName:_r,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:jt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Le,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:jt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:jt,rev:jt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:jt,requiredFeatures:jt,requiredFonts:jt,requiredFormats:jt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:jt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:jt,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:jt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Fp}),jp=Ur({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Mp=Ur({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Pp}),Dp=Ur({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),KS={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},HS=/[A-Z]/g,Lc=/-[a-z]/g,JS=/^data[-\w.:]+$/i;function WS(e,t){const n=ra(t);let r=t,i=Ft;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&JS.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Lc,GS);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Lc.test(o)){let s=o.replace(HS,QS);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}i=Xa}return new i(r,t)}function QS(e){return"-"+e.toLowerCase()}function GS(e){return e.charAt(1).toUpperCase()}const XS=Rp([Ap,US,jp,Mp,Dp],"html"),Ya=Rp([Ap,zS,jp,Mp,Dp],"svg");function YS(e){return e.join(" ").trim()}var Ir={},fs,Bc;function ZS(){if(Bc)return fs;Bc=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
7
- `,c="/",u="*",p="",h="comment",f="declaration";function m(y,x){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];x=x||{};var g=1,b=1;function I(P){var B=P.match(t);B&&(g+=B.length);var X=P.lastIndexOf(l);b=~X?P.length-X:b+P.length}function O(){var P={line:g,column:b};return function(B){return B.position=new _(P),A(),B}}function _(P){this.start=P,this.end={line:g,column:b},this.source=x.source}_.prototype.content=y;function R(P){var B=new Error(x.source+":"+g+":"+b+": "+P);if(B.reason=P,B.filename=x.source,B.line=g,B.column=b,B.source=y,!x.silent)throw B}function k(P){var B=P.exec(y);if(B){var X=B[0];return I(X),y=y.slice(X.length),B}}function A(){k(n)}function F(P){var B;for(P=P||[];B=j();)B!==!1&&P.push(B);return P}function j(){var P=O();if(!(c!=y.charAt(0)||u!=y.charAt(1))){for(var B=2;p!=y.charAt(B)&&(u!=y.charAt(B)||c!=y.charAt(B+1));)++B;if(B+=2,p===y.charAt(B-1))return R("End of comment missing");var X=y.slice(2,B-2);return b+=2,I(X),y=y.slice(B),b+=2,P({type:h,comment:X})}}function L(){var P=O(),B=k(r);if(B){if(j(),!k(i))return R("property missing ':'");var X=k(o),le=P({type:f,property:v(B[0].replace(e,p)),value:X?v(X[0].replace(e,p)):p});return k(s),le}}function H(){var P=[];F(P);for(var B;B=L();)B!==!1&&(P.push(B),F(P));return P}return A(),H()}function v(y){return y?y.replace(a,p):p}return fs=m,fs}var $c;function e0(){if($c)return Ir;$c=1;var e=Ir&&Ir.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.default=n;const t=e(ZS());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const s=(0,t.default)(r),a=typeof i=="function";return s.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;a?i(c,u,l):u&&(o=o||{},o[c]=u)}),o}return Ir}var Zr={},qc;function t0(){if(qc)return Zr;qc=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(c){return!c||n.test(c)||e.test(c)},s=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),o(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(i,a):c=c.replace(r,a),c.replace(t,s))};return Zr.camelCase=l,Zr}var ei,Vc;function n0(){if(Vc)return ei;Vc=1;var e=ei&&ei.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(e0()),n=t0();function r(i,o){var s={};return!i||typeof i!="string"||(0,t.default)(i,function(a,l){a&&l&&(s[(0,n.camelCase)(a,o)]=l)}),s}return r.default=r,ei=r,ei}var r0=n0();const i0=$r(r0),Lp=Bp("end"),Za=Bp("start");function Bp(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function o0(e){const t=Za(e),n=Lp(e);if(t&&n)return{start:t,end:n}}function li(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Uc(e.position):"start"in e||"end"in e?Uc(e):"line"in e||"column"in e?sa(e):""}function sa(e){return zc(e&&e.line)+":"+zc(e&&e.column)}function Uc(e){return sa(e&&e.start)+"-"+sa(e&&e.end)}function zc(e){return e&&typeof e=="number"?e:1}class xt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},s=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(s=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=li(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}xt.prototype.file="";xt.prototype.name="";xt.prototype.reason="";xt.prototype.message="";xt.prototype.stack="";xt.prototype.column=void 0;xt.prototype.line=void 0;xt.prototype.ancestors=void 0;xt.prototype.cause=void 0;xt.prototype.fatal=void 0;xt.prototype.place=void 0;xt.prototype.ruleId=void 0;xt.prototype.source=void 0;const el={}.hasOwnProperty,s0=new Map,a0=/[A-Z]/g,l0=new Set(["table","tbody","thead","tfoot","tr"]),c0=new Set(["td","th"]),$p="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function u0(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=v0(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=y0(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ya:XS,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=qp(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function qp(e,t,n){if(t.type==="element")return d0(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return p0(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return h0(e,t,n);if(t.type==="mdxjsEsm")return f0(e,t);if(t.type==="root")return m0(e,t,n);if(t.type==="text")return g0(e,t)}function d0(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Ya,e.schema=i),e.ancestors.push(t);const o=Up(e,t.tagName,!1),s=b0(e,t);let a=nl(e,t);return l0.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!qS(l):!0})),Vp(e,s,o,t),tl(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function p0(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}wi(e,t.position)}function f0(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wi(e,t.position)}function h0(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Ya,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:Up(e,t.name,!0),s=w0(e,t),a=nl(e,t);return Vp(e,s,o,t),tl(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function m0(e,t,n){const r={};return tl(r,nl(e,t)),e.create(t,e.Fragment,r,n)}function g0(e,t){return t.value}function Vp(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function tl(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function y0(e,t,n){return r;function r(i,o,s,a){const c=Array.isArray(s.children)?n:t;return a?c(o,s,a):c(o,s)}}function v0(e,t){return n;function n(r,i,o,s){const a=Array.isArray(o.children),l=Za(r);return t(i,o,s,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function b0(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&el.call(t.properties,i)){const o=x0(e,i,t.properties[i]);if(o){const[s,a]=o;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&c0.has(t.tagName)?r=a:n[s]=a}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function w0(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const s=o.expression;s.type;const a=s.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else wi(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,o=e.evaluater.evaluateExpression(a.expression)}else wi(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function nl(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:s0;for(;++r<t.children.length;){const o=t.children[r];let s;if(e.passKeys){const l=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(l){const c=i.get(l)||0;s=l+"-"+c,i.set(l,c+1)}}const a=qp(e,o,s);a!==void 0&&n.push(a)}return n}function x0(e,t,n){const r=WS(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?MS(n):YS(n)),r.property==="style"){let i=typeof n=="object"?n:I0(e,String(n));return e.stylePropertyNameCase==="css"&&(i=C0(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?KS[r.property]||r.property:r.attribute,n]}}function I0(e,t){try{return i0(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new xt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=$p+"#cannot-parse-style-attribute",i}}function Up(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,s;for(;++o<i.length;){const a=jc(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(o&&a.type==="Literal"),optional:!1}:a}r=s}else r=jc(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return el.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);wi(e)}function wi(e,t){const n=new xt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=$p+"#cannot-handle-mdx-estrees-without-createevaluater",n}function C0(e){const t={};let n;for(n in e)el.call(e,n)&&(t[S0(n)]=e[n]);return t}function S0(e){let t=e.replace(a0,O0);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function O0(e){return"-"+e.toLowerCase()}const hs={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},_0={};function E0(e,t){const n=_0,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return zp(e,r,i)}function zp(e,t,n){if(N0(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Kc(e.children,t,n)}return Array.isArray(e)?Kc(e,t,n):""}function Kc(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=zp(e[i],t,n);return r.join("")}function N0(e){return!!(e&&typeof e=="object")}const Hc=document.createElement("i");function rl(e){const t="&"+e+";";Hc.innerHTML=t;const n=Hc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function gn(e,t,n,r){const i=e.length;let o=0,s;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);o<r.length;)s=r.slice(o,o+1e4),s.unshift(t,0),e.splice(...s),o+=1e4,t+=1e4}function Wt(e,t){return e.length>0?(gn(e,e.length,0,t),e):t}const Jc={}.hasOwnProperty;function T0(e){const t={};let n=-1;for(;++n<e.length;)k0(t,e[n]);return t}function k0(e,t){let n;for(n in t){const i=(Jc.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let s;if(o)for(s in o){Jc.call(i,s)||(i[s]=[]);const a=o[s];R0(i[s],Array.isArray(a)?a:a?[a]:[])}}}function R0(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);gn(e,0,0,r)}function Kp(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Er(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const hn=Gn(/[A-Za-z]/),Dt=Gn(/[\dA-Za-z]/),A0=Gn(/[#-'*+\--9=?A-Z^-~]/);function aa(e){return e!==null&&(e<32||e===127)}const la=Gn(/\d/),F0=Gn(/[\dA-Fa-f]/),P0=Gn(/[!-/:-@[-`{-~]/);function he(e){return e!==null&&e<-2}function At(e){return e!==null&&(e<0||e===32)}function Ee(e){return e===-2||e===-1||e===32}const j0=Gn(new RegExp("\\p{P}|\\p{S}","u")),M0=Gn(/\s/);function Gn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function zr(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let s="";if(o===37&&Dt(e.charCodeAt(n+1))&&Dt(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(s=String.fromCharCode(o));else if(o>55295&&o<57344){const a=e.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="�"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Be(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return Ee(l)?(e.enter(n),a(l)):t(l)}function a(l){return Ee(l)&&o++<i?(e.consume(l),a):(e.exit(n),t(l))}}const D0={tokenize:L0};function L0(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Be(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),o(a)}function o(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return he(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),s)}}const B0={tokenize:$0},Wc={tokenize:q0};function $0(e){const t=this,n=[];let r=0,i,o,s;return a;function a(b){if(r<n.length){const I=n[r];return t.containerState=I[1],e.attempt(I[0].continuation,l,c)(b)}return c(b)}function l(b){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&g();const I=t.events.length;let O=I,_;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){_=t.events[O][1].end;break}x(r);let R=I;for(;R<t.events.length;)t.events[R][1].end={..._},R++;return gn(t.events,O+1,0,t.events.slice(I)),t.events.length=R,c(b)}return a(b)}function c(b){if(r===n.length){if(!i)return h(b);if(i.currentConstruct&&i.currentConstruct.concrete)return m(b);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Wc,u,p)(b)}function u(b){return i&&g(),x(r),h(b)}function p(b){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,m(b)}function h(b){return t.containerState={},e.attempt(Wc,f,m)(b)}function f(b){return r++,n.push([t.currentConstruct,t.containerState]),h(b)}function m(b){if(b===null){i&&g(),x(0),e.consume(b);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),v(b)}function v(b){if(b===null){y(e.exit("chunkFlow"),!0),x(0),e.consume(b);return}return he(b)?(e.consume(b),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(b),v)}function y(b,I){const O=t.sliceStream(b);if(I&&O.push(null),b.previous=o,o&&(o.next=b),o=b,i.defineSkip(b.start),i.write(O),t.parser.lazy[b.start.line]){let _=i.events.length;for(;_--;)if(i.events[_][1].start.offset<s&&(!i.events[_][1].end||i.events[_][1].end.offset>s))return;const R=t.events.length;let k=R,A,F;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){if(A){F=t.events[k][1].end;break}A=!0}for(x(r),_=R;_<t.events.length;)t.events[_][1].end={...F},_++;gn(t.events,k+1,0,t.events.slice(R)),t.events.length=_}}function x(b){let I=n.length;for(;I-- >b;){const O=n[I];t.containerState=O[1],O[0].exit.call(t,e)}n.length=b}function g(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function q0(e,t,n){return Be(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Qc(e){if(e===null||At(e)||M0(e))return 1;if(j0(e))return 2}function il(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const ca={name:"attention",resolveAll:V0,tokenize:U0};function V0(e,t){let n=-1,r,i,o,s,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},h={...e[n][1].start};Gc(p,-l),Gc(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},o={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Wt(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Wt(c,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",o,t]]),c=Wt(c,il(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Wt(c,[["exit",o,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=Wt(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,gn(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function U0(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Qc(r);let o;return s;function s(l){return o=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===o)return e.consume(l),a;const c=e.exit("attentionSequence"),u=Qc(l),p=!u||u===2&&i||n.includes(l),h=!i||i===2&&u||n.includes(r);return c._open=!!(o===42?p:p&&(i||!h)),c._close=!!(o===42?h:h&&(u||!p)),t(l)}}function Gc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const z0={name:"autolink",tokenize:K0};function K0(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(f){return hn(f)?(e.consume(f),s):f===64?n(f):c(f)}function s(f){return f===43||f===45||f===46||Dt(f)?(r=1,a(f)):c(f)}function a(f){return f===58?(e.consume(f),r=0,l):(f===43||f===45||f===46||Dt(f))&&r++<32?(e.consume(f),a):(r=0,c(f))}function l(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||aa(f)?n(f):(e.consume(f),l)}function c(f){return f===64?(e.consume(f),u):A0(f)?(e.consume(f),c):n(f)}function u(f){return Dt(f)?p(f):n(f)}function p(f){return f===46?(e.consume(f),r=0,u):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):h(f)}function h(f){if((f===45||Dt(f))&&r++<63){const m=f===45?h:p;return e.consume(f),m}return n(f)}}const Vo={partial:!0,tokenize:H0};function H0(e,t,n){return r;function r(o){return Ee(o)?Be(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||he(o)?t(o):n(o)}}const Hp={continuation:{tokenize:W0},exit:Q0,name:"blockQuote",tokenize:J0};function J0(e,t,n){const r=this;return i;function i(s){if(s===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),o}return n(s)}function o(s){return Ee(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function W0(e,t,n){const r=this;return i;function i(s){return Ee(s)?Be(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)}function o(s){return e.attempt(Hp,t,n)(s)}}function Q0(e){e.exit("blockQuote")}const Jp={name:"characterEscape",tokenize:G0};function G0(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return P0(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const Wp={name:"characterReference",tokenize:X0};function X0(e,t,n){const r=this;let i=0,o,s;return a;function a(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),l}function l(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),o=31,s=Dt,u(p))}function c(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,s=F0,u):(e.enter("characterReferenceValue"),o=7,s=la,u(p))}function u(p){if(p===59&&i){const h=e.exit("characterReferenceValue");return s===Dt&&!rl(r.sliceSerialize(h))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(p)&&i++<o?(e.consume(p),u):n(p)}}const Xc={partial:!0,tokenize:Z0},Yc={concrete:!0,name:"codeFenced",tokenize:Y0};function Y0(e,t,n){const r=this,i={partial:!0,tokenize:O};let o=0,s=0,a;return l;function l(_){return c(_)}function c(_){const R=r.events[r.events.length-1];return o=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,a=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(_)}function u(_){return _===a?(s++,e.consume(_),u):s<3?n(_):(e.exit("codeFencedFenceSequence"),Ee(_)?Be(e,p,"whitespace")(_):p(_))}function p(_){return _===null||he(_)?(e.exit("codeFencedFence"),r.interrupt?t(_):e.check(Xc,v,I)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(_))}function h(_){return _===null||he(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(_)):Ee(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Be(e,f,"whitespace")(_)):_===96&&_===a?n(_):(e.consume(_),h)}function f(_){return _===null||he(_)?p(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||he(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(_)):_===96&&_===a?n(_):(e.consume(_),m)}function v(_){return e.attempt(i,I,y)(_)}function y(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),x}function x(_){return o>0&&Ee(_)?Be(e,g,"linePrefix",o+1)(_):g(_)}function g(_){return _===null||he(_)?e.check(Xc,v,I)(_):(e.enter("codeFlowValue"),b(_))}function b(_){return _===null||he(_)?(e.exit("codeFlowValue"),g(_)):(e.consume(_),b)}function I(_){return e.exit("codeFenced"),t(_)}function O(_,R,k){let A=0;return F;function F(B){return _.enter("lineEnding"),_.consume(B),_.exit("lineEnding"),j}function j(B){return _.enter("codeFencedFence"),Ee(B)?Be(_,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):L(B)}function L(B){return B===a?(_.enter("codeFencedFenceSequence"),H(B)):k(B)}function H(B){return B===a?(A++,_.consume(B),H):A>=s?(_.exit("codeFencedFenceSequence"),Ee(B)?Be(_,P,"whitespace")(B):P(B)):k(B)}function P(B){return B===null||he(B)?(_.exit("codeFencedFence"),R(B)):k(B)}}}function Z0(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const ms={name:"codeIndented",tokenize:tO},eO={partial:!0,tokenize:nO};function tO(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Be(e,o,"linePrefix",5)(c)}function o(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?l(c):he(c)?e.attempt(eO,s,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||he(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function nO(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):he(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):Be(e,o,"linePrefix",5)(s)}function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):he(s)?i(s):n(s)}}const rO={name:"codeText",previous:oO,resolve:iO,tokenize:sO};function iO(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function oO(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sO(e,t,n){let r=0,i,o;return s;function s(p){return e.enter("codeText"),e.enter("codeTextSequence"),a(p)}function a(p){return p===96?(e.consume(p),r++,a):(e.exit("codeTextSequence"),l(p))}function l(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),l):p===96?(o=e.enter("codeTextSequence"),i=0,u(p)):he(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(p))}function c(p){return p===null||p===32||p===96||he(p)?(e.exit("codeTextData"),l(p)):(e.consume(p),c)}function u(p){return p===96?(e.consume(p),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(o.type="codeTextData",c(p))}}class aO{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&ti(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ti(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ti(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ti(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ti(this.left,n.reverse())}}}function ti(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Qp(e){const t={};let n=-1,r,i,o,s,a,l,c;const u=new aO(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,lO(u,n)),n=t[n],c=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(s=u.get(o),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=o);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return gn(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function lO(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const a=s.events,l=[],c={};let u,p,h=-1,f=n,m=0,v=0;const y=[v];for(;f;){for(;e.get(++i)[1]!==f;);o.push(i),f._tokenizer||(u=r.sliceStream(f),f.next||u.push(null),p&&s.defineSkip(f.start),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),p=f,f=f.next}for(f=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(v=h+1,y.push(v),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(s.events=[],f?(f._tokenizer=void 0,f.previous=void 0):y.pop(),h=y.length;h--;){const x=a.slice(y[h],y[h+1]),g=o.pop();l.push([g,g+x.length-1]),e.splice(g,2,x)}for(l.reverse(),h=-1;++h<l.length;)c[m+l[h][0]]=m+l[h][1],m+=l[h][1]-l[h][0]-1;return c}const cO={resolve:dO,tokenize:pO},uO={partial:!0,tokenize:fO};function dO(e){return Qp(e),e}function pO(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?o(a):he(a)?e.check(uO,s,o)(a):(e.consume(a),i)}function o(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function fO(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Be(e,o,"linePrefix")}function o(s){if(s===null||he(s))return n(s);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function Gp(e,t,n,r,i,o,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return p;function p(x){return x===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(x),e.exit(o),h):x===null||x===32||x===41||aa(x)?n(x):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),v(x))}function h(x){return x===62?(e.enter(o),e.consume(x),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(x))}function f(x){return x===62?(e.exit("chunkString"),e.exit(a),h(x)):x===null||x===60||he(x)?n(x):(e.consume(x),x===92?m:f)}function m(x){return x===60||x===62||x===92?(e.consume(x),f):f(x)}function v(x){return!u&&(x===null||x===41||At(x))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(x)):u<c&&x===40?(e.consume(x),u++,v):x===41?(e.consume(x),u--,v):x===null||x===32||x===40||aa(x)?n(x):(e.consume(x),x===92?y:v)}function y(x){return x===40||x===41||x===92?(e.consume(x),v):v(x)}}function Xp(e,t,n,r,i,o){const s=this;let a=0,l;return c;function c(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(o),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):f===93?(e.exit(o),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):he(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),p(f))}function p(f){return f===null||f===91||f===93||he(f)||a++>999?(e.exit("chunkString"),u(f)):(e.consume(f),l||(l=!Ee(f)),f===92?h:p)}function h(f){return f===91||f===92||f===93?(e.consume(f),a++,p):p(f)}}function Yp(e,t,n,r,i,o){let s;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(o),c(h))}function c(h){return h===s?(e.exit(o),l(s)):h===null?n(h):he(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Be(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===s||h===null||he(h)?(e.exit("chunkString"),c(h)):(e.consume(h),h===92?p:u)}function p(h){return h===s||h===92?(e.consume(h),u):u(h)}}function ci(e,t){let n;return r;function r(i){return he(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ee(i)?Be(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const hO={name:"definition",tokenize:gO},mO={partial:!0,tokenize:yO};function gO(e,t,n){const r=this;let i;return o;function o(f){return e.enter("definition"),s(f)}function s(f){return Xp.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=Er(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),l):n(f)}function l(f){return At(f)?ci(e,c)(f):c(f)}function c(f){return Gp(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return e.attempt(mO,p,p)(f)}function p(f){return Ee(f)?Be(e,h,"whitespace")(f):h(f)}function h(f){return f===null||he(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function yO(e,t,n){return r;function r(a){return At(a)?ci(e,i)(a):n(a)}function i(a){return Yp(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Ee(a)?Be(e,s,"whitespace")(a):s(a)}function s(a){return a===null||he(a)?t(a):n(a)}}const vO={name:"hardBreakEscape",tokenize:bO};function bO(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return he(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const wO={name:"headingAtx",resolve:xO,tokenize:IO};function xO(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},gn(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function IO(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),o(u)}function o(u){return e.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&r++<6?(e.consume(u),s):u===null||At(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||he(u)?(e.exit("atxHeading"),t(u)):Ee(u)?Be(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||At(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const CO=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Zc=["pre","script","style","textarea"],SO={concrete:!0,name:"htmlFlow",resolveTo:EO,tokenize:NO},OO={partial:!0,tokenize:kO},_O={partial:!0,tokenize:TO};function EO(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function NO(e,t,n){const r=this;let i,o,s,a,l;return c;function c(S){return u(S)}function u(S){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(S),p}function p(S){return S===33?(e.consume(S),h):S===47?(e.consume(S),o=!0,v):S===63?(e.consume(S),i=3,r.interrupt?t:C):hn(S)?(e.consume(S),s=String.fromCharCode(S),y):n(S)}function h(S){return S===45?(e.consume(S),i=2,f):S===91?(e.consume(S),i=5,a=0,m):hn(S)?(e.consume(S),i=4,r.interrupt?t:C):n(S)}function f(S){return S===45?(e.consume(S),r.interrupt?t:C):n(S)}function m(S){const U="CDATA[";return S===U.charCodeAt(a++)?(e.consume(S),a===U.length?r.interrupt?t:L:m):n(S)}function v(S){return hn(S)?(e.consume(S),s=String.fromCharCode(S),y):n(S)}function y(S){if(S===null||S===47||S===62||At(S)){const U=S===47,V=s.toLowerCase();return!U&&!o&&Zc.includes(V)?(i=1,r.interrupt?t(S):L(S)):CO.includes(s.toLowerCase())?(i=6,U?(e.consume(S),x):r.interrupt?t(S):L(S)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(S):o?g(S):b(S))}return S===45||Dt(S)?(e.consume(S),s+=String.fromCharCode(S),y):n(S)}function x(S){return S===62?(e.consume(S),r.interrupt?t:L):n(S)}function g(S){return Ee(S)?(e.consume(S),g):F(S)}function b(S){return S===47?(e.consume(S),F):S===58||S===95||hn(S)?(e.consume(S),I):Ee(S)?(e.consume(S),b):F(S)}function I(S){return S===45||S===46||S===58||S===95||Dt(S)?(e.consume(S),I):O(S)}function O(S){return S===61?(e.consume(S),_):Ee(S)?(e.consume(S),O):b(S)}function _(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),l=S,R):Ee(S)?(e.consume(S),_):k(S)}function R(S){return S===l?(e.consume(S),l=null,A):S===null||he(S)?n(S):(e.consume(S),R)}function k(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||At(S)?O(S):(e.consume(S),k)}function A(S){return S===47||S===62||Ee(S)?b(S):n(S)}function F(S){return S===62?(e.consume(S),j):n(S)}function j(S){return S===null||he(S)?L(S):Ee(S)?(e.consume(S),j):n(S)}function L(S){return S===45&&i===2?(e.consume(S),X):S===60&&i===1?(e.consume(S),le):S===62&&i===4?(e.consume(S),W):S===63&&i===3?(e.consume(S),C):S===93&&i===5?(e.consume(S),ge):he(S)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(OO,$,H)(S)):S===null||he(S)?(e.exit("htmlFlowData"),H(S)):(e.consume(S),L)}function H(S){return e.check(_O,P,$)(S)}function P(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),B}function B(S){return S===null||he(S)?H(S):(e.enter("htmlFlowData"),L(S))}function X(S){return S===45?(e.consume(S),C):L(S)}function le(S){return S===47?(e.consume(S),s="",fe):L(S)}function fe(S){if(S===62){const U=s.toLowerCase();return Zc.includes(U)?(e.consume(S),W):L(S)}return hn(S)&&s.length<8?(e.consume(S),s+=String.fromCharCode(S),fe):L(S)}function ge(S){return S===93?(e.consume(S),C):L(S)}function C(S){return S===62?(e.consume(S),W):S===45&&i===2?(e.consume(S),C):L(S)}function W(S){return S===null||he(S)?(e.exit("htmlFlowData"),$(S)):(e.consume(S),W)}function $(S){return e.exit("htmlFlow"),t(S)}}function TO(e,t,n){const r=this;return i;function i(s){return he(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):n(s)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function kO(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Vo,t,n)}}const RO={name:"htmlText",tokenize:AO};function AO(e,t,n){const r=this;let i,o,s;return a;function a(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),c):C===47?(e.consume(C),O):C===63?(e.consume(C),b):hn(C)?(e.consume(C),k):n(C)}function c(C){return C===45?(e.consume(C),u):C===91?(e.consume(C),o=0,m):hn(C)?(e.consume(C),g):n(C)}function u(C){return C===45?(e.consume(C),f):n(C)}function p(C){return C===null?n(C):C===45?(e.consume(C),h):he(C)?(s=p,le(C)):(e.consume(C),p)}function h(C){return C===45?(e.consume(C),f):p(C)}function f(C){return C===62?X(C):C===45?h(C):p(C)}function m(C){const W="CDATA[";return C===W.charCodeAt(o++)?(e.consume(C),o===W.length?v:m):n(C)}function v(C){return C===null?n(C):C===93?(e.consume(C),y):he(C)?(s=v,le(C)):(e.consume(C),v)}function y(C){return C===93?(e.consume(C),x):v(C)}function x(C){return C===62?X(C):C===93?(e.consume(C),x):v(C)}function g(C){return C===null||C===62?X(C):he(C)?(s=g,le(C)):(e.consume(C),g)}function b(C){return C===null?n(C):C===63?(e.consume(C),I):he(C)?(s=b,le(C)):(e.consume(C),b)}function I(C){return C===62?X(C):b(C)}function O(C){return hn(C)?(e.consume(C),_):n(C)}function _(C){return C===45||Dt(C)?(e.consume(C),_):R(C)}function R(C){return he(C)?(s=R,le(C)):Ee(C)?(e.consume(C),R):X(C)}function k(C){return C===45||Dt(C)?(e.consume(C),k):C===47||C===62||At(C)?A(C):n(C)}function A(C){return C===47?(e.consume(C),X):C===58||C===95||hn(C)?(e.consume(C),F):he(C)?(s=A,le(C)):Ee(C)?(e.consume(C),A):X(C)}function F(C){return C===45||C===46||C===58||C===95||Dt(C)?(e.consume(C),F):j(C)}function j(C){return C===61?(e.consume(C),L):he(C)?(s=j,le(C)):Ee(C)?(e.consume(C),j):A(C)}function L(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),i=C,H):he(C)?(s=L,le(C)):Ee(C)?(e.consume(C),L):(e.consume(C),P)}function H(C){return C===i?(e.consume(C),i=void 0,B):C===null?n(C):he(C)?(s=H,le(C)):(e.consume(C),H)}function P(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||At(C)?A(C):(e.consume(C),P)}function B(C){return C===47||C===62||At(C)?A(C):n(C)}function X(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function le(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),fe}function fe(C){return Ee(C)?Be(e,ge,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):ge(C)}function ge(C){return e.enter("htmlTextData"),s(C)}}const ol={name:"labelEnd",resolveAll:MO,resolveTo:DO,tokenize:LO},FO={tokenize:BO},PO={tokenize:$O},jO={tokenize:qO};function MO(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&gn(e,0,e.length,n),e}function DO(e,t){let n=e.length,r=0,i,o,s,a;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const l={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[o][1].start},end:{...e[s][1].end}},u={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[s-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=Wt(a,e.slice(o+1,o+r+3)),a=Wt(a,[["enter",u,t]]),a=Wt(a,il(t.parser.constructs.insideSpan.null,e.slice(o+r+4,s-3),t)),a=Wt(a,[["exit",u,t],e[s-2],e[s-1],["exit",c,t]]),a=Wt(a,e.slice(s+1)),a=Wt(a,[["exit",l,t]]),gn(e,o,e.length,a),e}function LO(e,t,n){const r=this;let i=r.events.length,o,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return a;function a(h){return o?o._inactive?p(h):(s=r.parser.defined.includes(Er(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(FO,u,s?u:p)(h):h===91?e.attempt(PO,u,s?c:p)(h):s?u(h):p(h)}function c(h){return e.attempt(jO,u,p)(h)}function u(h){return t(h)}function p(h){return o._balanced=!0,n(h)}}function BO(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),i}function i(p){return At(p)?ci(e,o)(p):o(p)}function o(p){return p===41?u(p):Gp(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function s(p){return At(p)?ci(e,l)(p):u(p)}function a(p){return n(p)}function l(p){return p===34||p===39||p===40?Yp(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):u(p)}function c(p){return At(p)?ci(e,u)(p):u(p)}function u(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function $O(e,t,n){const r=this;return i;function i(a){return Xp.call(r,e,o,s,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(Er(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function qO(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const VO={name:"labelStartImage",resolveAll:ol.resolveAll,tokenize:UO};function UO(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),o}function o(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const zO={name:"labelStartLink",resolveAll:ol.resolveAll,tokenize:KO};function KO(e,t,n){const r=this;return i;function i(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),o}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const gs={name:"lineEnding",tokenize:HO};function HO(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Be(e,t,"linePrefix")}}const lo={name:"thematicBreak",tokenize:JO};function JO(e,t,n){let r=0,i;return o;function o(c){return e.enter("thematicBreak"),s(c)}function s(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||he(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ee(c)?Be(e,a,"whitespace")(c):a(c))}}const kt={continuation:{tokenize:XO},exit:ZO,name:"list",tokenize:GO},WO={partial:!0,tokenize:e1},QO={partial:!0,tokenize:YO};function GO(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(f){const m=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:la(f)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(lo,n,c)(f):c(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(f)}return n(f)}function l(f){return la(f)&&++s<10?(e.consume(f),l):(!r.interrupt||s<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):n(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(Vo,r.interrupt?n:u,e.attempt(WO,h,p))}function u(f){return r.containerState.initialBlankLine=!0,o++,h(f)}function p(f){return Ee(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function XO(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Vo,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Be(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!Ee(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(QO,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Be(e,e.attempt(kt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function YO(e,t,n){const r=this;return Be(e,i,"listItemIndent",r.containerState.size+1);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(o):n(o)}}function ZO(e){e.exit(this.containerState.type)}function e1(e,t,n){const r=this;return Be(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const s=r.events[r.events.length-1];return!Ee(o)&&s&&s[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const eu={name:"setextUnderline",resolveTo:t1,tokenize:n1};function t1(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",s,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function n1(e,t,n){const r=this;let i;return o;function o(c){let u=r.events.length,p;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){p=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),i=c,s(c)):n(c)}function s(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Ee(c)?Be(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||he(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const r1={tokenize:i1};function i1(e){const t=this,n=e.attempt(Vo,r,e.attempt(this.parser.constructs.flowInitial,i,Be(e,e.attempt(this.parser.constructs.flow,i,e.attempt(cO,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const o1={resolveAll:ef()},s1=Zp("string"),a1=Zp("text");function Zp(e){return{resolveAll:ef(e==="text"?l1:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,s,a);return s;function s(u){return c(u)?o(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),o(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const p=i[u];let h=-1;if(p)for(;++h<p.length;){const f=p[h];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function ef(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function l1(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,s=-1,a=0,l;for(;o--;){const c=i[o];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)l=!0,a++;else if(c!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:r.start._bufferIndex+s,_index:r.start._index+o,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const c1={42:kt,43:kt,45:kt,48:kt,49:kt,50:kt,51:kt,52:kt,53:kt,54:kt,55:kt,56:kt,57:kt,62:Hp},u1={91:hO},d1={[-2]:ms,[-1]:ms,32:ms},p1={35:wO,42:lo,45:[eu,lo],60:SO,61:eu,95:lo,96:Yc,126:Yc},f1={38:Wp,92:Jp},h1={[-5]:gs,[-4]:gs,[-3]:gs,33:VO,38:Wp,42:ca,60:[z0,RO],91:zO,92:[vO,Jp],93:ol,95:ca,96:rO},m1={null:[ca,o1]},g1={null:[42,95]},y1={null:[]},v1=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:g1,contentInitial:u1,disable:y1,document:c1,flow:p1,flowInitial:d1,insideSpan:m1,string:f1,text:h1},Symbol.toStringTag,{value:"Module"}));function b1(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let s=[],a=[];const l={attempt:R(O),check:R(_),consume:g,enter:b,exit:I,interrupt:R(_,{interrupt:!0})},c={code:null,containerState:{},defineSkip:v,events:[],now:m,parser:e,previous:null,sliceSerialize:h,sliceStream:f,write:p};let u=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function p(j){return s=Wt(s,j),y(),s[s.length-1]!==null?[]:(k(t,0),c.events=il(o,c.events,c),c.events)}function h(j,L){return x1(f(j),L)}function f(j){return w1(s,j)}function m(){const{_bufferIndex:j,_index:L,line:H,column:P,offset:B}=r;return{_bufferIndex:j,_index:L,line:H,column:P,offset:B}}function v(j){i[j.line]=j.column,F()}function y(){let j;for(;r._index<s.length;){const L=s[r._index];if(typeof L=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<L.length;)x(L.charCodeAt(r._bufferIndex));else x(L)}}function x(j){u=u(j)}function g(j){he(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,F()):j!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=j}function b(j,L){const H=L||{};return H.type=j,H.start=m(),c.events.push(["enter",H,c]),a.push(H),H}function I(j){const L=a.pop();return L.end=m(),c.events.push(["exit",L,c]),L}function O(j,L){k(j,L.from)}function _(j,L){L.restore()}function R(j,L){return H;function H(P,B,X){let le,fe,ge,C;return Array.isArray(P)?$(P):"tokenize"in P?$([P]):W(P);function W(Y){return ie;function ie(ne){const se=ne!==null&&Y[ne],ee=ne!==null&&Y.null,me=[...Array.isArray(se)?se:se?[se]:[],...Array.isArray(ee)?ee:ee?[ee]:[]];return $(me)(ne)}}function $(Y){return le=Y,fe=0,Y.length===0?X:S(Y[fe])}function S(Y){return ie;function ie(ne){return C=A(),ge=Y,Y.partial||(c.currentConstruct=Y),Y.name&&c.parser.constructs.disable.null.includes(Y.name)?V():Y.tokenize.call(L?Object.assign(Object.create(c),L):c,l,U,V)(ne)}}function U(Y){return j(ge,C),B}function V(Y){return C.restore(),++fe<le.length?S(le[fe]):X}}}function k(j,L){j.resolveAll&&!o.includes(j)&&o.push(j),j.resolve&&gn(c.events,L,c.events.length-L,j.resolve(c.events.slice(L),c)),j.resolveTo&&(c.events=j.resolveTo(c.events,c))}function A(){const j=m(),L=c.previous,H=c.currentConstruct,P=c.events.length,B=Array.from(a);return{from:P,restore:X};function X(){r=j,c.previous=L,c.currentConstruct=H,c.events.length=P,a=B,F()}}function F(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function w1(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,o)];else{if(s=e.slice(n,i),r>-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}function x1(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let s;if(typeof o=="string")s=o;else switch(o){case-5:{s="\r";break}case-4:{s=`
5
+ [Remedy] ${o.remedy}`:""}`;t&&t(a)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message),t&&t(e.message)};function Ci(e,t){const n=wt(e,t),{projectIdOrName:r}=He(),{setError:i,removeError:o}=vn(),s=pr({queryKey:["amp","integrations",r],queryFn:async()=>{if(!r)throw new Error("Project ID or name is required");return(await n()).integrationApi.listIntegrations({projectIdOrName:r})},enabled:!!r});return w.useEffect(()=>{s.isError?(Ke(s.error),i(Ie.INTEGRATION_LIST,r)):o(Ie.INTEGRATION_LIST,r)},[s.isError,s.error,r,i,o]),s}const Pa=(e,t,n)=>{const r=wt(t,n),{projectIdOrName:i}=He(),{data:o,isError:s,error:a}=Ci(t,n),l=o?.find(u=>u.name===e)?.id,c=pr({queryKey:["amp","installations",i,l,t],queryFn:async()=>{if(!i)throw new Error("Project ID is required");if(!l)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await r()).installationApi.listInstallations({projectIdOrName:i,integrationId:l,groupRef:t})},enabled:!s&&!!i&&!!l&&!!t&&!!o&&o.length>0});return{...c,isError:c.isError||s,error:c.error||a}},an=()=>{const{setError:e}=vn(),t=wt(),{projectIdOrName:n}=He(),r=pr({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return w.useEffect(()=>{r.isError&&e(Ie.PROJECT,n)},[r.isError,n,e]),{...r,projectIdOrName:n,appName:r.data?.appName,projectId:r.data?.id}};function ln(){const{integrationNameOrId:e,groupRef:t}=Jn(),n=Pa(e,t),{isPending:r,isFetching:i,isError:o,isSuccess:s,error:a,data:l}=n;return{installation:l?.[0],isPending:r,isFetching:i,isError:o,isSuccess:s,error:a}}function fr(e){return!e.fieldName}function iI(e){return e?.requiredFields?.filter(t=>!fr(t)&&!!t.fieldName)||null}function ja(e){return e?.optionalFields?.filter(t=>!fr(t)&&!!t.fieldName)||null}function Gd(e){return e?.requiredFields?.filter(n=>fr(n)&&!!n.mapToName)||[]}function Xd(e){return e?.optionalFields?.filter(n=>fr(n)&&!!n.mapToName)||[]}const hr=e=>{const t=Ci(),r=t.data?.find(i=>i.name===e||i.id===e);return{...t,data:r,provider:r?.provider}},Ma=()=>{const{groupRef:e,integrationNameOrId:t}=Jn(),{provider:n}=hr(t),r=La({groupRef:e,provider:n}),{isPending:i,isFetching:o,isError:s,isSuccess:a,error:l,data:c}=r;return{connection:c?.[0],error:l,isPending:i,isFetching:o,isError:s,isSuccess:a}},Yd=()=>{const e=wt(),{connection:t,isPending:n,isFetching:r}=Ma(),{projectIdOrName:i}=He(),{integrationNameOrId:o}=Jn(),{data:s}=hr(o),a=t?.id,l=s?.id,c=s?.latestRevision?.id;return pr({queryKey:["amp","hydratedRevision",i,l,c,a],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!l)throw new Error("integrationId is required");if(!c)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await e()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:l,revisionId:c,connectionId:a})},enabled:!!i&&!!l&&!!c&&!!a&&!(n||r)})};function Tn(){const e=Yd(),{isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,data:a}=e,l=a?.content,c=w.useMemo(()=>({getReadObjects:()=>l?.read?.objects??[],getReadObject:u=>{const p=l?.read?.objects?.find(y=>y.objectName===u);if(!p)return console.error(`Object ${u} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null,getRequiredMapFields:()=>null,getOptionalMapFields:()=>null};const h=(y="raw")=>y==="mappings"?Gd(p)??[]:y==="no-mappings"?iI(p)??[]:p.requiredFields??[],f=(y="raw")=>y==="mappings"?Xd(p)??[]:y==="no-mappings"?ja(p)??[]:p.optionalFields??[];return{object:p,getRequiredFields:h,getOptionalFields:f,getRequiredMapFields:()=>h("mappings"),getOptionalMapFields:()=>f("mappings")}},getWriteObject:u=>{const p=l?.write?.objects?.find(h=>h.objectName===u);return p?{object:p}:(console.error(`Object ${u} not found`),{object:null})},getCustomerFieldsForObject:u=>{const p=l?.read?.objects?.find(h=>h.objectName===u);return p?{allFields:p.allFieldsMetadata??{},getField:h=>{const f=p.allFieldsMetadata?.[h];return f||(console.error(`Field ${h} not found`),null)}}:(console.error(`Object ${u} not found`),{allFields:null,getField:()=>null})}}),[l?.read?.objects,l?.write?.objects]);return{data:a,isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,...c}}function oI(e){const[t,n]=w.useState(e),r=w.useRef(void 0),{data:i,getReadObject:o}=Tn(),{installation:s}=ln(),a=w.useCallback(()=>t,[t]),l=w.useCallback((y,m)=>{m.provider=m.provider||i?.content?.provider||"";const g=m.read||{objects:{}},x=g.objects||{},b=x[y]||{};b.objectName=b.objectName||y;const v=o(y);if(v){const I=[...v.getRequiredMapFields()??[],...v.getOptionalMapFields()??[]];I.length>0&&(b.selectedFieldMappings=b.selectedFieldMappings||{},I.forEach(O=>{O._default&&!b.selectedFieldMappings[O.mapToName]&&(b.selectedFieldMappings[O.mapToName]=O._default)}))}return x[y]=b,g.objects=x,m.read=g,{read:g,objects:x,obj:b}},[i?.content?.provider,o]),c=w.useCallback(y=>{n(m=>ct(m,g=>{g.read?.objects?.[y]&&delete g.read.objects[y],g.write?.objects?.[y]&&delete g.write.objects[y]}))},[]),u=w.useCallback(y=>({object:t.read?.objects?.[y],setEnableRead:()=>{n(m=>ct(m,g=>{const{obj:x}=l(y,g);x.disabled=!1}))},setDisableRead:()=>{n(m=>ct(m,g=>{const{obj:x}=l(y,g);x.disabled=!0}))},getSelectedField:m=>!!t.read?.objects?.[y]?.selectedFields?.[m],setSelectedField:({fieldName:m,selected:g})=>{n(x=>ct(x,b=>{const{obj:v}=l(y,b);v.selectedFields=v.selectedFields||{},v.selectedFields[m]=g,v.selectedFields[m]===!1&&delete v.selectedFields[m]}))},getFieldMapping:m=>t.read?.objects?.[y]?.selectedFieldMappings?.[m],setFieldMapping:({fieldName:m,mapToName:g})=>{n(x=>ct(x,b=>{const{obj:v}=l(y,b);v.selectedFieldMappings=v.selectedFieldMappings||{},v.selectedFieldMappings[g]=m}))},deleteFieldMapping:m=>{n(g=>ct(g,x=>{const b=x.read?.objects?.[y]?.selectedFieldMappings;b&&m in b&&delete b[m]}))}}),[t.read?.objects,l]),p=w.useCallback(y=>{const m=t.write?.objects?.[y],g=v=>{const I=v.write||{},O=I.objects||{},E=O[y]||{objectName:y};return O[y]=E,I.objects=O,v.write=I,{write:I,objects:O,obj:E}},x=(v,I)=>m?.selectedFieldSettings?.[v]?.[I],b=(v,I,O)=>{n(E=>ct(E,R=>{const{obj:T}=g(R);T.selectedFieldSettings={...T.selectedFieldSettings,[v]:{...T.selectedFieldSettings?.[v],[I]:O}}}))};return{object:m,setEnableWrite:()=>{n(v=>ct(v,I=>{const{obj:O}=g(I);O.objectName=y}))},setDisableWrite:()=>{n(v=>ct(v,I=>{const{objects:O}=g(I);delete O[y]}))},getWriteObject:()=>t.write?.objects?.[y],getSelectedFieldSettings:v=>m?.selectedFieldSettings?.[v],setSelectedFieldSettings:({fieldName:v,settings:I})=>{n(O=>ct(O,E=>{const{obj:R}=g(E),T=R.selectedFieldSettings||{};R.selectedFieldSettings={...T,[v]:I},I===void 0&&delete R.selectedFieldSettings[v]}))},getDefaultValues:v=>x(v,"default"),setDefaultValues:({fieldName:v,value:I})=>b(v,"default",I),getWriteOnCreateSetting:v=>x(v,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:v,value:I})=>b(v,"writeOnCreate",I),getWriteOnUpdateSetting:v=>x(v,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:v,value:I})=>b(v,"writeOnUpdate",I),setEnableDeletion:()=>{n(v=>ct(v,I=>{const{obj:O}=g(I);O.deletionSettings={enabled:!0}}))},setDisableDeletion:()=>{n(v=>ct(v,I=>{const{obj:O}=g(I);O.deletionSettings={enabled:!1}}))}}},[t.write?.objects]),h=w.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(y=>ct(y,m=>{m.proxy={enabled:!0}}))},setDisableProxy:()=>{n(y=>ct(y,m=>{m.proxy={enabled:!1}}))},getProxyEnabled:()=>t.proxy?.enabled||!1}),[t.proxy]),f=w.useCallback(()=>{n(y=>ct(y,m=>{Object.assign(m,s?.config?.content)}))},[s?.config?.content]);return w.useEffect(()=>{s&&(console.debug("Installation found",{installation:s}),r.current?Qd(r.current,s)||(console.debug("Installation changed, resetting config",{previous:r.current,current:s}),f(),r.current=s):(r.current=s,f()))},[s,f]),{draft:t,get:a,reset:f,setDraft:n,removeObject:c,readObject:u,writeObject:p,proxy:h}}const Da=w.createContext(null);function sI({children:e,initialConfig:t}){const n=oI(t);return d.jsx(Da.Provider,{value:n,children:e})}function jo(){const e=w.useContext(Da);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function aI(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=w.useContext(Da);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const Zd=w.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Jn(){const e=w.useContext(Zd);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function Mo({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o}){const s=w.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o}),[t,n,r,i,o]);return d.jsx(Zd.Provider,{value:s,children:d.jsx(sI,{initialConfig:{},children:e})})}class ea{constructor(t){this.connectionApi=new qw(t),this.installationApi=new $w(t),this.integrationApi=new Vw(t),this.oAuthApi=new Uw(t),this.projectApi=new zw(t),this.providerApi=new Kw(t),this.providerAppApi=new Hw(t),this.revisionApi=new Jw(t)}}const ep="2.13.5",lI="v1",Ji="https://api.withampersand.com";function tp(){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 Ji;case"mock":return"http://127.0.0.1:4010";case"":return Ji;default:return e??Ji}}catch{return Ji}}const cI=(e,t)=>`${e}/${t}`;function uI(){return cI(tp(),lI)}const np=tp(),rp=uI(),dI=new Sa({basePath:rp,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":ep}});new ea(dI);const pI=e=>({header:"X-Api-Key",value:e}),fI=e=>{try{return{header:"Authorization",value:`Bearer ${e}`}}catch(t){throw console.error("Failed to get JWT token for API authentication:",t),new Error("Failed to authenticate with JWT token")}},_c=(e,t)=>new Sa({basePath:rp,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":ep,[e]:t}});function wt(e,t){const n=qd(),{getToken:r}=$x(),i=Jn(),o=t||i.consumerRef,s=e||i.groupRef;return w.useCallback(async()=>{if(n){const l=pI(n),c=_c(l.header,l.value);return new ea(c)}if(r){if(!o||!s)throw console.error("Unable to create JWT API service without consumerRef or groupRef.",{consumerRef:o,groupRef:s}),new Error("Unable to create JWT API service without consumerRef or groupRef. Provide via InstallationProvider or useAPI parameters.");const l=await r({consumerRef:o,groupRef:s}),c=fI(l),u=_c(c.header,c.value);return new ea(u)}throw console.error("Unable to create API service without API key or JWT token."),new Error("Unable to create API service without API key or JWT token.")},[n,r,o,s])}const La=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=He(),r=wt();return pr({queryKey:["amp","connections",n,e,t],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!e)throw new Error("Group reference not found.");if(!t)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:n,groupRef:e,provider:t})},retry:3,enabled:!!n&&!!e&&!!t})};function hI({height:e="48",width:t="48"}){return d.jsxs("svg",{width:t,height:e,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.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"}),d.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const mI="_box_1p7c5_1",Ec={box:mI};function kn({children:e,className:t,style:n}){return d.jsx("div",{className:t?`${Ec.box} ${t}`:Ec.box,style:n,children:e})}const gI="_container_1wvzr_1",Nc={container:gI};function qr({children:e,className:t,style:n}){return d.jsx("div",{className:t?`${Nc.container} ${t}`:Nc.container,style:n,children:e})}const yI="_errorBoxContainer_19655_1",vI="_errorBox_19655_1",bI="_errorIconWrapper_19655_23",wI="_errorText_19655_34",so={errorBoxContainer:yI,errorBox:vI,errorIconWrapper:bI,errorText:wI};function ip({message:e}){return d.jsxs(kn,{className:so.errorBox,children:[d.jsx("div",{className:so.errorIconWrapper,children:d.jsx(hI,{width:"20",height:"20"})}),d.jsx("p",{className:so.errorText,children:e})]})}function op({message:e,children:t}){return d.jsxs(qr,{className:so.errorBoxContainer,children:[d.jsx(ip,{message:e}),t]})}const xI="_loader_6ubm6_1",II={loader:xI};function CI(){return d.jsx("span",{className:II.loader})}function vi(){return d.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:d.jsx(CI,{})})}function sp({children:e}){return d.jsx(qr,{style:{maxWidth:"55rem"},children:d.jsx(kn,{children:e})})}function mr(){return d.jsx(sp,{children:d.jsx(vi,{})})}function ot({message:e,children:t}){return d.jsx(sp,{children:d.jsx(op,{message:e,children:t})})}function Ba(e,t){try{return process.env[e]}catch{return t}}function Yt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function SI(e,t){return t?.displayName??Yt(e)}const OI=e=>e.split(`
6
+ `).filter(n=>n.trim()!==""),_I=(e,t)=>t?.length===0||!e?null:t.find(n=>n.name===e)??null;function EI(e){return!e||typeof e!="string"?"id_"+Math.random().toString(36).substr(2,9):e.toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").replace(/^[^a-z]/,"id-").substring(0,50)}const NI=()=>{const[e,t]=w.useState(!1),n=w.useCallback(()=>{t(!0)},[t]),r=w.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},ap=w.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{},resetComponent:()=>{}});function st(){const e=w.useContext(ap);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function lp({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,fieldMapping:c,resetComponent:u}){const{data:p}=Ci(),{setError:h,isError:f,removeError:y}=vn(),{isIntegrationDeleted:m,setIntegrationDeleted:g,resetIntegrationDeleted:x}=NI(),b=w.useMemo(()=>_I(t,p||[]),[t,p]),{data:v,isLoading:I,isError:O,error:E}=Pa(t,i),R=v?.[0]||null;w.useEffect(()=>{x()},[t,n,r,i,o,c]),w.useEffect(()=>{b===null&&p?.length&&console.error(`Integration "${t}" not found in integration list`)},[t,b,p]),w.useEffect(()=>{O?(h(Ie.INSTALLATION_LIST,b?.id||""),Ke(E)):y(Ie.INSTALLATION_LIST,b?.id||"")},[O,b,h,y,E]);const T=Ze(),A=w.useCallback(()=>{T.invalidateQueries({queryKey:["amp","installations"]})},[T]),F=w.useCallback(H=>{T.setQueryData(["amp","installations"],[H]),T.invalidateQueries({queryKey:["amp","installations"]})},[T]),j=b?.id||"",L=w.useMemo(()=>({integrationId:b?.id||"",provider:b?.provider||"",integrationObj:b,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:R||void 0,setInstallation:F,resetInstallations:A,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,isIntegrationDeleted:m,setIntegrationDeleted:g,fieldMapping:c,resetComponent:u}),[b,n,r,i,o,R,F,A,s,a,l,m,g,c,u]);if(I)return d.jsx(mr,{});if(b===null)return d.jsx(ot,{message:`Integration "${t}" not found`});if(f(Ie.INSTALLATION_LIST,j)){const H=`Error retrieving installation information for integration "${b?.name||"unknown"}"`;return d.jsx(ot,{message:H})}return d.jsx(ap.Provider,{value:L,children:e})}const cp=w.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),cn=()=>{const e=w.useContext(cp);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function qa({groupRef:e,provider:t,children:n}){const r=Ze(),{setError:i,isError:o}=vn(),{projectIdOrName:s,isLoading:a}=an(),{integrationId:l,groupRef:c}=st(),{provider:u}=hr(l),{data:p,isLoading:h,isError:f,error:y}=La({groupRef:e||c,provider:u||t}),m=p?.[0],g=w.useCallback(v=>{r.setQueryData(["amp","connections"],()=>v),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),x=w.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);w.useEffect(()=>{f?(i(Ie.CONNECTION_LIST,s,!0),Ke(y)):i(Ie.CONNECTION_LIST,s,!1)},[f,i,s,y]);const b=w.useMemo(()=>({connections:p||null,isConnectionsLoading:h,selectedConnection:m||null,setConnections:g,setSelectedConnection:x}),[p,h,m,g,x]);if(h||a)return d.jsx(mr,{});if(s&&o(Ie.PROJECT,s))return d.jsx(ot,{message:`Error loading project ${s}`});if(s&&o(Ie.CONNECTION_LIST,s))return d.jsx(ot,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID or Project Name not found. ConnectionsProvider must be used within AmpersandProvider");return d.jsx(cp.Provider,{value:b,children:n})}const up=()=>{const e=wt(),t=Ze(),[n,r]=w.useState(null);return{...Nn({mutationKey:["createInstallation"],mutationFn:async o=>(await e()).installationApi.createInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error creating installation"),Ke(o,r)}}),errorMsg:n}};function TI(e){return typeof e.provider=="string"}function kI(e){return TI(e)?{data:e}:{error:new Error("Config must have a provider field for creation")}}function $a(){const{projectIdOrName:e}=He(),{groupRef:t,integrationNameOrId:n}=Jn(),{data:r}=hr(n),{connection:i}=Ma(),{installation:o}=ln(),s=Ze(),{mutate:a,isIdle:l,isPending:c,error:u,errorMsg:p}=up();return{createInstallation:({config:f,onSuccess:y,onError:m,onSettled:g})=>{if(o){const I=new Error("Installation already created. Try updating instead.");m?.(I),g?.();return}if(!r){const I=new Error("No integration found");m?.(I),g?.();return}const x={...f,provider:f.provider||r.provider||""},b=kI(x);if(b.error||!b.data){m?.(b.error||new Error("Invalid configuration data")),g?.();return}const v={projectIdOrName:e,integrationId:r?.id,installation:{groupRef:t,connectionId:i?.id,config:{content:b.data}}};return a(v,{onSuccess:I=>{y?.(I)},onError:I=>{m?.(I)},onSettled:()=>{g?.(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:l,isPending:c,error:u,errorMsg:p}}const dp=()=>{const e=wt(),t=Ze(),[n,r]=w.useState(null);return{...Nn({mutationKey:["updateInstallation"],mutationFn:async o=>(await e()).installationApi.updateInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error updating installation"),Ke(o,r)}}),errorMsg:n}};function pp(){const{projectIdOrName:e}=He(),{integrationNameOrId:t}=Jn(),{data:n}=hr(t),{installation:r}=ln(),i=Ze(),{mutate:o,isIdle:s,isPending:a,error:l,errorMsg:c}=dp();return{updateInstallation:({config:p,onSuccess:h,onError:f,onSettled:y})=>{if(!r){const x=new Error("Installation not created yet. Try creating the installation first.");f?.(x),y?.();return}if(!n){const x=new Error("No integration found");f?.(x),y?.();return}const m=[];if(p?.write?.objects){const x=Object.keys(p.write.objects).length,b=Object.keys(r?.config?.content?.write?.objects||{}).length;(x>0||x===0&&b>0)&&m.push("config.content.write.objects")}if(p?.read?.objects){const x=Object.keys(p.read.objects);m.push(...x.map(b=>`config.content.read.objects.${b}`))}const g={projectIdOrName:e,integrationId:n?.id,installationId:r.id,installationUpdate:{updateMask:m,installation:{config:{content:p}}}};return o(g,{onSuccess:x=>{h?.(x)},onError:x=>{f?.(x)},onSettled:()=>{y?.(),i.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:l,errorMsg:c}}const RI=()=>{const e=wt(),t=Ze(),[n,r]=w.useState(null);return{...Nn({mutationKey:["deleteInstallation"],mutationFn:async o=>(await e()).installationApi.deleteInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error deleting installation"),Ke(o,r)}}),errorMsg:n}};function AI(){const{projectIdOrName:e}=He(),{integrationNameOrId:t}=Jn(),{data:n}=hr(t),{installation:r}=ln(),i=Ze(),{mutate:o,isIdle:s,isPending:a,error:l,errorMsg:c}=RI();return{deleteInstallation:({onSuccess:p,onError:h,onSettled:f})=>{if(!r){const y=new Error("Installation not found. Not able to delete installation.");h?.(y),f?.();return}if(!n){const y=new Error("No integration found");h?.(y),f?.();return}return o({projectIdOrName:e,integrationId:n?.id,installationId:r.id},{onSuccess:()=>{p?.()},onError:y=>{h?.(y)},onSettled:()=>{f?.(),i.invalidateQueries({queryKey:["amp","installations"]}),i.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:l,errorMsg:c}}function Va(){const[e,t]=w.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}class Do extends w.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Ampersand Error Boundary caught an error:",t),console.error("[Error Info]:",n),this.props.onError?.(t,n)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:d.jsx(ot,{message:this.state.error?.message||"Something went wrong. Please try again later."}):this.props.children}}const fp=e=>{const t=wt(),{provider:n}=st(),r=e||n;return pr({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},ut=e=>{const t=fp(e),{data:n}=t,{provider:r}=st(),i=n&&SI(n?.name,n);return{...t,providerName:i,selectedProvider:e||r}};var Gt=(e=>(e[e.Connect=0]="Connect",e[e.SelectObjects=1]="SelectObjects",e[e.ConfigureObjects=2]="ConfigureObjects",e[e.Review=3]="Review",e[e.Success=4]="Success",e))(Gt||{});const FI={0:"Connect",1:"Select Objects",2:"Configure",3:"Review"},Tc=4;function PI(e,t){switch(t.type){case"SET_STEP":return{...e,currentStep:t.step};case"NEXT_STEP":return{...e,currentStep:Math.min(e.currentStep+1,4)};case"PREV_STEP":return{...e,currentStep:Math.max(e.currentStep-1,0)};case"SET_SELECTED_OBJECTS":return{...e,selectedObjects:t.objects,currentObjectIndex:0};case"SET_CURRENT_OBJECT_INDEX":return{...e,currentObjectIndex:t.index};case"NEXT_OBJECT":return{...e,currentObjectIndex:Math.min(e.currentObjectIndex+1,e.selectedObjects.length-1)};case"PREV_OBJECT":return{...e,currentObjectIndex:Math.max(e.currentObjectIndex-1,0)};case"SET_SUBMITTING":return{...e,isSubmitting:t.isSubmitting};case"SET_SUBMISSION_ERROR":return{...e,submissionError:t.error};default:return e}}const jI={currentStep:0,selectedObjects:[],currentObjectIndex:0,isSubmitting:!1,submissionError:null},hp=w.createContext(null);function MI({children:e}){const[t,n]=w.useReducer(PI,jI),r=w.useCallback(g=>n({type:"SET_STEP",step:g}),[]),i=w.useCallback(()=>n({type:"NEXT_STEP"}),[]),o=w.useCallback(()=>n({type:"PREV_STEP"}),[]),s=w.useCallback(g=>n({type:"SET_SELECTED_OBJECTS",objects:g}),[]),a=w.useCallback(()=>n({type:"NEXT_OBJECT"}),[]),l=w.useCallback(()=>n({type:"PREV_OBJECT"}),[]),c=w.useCallback(g=>n({type:"SET_CURRENT_OBJECT_INDEX",index:g}),[]),u=w.useCallback(g=>n({type:"SET_SUBMITTING",isSubmitting:g}),[]),p=w.useCallback(g=>n({type:"SET_SUBMISSION_ERROR",error:g}),[]),h=t.currentObjectIndex===0,f=t.currentObjectIndex===t.selectedObjects.length-1,y=t.selectedObjects[t.currentObjectIndex],m=w.useMemo(()=>({state:t,goToStep:r,nextStep:i,prevStep:o,setSelectedObjects:s,nextObject:a,prevObject:l,setCurrentObjectIndex:c,setSubmitting:u,setSubmissionError:p,isFirstObject:h,isLastObject:f,currentObjectName:y}),[t,r,i,o,s,a,l,c,u,p,h,f,y]);return d.jsx(hp.Provider,{value:m,children:e})}function un(){const e=w.useContext(hp);if(!e)throw new Error("useWizard must be used within a WizardProvider");return e}var as={exports:{}};var kc;function DI(){return kc||(kc=1,(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})()})(as)),as.exports}var LI=DI();const Xt=Br(LI),BI="_button_kwfiu_1",qI="_danger_kwfiu_42",$I="_ghost_kwfiu_47",ls={button:BI,danger:qI,ghost:$I};function Be({className:e,style:t,type:n,children:r,variant:i,...o}){const s=Xt(ls.button,{[ls.danger]:i==="danger",[ls.ghost]:i==="ghost",[e||""]:!!e});return d.jsx("button",{type:n,className:s,style:t,...o,children:r})}const VI="_navigation_oq8uj_1",UI="_backButton_oq8uj_10",zI="_nextButton_oq8uj_14",cs={navigation:VI,backButton:UI,nextButton:zI};function vo({onNext:e,onBack:t,nextLabel:n,backLabel:r="Back",nextDisabled:i=!1,showBack:o=!0,showNext:s=!0}){const{state:a,nextStep:l,prevStep:c}=un(),{currentStep:u}=a,p=t||c,h=e||l,f=u===Gt.Connect;return d.jsxs("div",{className:cs.navigation,children:[o&&!f?d.jsx(Be,{type:"button",variant:"ghost",className:cs.backButton,onClick:p,children:r}):d.jsx("div",{}),s&&d.jsx(Be,{type:"button",className:cs.nextButton,onClick:h,disabled:i,children:n||"Next"})]})}const KI="_input_1ymb7_1",HI="_inputError_1ymb7_27",us={input:KI,inputError:HI};function mp({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?Xt(us.inputError,us.input):us.input;return d.jsx("input",{id:e,type:t,className:Xt(o,n),...i})}function Rc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gp(...e){return t=>{let n=!1;const r=e.map(i=>{const o=Rc(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():Rc(e[i],null)}}}}function kr(...e){return J.useCallback(gp(...e),e)}function Lo(e,t=[]){let n=[];function r(o,s){const a=J.createContext(s),l=n.length;n=[...n,s];const c=p=>{const{scope:h,children:f,...y}=p,m=h?.[e]?.[l]||a,g=J.useMemo(()=>y,Object.values(y));return d.jsx(m.Provider,{value:g,children:f})};c.displayName=o+"Provider";function u(p,h){const f=h?.[e]?.[l]||a,y=J.useContext(f);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>J.createContext(s));return function(a){const l=a?.[e]||o;return J.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,JI(i,...t)]}function JI(...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:l,scopeName:c})=>{const p=l(o)[`__scope${c}`];return{...a,...p}},{});return J.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function rn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}var bi=globalThis?.document?J.useLayoutEffect:()=>{},WI=J[" useInsertionEffect ".trim().toString()]||bi;function Ua({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,s]=QI({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const u=J.useRef(e!==void 0);J.useEffect(()=>{const p=u.current;p!==a&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=J.useCallback(u=>{if(a){const p=GI(u)?u(e):u;p!==e&&s.current?.(p)}else o(u)},[a,e,o,s]);return[l,c]}function QI({defaultProp:e,onChange:t}){const[n,r]=J.useState(e),i=J.useRef(n),o=J.useRef(t);return WI(()=>{o.current=t},[t]),J.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function GI(e){return typeof e=="function"}function XI(e){const t=J.useRef({value:e,previous:e});return J.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function YI(e){const[t,n]=J.useState(void 0);return bi(()=>{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 l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.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 ZI(e,t){return J.useReducer((n,r)=>t[n][r]??n,e)}var za=e=>{const{present:t,children:n}=e,r=eC(t),i=typeof n=="function"?n({present:r.isPresent}):J.Children.only(n),o=kr(r.ref,tC(i));return typeof n=="function"||r.isPresent?J.cloneElement(i,{ref:o}):null};za.displayName="Presence";function eC(e){const[t,n]=J.useState(),r=J.useRef(null),i=J.useRef(e),o=J.useRef("none"),s=e?"mounted":"unmounted",[a,l]=ZI(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return J.useEffect(()=>{const c=Wi(r.current);o.current=a==="mounted"?c:"none"},[a]),bi(()=>{const c=r.current,u=i.current;if(u!==e){const h=o.current,f=Wi(c);e?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),bi(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,p=f=>{const m=Wi(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&m&&(l("ANIMATION_END"),!i.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=f=>{f.target===t&&(o.current=Wi(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:J.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Wi(e){return e?.animationName||"none"}function tC(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ta(e){const t=nC(e),n=J.forwardRef((r,i)=>{const{children:o,...s}=r,a=J.Children.toArray(o),l=a.find(iC);if(l){const c=l.props.children,u=a.map(p=>p===l?J.Children.count(c)>1?J.Children.only(null):J.isValidElement(c)?c.props.children:null:p);return d.jsx(t,{...s,ref:i,children:J.isValidElement(c)?J.cloneElement(c,void 0,u):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function nC(e){const t=J.forwardRef((n,r)=>{const{children:i,...o}=n;if(J.isValidElement(i)){const s=sC(i),a=oC(o,i.props);return i.type!==J.Fragment&&(a.ref=r?gp(r,s):s),J.cloneElement(i,a)}return J.Children.count(i)>1?J.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rC=Symbol("radix.slottable");function iC(e){return J.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rC}function oC(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)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function sC(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var aC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rn=aC.reduce((e,t)=>{const n=ta(`Primitive.${t}`),r=J.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Bo="Checkbox",[lC]=Lo(Bo),[cC,Ka]=lC(Bo);function uC(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:o,form:s,name:a,onCheckedChange:l,required:c,value:u="on",internal_do_not_use_render:p}=e,[h,f]=Ua({prop:n,defaultProp:i??!1,onChange:l,caller:Bo}),[y,m]=J.useState(null),[g,x]=J.useState(null),b=J.useRef(!1),v=y?!!s||!!y.closest("form"):!0,I={checked:h,disabled:o,setChecked:f,control:y,setControl:m,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:b,required:c,defaultChecked:Vn(i)?!1:i,isFormControl:v,bubbleInput:g,setBubbleInput:x};return d.jsx(cC,{scope:t,...I,children:dC(p)?p(I):r})}var yp="CheckboxTrigger",vp=J.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{const{control:o,value:s,disabled:a,checked:l,required:c,setControl:u,setChecked:p,hasConsumerStoppedPropagationRef:h,isFormControl:f,bubbleInput:y}=Ka(yp,e),m=kr(i,u),g=J.useRef(l);return J.useEffect(()=>{const x=o?.form;if(x){const b=()=>p(g.current);return x.addEventListener("reset",b),()=>x.removeEventListener("reset",b)}},[o,p]),d.jsx(Rn.button,{type:"button",role:"checkbox","aria-checked":Vn(l)?"mixed":l,"aria-required":c,"data-state":Ip(l),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:m,onKeyDown:rn(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:rn(n,x=>{p(b=>Vn(b)?!0:!b),y&&f&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})})});vp.displayName=yp;var Ha=J.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:l,onCheckedChange:c,form:u,...p}=e;return d.jsx(uC,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:a,required:s,onCheckedChange:c,name:r,form:u,value:l,internal_do_not_use_render:({isFormControl:h})=>d.jsxs(d.Fragment,{children:[d.jsx(vp,{...p,ref:t,__scopeCheckbox:n}),h&&d.jsx(xp,{__scopeCheckbox:n})]})})});Ha.displayName=Bo;var bp="CheckboxIndicator",Ja=J.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=Ka(bp,n);return d.jsx(za,{present:r||Vn(o.checked)||o.checked===!0,children:d.jsx(Rn.span,{"data-state":Ip(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Ja.displayName=bp;var wp="CheckboxBubbleInput",xp=J.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:s,required:a,disabled:l,name:c,value:u,form:p,bubbleInput:h,setBubbleInput:f}=Ka(wp,e),y=kr(n,f),m=XI(o),g=YI(r);J.useEffect(()=>{const b=h;if(!b)return;const v=window.HTMLInputElement.prototype,O=Object.getOwnPropertyDescriptor(v,"checked").set,E=!i.current;if(m!==o&&O){const R=new Event("click",{bubbles:E});b.indeterminate=Vn(o),O.call(b,Vn(o)?!1:o),b.dispatchEvent(R)}},[h,m,o,i]);const x=J.useRef(Vn(o)?!1:o);return d.jsx(Rn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??x.current,required:a,disabled:l,name:c,value:u,form:p,...t,tabIndex:-1,ref:y,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});xp.displayName=wp;function dC(e){return typeof e=="function"}function Vn(e){return e==="indeterminate"}function Ip(e){return Vn(e)?"indeterminate":e?"checked":"unchecked"}function $r(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 pC=["color"],Cp=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$r(e,pC);return w.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}),w.createElement("path",{d:"M8.14645 3.14645C8.34171 2.95118 8.65829 2.95118 8.85355 3.14645L12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L8.85355 11.8536C8.65829 12.0488 8.34171 12.0488 8.14645 11.8536C7.95118 11.6583 7.95118 11.3417 8.14645 11.1464L11.2929 8H2.5C2.22386 8 2 7.77614 2 7.5C2 7.22386 2.22386 7 2.5 7H11.2929L8.14645 3.85355C7.95118 3.65829 7.95118 3.34171 8.14645 3.14645Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),fC=["color"],Sp=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$r(e,fC);return w.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}),w.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),hC=["color"],mC=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$r(e,hC);return w.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}),w.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),gC=["color"],Op=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$r(e,gC);return w.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}),w.createElement("path",{d:"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),yC=["color"],vC=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$r(e,yC);return w.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}),w.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),bC=["color"],Wa=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$r(e,bC);return w.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}),w.createElement("path",{d:"M4.81812 4.68161C4.99386 4.85734 4.99386 5.14227 4.81812 5.318L3.08632 7.0498H11.9135L10.1817 5.318C10.006 5.14227 10.006 4.85734 10.1817 4.68161C10.3575 4.50587 10.6424 4.50587 10.8181 4.68161L13.3181 7.18161C13.4939 7.35734 13.4939 7.64227 13.3181 7.818L10.8181 10.318C10.6424 10.4937 10.3575 10.4937 10.1817 10.318C10.006 10.1423 10.006 9.85734 10.1817 9.68161L11.9135 7.9498H3.08632L4.81812 9.68161C4.99386 9.85734 4.99386 10.1423 4.81812 10.318C4.64239 10.4937 4.35746 10.4937 4.18173 10.318L1.68173 7.818C1.50599 7.64227 1.50599 7.35734 1.68173 7.18161L4.18173 4.68161C4.35746 4.50587 4.64239 4.50587 4.81812 4.68161Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const wC="_checkboxGroupContainer_hqfeu_1",xC="_stack_hqfeu_6",IC="_selectAllContainer_hqfeu_10",CC="_fieldContainer_hqfeu_17",SC="_checkbox_hqfeu_1",Rr={checkboxGroupContainer:wC,stack:xC,selectAllContainer:IC,fieldContainer:CC,checkbox:SC};function OC({id:e,isChecked:t,label:n,onCheckedChange:r}){return d.jsxs("div",{className:Rr.fieldContainer,children:[d.jsx(Ha,{className:Rr.checkbox,id:e,onCheckedChange:r,checked:t,children:d.jsx(Ja,{children:d.jsx(Sp,{})})}),d.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function _C({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return d.jsxs("div",{className:Rr.selectAllContainer,children:[d.jsx(Ha,{className:Rr.checkbox,id:e,onCheckedChange:r,checked:i?"indeterminate":t,children:d.jsxs(Ja,{children:[i&&d.jsx(mC,{}),t===!0&&d.jsx(Sp,{})]})}),d.jsx("label",{htmlFor:e,children:n})]})}function EC({children:e}){return d.jsx("div",{className:Rr.checkboxGroupContainer,children:e})}function NC({children:e}){return d.jsx("div",{className:Rr.stack,children:e})}const TC="_paginationContainer_1p51x_1",kC="_pageInfo_1p51x_7",RC="_searchContainer_1p51x_13",AC="_searchInput_1p51x_17",FC="_noResults_1p51x_21",Gr={paginationContainer:TC,pageInfo:kC,searchContainer:RC,searchInput:AC,noResults:FC};function Qa({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:i=!0,searchPlaceholder:o="Search fields...",itemName:s="fields"}){const[a,l]=w.useState(1),[c,u]=w.useState(""),p=e.filter(I=>I.label.toLowerCase().includes(c.toLowerCase())),h=Math.ceil(p.length/n),f=(a-1)*n,y=f+n,m=p.slice(f,y),g=I=>{u(I),l(1)},x=I=>{p.forEach(O=>{t(O.id,I)})},b=p.length>0&&p.every(I=>I.isChecked),v=p.some(I=>I.isChecked);return d.jsxs(EC,{children:[i&&d.jsx("div",{className:Gr.searchContainer,children:d.jsx(mp,{id:"field-search",type:"text",placeholder:o,value:c,onChange:I=>g(I.target.value),className:Gr.searchInput})}),r&&e.length>=2&&d.jsx(_C,{id:"select-all-fields",isChecked:b,label:`Select all ${p.length} ${c?"matching ":""}${s}`,onCheckedChange:x,isIndeterminate:v&&!b}),d.jsx(NC,{children:m.map(I=>d.jsx(OC,{id:I.id,isChecked:I.isChecked,label:I.label,onCheckedChange:O=>t(I.id,O===!0)},I.id))}),h>1&&d.jsxs("div",{className:Gr.paginationContainer,children:[d.jsx(Be,{type:"button",onClick:()=>l(I=>Math.max(1,I-1)),disabled:a===1,variant:"ghost",children:"<"}),d.jsxs("span",{className:Gr.pageInfo,children:[a," of ",h]}),d.jsx(Be,{type:"button",onClick:()=>l(I=>Math.min(h,I+1)),disabled:a===h,variant:"ghost",children:">"})]}),p.length===0&&c&&d.jsxs("div",{className:Gr.noResults,children:["No ",s,' found matching "',c,'"']})]})}const PC="_sectionTitle_1e9ty_1",jC="_helperText_1e9ty_10",Ac={sectionTitle:PC,helperText:jC};function bo({title:e,description:t}){return d.jsxs(d.Fragment,{children:[d.jsx("h3",{className:Ac.sectionTitle,children:e}),d.jsx("p",{className:Ac.helperText,children:t})]})}function MC({providerDisplayName:e,appName:t,optionalFieldItems:n,onItemChange:r}){return d.jsxs(d.Fragment,{children:[d.jsx(bo,{title:"Additional Fields",description:`Would you like to share any optional ${e} fields with ${t}?`}),d.jsx(Qa,{items:n,onItemChange:r})]})}function _p(e){return"fieldName"in e}function na(e){return _p(e)?e.fieldName:""}function Ep(e){return _p(e)?e.displayName||e.fieldName:""}function DC(e,t){return qo(e,t)[0]}function Fc(e,t){const n=qo(e,t);return n[n.length-1]}function qo(e,t){const n=e.getReadObject(t);if(!n)return["fields"];const r=[],i=(n.getRequiredFields("no-mappings")?.length??0)>0,o=!!n.object?.mapToName;return(i||o)&&r.push("fields"),((n.getRequiredMapFields()?.length??0)>0||(n.getOptionalMapFields()?.length??0)>0)&&r.push("mappings"),(n.getOptionalFields("no-mappings")?.length??0)>0&&r.push("additional"),r.length>0?r:["fields"]}const LC="_configureObjects_1di5e_1",BC="_objectConfigPanel_1di5e_10",qC="_objectName_1di5e_18",$C="_objectDescription_1di5e_26",VC="_empty_1di5e_33",UC="_mappingDisabledInput_1di5e_47",zC="_mappingDisabledInputText_1di5e_62",nn={configureObjects:LC,objectConfigPanel:BC,objectName:qC,objectDescription:$C,empty:VC,mappingDisabledInput:UC,mappingDisabledInputText:zC},KC="_fieldSection_186dk_1",HC="_fieldCardGrid_186dk_6",JC="_fieldCard_186dk_6",WC="_fieldCardDisabled_186dk_29",QC="_fieldCardName_186dk_41",GC="_noFields_186dk_47",XC="_objectMappingInline_186dk_58",YC="_objectMappingArrow_186dk_65",Cn={fieldSection:KC,fieldCardGrid:HC,fieldCard:JC,fieldCardDisabled:WC,fieldCardName:QC,noFields:GC,objectMappingInline:XC,objectMappingArrow:YC};function ZC({objectDisplayName:e,providerDisplayName:t,appName:n,hasObjectMapping:r,objectMapToDisplayName:i,isMappingBidirectional:o,hasRequiredFields:s,requiredFields:a,hasFieldsContent:l}){return d.jsxs(d.Fragment,{children:[r&&d.jsxs("div",{className:Cn.fieldSection,children:[d.jsx(bo,{title:"Object Mapping",description:`This ${t} object is mapped to the corresponding ${n} object.`}),d.jsxs("div",{className:Cn.objectMappingInline,children:[d.jsx("div",{className:nn.mappingDisabledInput,children:d.jsx("span",{className:nn.mappingDisabledInputText,children:e})}),d.jsx("div",{className:Cn.objectMappingArrow,children:o?d.jsx(Wa,{}):d.jsx(Cp,{})}),d.jsx("div",{className:nn.mappingDisabledInput,children:d.jsx("span",{className:nn.mappingDisabledInputText,children:i})})]})]}),s&&d.jsxs("div",{className:Cn.fieldSection,children:[d.jsx(bo,{title:"Included Fields",description:"These fields are always read and require no configuration."}),d.jsx("div",{className:Cn.fieldCardGrid,children:a.map(c=>{const u=na(c),p=Ep(c);return d.jsx("div",{className:`${Cn.fieldCard} ${Cn.fieldCardDisabled}`,children:d.jsx("span",{className:Cn.fieldCardName,children:p})},u)})})]}),!l&&d.jsxs("p",{className:Cn.noFields,children:["No configurable fields for ",e,"."]})]})}function _n(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 we(){return we=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},we.apply(null,arguments)}function ra(e,t){return ra=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ra(e,t)}function eS(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ra(e,t)}var Qi={exports:{}},Gi={exports:{}},Ne={};var Pc;function tS(){if(Pc)return Ne;Pc=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,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,b=e?Symbol.for("react.scope"):60119;function v(O){if(typeof O=="object"&&O!==null){var E=O.$$typeof;switch(E){case t:switch(O=O.type,O){case l:case c:case r:case o:case i:case p:return O;default:switch(O=O&&O.$$typeof,O){case a:case u:case y:case f:case s:return O;default:return E}}case n:return E}}}function I(O){return v(O)===c}return Ne.AsyncMode=l,Ne.ConcurrentMode=c,Ne.ContextConsumer=a,Ne.ContextProvider=s,Ne.Element=t,Ne.ForwardRef=u,Ne.Fragment=r,Ne.Lazy=y,Ne.Memo=f,Ne.Portal=n,Ne.Profiler=o,Ne.StrictMode=i,Ne.Suspense=p,Ne.isAsyncMode=function(O){return I(O)||v(O)===l},Ne.isConcurrentMode=I,Ne.isContextConsumer=function(O){return v(O)===a},Ne.isContextProvider=function(O){return v(O)===s},Ne.isElement=function(O){return typeof O=="object"&&O!==null&&O.$$typeof===t},Ne.isForwardRef=function(O){return v(O)===u},Ne.isFragment=function(O){return v(O)===r},Ne.isLazy=function(O){return v(O)===y},Ne.isMemo=function(O){return v(O)===f},Ne.isPortal=function(O){return v(O)===n},Ne.isProfiler=function(O){return v(O)===o},Ne.isStrictMode=function(O){return v(O)===i},Ne.isSuspense=function(O){return v(O)===p},Ne.isValidElementType=function(O){return typeof O=="string"||typeof O=="function"||O===r||O===c||O===o||O===i||O===p||O===h||typeof O=="object"&&O!==null&&(O.$$typeof===y||O.$$typeof===f||O.$$typeof===s||O.$$typeof===a||O.$$typeof===u||O.$$typeof===g||O.$$typeof===x||O.$$typeof===b||O.$$typeof===m)},Ne.typeOf=v,Ne}var Te={};var jc;function nS(){return jc||(jc=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,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,b=e?Symbol.for("react.scope"):60119;function v($){return typeof $=="string"||typeof $=="function"||$===r||$===c||$===o||$===i||$===p||$===h||typeof $=="object"&&$!==null&&($.$$typeof===y||$.$$typeof===f||$.$$typeof===s||$.$$typeof===a||$.$$typeof===u||$.$$typeof===g||$.$$typeof===x||$.$$typeof===b||$.$$typeof===m)}function I($){if(typeof $=="object"&&$!==null){var ye=$.$$typeof;switch(ye){case t:var Z=$.type;switch(Z){case l:case c:case r:case o:case i:case p:return Z;default:var qe=Z&&Z.$$typeof;switch(qe){case a:case u:case y:case f:case s:return qe;default:return ye}}case n:return ye}}}var O=l,E=c,R=a,T=s,A=t,F=u,j=r,L=y,H=f,P=n,B=o,X=i,le=p,fe=!1;function ge($){return fe||(fe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),C($)||I($)===l}function C($){return I($)===c}function W($){return I($)===a}function q($){return I($)===s}function S($){return typeof $=="object"&&$!==null&&$.$$typeof===t}function U($){return I($)===u}function V($){return I($)===r}function Y($){return I($)===y}function ie($){return I($)===f}function ne($){return I($)===n}function se($){return I($)===o}function ee($){return I($)===i}function me($){return I($)===p}Te.AsyncMode=O,Te.ConcurrentMode=E,Te.ContextConsumer=R,Te.ContextProvider=T,Te.Element=A,Te.ForwardRef=F,Te.Fragment=j,Te.Lazy=L,Te.Memo=H,Te.Portal=P,Te.Profiler=B,Te.StrictMode=X,Te.Suspense=le,Te.isAsyncMode=ge,Te.isConcurrentMode=C,Te.isContextConsumer=W,Te.isContextProvider=q,Te.isElement=S,Te.isForwardRef=U,Te.isFragment=V,Te.isLazy=Y,Te.isMemo=ie,Te.isPortal=ne,Te.isProfiler=se,Te.isStrictMode=ee,Te.isSuspense=me,Te.isValidElementType=v,Te.typeOf=I})()),Te}var Mc;function Np(){return Mc||(Mc=1,process.env.NODE_ENV==="production"?Gi.exports=tS():Gi.exports=nS()),Gi.exports}var ds,Dc;function rS(){if(Dc)return ds;Dc=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 l=Object.getOwnPropertyNames(s).map(function(u){return s[u]});if(l.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ds=i()?Object.assign:function(o,s){for(var a,l=r(o),c,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var p in a)t.call(a,p)&&(l[p]=a[p]);if(e){c=e(a);for(var h=0;h<c.length;h++)n.call(a,c[h])&&(l[c[h]]=a[c[h]])}}return l},ds}var ps,Lc;function Ga(){if(Lc)return ps;Lc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ps=e,ps}var fs,Bc;function Tp(){return Bc||(Bc=1,fs=Function.call.bind(Object.prototype.hasOwnProperty)),fs}var hs,qc;function iS(){if(qc)return hs;qc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Ga(),n={},r=Tp();e=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,a,l,c){if(process.env.NODE_ENV!=="production"){for(var u in o)if(r(o,u)){var p;try{if(typeof o[u]!="function"){var h=Error((l||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}p=o[u](s,u,l,a,null,t)}catch(y){p=y}if(p&&!(p instanceof Error)&&e((l||"React class")+": type specification of "+a+" `"+u+"` 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=c?c():"";e("Failed "+a+" type: "+p.message+(f??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},hs=i,hs}var ms,$c;function oS(){if($c)return ms;$c=1;var e=Np(),t=rS(),n=Ga(),r=Tp(),i=iS(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return ms=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function p(C){var W=C&&(c&&C[c]||C[u]);if(typeof W=="function")return W}var h="<<anonymous>>",f={array:x("array"),bigint:x("bigint"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:b(),arrayOf:v,element:I(),elementType:O(),instanceOf:E,node:F(),objectOf:T,oneOf:R,oneOfType:A,shape:L,exact:H};function y(C,W){return C===W?C!==0||1/C===1/W:C!==C&&W!==W}function m(C,W){this.message=C,this.data=W&&typeof W=="object"?W:{},this.stack=""}m.prototype=Error.prototype;function g(C){if(process.env.NODE_ENV!=="production")var W={},q=0;function S(V,Y,ie,ne,se,ee,me){if(ne=ne||h,ee=ee||ie,me!==n){if(l){var $=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 $.name="Invariant Violation",$}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ye=ne+":"+ie;!W[ye]&&q<3&&(o("You are manually calling a React.PropTypes validation function for the `"+ee+"` prop on `"+ne+"`. 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."),W[ye]=!0,q++)}}return Y[ie]==null?V?Y[ie]===null?new m("The "+se+" `"+ee+"` is marked as required "+("in `"+ne+"`, but its value is `null`.")):new m("The "+se+" `"+ee+"` is marked as required in "+("`"+ne+"`, but its value is `undefined`.")):null:C(Y,ie,ne,se,ee)}var U=S.bind(null,!1);return U.isRequired=S.bind(null,!0),U}function x(C){function W(q,S,U,V,Y,ie){var ne=q[S],se=X(ne);if(se!==C){var ee=le(ne);return new m("Invalid "+V+" `"+Y+"` of type "+("`"+ee+"` supplied to `"+U+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return g(W)}function b(){return g(s)}function v(C){function W(q,S,U,V,Y){if(typeof C!="function")return new m("Property `"+Y+"` of component `"+U+"` has invalid PropType notation inside arrayOf.");var ie=q[S];if(!Array.isArray(ie)){var ne=X(ie);return new m("Invalid "+V+" `"+Y+"` of type "+("`"+ne+"` supplied to `"+U+"`, expected an array."))}for(var se=0;se<ie.length;se++){var ee=C(ie,se,U,V,Y+"["+se+"]",n);if(ee instanceof Error)return ee}return null}return g(W)}function I(){function C(W,q,S,U,V){var Y=W[q];if(!a(Y)){var ie=X(Y);return new m("Invalid "+U+" `"+V+"` of type "+("`"+ie+"` supplied to `"+S+"`, expected a single ReactElement."))}return null}return g(C)}function O(){function C(W,q,S,U,V){var Y=W[q];if(!e.isValidElementType(Y)){var ie=X(Y);return new m("Invalid "+U+" `"+V+"` of type "+("`"+ie+"` supplied to `"+S+"`, expected a single ReactElement type."))}return null}return g(C)}function E(C){function W(q,S,U,V,Y){if(!(q[S]instanceof C)){var ie=C.name||h,ne=ge(q[S]);return new m("Invalid "+V+" `"+Y+"` of type "+("`"+ne+"` supplied to `"+U+"`, expected ")+("instance of `"+ie+"`."))}return null}return g(W)}function R(C){if(!Array.isArray(C))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 W(q,S,U,V,Y){for(var ie=q[S],ne=0;ne<C.length;ne++)if(y(ie,C[ne]))return null;var se=JSON.stringify(C,function(me,$){var ye=le($);return ye==="symbol"?String($):$});return new m("Invalid "+V+" `"+Y+"` of value `"+String(ie)+"` "+("supplied to `"+U+"`, expected one of "+se+"."))}return g(W)}function T(C){function W(q,S,U,V,Y){if(typeof C!="function")return new m("Property `"+Y+"` of component `"+U+"` has invalid PropType notation inside objectOf.");var ie=q[S],ne=X(ie);if(ne!=="object")return new m("Invalid "+V+" `"+Y+"` of type "+("`"+ne+"` supplied to `"+U+"`, expected an object."));for(var se in ie)if(r(ie,se)){var ee=C(ie,se,U,V,Y+"."+se,n);if(ee instanceof Error)return ee}return null}return g(W)}function A(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var W=0;W<C.length;W++){var q=C[W];if(typeof q!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+fe(q)+" at index "+W+"."),s}function S(U,V,Y,ie,ne){for(var se=[],ee=0;ee<C.length;ee++){var me=C[ee],$=me(U,V,Y,ie,ne,n);if($==null)return null;$.data&&r($.data,"expectedType")&&se.push($.data.expectedType)}var ye=se.length>0?", expected one of type ["+se.join(", ")+"]":"";return new m("Invalid "+ie+" `"+ne+"` supplied to "+("`"+Y+"`"+ye+"."))}return g(S)}function F(){function C(W,q,S,U,V){return P(W[q])?null:new m("Invalid "+U+" `"+V+"` supplied to "+("`"+S+"`, expected a ReactNode."))}return g(C)}function j(C,W,q,S,U){return new m((C||"React class")+": "+W+" type `"+q+"."+S+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+U+"`.")}function L(C){function W(q,S,U,V,Y){var ie=q[S],ne=X(ie);if(ne!=="object")return new m("Invalid "+V+" `"+Y+"` of type `"+ne+"` "+("supplied to `"+U+"`, expected `object`."));for(var se in C){var ee=C[se];if(typeof ee!="function")return j(U,V,Y,se,le(ee));var me=ee(ie,se,U,V,Y+"."+se,n);if(me)return me}return null}return g(W)}function H(C){function W(q,S,U,V,Y){var ie=q[S],ne=X(ie);if(ne!=="object")return new m("Invalid "+V+" `"+Y+"` of type `"+ne+"` "+("supplied to `"+U+"`, expected `object`."));var se=t({},q[S],C);for(var ee in se){var me=C[ee];if(r(C,ee)&&typeof me!="function")return j(U,V,Y,ee,le(me));if(!me)return new m("Invalid "+V+" `"+Y+"` key `"+ee+"` supplied to `"+U+"`.\nBad object: "+JSON.stringify(q[S],null," ")+`
7
+ Valid keys: `+JSON.stringify(Object.keys(C),null," "));var $=me(ie,ee,U,V,Y+"."+ee,n);if($)return $}return null}return g(W)}function P(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(P);if(C===null||a(C))return!0;var W=p(C);if(W){var q=W.call(C),S;if(W!==C.entries){for(;!(S=q.next()).done;)if(!P(S.value))return!1}else for(;!(S=q.next()).done;){var U=S.value;if(U&&!P(U[1]))return!1}}else return!1;return!0;default:return!1}}function B(C,W){return C==="symbol"?!0:W?W["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&W instanceof Symbol:!1}function X(C){var W=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":B(W,C)?"symbol":W}function le(C){if(typeof C>"u"||C===null)return""+C;var W=X(C);if(W==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return W}function fe(C){var W=le(C);switch(W){case"array":case"object":return"an "+W;case"boolean":case"date":case"regexp":return"a "+W;default:return W}}function ge(C){return!C.constructor||!C.constructor.name?h:C.constructor.name}return f.checkPropTypes=i,f.resetWarningCache=i.resetWarningCache,f.PropTypes=f,f},ms}var gs,Vc;function sS(){if(Vc)return gs;Vc=1;var e=Ga();function t(){}function n(){}return n.resetWarningCache=t,gs=function(){function r(s,a,l,c,u,p){if(p!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},gs}var Uc;function aS(){if(Uc)return Qi.exports;if(Uc=1,process.env.NODE_ENV!=="production"){var e=Np(),t=!0;Qi.exports=oS()(e.isElement,t)}else Qi.exports=sS()();return Qi.exports}var lS=aS();const G=Br(lS);var Xi={exports:{}},ke={};var zc;function cS(){if(zc)return ke;zc=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"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function m(g){if(typeof g=="object"&&g!==null){var x=g.$$typeof;switch(x){case e:switch(g=g.type,g){case n:case i:case r:case c:case u:return g;default:switch(g=g&&g.$$typeof,g){case a:case s:case l:case h:case p:case o:return g;default:return x}}case t:return x}}}return ke.ContextConsumer=s,ke.ContextProvider=o,ke.Element=e,ke.ForwardRef=l,ke.Fragment=n,ke.Lazy=h,ke.Memo=p,ke.Portal=t,ke.Profiler=i,ke.StrictMode=r,ke.Suspense=c,ke.SuspenseList=u,ke.isAsyncMode=function(){return!1},ke.isConcurrentMode=function(){return!1},ke.isContextConsumer=function(g){return m(g)===s},ke.isContextProvider=function(g){return m(g)===o},ke.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},ke.isForwardRef=function(g){return m(g)===l},ke.isFragment=function(g){return m(g)===n},ke.isLazy=function(g){return m(g)===h},ke.isMemo=function(g){return m(g)===p},ke.isPortal=function(g){return m(g)===t},ke.isProfiler=function(g){return m(g)===i},ke.isStrictMode=function(g){return m(g)===r},ke.isSuspense=function(g){return m(g)===c},ke.isSuspenseList=function(g){return m(g)===u},ke.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===i||g===r||g===c||g===u||g===f||typeof g=="object"&&g!==null&&(g.$$typeof===h||g.$$typeof===p||g.$$typeof===o||g.$$typeof===s||g.$$typeof===l||g.$$typeof===y||g.getModuleId!==void 0)},ke.typeOf=m,ke}var Re={};var Kc;function uS(){return Kc||(Kc=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"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),y=!1,m=!1,g=!1,x=!1,b=!1,v;v=Symbol.for("react.module.reference");function I(Z){return!!(typeof Z=="string"||typeof Z=="function"||Z===n||Z===i||b||Z===r||Z===c||Z===u||x||Z===f||y||m||g||typeof Z=="object"&&Z!==null&&(Z.$$typeof===h||Z.$$typeof===p||Z.$$typeof===o||Z.$$typeof===s||Z.$$typeof===l||Z.$$typeof===v||Z.getModuleId!==void 0))}function O(Z){if(typeof Z=="object"&&Z!==null){var qe=Z.$$typeof;switch(qe){case e:var Fe=Z.type;switch(Fe){case n:case i:case r:case c:case u:return Fe;default:var Ae=Fe&&Fe.$$typeof;switch(Ae){case a:case s:case l:case h:case p:case o:return Ae;default:return qe}}case t:return qe}}}var E=s,R=o,T=e,A=l,F=n,j=h,L=p,H=t,P=i,B=r,X=c,le=u,fe=!1,ge=!1;function C(Z){return fe||(fe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function W(Z){return ge||(ge=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function q(Z){return O(Z)===s}function S(Z){return O(Z)===o}function U(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===e}function V(Z){return O(Z)===l}function Y(Z){return O(Z)===n}function ie(Z){return O(Z)===h}function ne(Z){return O(Z)===p}function se(Z){return O(Z)===t}function ee(Z){return O(Z)===i}function me(Z){return O(Z)===r}function $(Z){return O(Z)===c}function ye(Z){return O(Z)===u}Re.ContextConsumer=E,Re.ContextProvider=R,Re.Element=T,Re.ForwardRef=A,Re.Fragment=F,Re.Lazy=j,Re.Memo=L,Re.Portal=H,Re.Profiler=P,Re.StrictMode=B,Re.Suspense=X,Re.SuspenseList=le,Re.isAsyncMode=C,Re.isConcurrentMode=W,Re.isContextConsumer=q,Re.isContextProvider=S,Re.isElement=U,Re.isForwardRef=V,Re.isFragment=Y,Re.isLazy=ie,Re.isMemo=ne,Re.isPortal=se,Re.isProfiler=ee,Re.isStrictMode=me,Re.isSuspense=$,Re.isSuspenseList=ye,Re.isValidElementType=I,Re.typeOf=O})()),Re}var Hc;function dS(){return Hc||(Hc=1,process.env.NODE_ENV==="production"?Xi.exports=cS():Xi.exports=uS()),Xi.exports}var Jc=dS();const Wc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Qc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",ys=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Qc(n.overflowY,t)||Qc(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},Yi=(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,pS=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},fS=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{inline:s,boundary:a,skipOverflowHiddenElements:l}=t,c=typeof a=="function"?a:H=>H!==a;if(!Wc(e))throw new TypeError("Invalid target");const u=document.scrollingElement||document.documentElement,p=[];let h=e;for(;Wc(h)&&c(h);){if(h=pS(h),h===u){p.push(h);break}h!=null&&h===document.body&&ys(h)&&!ys(document.documentElement)||h!=null&&ys(h,l)&&p.push(h)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(o=(i=window.visualViewport)==null?void 0:i.height)!=null?o:innerHeight,{scrollX:m,scrollY:g}=window,{height:x,width:b,top:v,right:I,bottom:O,left:E}=e.getBoundingClientRect(),{top:R,right:T,left:A}=(H=>{const P=window.getComputedStyle(H);return{top:parseFloat(P.scrollMarginTop)||0,right:parseFloat(P.scrollMarginRight)||0,bottom:parseFloat(P.scrollMarginBottom)||0,left:parseFloat(P.scrollMarginLeft)||0}})(e);let F=v-R,j=s==="center"?E+b/2-A+T:s==="end"?I+T:E-A;const L=[];for(let H=0;H<p.length;H++){const P=p[H],{height:B,width:X,top:le,right:fe,bottom:ge,left:C}=P.getBoundingClientRect();if(v>=0&&E>=0&&O<=y&&I<=f&&v>=le&&O<=ge&&E>=C&&I<=fe)return L;const W=getComputedStyle(P),q=parseInt(W.borderLeftWidth,10),S=parseInt(W.borderTopWidth,10),U=parseInt(W.borderRightWidth,10),V=parseInt(W.borderBottomWidth,10);let Y=0,ie=0;const ne="offsetWidth"in P?P.offsetWidth-P.clientWidth-q-U:0,se="offsetHeight"in P?P.offsetHeight-P.clientHeight-S-V:0,ee="offsetWidth"in P?P.offsetWidth===0?0:X/P.offsetWidth:0,me="offsetHeight"in P?P.offsetHeight===0?0:B/P.offsetHeight:0;if(u===P)Y=Yi(g,g+y,y,S,V,g+F,g+F+x,x),ie=s==="start"?j:s==="center"?j-f/2:s==="end"?j-f:Yi(m,m+f,f,q,U,m+j,m+j+b,b),Y=Math.max(0,Y+g),ie=Math.max(0,ie+m);else{Y=Yi(le,ge,B,S,V+se,F,F+x,x),ie=s==="start"?j-C-q:s==="center"?j-(C+X/2)+ne/2:s==="end"?j-fe+U+ne:Yi(C,fe,X,q,U+ne,j,j+b,b);const{scrollLeft:$,scrollTop:ye}=P;Y=me===0?0:Math.max(0,Math.min(ye+Y/me,P.scrollHeight-B/me+se)),ie=ee===0?0:Math.max(0,Math.min($+ie/ee,P.scrollWidth-X/ee+ne)),F+=ye-Y,j+=$-ie}L.push({el:P,top:Y,left:ie})}return L};var Ar=function(){return Ar=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},Ar.apply(this,arguments)};var hS=0;function Gc(e){return typeof e=="function"?e:Mt}function Mt(){}function kp(e,t){if(e){var n=fS(e,{boundary:t});n.forEach(function(r){var i=r.el,o=r.top,s=r.left;i.scrollTop=o,i.scrollLeft=s})}}function Xc(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Xa(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 rt(){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 Sr(){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 Rp(){return String(hS++)}function mS(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 Yc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Ap(e){return typeof e.type=="string"}function Fp(e){return e.props}function gS(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var yS=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Zi(e){e===void 0&&(e={});var t={};return yS.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function wo(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=xo(t,r)?t[r]:e[r],n},{})}function xo(e,t){return e[t]!==void 0}function ia(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function vS(e){return Object.prototype.toString.call(e)==="[object Object]"}function ir(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 l=Fr(a,t<0,n,r,i);return l===-1?e>=o?-1:e:l}function Fr(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?Fr(t?o-1:0,t,n,r):-1}function Io(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(Xc(i,e,n)||r&&Xc(i,n.document.activeElement,n))})}var Ya=Mt;process.env.NODE_ENV!=="production"&&(Ya=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 bS=Xa(function(e){Pp(e).textContent=""},500);function Pp(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 jp(e,t){if(!(!e||!t)){var n=Pp(t);n.textContent=e,bS(t)}}function wS(e){var t=e?.getElementById("a11y-status-message");t&&t.remove()}var Mp=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Dp=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Lp=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,ao=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,lo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Bp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,qp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,$p=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Vp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Up=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,zp=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Kp=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Hp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,oa=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Jp=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Wp=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Qp=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,xS=Object.freeze({__proto__:null,blurButton:Jp,blurInput:zp,changeInput:Kp,clickButton:oa,clickItem:Up,controlledPropUpdatedSelectedItem:Wp,itemMouseEnter:Lp,keyDownArrowDown:lo,keyDownArrowUp:ao,keyDownEnd:Vp,keyDownEnter:qp,keyDownEscape:Bp,keyDownHome:$p,keyDownSpaceButton:Hp,mouseUp:Dp,touchEnd:Qp,unknown:Mp}),IS=["refKey","ref"],CS=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],SS=["onKeyDown","onBlur","onChange","onInput","onChangeText"],OS=["refKey","ref"],_S=["onMouseMove","onMouseDown","onClick","onPress","index","item"],ES=(function(){var e=(function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+Rp(),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(b){return o.id+"-item-"+b},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(b,v){var I=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(O){return O!==I}),b()},v);o.timeoutIds.push(I)},o.setItemCount=function(b){o.itemCount=b},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(b,v){var I=o.getItemNodeFromIndex(v);return I&&I.hasAttribute("disabled")},o.setHighlightedIndex=function(b,v){b===void 0&&(b=o.props.defaultHighlightedIndex),v===void 0&&(v={}),v=Zi(v),o.internalSetState(we({highlightedIndex:b},v))},o.clearSelection=function(b){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},b)},o.selectItem=function(b,v,I){v=Zi(v),o.internalSetState(we({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:b,inputValue:o.props.itemToString(b)},v),I)},o.selectItemAtIndex=function(b,v,I){var O=o.items[b];O!=null&&o.selectItem(O,v,I)},o.selectHighlightedItem=function(b,v){return o.selectItemAtIndex(o.getState().highlightedIndex,b,v)},o.internalSetState=function(b,v){var I,O,E={},R=typeof b=="function";return!R&&b.hasOwnProperty("inputValue")&&o.props.onInputValueChange(b.inputValue,we({},o.getStateAndHelpers(),b)),o.setState(function(T){var A;T=o.getState(T);var F=R?b(T):b;F=o.props.stateReducer(T,F),I=F.hasOwnProperty("selectedItem");var j={};return I&&F.selectedItem!==T.selectedItem&&(O=F.selectedItem),(A=F).type||(A.type=Mp),Object.keys(F).forEach(function(L){T[L]!==F[L]&&(E[L]=F[L]),L!=="type"&&(F[L],xo(o.props,L)||(j[L]=F[L]))}),R&&F.hasOwnProperty("inputValue")&&o.props.onInputValueChange(F.inputValue,we({},o.getStateAndHelpers(),F)),j},function(){Gc(v)();var T=Object.keys(E).length>1;T&&o.props.onStateChange(E,o.getStateAndHelpers()),I&&o.props.onSelect(b.selectedItem,o.getStateAndHelpers()),O!==void 0&&o.props.onChange(O,o.getStateAndHelpers()),o.props.onUserAction(E,o.getStateAndHelpers())})},o.rootRef=function(b){return o._rootNode=b},o.getRootProps=function(b,v){var I,O=b===void 0?{}:b,E=O.refKey,R=E===void 0?"ref":E,T=O.ref,A=_n(O,IS),F=v===void 0?{}:v,j=F.suppressRefError,L=j===void 0?!1:j;o.getRootProps.called=!0,o.getRootProps.refKey=R,o.getRootProps.suppressRefError=L;var H=o.getState(),P=H.isOpen;return we((I={},I[R]=Sr(T,o.rootRef),I.role="combobox",I["aria-expanded"]=P,I["aria-haspopup"]="listbox",I["aria-owns"]=P?o.menuId:void 0,I["aria-labelledby"]=o.labelId,I),A)},o.keyDownHandlers={ArrowDown:function(v){var I=this;if(v.preventDefault(),this.getState().isOpen){var O=v.shiftKey?5:1;this.moveHighlightedIndex(O,{type:lo})}else this.internalSetState({isOpen:!0,type:lo},function(){var E=I.getItemCount();if(E>0){var R=I.getState(),T=R.highlightedIndex,A=ir(T,1,{length:E},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:lo})}})},ArrowUp:function(v){var I=this;if(v.preventDefault(),this.getState().isOpen){var O=v.shiftKey?-5:-1;this.moveHighlightedIndex(O,{type:ao})}else this.internalSetState({isOpen:!0,type:ao},function(){var E=I.getItemCount();if(E>0){var R=I.getState(),T=R.highlightedIndex,A=ir(T,-1,{length:E},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:ao})}})},Enter:function(v){if(v.which!==229){var I=this.getState(),O=I.isOpen,E=I.highlightedIndex;if(O&&E!=null){v.preventDefault();var R=this.items[E],T=this.getItemNodeFromIndex(E);if(R==null||T&&T.hasAttribute("disabled"))return;this.selectHighlightedItem({type:qp})}}},Escape:function(v){v.preventDefault(),this.reset(we({type:Bp},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=we({},o.keyDownHandlers,{" ":function(v){v.preventDefault(),this.toggleMenu({type:Hp})}}),o.inputKeyDownHandlers=we({},o.keyDownHandlers,{Home:function(v){var I=this.getState(),O=I.isOpen;if(O){v.preventDefault();var E=this.getItemCount();if(!(E<=0||!O)){var R=Fr(0,!1,{length:E},this.isItemDisabled);this.setHighlightedIndex(R,{type:$p})}}},End:function(v){var I=this.getState(),O=I.isOpen;if(O){v.preventDefault();var E=this.getItemCount();if(!(E<=0||!O)){var R=Fr(E-1,!0,{length:E},this.isItemDisabled);this.setHighlightedIndex(R,{type:Vp})}}}}),o.getToggleButtonProps=function(b){var v=b===void 0?{}:b,I=v.onClick;v.onPress;var O=v.onKeyDown,E=v.onKeyUp,R=v.onBlur,T=_n(v,CS),A=o.getState(),F=A.isOpen,j={onClick:rt(I,o.buttonHandleClick),onKeyDown:rt(O,o.buttonHandleKeyDown),onKeyUp:rt(E,o.buttonHandleKeyUp),onBlur:rt(R,o.buttonHandleBlur)},L=T.disabled?{}:j;return we({type:"button",role:"button","aria-label":F?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},L,T)},o.buttonHandleKeyUp=function(b){b.preventDefault()},o.buttonHandleKeyDown=function(b){var v=ia(b);o.buttonKeyDownHandlers[v]&&o.buttonKeyDownHandlers[v].call(o,b)},o.buttonHandleClick=function(b){if(b.preventDefault(),o.props.environment){var v=o.props.environment.document,I=v.body,O=v.activeElement;I&&I===O&&b.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:oa}):o.internalSetTimeout(function(){return o.toggleMenu({type:oa})})},o.buttonHandleBlur=function(b){var v=b.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var I=o.props.environment.document.activeElement;(I==null||I.id!==o.inputId)&&I!==v&&o.reset({type:Jp})}})},o.getLabelProps=function(b){return we({htmlFor:o.inputId,id:o.labelId},b)},o.getInputProps=function(b){var v=b===void 0?{}:b,I=v.onKeyDown,O=v.onBlur,E=v.onChange,R=v.onInput;v.onChangeText;var T=_n(v,SS),A,F={};A="onChange";var j=o.getState(),L=j.inputValue,H=j.isOpen,P=j.highlightedIndex;if(!T.disabled){var B;F=(B={},B[A]=rt(E,R,o.inputHandleChange),B.onKeyDown=rt(I,o.inputHandleKeyDown),B.onBlur=rt(O,o.inputHandleBlur),B)}return we({"aria-autocomplete":"list","aria-activedescendant":H&&typeof P=="number"&&P>=0?o.getItemId(P):void 0,"aria-controls":H?o.menuId:void 0,"aria-labelledby":T&&T["aria-label"]?void 0:o.labelId,autoComplete:"off",value:L,id:o.inputId},F,T)},o.inputHandleKeyDown=function(b){var v=ia(b);v&&o.inputKeyDownHandlers[v]&&o.inputKeyDownHandlers[v].call(o,b)},o.inputHandleChange=function(b){o.internalSetState({type:Kp,isOpen:!0,inputValue:b.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var b;if(!(o.isMouseDown||!o.props.environment)){var v=o.props.environment.document.activeElement,I=(v==null||(b=v.dataset)==null?void 0:b.toggle)&&o._rootNode&&o._rootNode.contains(v);I||o.reset({type:zp})}})},o.menuRef=function(b){o._menuNode=b},o.getMenuProps=function(b,v){var I,O=b===void 0?{}:b,E=O.refKey,R=E===void 0?"ref":E,T=O.ref,A=_n(O,OS),F=v===void 0?{}:v,j=F.suppressRefError,L=j===void 0?!1:j;return o.getMenuProps.called=!0,o.getMenuProps.refKey=R,o.getMenuProps.suppressRefError=L,we((I={},I[R]=Sr(T,o.menuRef),I.role="listbox",I["aria-labelledby"]=A&&A["aria-label"]?void 0:o.labelId,I.id=o.menuId,I),A)},o.getItemProps=function(b){var v,I=b===void 0?{}:b,O=I.onMouseMove,E=I.onMouseDown,R=I.onClick;I.onPress;var T=I.index,A=I.item,F=A===void 0?process.env.NODE_ENV==="production"?void 0:gS("getItemProps","item"):A,j=_n(I,_S);T===void 0?(o.items.push(F),T=o.items.indexOf(F)):o.items[T]=F;var L="onClick",H=R,P=(v={onMouseMove:rt(O,function(){T!==o.getState().highlightedIndex&&(o.setHighlightedIndex(T,{type:Lp}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:rt(E,function(X){X.preventDefault()})},v[L]=rt(H,function(){o.selectItemAtIndex(T,{type:Up})}),v),B=j.disabled?{onMouseDown:P.onMouseDown}:P;return we({id:o.getItemId(T),role:"option","aria-selected":o.getState().highlightedIndex===T},B,j)},o.clearItems=function(){o.items=[]},o.reset=function(b,v){b===void 0&&(b={}),b=Zi(b),o.internalSetState(function(I){var O=I.selectedItem;return we({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(O)},b)},v)},o.toggleMenu=function(b,v){b===void 0&&(b={}),b=Zi(b),o.internalSetState(function(I){var O=I.isOpen;return we({isOpen:!O},O&&{highlightedIndex:o.props.defaultHighlightedIndex},b)},function(){var I=o.getState(),O=I.isOpen,E=I.highlightedIndex;O&&o.getItemCount()>0&&typeof E=="number"&&o.setHighlightedIndex(E,b),Gc(v)()})},o.openMenu=function(b){o.internalSetState({isOpen:!0},b)},o.closeMenu=function(b){o.internalSetState({isOpen:!1},b)},o.updateStatus=Xa(function(){var b;if((b=o.props)!=null&&(b=b.environment)!=null&&b.document){var v=o.getState(),I=o.items[v.highlightedIndex],O=o.getItemCount(),E=o.props.getA11yStatusMessage(we({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:O,highlightedItem:I},v));o.previousResultCount=O,jp(E,o.props.environment.document)}},200);var s=o.props,a=s.defaultHighlightedIndex,l=s.initialHighlightedIndex,c=l===void 0?a:l,u=s.defaultIsOpen,p=s.initialIsOpen,h=p===void 0?u:p,f=s.initialInputValue,y=f===void 0?"":f,m=s.initialSelectedItem,g=m===void 0?null:m,x=o.getState({highlightedIndex:c,isOpen:h,inputValue:y,selectedItem:g});return x.selectedItem!=null&&o.props.initialInputValue===void 0&&(x.inputValue=o.props.itemToString(x.selectedItem)),o.state=x,o}eS(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),wo(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(),l=this.getState(),c=l.highlightedIndex;if(a>0){var u=ir(c,o,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(u,s)}},r.getStateAndHelpers=function(){var o=this.getState(),s=o.highlightedIndex,a=o.inputValue,l=o.selectedItem,c=o.isOpen,u=this.props.itemToString,p=this.id,h=this.getRootProps,f=this.getToggleButtonProps,y=this.getLabelProps,m=this.getMenuProps,g=this.getInputProps,x=this.getItemProps,b=this.openMenu,v=this.closeMenu,I=this.toggleMenu,O=this.selectItem,E=this.selectItemAtIndex,R=this.selectHighlightedItem,T=this.setHighlightedIndex,A=this.clearSelection,F=this.clearItems,j=this.reset,L=this.setItemCount,H=this.unsetItemCount,P=this.internalSetState;return{getRootProps:h,getToggleButtonProps:f,getLabelProps:y,getMenuProps:m,getInputProps:g,getItemProps:x,reset:j,openMenu:b,closeMenu:v,toggleMenu:I,selectItem:O,selectItemAtIndex:E,selectHighlightedItem:R,setHighlightedIndex:T,clearSelection:A,clearItems:F,setItemCount:L,unsetItemCount:H,setState:P,itemToString:u,id:p,highlightedIndex:s,inputValue:a,isOpen:c,selectedItem:l}},r.componentDidMount=function(){var o=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Zc(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 y=Io(f.target,[o._rootNode,o._menuNode],o.props.environment);!y&&o.getState().isOpen&&o.reset({type:Dp},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},l=function(){o.isTouchMove=!1},c=function(){o.isTouchMove=!0},u=function(f){var y=Io(f.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!y&&o.getState().isOpen&&o.reset({type:Qp},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},p=this.props.environment;p.addEventListener("mousedown",s),p.addEventListener("mouseup",a),p.addEventListener("touchstart",l),p.addEventListener("touchmove",c),p.addEventListener("touchend",u),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),p.removeEventListener("mousedown",s),p.removeEventListener("mouseup",a),p.removeEventListener("touchstart",l),p.removeEventListener("touchmove",c),p.removeEventListener("touchend",u)}}},r.shouldScroll=function(o,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,l=a.highlightedIndex,c=s.highlightedIndex===void 0?o:s,u=c.highlightedIndex,p=l&&this.getState().isOpen&&!o.isOpen,h=l!==u;return p||h},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(Ya(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Zc(this._menuNode,this.getMenuProps)),xo(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Wp,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=Yc(this.props.children,Mt);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=Yc(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&&NS(s,this.getRootProps),s;if(Ap(s))return w.cloneElement(s,this.getRootProps(Fp(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n})(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:mS,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&vS(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:Mt,onInputValueChange:Mt,onUserAction:Mt,onChange:Mt,onSelect:Mt,onOuterClick:Mt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:kp},e.stateChangeTypes=xS,e})();process.env.NODE_ENV!=="production"&&(ES.propTypes={children:G.func,defaultHighlightedIndex:G.number,defaultIsOpen:G.bool,initialHighlightedIndex:G.number,initialSelectedItem:G.any,initialInputValue:G.string,initialIsOpen:G.bool,getA11yStatusMessage:G.func,itemToString:G.func,onChange:G.func,onSelect:G.func,onStateChange:G.func,onInputValueChange:G.func,onUserAction:G.func,onOuterClick:G.func,selectedItemChanged:G.func,stateReducer:G.func,itemCount:G.number,id:G.string,environment:G.shape({addEventListener:G.func.isRequired,removeEventListener:G.func.isRequired,document:G.shape({createElement:G.func.isRequired,getElementById:G.func.isRequired,activeElement:G.any.isRequired,body:G.any.isRequired}).isRequired,Node:G.func.isRequired}),suppressRefError:G.bool,scrollIntoView:G.func,selectedItem:G.any,isOpen:G.bool,inputValue:G.string,highlightedIndex:G.number,labelId:G.string,inputId:G.string,menuId:G.string,getItemId:G.func});function Zc(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 NS(e,t){var n=t.refKey,r=n!=="ref",i=!Ap(e);i&&!r&&!Jc.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+'"'),!Jc.isForwardRef(e)&&!Fp(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Gp={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function TS(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){kS(s,e,t,n),n[s]!==t[s]&&(o[s]=n[s])}),r.onStateChange&&Object.keys(o).length&&r.onStateChange(we({type:i},o))}function kS(e,t,n,r){var i=t.props,o=t.type,s="on"+Za(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](we({type:o},r))}function RS(e,t){return t.changes}var eu=Xa(function(e,t){jp(e,t)},200),AS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,FS="useId"in w?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,a=t.inputId,l="downshift-"+w.useId();n||(n=l);var c=w.useRef({labelId:r||n+"-label",menuId:i||n+"-menu",getItemId:o||function(u){return n+"-item-"+u},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return c.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+Rp():n,i=t.labelId,o=t.menuId,s=t.getItemId,a=t.toggleButtonId,l=t.inputId,c=w.useRef({labelId:i||r+"-label",menuId:o||r+"-menu",getItemId:s||function(u){return r+"-item-"+u},toggleButtonId:a||r+"-toggle-button",inputId:l||r+"-input"});return c.current};function PS(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 Za(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Xp(e){var t=w.useRef(e);return t.current=e,t}function jS(e,t,n,r){var i=w.useRef(),o=w.useRef(),s=w.useCallback(function(f,y){o.current=y,f=wo(f,y.props);var m=e(f,y),g=y.props.stateReducer(f,we({},y,{changes:m}));return g},[e]),a=w.useReducer(s,t,n),l=a[0],c=a[1],u=Xp(t),p=w.useCallback(function(f){return c(we({props:u.current},f))},[u]),h=o.current;return w.useEffect(function(){var f=wo(i.current,h?.props),y=h&&i.current&&!r(f,l);y&&TS(h,f,l),i.current=l},[l,h,r]),[l,p]}var li={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:RS,scrollIntoView:kp,environment:typeof window>"u"?void 0:window};function Un(e,t,n){n===void 0&&(n=Gp);var r=e["default"+Za(t)];return r!==void 0?r:n[t]}function ci(e,t,n){n===void 0&&(n=Gp);var r=e[t];if(r!==void 0)return r;var i=e["initial"+Za(t)];return i!==void 0?i:Un(e,t,n)}function MS(e){var t=ci(e,"selectedItem"),n=ci(e,"isOpen"),r=$S(e),i=ci(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 ui(e,t,n){var r=e.items,i=e.initialHighlightedIndex,o=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,l=t.selectedItem,c=t.highlightedIndex;return r.length===0?-1:i!==void 0&&c===i&&!s(r[i],i)?i:o!==void 0&&!s(r[o],o)?o:l?r.findIndex(function(u){return a(l)===a(u)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function DS(e,t,n){var r=w.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return w.useEffect(function(){if(!e)return Mt;var i=n.map(function(u){return u.current});function o(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(u){r.current.isMouseDown=!1,Io(u.target,i,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function l(){r.current.isTouchMove=!0}function c(u){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!Io(u.target,i,e,!1)&&t()}return e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",l),e.addEventListener("touchend",c),function(){e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",l),e.removeEventListener("touchend",c)}},[n,e,t]),r.current}var Yp=function(){return Mt};process.env.NODE_ENV!=="production"&&(Yp=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=w.useRef(n.reduce(function(s,a){return s[a]={},s},{}));w.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 l=a.suppressRefError,c=a.refKey,u=a.elementRef;l||u!=null&&u.current||console.error('downshift: The ref prop "'+c+'" from '+s+" was not applied correctly on your element.")})},[]);var o=w.useCallback(function(s,a,l,c){i.current[s]={suppressRefError:a,refKey:l,elementRef:c}},[]);return o});function LS(e,t,n,r){r===void 0&&(r={});var i=r.document,o=$o();w.useEffect(function(){if(!(!e||o||!i)){var s=e(t);eu(s,i)}},n),w.useEffect(function(){return function(){eu.cancel(),wS(i)}},[i])}function BS(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,o=e.menuElement,s=e.scrollIntoView,a=w.useRef(!0);return AS(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var Zp=Mt;process.env.NODE_ENV!=="production"&&(Zp=function(t){var n=t.props,r=t.state,i=w.useRef(n),o=$o();w.useEffect(function(){o||(Ya(r,i.current,n),i.current=n)},[r,n,o])});function tu(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return we({isOpen:!1,highlightedIndex:-1},i&&we({selectedItem:e.items[t],isOpen:Un(e,"isOpen"),highlightedIndex:Un(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function qS(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function $o(){var e=w.useRef(!0);return w.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function sa(e){var t=Un(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function $S(e){var t=ci(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var co={environment:G.shape({addEventListener:G.func.isRequired,removeEventListener:G.func.isRequired,document:G.shape({createElement:G.func.isRequired,getElementById:G.func.isRequired,activeElement:G.any.isRequired,body:G.any.isRequired}).isRequired,Node:G.func.isRequired}),itemToString:G.func,itemToKey:G.func,stateReducer:G.func},ef=we({},co,{getA11yStatusMessage:G.func,highlightedIndex:G.number,defaultHighlightedIndex:G.number,initialHighlightedIndex:G.number,isOpen:G.bool,defaultIsOpen:G.bool,initialIsOpen:G.bool,selectedItem:G.any,initialSelectedItem:G.any,defaultSelectedItem:G.any,id:G.string,labelId:G.string,menuId:G.string,getItemId:G.func,toggleButtonId:G.string,onSelectedItemChange:G.func,onHighlightedIndexChange:G.func,onStateChange:G.func,onIsOpenChange:G.func,scrollIntoView:G.func});function VS(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:ui(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:ui(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:sa(i),isOpen:Un(i,"isOpen"),selectedItem:Un(i,"selectedItem"),inputValue:Un(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return we({},e,o)}Ar(Ar({},ef),{items:G.array.isRequired,isItemDisabled:G.func});Ar(Ar({},li),{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 el=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,tl=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,nl=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,rl=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,il=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,ol=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,sl=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,al=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,ll=process.env.NODE_ENV!=="production"?"__input_change__":8,Co=process.env.NODE_ENV!=="production"?"__input_blur__":9,cl=process.env.NODE_ENV!=="production"?"__input_click__":10,tf=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,nf=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ul=process.env.NODE_ENV!=="production"?"__item_click__":13,rf=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,of=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,sf=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,af=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,lf=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,dl=process.env.NODE_ENV!=="production"?"__function_select_item__":19,cf=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,uf=process.env.NODE_ENV!=="production"?"__function_reset__":21,pl=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,df=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:pl,FunctionCloseMenu:af,FunctionOpenMenu:sf,FunctionReset:uf,FunctionSelectItem:dl,FunctionSetHighlightedIndex:lf,FunctionSetInputValue:cf,FunctionToggleMenu:of,InputBlur:Co,InputChange:ll,InputClick:cl,InputKeyDownArrowDown:el,InputKeyDownArrowUp:tl,InputKeyDownEnd:il,InputKeyDownEnter:al,InputKeyDownEscape:nl,InputKeyDownHome:rl,InputKeyDownPageDown:sl,InputKeyDownPageUp:ol,ItemClick:ul,ItemMouseMove:nf,MenuMouseLeave:tf,ToggleButtonClick:rf});function US(e){var t=MS(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)),we({},t,{inputValue:r})}var zS=we({},ef,{items:G.array.isRequired,isItemDisabled:G.func,inputValue:G.string,defaultInputValue:G.string,initialInputValue:G.string,inputId:G.string,onInputValueChange:G.func});function KS(e,t,n,r){var i=w.useRef(),o=jS(e,t,n,r),s=o[0],a=o[1],l=$o();return w.useEffect(function(){if(xo(t,"selectedItem")){if(!l){var c=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);c&&a({type:pl,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[wo(s,t),a]}var pf=Mt;process.env.NODE_ENV!=="production"&&(pf=function(t,n){G.checkPropTypes(zS,t,"prop",n.name)});var HS=we({},li,{isItemDisabled:function(){return!1}});function JS(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case ul:s={isOpen:Un(i,"isOpen"),highlightedIndex:sa(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case el:e.isOpen?s={highlightedIndex:ir(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:ui(i,e,1),isOpen:i.items.length>=0};break;case tl:e.isOpen?o?s=tu(i,e.highlightedIndex):s={highlightedIndex:ir(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:ui(i,e,-1),isOpen:i.items.length>=0};break;case al:s=tu(i,e.highlightedIndex);break;case nl:s=we({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case ol:s={highlightedIndex:ir(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case sl:s={highlightedIndex:ir(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case rl:s={highlightedIndex:Fr(0,!1,i.items,i.isItemDisabled)};break;case il:s={highlightedIndex:Fr(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case Co:s=we({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 ll:s={isOpen:!0,highlightedIndex:sa(i),inputValue:t.inputValue};break;case cl:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ui(i,e,0)};break;case dl:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case pl:s={inputValue:t.inputValue};break;default:return VS(e,t,df)}return we({},e,s)}var WS=["onMouseLeave","refKey","ref"],QS=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],GS=["onClick","onPress","refKey","ref"],XS=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];fl.stateChangeTypes=df;function fl(e){e===void 0&&(e={}),pf(e,fl);var t=we({},HS,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=KS(JS,t,US,qS),a=s[0],l=s[1],c=a.isOpen,u=a.highlightedIndex,p=a.selectedItem,h=a.inputValue,f=w.useRef(null),y=w.useRef({}),m=w.useRef(null),g=w.useRef(null),x=$o(),b=FS(t),v=w.useRef(),I=Xp({state:a,props:t}),O=w.useCallback(function(q){return y.current[b.getItemId(q)]},[b]);LS(o,a,[c,u,p,h],i);var E=BS({menuElement:f.current,highlightedIndex:u,isOpen:c,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:O});Zp({props:t,state:a}),w.useEffect(function(){var q=ci(t,"isOpen");q&&m.current&&m.current.focus()},[]),w.useEffect(function(){x||(v.current=n.length)});var R=DS(i,w.useCallback(function(){I.current.state.isOpen&&l({type:Co,selectItem:!1})},[l,I]),w.useMemo(function(){return[f,g,m]},[f.current,g.current,m.current])),T=Yp("getInputProps","getMenuProps");w.useEffect(function(){c||(y.current={})},[c]),w.useEffect(function(){var q;!c||!(i!=null&&i.document)||!(m!=null&&(q=m.current)!=null&&q.focus)||i.document.activeElement!==m.current&&m.current.focus()},[c,i]);var A=w.useMemo(function(){return{ArrowDown:function(S){S.preventDefault(),l({type:el,altKey:S.altKey})},ArrowUp:function(S){S.preventDefault(),l({type:tl,altKey:S.altKey})},Home:function(S){I.current.state.isOpen&&(S.preventDefault(),l({type:rl}))},End:function(S){I.current.state.isOpen&&(S.preventDefault(),l({type:il}))},Escape:function(S){var U=I.current.state;(U.isOpen||U.inputValue||U.selectedItem||U.highlightedIndex>-1)&&(S.preventDefault(),l({type:nl}))},Enter:function(S){var U=I.current.state;!U.isOpen||S.which===229||(S.preventDefault(),l({type:al}))},PageUp:function(S){I.current.state.isOpen&&(S.preventDefault(),l({type:ol}))},PageDown:function(S){I.current.state.isOpen&&(S.preventDefault(),l({type:sl}))}}},[l,I]),F=w.useCallback(function(q){return we({id:b.labelId,htmlFor:b.inputId},q)},[b]),j=w.useCallback(function(q,S){var U,V=q===void 0?{}:q,Y=V.onMouseLeave,ie=V.refKey,ne=ie===void 0?"ref":ie,se=V.ref,ee=_n(V,WS),me=S===void 0?{}:S,$=me.suppressRefError,ye=$===void 0?!1:$;return T("getMenuProps",ye,ne,f),we((U={},U[ne]=Sr(se,function(Z){f.current=Z}),U.id=b.menuId,U.role="listbox",U["aria-labelledby"]=ee&&ee["aria-label"]?void 0:""+b.labelId,U.onMouseLeave=rt(Y,function(){l({type:tf})}),U),ee)},[l,T,b]),L=w.useCallback(function(q){var S,U,V=q===void 0?{}:q,Y=V.item,ie=V.index,ne=V.refKey,se=ne===void 0?"ref":ne,ee=V.ref,me=V.onMouseMove,$=V.onMouseDown,ye=V.onClick;V.onPress;var Z=V.disabled,qe=_n(V,QS);Z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Fe=I.current,Ae=Fe.props,Qe=Fe.state,et=PS(Y,ie,Ae.items,"Pass either item or index to getItemProps!"),tt=et[0],xe=et[1],at=Ae.isItemDisabled(tt,xe),It="onClick",dt=ye,Xe=function(){R.isTouchEnd||xe===Qe.highlightedIndex||(E.current=!1,l({type:nf,index:xe,disabled:at}))},D=function(){l({type:ul,index:xe})},K=function(re){return re.preventDefault()};return we((S={},S[se]=Sr(ee,function(M){M&&(y.current[b.getItemId(xe)]=M)}),S["aria-disabled"]=at,S["aria-selected"]=xe===Qe.highlightedIndex,S.id=b.getItemId(xe),S.role="option",S),!at&&(U={},U[It]=rt(dt,D),U),{onMouseMove:rt(me,Xe),onMouseDown:rt($,K)},qe)},[l,b,I,R,E]),H=w.useCallback(function(q){var S,U=q===void 0?{}:q,V=U.onClick;U.onPress;var Y=U.refKey,ie=Y===void 0?"ref":Y,ne=U.ref,se=_n(U,GS),ee=I.current.state,me=function(){l({type:rf})};return we((S={},S[ie]=Sr(ne,function($){g.current=$}),S["aria-controls"]=b.menuId,S["aria-expanded"]=ee.isOpen,S.id=b.toggleButtonId,S.tabIndex=-1,S),!se.disabled&&we({},{onClick:rt(V,me)}),se)},[l,I,b]),P=w.useCallback(function(q,S){var U,V=q===void 0?{}:q,Y=V.onKeyDown,ie=V.onChange,ne=V.onInput,se=V.onBlur;V.onChangeText;var ee=V.onClick,me=V.refKey,$=me===void 0?"ref":me,ye=V.ref,Z=_n(V,XS),qe=S===void 0?{}:S,Fe=qe.suppressRefError,Ae=Fe===void 0?!1:Fe;T("getInputProps",Ae,$,m);var Qe=I.current.state,et=function(K){var M=ia(K);M&&A[M]&&A[M](K)},tt=function(K){l({type:ll,inputValue:K.target.value})},xe=function(K){if(i!=null&&i.document&&Qe.isOpen&&!R.isMouseDown){var M=K.relatedTarget===null&&i.document.activeElement!==i.document.body;l({type:Co,selectItem:!M})}},at=function(){l({type:cl})},It="onChange",dt={};if(!Z.disabled){var Xe;dt=(Xe={},Xe[It]=rt(ie,ne,tt),Xe.onKeyDown=rt(Y,et),Xe.onBlur=rt(se,xe),Xe.onClick=rt(ee,at),Xe)}return we((U={},U[$]=Sr(ye,function(D){m.current=D}),U["aria-activedescendant"]=Qe.isOpen&&Qe.highlightedIndex>-1?b.getItemId(Qe.highlightedIndex):"",U["aria-autocomplete"]="list",U["aria-controls"]=b.menuId,U["aria-expanded"]=Qe.isOpen,U["aria-labelledby"]=Z&&Z["aria-label"]?void 0:b.labelId,U.autoComplete="off",U.id=b.inputId,U.role="combobox",U.value=Qe.inputValue,U),dt,Z)},[l,b,i,A,I,R,T]),B=w.useCallback(function(){l({type:of})},[l]),X=w.useCallback(function(){l({type:af})},[l]),le=w.useCallback(function(){l({type:sf})},[l]),fe=w.useCallback(function(q){l({type:lf,highlightedIndex:q})},[l]),ge=w.useCallback(function(q){l({type:dl,selectedItem:q})},[l]),C=w.useCallback(function(q){l({type:cf,inputValue:q})},[l]),W=w.useCallback(function(){l({type:uf})},[l]);return{getItemProps:L,getLabelProps:F,getMenuProps:j,getInputProps:P,getToggleButtonProps:H,toggleMenu:B,openMenu:le,closeMenu:X,setHighlightedIndex:fe,setInputValue:C,selectItem:ge,reset:W,highlightedIndex:u,isOpen:c,selectedItem:p,inputValue:h}}co.stateReducer,co.itemToKey,co.environment,G.array,G.array,G.array,G.func,G.number,G.number,G.number,G.func,G.func,G.string,G.string;li.itemToKey,li.stateReducer,li.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 YS="_comboboxContainer_1qi3r_1",ZS="_inputContainer_1qi3r_12",e0="_input_1qi3r_12",t0="_clearButton_1qi3r_33",n0="_toggleButton_1qi3r_42",r0="_menu_1qi3r_48",i0="_menuBottom_1qi3r_64",o0="_menuTop_1qi3r_70",s0="_menuItem_1qi3r_75",a0="_highlighted_1qi3r_82",l0="_selected_1qi3r_86",c0="_hidden_1qi3r_90",Ht={comboboxContainer:YS,inputContainer:ZS,input:e0,clearButton:t0,toggleButton:n0,menu:r0,menuBottom:i0,menuTop:o0,menuItem:s0,highlighted:a0,selected:l0,hidden:c0};function u0(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function hl({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:i,clearable:o,style:s,menuPosition:a="bottom"}){const[l,c]=w.useState(e),u=w.useRef(null);w.useEffect(()=>c(e),[e]);const p=w.useCallback(R=>{R?.length>0?c(e.filter(u0(R))):c(e)},[e]),{isOpen:h,getToggleButtonProps:f,getMenuProps:y,getInputProps:m,highlightedIndex:g,getItemProps:x,setInputValue:b}=fl({items:l,selectedItem:t?e.find(R=>R.value===t):null,itemToString:R=>R?.label||"",onInputValueChange:({inputValue:R})=>p(R),onSelectedItemChange:({selectedItem:R})=>{n(R),u.current?.blur()}}),v=()=>{b(""),c(e)},I=()=>v(),O=w.useMemo(()=>e.find(R=>R.value===t)?.label,[e,t]),E=()=>{b(t&&O?O:"")};return d.jsxs("div",{style:{position:"relative",...s},children:[d.jsx("div",{className:Ht.comboboxContainer,children:d.jsxs("div",{className:Ht.inputContainer,children:[d.jsx("input",{style:{border:"none"},disabled:i,placeholder:r,className:Ht.input,...m({onFocus:I,onBlur:E,ref:u})}),o&&t&&d.jsx("button",{type:"button","aria-label":"clear selection",className:Ht.clearButton,onClick:()=>{n(null),v()},children:"✕"}),d.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:Ht.toggleButton,type:"button",...f(),children:h?d.jsx(d.Fragment,{children:"↑"}):d.jsx(d.Fragment,{children:"↓"})})]})}),d.jsx("ul",{className:`${Ht.menu} ${h&&e.length?"":Ht.hidden} ${a==="top"?Ht.menuTop:Ht.menuBottom}`,...y(),children:h&&l.map((R,T)=>d.jsx("li",{className:`${Ht.menuItem} ${g===T?Ht.highlighted:""} ${t===R?.value?Ht.selected:""}`,...x({item:R,index:T}),children:d.jsx("span",{children:R.label})},R.id))})]})}const d0="_trigger_1dvzj_1",p0="_tooltip_1dvzj_10",nu={trigger:d0,tooltip:p0};function ff({text:e}){return d.jsxs("span",{className:nu.trigger,children:[d.jsx(vC,{}),d.jsx("span",{className:nu.tooltip,children:e})]})}const f0="_mappingRow_7xcae_2",h0="_mappingField_7xcae_15",m0="_requiredAsterisk_7xcae_36",g0="_mappingArrow_7xcae_41",Xr={mappingRow:f0,mappingField:h0,requiredAsterisk:m0,mappingArrow:g0};function ru({mapping:e,required:t,bidirectional:n,customerFieldOptions:r,configHandlers:i}){const o=i.getFieldMapping(e.mapToName)??"",s=w.useMemo(()=>r.map(a=>({id:a.fieldName,label:a.displayName,value:a.fieldName})).sort((a,l)=>a.label.localeCompare(l.label)),[r]);return d.jsxs("div",{className:Xr.mappingRow,children:[d.jsx("div",{className:Xr.mappingField,children:d.jsx(hl,{items:s,selectedValue:o||null,onSelectedItemChange:a=>{a?.value?i.setFieldMapping({fieldName:a.value,mapToName:e.mapToName}):i.deleteFieldMapping(e.mapToName)},placeholder:"Select a field...",clearable:!t})}),d.jsx("div",{className:Xr.mappingArrow,children:n?d.jsx(Wa,{}):d.jsx(Cp,{})}),d.jsx("div",{className:Xr.mappingField,children:d.jsxs("div",{className:nn.mappingDisabledInput,children:[d.jsxs("span",{className:nn.mappingDisabledInputText,children:[e.mapToDisplayName??e.mapToName,t&&d.jsx("span",{className:Xr.requiredAsterisk,children:"*"})]}),e.prompt&&d.jsx(ff,{text:e.prompt})]})})]})}const y0="_mappingContent_pg19z_1",v0="_mappingColumnHeaders_pg19z_5",b0="_mappingColumnTitle_pg19z_13",w0="_mappingColumnArrow_pg19z_21",Yr={mappingContent:y0,mappingColumnHeaders:v0,mappingColumnTitle:b0,mappingColumnArrow:w0};function x0({objectName:e,providerDisplayName:t,appName:n,isMappingBidirectional:r,requiredMapFields:i,optionalMapFields:o,customerFieldOptions:s,configHandlers:a}){return d.jsxs(d.Fragment,{children:[d.jsx(bo,{title:"Field Mappings",description:`Map ${t} fields to the corresponding ${n} fields for read${r?" and write":""}.`}),d.jsxs("div",{className:Yr.mappingContent,children:[d.jsxs("div",{className:Yr.mappingColumnHeaders,children:[d.jsxs("span",{className:Yr.mappingColumnTitle,children:[t," Field"]}),d.jsx("span",{className:Yr.mappingColumnArrow}),d.jsxs("span",{className:Yr.mappingColumnTitle,children:[n," Field"]})]}),i.map(l=>d.jsx(ru,{objectName:e,mapping:l,required:!0,bidirectional:r,customerFieldOptions:s,configHandlers:a},l.mapToName)),o.map(l=>d.jsx(ru,{objectName:e,mapping:l,required:!1,bidirectional:r,customerFieldOptions:s,configHandlers:a},l.mapToName))]})]})}const I0="_objectTabs_bcy6q_1",C0="_objectTab_bcy6q_1",S0="_objectTabActive_bcy6q_34",O0="_objectTabLabel_bcy6q_38",_0="_objectTabDots_bcy6q_45",E0="_dot_bcy6q_50",N0="_dotComplete_bcy6q_56",T0="_dotActive_bcy6q_60",k0="_dotPending_bcy6q_64",Sn={objectTabs:I0,objectTab:C0,objectTabActive:S0,objectTabLabel:O0,objectTabDots:_0,dot:E0,dotComplete:N0,dotActive:T0,dotPending:k0};function R0({currentPageIndex:e,onTabClick:t}){const n=Tn(),{state:r}=un(),{selectedObjects:i,currentObjectIndex:o}=r,s=w.useMemo(()=>i.map((a,l)=>{const c=qo(n,a),u=n.getReadObject(a)?.object?.displayName||a,p=c.map((h,f)=>l<o?"complete":l===o?f<e?"complete":f===e?"active":"pending":"pending");return{objName:a,displayName:u,dots:p,objIndex:l}}),[i,n,o,e]);return d.jsx("div",{className:Sn.objectTabs,children:s.map(a=>d.jsxs("button",{type:"button",className:`${Sn.objectTab}${a.objIndex===o?` ${Sn.objectTabActive}`:""}`,disabled:a.objIndex>o,onClick:()=>t(a.objIndex),children:[d.jsx("span",{className:Sn.objectTabLabel,children:a.displayName}),d.jsx("span",{className:Sn.objectTabDots,children:a.dots.map((l,c)=>d.jsx("span",{className:`${Sn.dot} ${l==="complete"?Sn.dotComplete:l==="active"?Sn.dotActive:Sn.dotPending}`},c))})]},a.objName))})}function A0(){const e=Tn(),{state:t,isFirstObject:n,isLastObject:r,currentObjectName:i,nextObject:o,prevObject:s,nextStep:a,prevStep:l,setCurrentObjectIndex:c}=un(),{selectedObjects:u,currentObjectIndex:p}=t,[h,f]=w.useState("fields"),y=w.useRef(null),m=w.useRef(i);w.useEffect(()=>{i!==m.current&&(m.current=i,y.current!==null?(f(y.current),y.current=null):i&&f(DC(e,i)))},[i,e]);const g=w.useMemo(()=>i?e.getReadObject(i):null,[e,i]),x=w.useMemo(()=>{const A=g?.getRequiredMapFields()?.length??0,F=g?.getOptionalMapFields()?.length??0;return A>0||F>0},[g]),b=w.useMemo(()=>(g?.getOptionalFields("no-mappings")?.length??0)>0,[g]),v=w.useMemo(()=>{const A=(g?.getRequiredFields("no-mappings")?.length??0)>0,F=!!g?.object?.mapToName;return A||F},[g]),I=w.useCallback(()=>{if(h==="fields"){if(x){f("mappings");return}if(b){f("additional");return}}else if(h==="mappings"&&b){f("additional");return}r?a():o()},[h,x,b,r,a,o]),O=w.useCallback(()=>{if(h==="additional"){if(x){f("mappings");return}if(v){f("fields");return}}else if(h==="mappings"&&v){f("fields");return}if(n)l();else{const A=p-1,F=u[A];F&&(y.current=Fc(e,F)),s()}},[h,x,v,n,l,p,u,e,s]),R=w.useMemo(()=>i?qo(e,i):[],[e,i]).indexOf(h),T=w.useCallback(A=>{if(A>=p)return;const F=u[A];F&&(y.current=Fc(e,F)),c(A)},[p,u,e,c]);return{subPage:h,currentPageIndex:R,currentManifestObject:g,hasFieldsContent:v,handleNext:I,handleBack:O,handleTabClick:T}}function F0(){const e=Tn(),t=jo(),{provider:n}=st(),{providerName:r}=ut(),{appName:i}=an(),{currentObjectName:o}=un(),{subPage:s,currentPageIndex:a,currentManifestObject:l,hasFieldsContent:c,handleNext:u,handleBack:p,handleTabClick:h}=A0(),f=w.useMemo(()=>l?.getRequiredFields("no-mappings")??[],[l]),y=w.useMemo(()=>l?.getOptionalFields("no-mappings")??[],[l]),m=w.useMemo(()=>l?.getRequiredMapFields()??[],[l]),g=w.useMemo(()=>l?.getOptionalMapFields()??[],[l]),x=w.useMemo(()=>o?e.getCustomerFieldsForObject(o).allFields??{}:{},[e,o]),b=f.length>0,v=l?.object?.mapToName,I=l?.object?.mapToDisplayName||v,O=!!v,E=!!o&&!!t.writeObject(o).object,R=w.useMemo(()=>o?t.readObject(o):null,[t,o]),T=w.useMemo(()=>Object.entries(x).map(([B,X])=>({fieldName:B,displayName:X.displayName||B})),[x]),A=w.useCallback((B,X)=>{R?.setSelectedField({fieldName:B,selected:X})},[R]),F=w.useMemo(()=>y.map(B=>({id:na(B),label:Ep(B),isChecked:R?.getSelectedField(na(B))??!1})),[y,R]),j=w.useMemo(()=>m.every(B=>!!R?.getFieldMapping(B.mapToName)),[m,R]);if(!o||!l)return d.jsx("div",{className:nn.empty,children:"No objects to configure."});const L=l.object?.displayName||o,H=i||"Your App",P=r||n||"Provider";return d.jsxs("div",{className:nn.configureObjects,children:[d.jsx(R0,{currentPageIndex:a,onTabClick:h}),d.jsxs("div",{className:nn.objectConfigPanel,children:[d.jsx("h2",{className:nn.objectName,children:L}),d.jsxs("p",{className:nn.objectDescription,children:["Confirm which ",P," fields ",H," can read",E?" and write":"","."]}),s==="fields"&&d.jsx(ZC,{objectDisplayName:L,providerDisplayName:P,appName:H,hasObjectMapping:O,objectMapToDisplayName:I,isMappingBidirectional:E,hasRequiredFields:b,requiredFields:f,hasFieldsContent:c}),s==="mappings"&&R&&d.jsx(x0,{objectName:o,providerDisplayName:P,appName:H,isMappingBidirectional:E,requiredMapFields:m,optionalMapFields:g,customerFieldOptions:T,configHandlers:R}),s==="additional"&&d.jsx(MC,{providerDisplayName:P,appName:H,optionalFieldItems:F,onItemChange:A})]}),d.jsx(vo,{onBack:p,onNext:u,backLabel:"Back",nextLabel:"Next",nextDisabled:s==="mappings"&&!j})]})}function P0(){const{state:e,goToStep:t}=un();return w.useEffect(()=>{e.selectedObjects.length===0&&t(Gt.SelectObjects)},[e.selectedObjects.length,t]),e.selectedObjects.length===0?null:d.jsx(F0,{})}function hf(){return d.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),d.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function ml({text:e,children:t}){return d.jsx(qr,{children:d.jsxs(kn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[d.jsx(hf,{}),d.jsx("p",{children:e}),t]})})}const j0={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 Si({children:e,style:t}){return d.jsx(kn,{style:{...j0,...t},children:e})}function bn({error:e}){return e?d.jsx(Si,{style:{marginTop:"2em"},children:e}):null}function M0(){return d.jsx("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d.jsxs("g",{opacity:"0.5",children:[d.jsx("path",{d:"M14.2821 11.0004C14.2821 12.8154 12.8154 14.2821 11.0004 14.2821C9.18542 14.2821 7.71875 12.8154 7.71875 11.0004C7.71875 9.18542 9.18542 7.71875 11.0004 7.71875C12.8154 7.71875 14.2821 9.18542 14.2821 11.0004Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M10.9999 18.581C14.2357 18.581 17.2515 16.6743 19.3507 13.3743C20.1757 12.0818 20.1757 9.90932 19.3507 8.61682C17.2515 5.31682 14.2357 3.41016 10.9999 3.41016C7.76402 3.41016 4.74819 5.31682 2.64902 8.61682C1.82402 9.90932 1.82402 12.0818 2.64902 13.3743C4.74819 16.6743 7.76402 18.581 10.9999 18.581Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function D0(){return d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[d.jsx("path",{d:"M13.3187 8.68036L8.68036 13.3187C8.06528 12.7036 7.71973 11.8694 7.71973 10.9995C7.71973 10.5688 7.80456 10.1423 7.96939 9.7444C8.13421 9.34648 8.3758 8.98491 8.68036 8.68036C8.98491 8.3758 9.34648 8.13421 9.7444 7.96939C10.1423 7.80456 10.5688 7.71973 10.9995 7.71973C11.8694 7.71973 12.7036 8.06528 13.3187 8.68036Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M16.3349 5.28895C14.7307 4.07895 12.8974 3.41895 10.9999 3.41895C7.76402 3.41895 4.74819 5.32561 2.64902 8.62561C1.82402 9.91811 1.82402 12.0906 2.64902 13.3831C3.37319 14.5198 4.21652 15.5006 5.13319 16.2889M7.71819 17.9023C8.76319 18.3423 9.87236 18.5806 10.9999 18.5806C14.2357 18.5806 17.2515 16.6739 19.3507 13.3739C20.1757 12.0814 20.1757 9.90895 19.3507 8.61645C19.0482 8.13978 18.7182 7.69061 18.379 7.26895",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M14.2172 11.6413C14.093 12.2808 13.7806 12.8685 13.32 13.3291C12.8594 13.7897 12.2716 14.1022 11.6322 14.2263M8.68051 13.3188L1.83301 20.1663M20.1663 1.83301L13.3188 8.68051",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function L0({id:e,name:t,placeholder:n="Password",onChange:r,value:i,className:o,isError:s}){const[a,l]=w.useState(!1),c=()=>l(u=>!u);return d.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[d.jsx(En.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:i,className:o,isError:s}),d.jsx(Be,{type:"button","aria-label":a?"Hide password":"Show password",style:{height:"2.5rem",width:"2.5rem",display:"flex",alignItems:"center",justifyContent:"center"},onClick:c,variant:"ghost",children:d.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?d.jsx(D0,{}):d.jsx(M0,{})})})]})}const B0="_textarea_18zl4_1",q0="_textareaError_18zl4_14",vs={textarea:B0,textareaError:q0};function $0({className:e,isError:t=!1,...n}){const r=t?Xt(vs.textareaError,vs.textarea):vs.textarea;return d.jsx("textarea",{className:Xt(e,r),...n})}const En={Input:mp,Textarea:$0,PasswordInput:L0},V0=()=>{const{projectIdOrName:e}=He(),t=wt();return pr({queryKey:["project",e,"entitlements"],queryFn:async()=>{if(!e)throw new Error("Project ID is required");return(await t()).projectApi.getProject({projectIdOrName:e,includeEntitlements:!0})},enabled:!!e})};function mf(){const{data:e}=V0();return e?.entitlements?.brandingRemoval?.value===!0?null:d.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:[d.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),d.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:d.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})})]})}function Wn({children:e}){return d.jsx(qr,{children:d.jsxs(kn,{children:[d.jsx("div",{style:{padding:"3rem 2rem"},children:e}),d.jsx(mf,{})]})})}function Qn({children:e}){return d.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function U0({children:e}){return d.jsx("p",{style:{padding:".5em 0"},children:e})}const z0="_link_oo2kv_1",K0={link:z0};function gf({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return d.jsx("a",{className:Xt(K0.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function H0(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const J0=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,W0=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Q0={};function iu(e,t){return(Q0.jsx?W0:J0).test(e)}const G0=/[ \t\n\f\r]/g;function X0(e){return typeof e=="object"?e.type==="text"?ou(e.value):!1:ou(e)}function ou(e){return e.replace(G0,"")===""}class Oi{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Oi.prototype.normal={};Oi.prototype.property={};Oi.prototype.space=void 0;function yf(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Oi(n,r,t)}function aa(e){return e.toLowerCase()}class Ft{constructor(t,n){this.attribute=n,this.property=t}}Ft.prototype.attribute="";Ft.prototype.booleanish=!1;Ft.prototype.boolean=!1;Ft.prototype.commaOrSpaceSeparated=!1;Ft.prototype.commaSeparated=!1;Ft.prototype.defined=!1;Ft.prototype.mustUseProperty=!1;Ft.prototype.number=!1;Ft.prototype.overloadedBoolean=!1;Ft.prototype.property="";Ft.prototype.spaceSeparated=!1;Ft.prototype.space=void 0;let Y0=0;const be=gr(),Ye=gr(),la=gr(),Q=gr(),De=gr(),Or=gr(),jt=gr();function gr(){return 2**++Y0}const ca=Object.freeze(Object.defineProperty({__proto__:null,boolean:be,booleanish:Ye,commaOrSpaceSeparated:jt,commaSeparated:Or,number:Q,overloadedBoolean:la,spaceSeparated:De},Symbol.toStringTag,{value:"Module"})),bs=Object.keys(ca);class gl extends Ft{constructor(t,n,r,i){let o=-1;if(super(t,n),su(this,"space",i),typeof r=="number")for(;++o<bs.length;){const s=bs[o];su(this,bs[o],(r&ca[s])===ca[s])}}}gl.prototype.defined=!0;function su(e,t,n){n&&(e[t]=n)}function Vr(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new gl(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[aa(r)]=r,n[aa(o.attribute)]=r}return new Oi(t,n,e.space)}const vf=Vr({properties:{ariaActiveDescendant:null,ariaAtomic:Ye,ariaAutoComplete:null,ariaBusy:Ye,ariaChecked:Ye,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:De,ariaCurrent:null,ariaDescribedBy:De,ariaDetails:null,ariaDisabled:Ye,ariaDropEffect:De,ariaErrorMessage:null,ariaExpanded:Ye,ariaFlowTo:De,ariaGrabbed:Ye,ariaHasPopup:null,ariaHidden:Ye,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:De,ariaLevel:Q,ariaLive:null,ariaModal:Ye,ariaMultiLine:Ye,ariaMultiSelectable:Ye,ariaOrientation:null,ariaOwns:De,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:Ye,ariaReadOnly:Ye,ariaRelevant:null,ariaRequired:Ye,ariaRoleDescription:De,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:Ye,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function bf(e,t){return t in e?e[t]:t}function wf(e,t){return bf(e,t.toLowerCase())}const Z0=Vr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Or,acceptCharset:De,accessKey:De,action:null,allow:null,allowFullScreen:be,allowPaymentRequest:be,allowUserMedia:be,alt:null,as:null,async:be,autoCapitalize:null,autoComplete:De,autoFocus:be,autoPlay:be,blocking:De,capture:null,charSet:null,checked:be,cite:null,className:De,cols:Q,colSpan:null,content:null,contentEditable:Ye,controls:be,controlsList:De,coords:Q|Or,crossOrigin:null,data:null,dateTime:null,decoding:null,default:be,defer:be,dir:null,dirName:null,disabled:be,download:la,draggable:Ye,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:be,formTarget:null,headers:De,height:Q,hidden:la,high:Q,href:null,hrefLang:null,htmlFor:De,httpEquiv:De,id:null,imageSizes:null,imageSrcSet:null,inert:be,inputMode:null,integrity:null,is:null,isMap:be,itemId:null,itemProp:De,itemRef:De,itemScope:be,itemType:De,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:be,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:be,muted:be,name:null,nonce:null,noModule:be,noValidate:be,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:be,optimum:Q,pattern:null,ping:De,placeholder:null,playsInline:be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:be,referrerPolicy:null,rel:De,required:be,reversed:be,rows:Q,rowSpan:Q,sandbox:De,scope:null,scoped:be,seamless:be,selected:be,shadowRootClonable:be,shadowRootDelegatesFocus:be,shadowRootMode:null,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:Ye,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:be,useMap:null,value:Ye,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:De,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:be,declare:be,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:be,noHref:be,noShade:be,noWrap:be,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:Ye,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:be,disableRemotePlayback:be,prefix:null,property:null,results:Q,security:null,unselectable:null},space:"html",transform:wf}),eO=Vr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:jt,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:De,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:be,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Or,g2:Or,glyphName:Or,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:jt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:De,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:jt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:jt,rev:jt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:jt,requiredFeatures:jt,requiredFonts:jt,requiredFormats:jt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:jt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:jt,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:jt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:bf}),xf=Vr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),If=Vr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:wf}),Cf=Vr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),tO={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},nO=/[A-Z]/g,au=/-[a-z]/g,rO=/^data[-\w.:]+$/i;function iO(e,t){const n=aa(t);let r=t,i=Ft;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&rO.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(au,sO);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!au.test(o)){let s=o.replace(nO,oO);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}i=gl}return new i(r,t)}function oO(e){return"-"+e.toLowerCase()}function sO(e){return e.charAt(1).toUpperCase()}const aO=yf([vf,Z0,xf,If,Cf],"html"),yl=yf([vf,eO,xf,If,Cf],"svg");function lO(e){return e.join(" ").trim()}var xr={},ws,lu;function cO(){if(lu)return ws;lu=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
8
+ `,c="/",u="*",p="",h="comment",f="declaration";function y(g,x){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];x=x||{};var b=1,v=1;function I(P){var B=P.match(t);B&&(b+=B.length);var X=P.lastIndexOf(l);v=~X?P.length-X:v+P.length}function O(){var P={line:b,column:v};return function(B){return B.position=new E(P),A(),B}}function E(P){this.start=P,this.end={line:b,column:v},this.source=x.source}E.prototype.content=g;function R(P){var B=new Error(x.source+":"+b+":"+v+": "+P);if(B.reason=P,B.filename=x.source,B.line=b,B.column=v,B.source=g,!x.silent)throw B}function T(P){var B=P.exec(g);if(B){var X=B[0];return I(X),g=g.slice(X.length),B}}function A(){T(n)}function F(P){var B;for(P=P||[];B=j();)B!==!1&&P.push(B);return P}function j(){var P=O();if(!(c!=g.charAt(0)||u!=g.charAt(1))){for(var B=2;p!=g.charAt(B)&&(u!=g.charAt(B)||c!=g.charAt(B+1));)++B;if(B+=2,p===g.charAt(B-1))return R("End of comment missing");var X=g.slice(2,B-2);return v+=2,I(X),g=g.slice(B),v+=2,P({type:h,comment:X})}}function L(){var P=O(),B=T(r);if(B){if(j(),!T(i))return R("property missing ':'");var X=T(o),le=P({type:f,property:m(B[0].replace(e,p)),value:X?m(X[0].replace(e,p)):p});return T(s),le}}function H(){var P=[];F(P);for(var B;B=L();)B!==!1&&(P.push(B),F(P));return P}return A(),H()}function m(g){return g?g.replace(a,p):p}return ws=y,ws}var cu;function uO(){if(cu)return xr;cu=1;var e=xr&&xr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(xr,"__esModule",{value:!0}),xr.default=n;const t=e(cO());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const s=(0,t.default)(r),a=typeof i=="function";return s.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;a?i(c,u,l):u&&(o=o||{},o[c]=u)}),o}return xr}var Zr={},uu;function dO(){if(uu)return Zr;uu=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(c){return!c||n.test(c)||e.test(c)},s=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),o(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(i,a):c=c.replace(r,a),c.replace(t,s))};return Zr.camelCase=l,Zr}var ei,du;function pO(){if(du)return ei;du=1;var e=ei&&ei.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(uO()),n=dO();function r(i,o){var s={};return!i||typeof i!="string"||(0,t.default)(i,function(a,l){a&&l&&(s[(0,n.camelCase)(a,o)]=l)}),s}return r.default=r,ei=r,ei}var fO=pO();const hO=Br(fO),Sf=Of("end"),vl=Of("start");function Of(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function mO(e){const t=vl(e),n=Sf(e);if(t&&n)return{start:t,end:n}}function di(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?pu(e.position):"start"in e||"end"in e?pu(e):"line"in e||"column"in e?ua(e):""}function ua(e){return fu(e&&e.line)+":"+fu(e&&e.column)}function pu(e){return ua(e&&e.start)+"-"+ua(e&&e.end)}function fu(e){return e&&typeof e=="number"?e:1}class xt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},s=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(s=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=di(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}xt.prototype.file="";xt.prototype.name="";xt.prototype.reason="";xt.prototype.message="";xt.prototype.stack="";xt.prototype.column=void 0;xt.prototype.line=void 0;xt.prototype.ancestors=void 0;xt.prototype.cause=void 0;xt.prototype.fatal=void 0;xt.prototype.place=void 0;xt.prototype.ruleId=void 0;xt.prototype.source=void 0;const bl={}.hasOwnProperty,gO=new Map,yO=/[A-Z]/g,vO=new Set(["table","tbody","thead","tfoot","tr"]),bO=new Set(["td","th"]),_f="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=NO(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=EO(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?yl:aO,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=Ef(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function Ef(e,t,n){if(t.type==="element")return xO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return IO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return SO(e,t,n);if(t.type==="mdxjsEsm")return CO(e,t);if(t.type==="root")return OO(e,t,n);if(t.type==="text")return _O(e,t)}function xO(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=yl,e.schema=i),e.ancestors.push(t);const o=Tf(e,t.tagName,!1),s=TO(e,t);let a=xl(e,t);return vO.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!X0(l):!0})),Nf(e,s,o,t),wl(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function IO(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}wi(e,t.position)}function CO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wi(e,t.position)}function SO(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=yl,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:Tf(e,t.name,!0),s=kO(e,t),a=xl(e,t);return Nf(e,s,o,t),wl(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function OO(e,t,n){const r={};return wl(r,xl(e,t)),e.create(t,e.Fragment,r,n)}function _O(e,t){return t.value}function Nf(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function wl(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function EO(e,t,n){return r;function r(i,o,s,a){const c=Array.isArray(s.children)?n:t;return a?c(o,s,a):c(o,s)}}function NO(e,t){return n;function n(r,i,o,s){const a=Array.isArray(o.children),l=vl(r);return t(i,o,s,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function TO(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&bl.call(t.properties,i)){const o=RO(e,i,t.properties[i]);if(o){const[s,a]=o;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&bO.has(t.tagName)?r=a:n[s]=a}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function kO(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const s=o.expression;s.type;const a=s.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else wi(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,o=e.evaluater.evaluateExpression(a.expression)}else wi(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function xl(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:gO;for(;++r<t.children.length;){const o=t.children[r];let s;if(e.passKeys){const l=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(l){const c=i.get(l)||0;s=l+"-"+c,i.set(l,c+1)}}const a=Ef(e,o,s);a!==void 0&&n.push(a)}return n}function RO(e,t,n){const r=iO(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?H0(n):lO(n)),r.property==="style"){let i=typeof n=="object"?n:AO(e,String(n));return e.stylePropertyNameCase==="css"&&(i=FO(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?tO[r.property]||r.property:r.attribute,n]}}function AO(e,t){try{return hO(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new xt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=_f+"#cannot-parse-style-attribute",i}}function Tf(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,s;for(;++o<i.length;){const a=iu(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(o&&a.type==="Literal"),optional:!1}:a}r=s}else r=iu(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return bl.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);wi(e)}function wi(e,t){const n=new xt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=_f+"#cannot-handle-mdx-estrees-without-createevaluater",n}function FO(e){const t={};let n;for(n in e)bl.call(e,n)&&(t[PO(n)]=e[n]);return t}function PO(e){let t=e.replace(yO,jO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function jO(e){return"-"+e.toLowerCase()}const xs={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},MO={};function DO(e,t){const n=MO,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return kf(e,r,i)}function kf(e,t,n){if(LO(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return hu(e.children,t,n)}return Array.isArray(e)?hu(e,t,n):""}function hu(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=kf(e[i],t,n);return r.join("")}function LO(e){return!!(e&&typeof e=="object")}const mu=document.createElement("i");function Il(e){const t="&"+e+";";mu.innerHTML=t;const n=mu.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function gn(e,t,n,r){const i=e.length;let o=0,s;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);o<r.length;)s=r.slice(o,o+1e4),s.unshift(t,0),e.splice(...s),o+=1e4,t+=1e4}function Qt(e,t){return e.length>0?(gn(e,e.length,0,t),e):t}const gu={}.hasOwnProperty;function BO(e){const t={};let n=-1;for(;++n<e.length;)qO(t,e[n]);return t}function qO(e,t){let n;for(n in t){const i=(gu.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let s;if(o)for(s in o){gu.call(i,s)||(i[s]=[]);const a=o[s];$O(i[s],Array.isArray(a)?a:a?[a]:[])}}}function $O(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);gn(e,0,0,r)}function Rf(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function _r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const hn=Gn(/[A-Za-z]/),Dt=Gn(/[\dA-Za-z]/),VO=Gn(/[#-'*+\--9=?A-Z^-~]/);function da(e){return e!==null&&(e<32||e===127)}const pa=Gn(/\d/),UO=Gn(/[\dA-Fa-f]/),zO=Gn(/[!-/:-@[-`{-~]/);function he(e){return e!==null&&e<-2}function At(e){return e!==null&&(e<0||e===32)}function Ee(e){return e===-2||e===-1||e===32}const KO=Gn(new RegExp("\\p{P}|\\p{S}","u")),HO=Gn(/\s/);function Gn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ur(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let s="";if(o===37&&Dt(e.charCodeAt(n+1))&&Dt(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(s=String.fromCharCode(o));else if(o>55295&&o<57344){const a=e.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="�"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Le(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return Ee(l)?(e.enter(n),a(l)):t(l)}function a(l){return Ee(l)&&o++<i?(e.consume(l),a):(e.exit(n),t(l))}}const JO={tokenize:WO};function WO(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Le(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),o(a)}function o(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return he(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),s)}}const QO={tokenize:GO},yu={tokenize:XO};function GO(e){const t=this,n=[];let r=0,i,o,s;return a;function a(v){if(r<n.length){const I=n[r];return t.containerState=I[1],e.attempt(I[0].continuation,l,c)(v)}return c(v)}function l(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&b();const I=t.events.length;let O=I,E;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){E=t.events[O][1].end;break}x(r);let R=I;for(;R<t.events.length;)t.events[R][1].end={...E},R++;return gn(t.events,O+1,0,t.events.slice(I)),t.events.length=R,c(v)}return a(v)}function c(v){if(r===n.length){if(!i)return h(v);if(i.currentConstruct&&i.currentConstruct.concrete)return y(v);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(yu,u,p)(v)}function u(v){return i&&b(),x(r),h(v)}function p(v){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,y(v)}function h(v){return t.containerState={},e.attempt(yu,f,y)(v)}function f(v){return r++,n.push([t.currentConstruct,t.containerState]),h(v)}function y(v){if(v===null){i&&b(),x(0),e.consume(v);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),m(v)}function m(v){if(v===null){g(e.exit("chunkFlow"),!0),x(0),e.consume(v);return}return he(v)?(e.consume(v),g(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(v),m)}function g(v,I){const O=t.sliceStream(v);if(I&&O.push(null),v.previous=o,o&&(o.next=v),o=v,i.defineSkip(v.start),i.write(O),t.parser.lazy[v.start.line]){let E=i.events.length;for(;E--;)if(i.events[E][1].start.offset<s&&(!i.events[E][1].end||i.events[E][1].end.offset>s))return;const R=t.events.length;let T=R,A,F;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(A){F=t.events[T][1].end;break}A=!0}for(x(r),E=R;E<t.events.length;)t.events[E][1].end={...F},E++;gn(t.events,T+1,0,t.events.slice(R)),t.events.length=E}}function x(v){let I=n.length;for(;I-- >v;){const O=n[I];t.containerState=O[1],O[0].exit.call(t,e)}n.length=v}function b(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function XO(e,t,n){return Le(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vu(e){if(e===null||At(e)||HO(e))return 1;if(KO(e))return 2}function Cl(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const fa={name:"attention",resolveAll:YO,tokenize:ZO};function YO(e,t){let n=-1,r,i,o,s,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},h={...e[n][1].start};bu(p,-l),bu(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},o={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Qt(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Qt(c,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",o,t]]),c=Qt(c,Cl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Qt(c,[["exit",o,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=Qt(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,gn(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function ZO(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=vu(r);let o;return s;function s(l){return o=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===o)return e.consume(l),a;const c=e.exit("attentionSequence"),u=vu(l),p=!u||u===2&&i||n.includes(l),h=!i||i===2&&u||n.includes(r);return c._open=!!(o===42?p:p&&(i||!h)),c._close=!!(o===42?h:h&&(u||!p)),t(l)}}function bu(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const e1={name:"autolink",tokenize:t1};function t1(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(f){return hn(f)?(e.consume(f),s):f===64?n(f):c(f)}function s(f){return f===43||f===45||f===46||Dt(f)?(r=1,a(f)):c(f)}function a(f){return f===58?(e.consume(f),r=0,l):(f===43||f===45||f===46||Dt(f))&&r++<32?(e.consume(f),a):(r=0,c(f))}function l(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||da(f)?n(f):(e.consume(f),l)}function c(f){return f===64?(e.consume(f),u):VO(f)?(e.consume(f),c):n(f)}function u(f){return Dt(f)?p(f):n(f)}function p(f){return f===46?(e.consume(f),r=0,u):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):h(f)}function h(f){if((f===45||Dt(f))&&r++<63){const y=f===45?h:p;return e.consume(f),y}return n(f)}}const Vo={partial:!0,tokenize:n1};function n1(e,t,n){return r;function r(o){return Ee(o)?Le(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||he(o)?t(o):n(o)}}const Af={continuation:{tokenize:i1},exit:o1,name:"blockQuote",tokenize:r1};function r1(e,t,n){const r=this;return i;function i(s){if(s===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),o}return n(s)}function o(s){return Ee(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function i1(e,t,n){const r=this;return i;function i(s){return Ee(s)?Le(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)}function o(s){return e.attempt(Af,t,n)(s)}}function o1(e){e.exit("blockQuote")}const Ff={name:"characterEscape",tokenize:s1};function s1(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return zO(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const Pf={name:"characterReference",tokenize:a1};function a1(e,t,n){const r=this;let i=0,o,s;return a;function a(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),l}function l(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),o=31,s=Dt,u(p))}function c(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,s=UO,u):(e.enter("characterReferenceValue"),o=7,s=pa,u(p))}function u(p){if(p===59&&i){const h=e.exit("characterReferenceValue");return s===Dt&&!Il(r.sliceSerialize(h))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(p)&&i++<o?(e.consume(p),u):n(p)}}const wu={partial:!0,tokenize:c1},xu={concrete:!0,name:"codeFenced",tokenize:l1};function l1(e,t,n){const r=this,i={partial:!0,tokenize:O};let o=0,s=0,a;return l;function l(E){return c(E)}function c(E){const R=r.events[r.events.length-1];return o=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,a=E,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(E)}function u(E){return E===a?(s++,e.consume(E),u):s<3?n(E):(e.exit("codeFencedFenceSequence"),Ee(E)?Le(e,p,"whitespace")(E):p(E))}function p(E){return E===null||he(E)?(e.exit("codeFencedFence"),r.interrupt?t(E):e.check(wu,m,I)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(E))}function h(E){return E===null||he(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(E)):Ee(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Le(e,f,"whitespace")(E)):E===96&&E===a?n(E):(e.consume(E),h)}function f(E){return E===null||he(E)?p(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(E))}function y(E){return E===null||he(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(E)):E===96&&E===a?n(E):(e.consume(E),y)}function m(E){return e.attempt(i,I,g)(E)}function g(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),x}function x(E){return o>0&&Ee(E)?Le(e,b,"linePrefix",o+1)(E):b(E)}function b(E){return E===null||he(E)?e.check(wu,m,I)(E):(e.enter("codeFlowValue"),v(E))}function v(E){return E===null||he(E)?(e.exit("codeFlowValue"),b(E)):(e.consume(E),v)}function I(E){return e.exit("codeFenced"),t(E)}function O(E,R,T){let A=0;return F;function F(B){return E.enter("lineEnding"),E.consume(B),E.exit("lineEnding"),j}function j(B){return E.enter("codeFencedFence"),Ee(B)?Le(E,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):L(B)}function L(B){return B===a?(E.enter("codeFencedFenceSequence"),H(B)):T(B)}function H(B){return B===a?(A++,E.consume(B),H):A>=s?(E.exit("codeFencedFenceSequence"),Ee(B)?Le(E,P,"whitespace")(B):P(B)):T(B)}function P(B){return B===null||he(B)?(E.exit("codeFencedFence"),R(B)):T(B)}}}function c1(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Is={name:"codeIndented",tokenize:d1},u1={partial:!0,tokenize:p1};function d1(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Le(e,o,"linePrefix",5)(c)}function o(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?l(c):he(c)?e.attempt(u1,s,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||he(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function p1(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):he(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):Le(e,o,"linePrefix",5)(s)}function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):he(s)?i(s):n(s)}}const f1={name:"codeText",previous:m1,resolve:h1,tokenize:g1};function h1(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function m1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function g1(e,t,n){let r=0,i,o;return s;function s(p){return e.enter("codeText"),e.enter("codeTextSequence"),a(p)}function a(p){return p===96?(e.consume(p),r++,a):(e.exit("codeTextSequence"),l(p))}function l(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),l):p===96?(o=e.enter("codeTextSequence"),i=0,u(p)):he(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(p))}function c(p){return p===null||p===32||p===96||he(p)?(e.exit("codeTextData"),l(p)):(e.consume(p),c)}function u(p){return p===96?(e.consume(p),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(o.type="codeTextData",c(p))}}class y1{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&ti(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ti(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ti(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ti(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ti(this.left,n.reverse())}}}function ti(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function jf(e){const t={};let n=-1,r,i,o,s,a,l,c;const u=new y1(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,v1(u,n)),n=t[n],c=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(s=u.get(o),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=o);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return gn(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function v1(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const a=s.events,l=[],c={};let u,p,h=-1,f=n,y=0,m=0;const g=[m];for(;f;){for(;e.get(++i)[1]!==f;);o.push(i),f._tokenizer||(u=r.sliceStream(f),f.next||u.push(null),p&&s.defineSkip(f.start),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),p=f,f=f.next}for(f=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(m=h+1,g.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(s.events=[],f?(f._tokenizer=void 0,f.previous=void 0):g.pop(),h=g.length;h--;){const x=a.slice(g[h],g[h+1]),b=o.pop();l.push([b,b+x.length-1]),e.splice(b,2,x)}for(l.reverse(),h=-1;++h<l.length;)c[y+l[h][0]]=y+l[h][1],y+=l[h][1]-l[h][0]-1;return c}const b1={resolve:x1,tokenize:I1},w1={partial:!0,tokenize:C1};function x1(e){return jf(e),e}function I1(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?o(a):he(a)?e.check(w1,s,o)(a):(e.consume(a),i)}function o(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function C1(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Le(e,o,"linePrefix")}function o(s){if(s===null||he(s))return n(s);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function Mf(e,t,n,r,i,o,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return p;function p(x){return x===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(x),e.exit(o),h):x===null||x===32||x===41||da(x)?n(x):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(x))}function h(x){return x===62?(e.enter(o),e.consume(x),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(x))}function f(x){return x===62?(e.exit("chunkString"),e.exit(a),h(x)):x===null||x===60||he(x)?n(x):(e.consume(x),x===92?y:f)}function y(x){return x===60||x===62||x===92?(e.consume(x),f):f(x)}function m(x){return!u&&(x===null||x===41||At(x))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(x)):u<c&&x===40?(e.consume(x),u++,m):x===41?(e.consume(x),u--,m):x===null||x===32||x===40||da(x)?n(x):(e.consume(x),x===92?g:m)}function g(x){return x===40||x===41||x===92?(e.consume(x),m):m(x)}}function Df(e,t,n,r,i,o){const s=this;let a=0,l;return c;function c(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(o),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):f===93?(e.exit(o),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):he(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),p(f))}function p(f){return f===null||f===91||f===93||he(f)||a++>999?(e.exit("chunkString"),u(f)):(e.consume(f),l||(l=!Ee(f)),f===92?h:p)}function h(f){return f===91||f===92||f===93?(e.consume(f),a++,p):p(f)}}function Lf(e,t,n,r,i,o){let s;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(o),c(h))}function c(h){return h===s?(e.exit(o),l(s)):h===null?n(h):he(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Le(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===s||h===null||he(h)?(e.exit("chunkString"),c(h)):(e.consume(h),h===92?p:u)}function p(h){return h===s||h===92?(e.consume(h),u):u(h)}}function pi(e,t){let n;return r;function r(i){return he(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ee(i)?Le(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const S1={name:"definition",tokenize:_1},O1={partial:!0,tokenize:E1};function _1(e,t,n){const r=this;let i;return o;function o(f){return e.enter("definition"),s(f)}function s(f){return Df.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=_r(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),l):n(f)}function l(f){return At(f)?pi(e,c)(f):c(f)}function c(f){return Mf(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return e.attempt(O1,p,p)(f)}function p(f){return Ee(f)?Le(e,h,"whitespace")(f):h(f)}function h(f){return f===null||he(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function E1(e,t,n){return r;function r(a){return At(a)?pi(e,i)(a):n(a)}function i(a){return Lf(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Ee(a)?Le(e,s,"whitespace")(a):s(a)}function s(a){return a===null||he(a)?t(a):n(a)}}const N1={name:"hardBreakEscape",tokenize:T1};function T1(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return he(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const k1={name:"headingAtx",resolve:R1,tokenize:A1};function R1(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},gn(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function A1(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),o(u)}function o(u){return e.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&r++<6?(e.consume(u),s):u===null||At(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||he(u)?(e.exit("atxHeading"),t(u)):Ee(u)?Le(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||At(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const F1=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Iu=["pre","script","style","textarea"],P1={concrete:!0,name:"htmlFlow",resolveTo:D1,tokenize:L1},j1={partial:!0,tokenize:q1},M1={partial:!0,tokenize:B1};function D1(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function L1(e,t,n){const r=this;let i,o,s,a,l;return c;function c(S){return u(S)}function u(S){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(S),p}function p(S){return S===33?(e.consume(S),h):S===47?(e.consume(S),o=!0,m):S===63?(e.consume(S),i=3,r.interrupt?t:C):hn(S)?(e.consume(S),s=String.fromCharCode(S),g):n(S)}function h(S){return S===45?(e.consume(S),i=2,f):S===91?(e.consume(S),i=5,a=0,y):hn(S)?(e.consume(S),i=4,r.interrupt?t:C):n(S)}function f(S){return S===45?(e.consume(S),r.interrupt?t:C):n(S)}function y(S){const U="CDATA[";return S===U.charCodeAt(a++)?(e.consume(S),a===U.length?r.interrupt?t:L:y):n(S)}function m(S){return hn(S)?(e.consume(S),s=String.fromCharCode(S),g):n(S)}function g(S){if(S===null||S===47||S===62||At(S)){const U=S===47,V=s.toLowerCase();return!U&&!o&&Iu.includes(V)?(i=1,r.interrupt?t(S):L(S)):F1.includes(s.toLowerCase())?(i=6,U?(e.consume(S),x):r.interrupt?t(S):L(S)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(S):o?b(S):v(S))}return S===45||Dt(S)?(e.consume(S),s+=String.fromCharCode(S),g):n(S)}function x(S){return S===62?(e.consume(S),r.interrupt?t:L):n(S)}function b(S){return Ee(S)?(e.consume(S),b):F(S)}function v(S){return S===47?(e.consume(S),F):S===58||S===95||hn(S)?(e.consume(S),I):Ee(S)?(e.consume(S),v):F(S)}function I(S){return S===45||S===46||S===58||S===95||Dt(S)?(e.consume(S),I):O(S)}function O(S){return S===61?(e.consume(S),E):Ee(S)?(e.consume(S),O):v(S)}function E(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),l=S,R):Ee(S)?(e.consume(S),E):T(S)}function R(S){return S===l?(e.consume(S),l=null,A):S===null||he(S)?n(S):(e.consume(S),R)}function T(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||At(S)?O(S):(e.consume(S),T)}function A(S){return S===47||S===62||Ee(S)?v(S):n(S)}function F(S){return S===62?(e.consume(S),j):n(S)}function j(S){return S===null||he(S)?L(S):Ee(S)?(e.consume(S),j):n(S)}function L(S){return S===45&&i===2?(e.consume(S),X):S===60&&i===1?(e.consume(S),le):S===62&&i===4?(e.consume(S),W):S===63&&i===3?(e.consume(S),C):S===93&&i===5?(e.consume(S),ge):he(S)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(j1,q,H)(S)):S===null||he(S)?(e.exit("htmlFlowData"),H(S)):(e.consume(S),L)}function H(S){return e.check(M1,P,q)(S)}function P(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),B}function B(S){return S===null||he(S)?H(S):(e.enter("htmlFlowData"),L(S))}function X(S){return S===45?(e.consume(S),C):L(S)}function le(S){return S===47?(e.consume(S),s="",fe):L(S)}function fe(S){if(S===62){const U=s.toLowerCase();return Iu.includes(U)?(e.consume(S),W):L(S)}return hn(S)&&s.length<8?(e.consume(S),s+=String.fromCharCode(S),fe):L(S)}function ge(S){return S===93?(e.consume(S),C):L(S)}function C(S){return S===62?(e.consume(S),W):S===45&&i===2?(e.consume(S),C):L(S)}function W(S){return S===null||he(S)?(e.exit("htmlFlowData"),q(S)):(e.consume(S),W)}function q(S){return e.exit("htmlFlow"),t(S)}}function B1(e,t,n){const r=this;return i;function i(s){return he(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):n(s)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function q1(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Vo,t,n)}}const $1={name:"htmlText",tokenize:V1};function V1(e,t,n){const r=this;let i,o,s;return a;function a(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),c):C===47?(e.consume(C),O):C===63?(e.consume(C),v):hn(C)?(e.consume(C),T):n(C)}function c(C){return C===45?(e.consume(C),u):C===91?(e.consume(C),o=0,y):hn(C)?(e.consume(C),b):n(C)}function u(C){return C===45?(e.consume(C),f):n(C)}function p(C){return C===null?n(C):C===45?(e.consume(C),h):he(C)?(s=p,le(C)):(e.consume(C),p)}function h(C){return C===45?(e.consume(C),f):p(C)}function f(C){return C===62?X(C):C===45?h(C):p(C)}function y(C){const W="CDATA[";return C===W.charCodeAt(o++)?(e.consume(C),o===W.length?m:y):n(C)}function m(C){return C===null?n(C):C===93?(e.consume(C),g):he(C)?(s=m,le(C)):(e.consume(C),m)}function g(C){return C===93?(e.consume(C),x):m(C)}function x(C){return C===62?X(C):C===93?(e.consume(C),x):m(C)}function b(C){return C===null||C===62?X(C):he(C)?(s=b,le(C)):(e.consume(C),b)}function v(C){return C===null?n(C):C===63?(e.consume(C),I):he(C)?(s=v,le(C)):(e.consume(C),v)}function I(C){return C===62?X(C):v(C)}function O(C){return hn(C)?(e.consume(C),E):n(C)}function E(C){return C===45||Dt(C)?(e.consume(C),E):R(C)}function R(C){return he(C)?(s=R,le(C)):Ee(C)?(e.consume(C),R):X(C)}function T(C){return C===45||Dt(C)?(e.consume(C),T):C===47||C===62||At(C)?A(C):n(C)}function A(C){return C===47?(e.consume(C),X):C===58||C===95||hn(C)?(e.consume(C),F):he(C)?(s=A,le(C)):Ee(C)?(e.consume(C),A):X(C)}function F(C){return C===45||C===46||C===58||C===95||Dt(C)?(e.consume(C),F):j(C)}function j(C){return C===61?(e.consume(C),L):he(C)?(s=j,le(C)):Ee(C)?(e.consume(C),j):A(C)}function L(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),i=C,H):he(C)?(s=L,le(C)):Ee(C)?(e.consume(C),L):(e.consume(C),P)}function H(C){return C===i?(e.consume(C),i=void 0,B):C===null?n(C):he(C)?(s=H,le(C)):(e.consume(C),H)}function P(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||At(C)?A(C):(e.consume(C),P)}function B(C){return C===47||C===62||At(C)?A(C):n(C)}function X(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function le(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),fe}function fe(C){return Ee(C)?Le(e,ge,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):ge(C)}function ge(C){return e.enter("htmlTextData"),s(C)}}const Sl={name:"labelEnd",resolveAll:H1,resolveTo:J1,tokenize:W1},U1={tokenize:Q1},z1={tokenize:G1},K1={tokenize:X1};function H1(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&gn(e,0,e.length,n),e}function J1(e,t){let n=e.length,r=0,i,o,s,a;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const l={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[o][1].start},end:{...e[s][1].end}},u={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[s-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=Qt(a,e.slice(o+1,o+r+3)),a=Qt(a,[["enter",u,t]]),a=Qt(a,Cl(t.parser.constructs.insideSpan.null,e.slice(o+r+4,s-3),t)),a=Qt(a,[["exit",u,t],e[s-2],e[s-1],["exit",c,t]]),a=Qt(a,e.slice(s+1)),a=Qt(a,[["exit",l,t]]),gn(e,o,e.length,a),e}function W1(e,t,n){const r=this;let i=r.events.length,o,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return a;function a(h){return o?o._inactive?p(h):(s=r.parser.defined.includes(_r(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(U1,u,s?u:p)(h):h===91?e.attempt(z1,u,s?c:p)(h):s?u(h):p(h)}function c(h){return e.attempt(K1,u,p)(h)}function u(h){return t(h)}function p(h){return o._balanced=!0,n(h)}}function Q1(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),i}function i(p){return At(p)?pi(e,o)(p):o(p)}function o(p){return p===41?u(p):Mf(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function s(p){return At(p)?pi(e,l)(p):u(p)}function a(p){return n(p)}function l(p){return p===34||p===39||p===40?Lf(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):u(p)}function c(p){return At(p)?pi(e,u)(p):u(p)}function u(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function G1(e,t,n){const r=this;return i;function i(a){return Df.call(r,e,o,s,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(_r(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function X1(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const Y1={name:"labelStartImage",resolveAll:Sl.resolveAll,tokenize:Z1};function Z1(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),o}function o(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const e_={name:"labelStartLink",resolveAll:Sl.resolveAll,tokenize:t_};function t_(e,t,n){const r=this;return i;function i(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),o}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Cs={name:"lineEnding",tokenize:n_};function n_(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Le(e,t,"linePrefix")}}const uo={name:"thematicBreak",tokenize:r_};function r_(e,t,n){let r=0,i;return o;function o(c){return e.enter("thematicBreak"),s(c)}function s(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||he(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ee(c)?Le(e,a,"whitespace")(c):a(c))}}const kt={continuation:{tokenize:a_},exit:c_,name:"list",tokenize:s_},i_={partial:!0,tokenize:u_},o_={partial:!0,tokenize:l_};function s_(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(f){const y=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:pa(f)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(uo,n,c)(f):c(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(f)}return n(f)}function l(f){return pa(f)&&++s<10?(e.consume(f),l):(!r.interrupt||s<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):n(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(Vo,r.interrupt?n:u,e.attempt(i_,h,p))}function u(f){return r.containerState.initialBlankLine=!0,o++,h(f)}function p(f){return Ee(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function a_(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Vo,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Le(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!Ee(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(o_,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Le(e,e.attempt(kt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function l_(e,t,n){const r=this;return Le(e,i,"listItemIndent",r.containerState.size+1);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(o):n(o)}}function c_(e){e.exit(this.containerState.type)}function u_(e,t,n){const r=this;return Le(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const s=r.events[r.events.length-1];return!Ee(o)&&s&&s[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Cu={name:"setextUnderline",resolveTo:d_,tokenize:p_};function d_(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",s,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function p_(e,t,n){const r=this;let i;return o;function o(c){let u=r.events.length,p;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){p=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),i=c,s(c)):n(c)}function s(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Ee(c)?Le(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||he(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const f_={tokenize:h_};function h_(e){const t=this,n=e.attempt(Vo,r,e.attempt(this.parser.constructs.flowInitial,i,Le(e,e.attempt(this.parser.constructs.flow,i,e.attempt(b1,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const m_={resolveAll:qf()},g_=Bf("string"),y_=Bf("text");function Bf(e){return{resolveAll:qf(e==="text"?v_:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,s,a);return s;function s(u){return c(u)?o(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),o(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const p=i[u];let h=-1;if(p)for(;++h<p.length;){const f=p[h];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function qf(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function v_(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,s=-1,a=0,l;for(;o--;){const c=i[o];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)l=!0,a++;else if(c!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:r.start._bufferIndex+s,_index:r.start._index+o,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const b_={42:kt,43:kt,45:kt,48:kt,49:kt,50:kt,51:kt,52:kt,53:kt,54:kt,55:kt,56:kt,57:kt,62:Af},w_={91:S1},x_={[-2]:Is,[-1]:Is,32:Is},I_={35:k1,42:uo,45:[Cu,uo],60:P1,61:Cu,95:uo,96:xu,126:xu},C_={38:Pf,92:Ff},S_={[-5]:Cs,[-4]:Cs,[-3]:Cs,33:Y1,38:Pf,42:fa,60:[e1,$1],91:e_,92:[N1,Ff],93:Sl,95:fa,96:f1},O_={null:[fa,m_]},__={null:[42,95]},E_={null:[]},N_=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:__,contentInitial:w_,disable:E_,document:b_,flow:I_,flowInitial:x_,insideSpan:O_,string:C_,text:S_},Symbol.toStringTag,{value:"Module"}));function T_(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let s=[],a=[];const l={attempt:R(O),check:R(E),consume:b,enter:v,exit:I,interrupt:R(E,{interrupt:!0})},c={code:null,containerState:{},defineSkip:m,events:[],now:y,parser:e,previous:null,sliceSerialize:h,sliceStream:f,write:p};let u=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function p(j){return s=Qt(s,j),g(),s[s.length-1]!==null?[]:(T(t,0),c.events=Cl(o,c.events,c),c.events)}function h(j,L){return R_(f(j),L)}function f(j){return k_(s,j)}function y(){const{_bufferIndex:j,_index:L,line:H,column:P,offset:B}=r;return{_bufferIndex:j,_index:L,line:H,column:P,offset:B}}function m(j){i[j.line]=j.column,F()}function g(){let j;for(;r._index<s.length;){const L=s[r._index];if(typeof L=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<L.length;)x(L.charCodeAt(r._bufferIndex));else x(L)}}function x(j){u=u(j)}function b(j){he(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,F()):j!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=j}function v(j,L){const H=L||{};return H.type=j,H.start=y(),c.events.push(["enter",H,c]),a.push(H),H}function I(j){const L=a.pop();return L.end=y(),c.events.push(["exit",L,c]),L}function O(j,L){T(j,L.from)}function E(j,L){L.restore()}function R(j,L){return H;function H(P,B,X){let le,fe,ge,C;return Array.isArray(P)?q(P):"tokenize"in P?q([P]):W(P);function W(Y){return ie;function ie(ne){const se=ne!==null&&Y[ne],ee=ne!==null&&Y.null,me=[...Array.isArray(se)?se:se?[se]:[],...Array.isArray(ee)?ee:ee?[ee]:[]];return q(me)(ne)}}function q(Y){return le=Y,fe=0,Y.length===0?X:S(Y[fe])}function S(Y){return ie;function ie(ne){return C=A(),ge=Y,Y.partial||(c.currentConstruct=Y),Y.name&&c.parser.constructs.disable.null.includes(Y.name)?V():Y.tokenize.call(L?Object.assign(Object.create(c),L):c,l,U,V)(ne)}}function U(Y){return j(ge,C),B}function V(Y){return C.restore(),++fe<le.length?S(le[fe]):X}}}function T(j,L){j.resolveAll&&!o.includes(j)&&o.push(j),j.resolve&&gn(c.events,L,c.events.length-L,j.resolve(c.events.slice(L),c)),j.resolveTo&&(c.events=j.resolveTo(c.events,c))}function A(){const j=y(),L=c.previous,H=c.currentConstruct,P=c.events.length,B=Array.from(a);return{from:P,restore:X};function X(){r=j,c.previous=L,c.currentConstruct=H,c.events.length=P,a=B,F()}}function F(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function k_(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,o)];else{if(s=e.slice(n,i),r>-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}function R_(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let s;if(typeof o=="string")s=o;else switch(o){case-5:{s="\r";break}case-4:{s=`
8
9
  `;break}case-3:{s=`\r
9
- `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&i)continue;s=" ";break}default:s=String.fromCharCode(o)}i=o===-2,r.push(s)}return r.join("")}function I1(e){const r={constructs:T0([v1,...(e||{}).extensions||[]]),content:i(D0),defined:[],document:i(B0),flow:i(r1),lazy:{},string:i(s1),text:i(a1)};return r;function i(o){return s;function s(a){return b1(r,o,a)}}}function C1(e){for(;!Qp(e););return e}const tu=/[\0\t\n\r]/g;function S1(){let e=1,t="",n=!0,r;return i;function i(o,s,a){const l=[];let c,u,p,h,f;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(tu.lastIndex=p,c=tu.exec(o),h=c&&c.index!==void 0?c.index:o.length,f=o.charCodeAt(h),!c){t=o.slice(p);break}if(f===10&&p===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),p<h&&(l.push(o.slice(p,h)),e+=h-p),f){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}p=h+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const O1=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function _1(e){return e.replace(O1,E1)}function E1(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return Kp(n.slice(o?2:1),o?16:10)}return rl(n)||e}const tf={}.hasOwnProperty;function N1(e,t,n){return typeof t!="string"&&(n=t,t=void 0),T1(n)(C1(I1(n).document().write(S1()(e,t,!0))))}function T1(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(et),autolinkProtocol:A,autolinkEmail:A,atxHeading:o($e),blockQuote:o(ee),characterEscape:A,characterReference:A,codeFenced:o(me),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(me,s),codeText:o(q,s),codeTextData:A,data:A,codeFlowValue:A,definition:o(ye),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(Z),hardBreakEscape:o(Fe),hardBreakTrailing:o(Fe),htmlFlow:o(Ae,s),htmlFlowData:A,htmlText:o(Ae,s),htmlTextData:A,image:o(We),label:s,link:o(et),listItem:o(xe),listItemValue:h,listOrdered:o(tt,p),listUnordered:o(tt),paragraph:o(at),reference:S,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o($e),strong:o(It),thematicBreak:o(Ge)},exit:{atxHeading:l(),atxHeadingSequence:O,autolink:l(),autolinkEmail:se,autolinkProtocol:ne,blockQuote:l(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:V,characterReferenceMarkerNumeric:V,characterReferenceValue:Y,characterReference:ie,codeFenced:l(y),codeFencedFence:v,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:F,codeIndented:l(x),codeText:l(B),codeTextData:F,data:F,definition:l(),definitionDestinationString:I,definitionLabelString:g,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(L),hardBreakTrailing:l(L),htmlFlow:l(H),htmlFlowData:F,htmlText:l(P),htmlTextData:F,image:l(le),label:ge,labelText:fe,lineEnding:j,link:l(X),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:U,resourceDestinationString:C,resourceTitleString:W,resource:$,setextHeading:l(k),setextHeadingLineSequence:R,setextHeadingText:_,strong:l(),thematicBreak:l()}};nf(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(D){let K={type:"root",children:[]};const M={stack:[K],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:u,data:n},re=[];let ce=-1;for(;++ce<D.length;)if(D[ce][1].type==="listOrdered"||D[ce][1].type==="listUnordered")if(D[ce][0]==="enter")re.push(ce);else{const Ue=re.pop();ce=i(D,Ue,ce)}for(ce=-1;++ce<D.length;){const Ue=t[D[ce][0]];tf.call(Ue,D[ce][1].type)&&Ue[D[ce][1].type].call(Object.assign({sliceSerialize:D[ce][2].sliceSerialize},M),D[ce][1])}if(M.tokenStack.length>0){const Ue=M.tokenStack[M.tokenStack.length-1];(Ue[1]||nu).call(M,void 0,Ue[0])}for(K.position={start:Bn(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:Bn(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},ce=-1;++ce<t.transforms.length;)K=t.transforms[ce](K)||K;return K}function i(D,K,M){let re=K-1,ce=-1,Ue=!1,Ct,pt,gt,Pe;for(;++re<=M;){const Oe=D[re];switch(Oe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Oe[0]==="enter"?ce++:ce--,Pe=void 0;break}case"lineEndingBlank":{Oe[0]==="enter"&&(Ct&&!Pe&&!ce&&!gt&&(gt=re),Pe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pe=void 0}if(!ce&&Oe[0]==="enter"&&Oe[1].type==="listItemPrefix"||ce===-1&&Oe[0]==="exit"&&(Oe[1].type==="listUnordered"||Oe[1].type==="listOrdered")){if(Ct){let St=re;for(pt=void 0;St--;){const ft=D[St];if(ft[1].type==="lineEnding"||ft[1].type==="lineEndingBlank"){if(ft[0]==="exit")continue;pt&&(D[pt][1].type="lineEndingBlank",Ue=!0),ft[1].type="lineEnding",pt=St}else if(!(ft[1].type==="linePrefix"||ft[1].type==="blockQuotePrefix"||ft[1].type==="blockQuotePrefixWhitespace"||ft[1].type==="blockQuoteMarker"||ft[1].type==="listItemIndent"))break}gt&&(!pt||gt<pt)&&(Ct._spread=!0),Ct.end=Object.assign({},pt?D[pt][1].start:Oe[1].end),D.splice(pt||re,0,["exit",Ct,Oe[2]]),re++,M++}if(Oe[1].type==="listItemPrefix"){const St={type:"listItem",_spread:!1,start:Object.assign({},Oe[1].start),end:void 0};Ct=St,D.splice(re,0,["enter",St,Oe[2]]),re++,M++,gt=void 0,Pe=!0}}}return D[K][1]._spread=Ue,M}function o(D,K){return M;function M(re){a.call(this,D(re),re),K&&K.call(this,re)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(D,K,M){this.stack[this.stack.length-1].children.push(D),this.stack.push(D),this.tokenStack.push([K,M||void 0]),D.position={start:Bn(K.start),end:void 0}}function l(D){return K;function K(M){D&&D.call(this,M),c.call(this,M)}}function c(D,K){const M=this.stack.pop(),re=this.tokenStack.pop();if(re)re[0].type!==D.type&&(K?K.call(this,D,re[0]):(re[1]||nu).call(this,D,re[0]));else throw new Error("Cannot close `"+D.type+"` ("+li({start:D.start,end:D.end})+"): it’s not open");M.position.end=Bn(D.end)}function u(){return E0(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function h(D){if(this.data.expectingFirstListItemValue){const K=this.stack[this.stack.length-2];K.start=Number.parseInt(this.sliceSerialize(D),10),this.data.expectingFirstListItemValue=void 0}}function f(){const D=this.resume(),K=this.stack[this.stack.length-1];K.lang=D}function m(){const D=this.resume(),K=this.stack[this.stack.length-1];K.meta=D}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D.replace(/(\r?\n|\r)$/g,"")}function g(D){const K=this.resume(),M=this.stack[this.stack.length-1];M.label=K,M.identifier=Er(this.sliceSerialize(D)).toLowerCase()}function b(){const D=this.resume(),K=this.stack[this.stack.length-1];K.title=D}function I(){const D=this.resume(),K=this.stack[this.stack.length-1];K.url=D}function O(D){const K=this.stack[this.stack.length-1];if(!K.depth){const M=this.sliceSerialize(D).length;K.depth=M}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function R(D){const K=this.stack[this.stack.length-1];K.depth=this.sliceSerialize(D).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function A(D){const M=this.stack[this.stack.length-1].children;let re=M[M.length-1];(!re||re.type!=="text")&&(re=dt(),re.position={start:Bn(D.start),end:void 0},M.push(re)),this.stack.push(re)}function F(D){const K=this.stack.pop();K.value+=this.sliceSerialize(D),K.position.end=Bn(D.end)}function j(D){const K=this.stack[this.stack.length-1];if(this.data.atHardBreak){const M=K.children[K.children.length-1];M.position.end=Bn(D.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(K.type)&&(A.call(this,D),F.call(this,D))}function L(){this.data.atHardBreak=!0}function H(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D}function P(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D}function B(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D}function X(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=K,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function le(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=K,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function fe(D){const K=this.sliceSerialize(D),M=this.stack[this.stack.length-2];M.label=_1(K),M.identifier=Er(K).toLowerCase()}function ge(){const D=this.stack[this.stack.length-1],K=this.resume(),M=this.stack[this.stack.length-1];if(this.data.inReference=!0,M.type==="link"){const re=D.children;M.children=re}else M.alt=K}function C(){const D=this.resume(),K=this.stack[this.stack.length-1];K.url=D}function W(){const D=this.resume(),K=this.stack[this.stack.length-1];K.title=D}function $(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function U(D){const K=this.resume(),M=this.stack[this.stack.length-1];M.label=K,M.identifier=Er(this.sliceSerialize(D)).toLowerCase(),this.data.referenceType="full"}function V(D){this.data.characterReferenceType=D.type}function Y(D){const K=this.sliceSerialize(D),M=this.data.characterReferenceType;let re;M?(re=Kp(K,M==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):re=rl(K);const ce=this.stack[this.stack.length-1];ce.value+=re}function ie(D){const K=this.stack.pop();K.position.end=Bn(D.end)}function ne(D){F.call(this,D);const K=this.stack[this.stack.length-1];K.url=this.sliceSerialize(D)}function se(D){F.call(this,D);const K=this.stack[this.stack.length-1];K.url="mailto:"+this.sliceSerialize(D)}function ee(){return{type:"blockquote",children:[]}}function me(){return{type:"code",lang:null,meta:null,value:""}}function q(){return{type:"inlineCode",value:""}}function ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Z(){return{type:"emphasis",children:[]}}function $e(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function Ae(){return{type:"html",value:""}}function We(){return{type:"image",title:null,url:"",alt:null}}function et(){return{type:"link",title:null,url:"",children:[]}}function tt(D){return{type:"list",ordered:D.type==="listOrdered",start:null,spread:D._spread,children:[]}}function xe(D){return{type:"listItem",spread:D._spread,checked:null,children:[]}}function at(){return{type:"paragraph",children:[]}}function It(){return{type:"strong",children:[]}}function dt(){return{type:"text",value:""}}function Ge(){return{type:"thematicBreak"}}}function Bn(e){return{line:e.line,column:e.column,offset:e.offset}}function nf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?nf(e,r):k1(e,r)}}function k1(e,t){let n;for(n in t)if(tf.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function nu(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+li({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+li({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+li({start:t.start,end:t.end})+") is still open")}function R1(e){const t=this;t.parser=n;function n(r){return N1(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function A1(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function F1(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
10
- `}]}function P1(e,t){const n=t.value?t.value+`
11
- `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function j1(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function M1(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function D1(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=zr(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let s,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=o+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function L1(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function B1(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function rf(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&s.type==="text"?s.value+=r:i.push({type:"text",value:r}),i}function $1(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return rf(e,t);const i={src:zr(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function q1(e,t){const n={src:zr(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function V1(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function U1(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return rf(e,t);const i={href:zr(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function z1(e,t){const n={href:zr(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function K1(e,t,n){const r=e.all(t),i=n?H1(n):of(t),o={},s=[];if(typeof t.checked=="boolean"){const u=r[0];let p;u&&u.type==="element"&&u.tagName==="p"?p=u:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&s.push({type:"text",value:`
10
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&i)continue;s=" ";break}default:s=String.fromCharCode(o)}i=o===-2,r.push(s)}return r.join("")}function A_(e){const r={constructs:BO([N_,...(e||{}).extensions||[]]),content:i(JO),defined:[],document:i(QO),flow:i(f_),lazy:{},string:i(g_),text:i(y_)};return r;function i(o){return s;function s(a){return T_(r,o,a)}}}function F_(e){for(;!jf(e););return e}const Su=/[\0\t\n\r]/g;function P_(){let e=1,t="",n=!0,r;return i;function i(o,s,a){const l=[];let c,u,p,h,f;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(Su.lastIndex=p,c=Su.exec(o),h=c&&c.index!==void 0?c.index:o.length,f=o.charCodeAt(h),!c){t=o.slice(p);break}if(f===10&&p===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),p<h&&(l.push(o.slice(p,h)),e+=h-p),f){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}p=h+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const j_=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function M_(e){return e.replace(j_,D_)}function D_(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return Rf(n.slice(o?2:1),o?16:10)}return Il(n)||e}const $f={}.hasOwnProperty;function L_(e,t,n){return typeof t!="string"&&(n=t,t=void 0),B_(n)(F_(A_(n).document().write(P_()(e,t,!0))))}function B_(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(et),autolinkProtocol:A,autolinkEmail:A,atxHeading:o(qe),blockQuote:o(ee),characterEscape:A,characterReference:A,codeFenced:o(me),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(me,s),codeText:o($,s),codeTextData:A,data:A,codeFlowValue:A,definition:o(ye),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(Z),hardBreakEscape:o(Fe),hardBreakTrailing:o(Fe),htmlFlow:o(Ae,s),htmlFlowData:A,htmlText:o(Ae,s),htmlTextData:A,image:o(Qe),label:s,link:o(et),listItem:o(xe),listItemValue:h,listOrdered:o(tt,p),listUnordered:o(tt),paragraph:o(at),reference:S,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(qe),strong:o(It),thematicBreak:o(Xe)},exit:{atxHeading:l(),atxHeadingSequence:O,autolink:l(),autolinkEmail:se,autolinkProtocol:ne,blockQuote:l(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:V,characterReferenceMarkerNumeric:V,characterReferenceValue:Y,characterReference:ie,codeFenced:l(g),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:y,codeFlowValue:F,codeIndented:l(x),codeText:l(B),codeTextData:F,data:F,definition:l(),definitionDestinationString:I,definitionLabelString:b,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(L),hardBreakTrailing:l(L),htmlFlow:l(H),htmlFlowData:F,htmlText:l(P),htmlTextData:F,image:l(le),label:ge,labelText:fe,lineEnding:j,link:l(X),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:U,resourceDestinationString:C,resourceTitleString:W,resource:q,setextHeading:l(T),setextHeadingLineSequence:R,setextHeadingText:E,strong:l(),thematicBreak:l()}};Vf(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(D){let K={type:"root",children:[]};const M={stack:[K],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:u,data:n},re=[];let ce=-1;for(;++ce<D.length;)if(D[ce][1].type==="listOrdered"||D[ce][1].type==="listUnordered")if(D[ce][0]==="enter")re.push(ce);else{const Ue=re.pop();ce=i(D,Ue,ce)}for(ce=-1;++ce<D.length;){const Ue=t[D[ce][0]];$f.call(Ue,D[ce][1].type)&&Ue[D[ce][1].type].call(Object.assign({sliceSerialize:D[ce][2].sliceSerialize},M),D[ce][1])}if(M.tokenStack.length>0){const Ue=M.tokenStack[M.tokenStack.length-1];(Ue[1]||Ou).call(M,void 0,Ue[0])}for(K.position={start:Bn(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:Bn(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},ce=-1;++ce<t.transforms.length;)K=t.transforms[ce](K)||K;return K}function i(D,K,M){let re=K-1,ce=-1,Ue=!1,Ct,pt,gt,Pe;for(;++re<=M;){const Oe=D[re];switch(Oe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Oe[0]==="enter"?ce++:ce--,Pe=void 0;break}case"lineEndingBlank":{Oe[0]==="enter"&&(Ct&&!Pe&&!ce&&!gt&&(gt=re),Pe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pe=void 0}if(!ce&&Oe[0]==="enter"&&Oe[1].type==="listItemPrefix"||ce===-1&&Oe[0]==="exit"&&(Oe[1].type==="listUnordered"||Oe[1].type==="listOrdered")){if(Ct){let St=re;for(pt=void 0;St--;){const ft=D[St];if(ft[1].type==="lineEnding"||ft[1].type==="lineEndingBlank"){if(ft[0]==="exit")continue;pt&&(D[pt][1].type="lineEndingBlank",Ue=!0),ft[1].type="lineEnding",pt=St}else if(!(ft[1].type==="linePrefix"||ft[1].type==="blockQuotePrefix"||ft[1].type==="blockQuotePrefixWhitespace"||ft[1].type==="blockQuoteMarker"||ft[1].type==="listItemIndent"))break}gt&&(!pt||gt<pt)&&(Ct._spread=!0),Ct.end=Object.assign({},pt?D[pt][1].start:Oe[1].end),D.splice(pt||re,0,["exit",Ct,Oe[2]]),re++,M++}if(Oe[1].type==="listItemPrefix"){const St={type:"listItem",_spread:!1,start:Object.assign({},Oe[1].start),end:void 0};Ct=St,D.splice(re,0,["enter",St,Oe[2]]),re++,M++,gt=void 0,Pe=!0}}}return D[K][1]._spread=Ue,M}function o(D,K){return M;function M(re){a.call(this,D(re),re),K&&K.call(this,re)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(D,K,M){this.stack[this.stack.length-1].children.push(D),this.stack.push(D),this.tokenStack.push([K,M||void 0]),D.position={start:Bn(K.start),end:void 0}}function l(D){return K;function K(M){D&&D.call(this,M),c.call(this,M)}}function c(D,K){const M=this.stack.pop(),re=this.tokenStack.pop();if(re)re[0].type!==D.type&&(K?K.call(this,D,re[0]):(re[1]||Ou).call(this,D,re[0]));else throw new Error("Cannot close `"+D.type+"` ("+di({start:D.start,end:D.end})+"): it’s not open");M.position.end=Bn(D.end)}function u(){return DO(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function h(D){if(this.data.expectingFirstListItemValue){const K=this.stack[this.stack.length-2];K.start=Number.parseInt(this.sliceSerialize(D),10),this.data.expectingFirstListItemValue=void 0}}function f(){const D=this.resume(),K=this.stack[this.stack.length-1];K.lang=D}function y(){const D=this.resume(),K=this.stack[this.stack.length-1];K.meta=D}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D.replace(/(\r?\n|\r)$/g,"")}function b(D){const K=this.resume(),M=this.stack[this.stack.length-1];M.label=K,M.identifier=_r(this.sliceSerialize(D)).toLowerCase()}function v(){const D=this.resume(),K=this.stack[this.stack.length-1];K.title=D}function I(){const D=this.resume(),K=this.stack[this.stack.length-1];K.url=D}function O(D){const K=this.stack[this.stack.length-1];if(!K.depth){const M=this.sliceSerialize(D).length;K.depth=M}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function R(D){const K=this.stack[this.stack.length-1];K.depth=this.sliceSerialize(D).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function A(D){const M=this.stack[this.stack.length-1].children;let re=M[M.length-1];(!re||re.type!=="text")&&(re=dt(),re.position={start:Bn(D.start),end:void 0},M.push(re)),this.stack.push(re)}function F(D){const K=this.stack.pop();K.value+=this.sliceSerialize(D),K.position.end=Bn(D.end)}function j(D){const K=this.stack[this.stack.length-1];if(this.data.atHardBreak){const M=K.children[K.children.length-1];M.position.end=Bn(D.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(K.type)&&(A.call(this,D),F.call(this,D))}function L(){this.data.atHardBreak=!0}function H(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D}function P(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D}function B(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D}function X(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=K,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function le(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=K,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function fe(D){const K=this.sliceSerialize(D),M=this.stack[this.stack.length-2];M.label=M_(K),M.identifier=_r(K).toLowerCase()}function ge(){const D=this.stack[this.stack.length-1],K=this.resume(),M=this.stack[this.stack.length-1];if(this.data.inReference=!0,M.type==="link"){const re=D.children;M.children=re}else M.alt=K}function C(){const D=this.resume(),K=this.stack[this.stack.length-1];K.url=D}function W(){const D=this.resume(),K=this.stack[this.stack.length-1];K.title=D}function q(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function U(D){const K=this.resume(),M=this.stack[this.stack.length-1];M.label=K,M.identifier=_r(this.sliceSerialize(D)).toLowerCase(),this.data.referenceType="full"}function V(D){this.data.characterReferenceType=D.type}function Y(D){const K=this.sliceSerialize(D),M=this.data.characterReferenceType;let re;M?(re=Rf(K,M==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):re=Il(K);const ce=this.stack[this.stack.length-1];ce.value+=re}function ie(D){const K=this.stack.pop();K.position.end=Bn(D.end)}function ne(D){F.call(this,D);const K=this.stack[this.stack.length-1];K.url=this.sliceSerialize(D)}function se(D){F.call(this,D);const K=this.stack[this.stack.length-1];K.url="mailto:"+this.sliceSerialize(D)}function ee(){return{type:"blockquote",children:[]}}function me(){return{type:"code",lang:null,meta:null,value:""}}function $(){return{type:"inlineCode",value:""}}function ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Z(){return{type:"emphasis",children:[]}}function qe(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function Ae(){return{type:"html",value:""}}function Qe(){return{type:"image",title:null,url:"",alt:null}}function et(){return{type:"link",title:null,url:"",children:[]}}function tt(D){return{type:"list",ordered:D.type==="listOrdered",start:null,spread:D._spread,children:[]}}function xe(D){return{type:"listItem",spread:D._spread,checked:null,children:[]}}function at(){return{type:"paragraph",children:[]}}function It(){return{type:"strong",children:[]}}function dt(){return{type:"text",value:""}}function Xe(){return{type:"thematicBreak"}}}function Bn(e){return{line:e.line,column:e.column,offset:e.offset}}function Vf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Vf(e,r):q_(e,r)}}function q_(e,t){let n;for(n in t)if($f.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Ou(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+di({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+di({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+di({start:t.start,end:t.end})+") is still open")}function $_(e){const t=this;t.parser=n;function n(r){return L_(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function V_(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function U_(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
11
+ `}]}function z_(e,t){const n=t.value?t.value+`
12
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function K_(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function H_(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function J_(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Ur(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let s,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=o+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function W_(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Q_(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Uf(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&s.type==="text"?s.value+=r:i.push({type:"text",value:r}),i}function G_(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Uf(e,t);const i={src:Ur(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function X_(e,t){const n={src:Ur(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Y_(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Z_(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Uf(e,t);const i={href:Ur(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function eE(e,t){const n={href:Ur(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function tE(e,t,n){const r=e.all(t),i=n?nE(n):zf(t),o={},s=[];if(typeof t.checked=="boolean"){const u=r[0];let p;u&&u.type==="element"&&u.tagName==="p"?p=u:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&s.push({type:"text",value:`
12
13
  `}),u.type==="element"&&u.tagName==="p"&&!i?s.push(...u.children):s.push(u)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&s.push({type:"text",value:`
13
- `});const c={type:"element",tagName:"li",properties:o,children:s};return e.patch(t,c),e.applyData(t,c)}function H1(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=of(n[r])}return t}function of(e){const t=e.spread;return t??e.children.length>1}function J1(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const s=r[i];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function W1(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Q1(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function G1(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function X1(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],s),i.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=Za(t.children[1]),l=Lp(t.children[t.children.length-1]);a&&l&&(s.position={start:a,end:l}),i.push(s)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function Y1(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:t.children.length;let l=-1;const c=[];for(;++l<a;){const p=t.children[l],h={},f=s?s[l]:void 0;f&&(h.align=f);let m={type:"element",tagName:o,properties:h,children:[]};p&&(m.children=e.all(p),e.patch(p,m),m=e.applyData(p,m)),c.push(m)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function Z1(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ru=9,iu=32;function e_(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(ou(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(ou(t.slice(i),i>0,!1)),o.join("")}function ou(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===ru||o===iu;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===ru||o===iu;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function t_(e,t){const n={type:"text",value:e_(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function n_(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const r_={blockquote:A1,break:F1,code:P1,delete:j1,emphasis:M1,footnoteReference:D1,heading:L1,html:B1,imageReference:$1,image:q1,inlineCode:V1,linkReference:U1,link:z1,listItem:K1,list:J1,paragraph:W1,root:Q1,strong:G1,table:X1,tableCell:Z1,tableRow:Y1,text:t_,thematicBreak:n_,toml:Gi,yaml:Gi,definition:Gi,footnoteDefinition:Gi};function Gi(){}const sf=-1,Uo=0,ui=1,xo=2,sl=3,al=4,ll=5,cl=6,af=7,lf=8,su=typeof self=="object"?self:globalThis,i_=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,s]=t[i];switch(o){case Uo:case sf:return n(s,i);case ui:{const a=n([],i);for(const l of s)a.push(r(l));return a}case xo:{const a=n({},i);for(const[l,c]of s)a[r(l)]=r(c);return a}case sl:return n(new Date(s),i);case al:{const{source:a,flags:l}=s;return n(new RegExp(a,l),i)}case ll:{const a=n(new Map,i);for(const[l,c]of s)a.set(r(l),r(c));return a}case cl:{const a=n(new Set,i);for(const l of s)a.add(r(l));return a}case af:{const{name:a,message:l}=s;return n(new su[a](l),i)}case lf:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:a}=new Uint8Array(s);return n(new DataView(a),s)}}return n(new su[o](s),i)};return r},au=e=>i_(new Map,e)(0),Cr="",{toString:o_}={},{keys:s_}=Object,ni=e=>{const t=typeof e;if(t!=="object"||!e)return[Uo,t];const n=o_.call(e).slice(8,-1);switch(n){case"Array":return[ui,Cr];case"Object":return[xo,Cr];case"Date":return[sl,Cr];case"RegExp":return[al,Cr];case"Map":return[ll,Cr];case"Set":return[cl,Cr];case"DataView":return[ui,n]}return n.includes("Array")?[ui,n]:n.includes("Error")?[af,n]:[xo,n]},Xi=([e,t])=>e===Uo&&(t==="function"||t==="symbol"),a_=(e,t,n,r)=>{const i=(s,a)=>{const l=r.push(s)-1;return n.set(a,l),l},o=s=>{if(n.has(s))return n.get(s);let[a,l]=ni(s);switch(a){case Uo:{let u=s;switch(l){case"bigint":a=lf,u=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([sf],s)}return i([a,u],s)}case ui:{if(l){let h=s;return l==="DataView"?h=new Uint8Array(s.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(s)),i([l,[...h]],s)}const u=[],p=i([a,u],s);for(const h of s)u.push(o(h));return p}case xo:{if(l)switch(l){case"BigInt":return i([l,s.toString()],s);case"Boolean":case"Number":case"String":return i([l,s.valueOf()],s)}if(t&&"toJSON"in s)return o(s.toJSON());const u=[],p=i([a,u],s);for(const h of s_(s))(e||!Xi(ni(s[h])))&&u.push([o(h),o(s[h])]);return p}case sl:return i([a,s.toISOString()],s);case al:{const{source:u,flags:p}=s;return i([a,{source:u,flags:p}],s)}case ll:{const u=[],p=i([a,u],s);for(const[h,f]of s)(e||!(Xi(ni(h))||Xi(ni(f))))&&u.push([o(h),o(f)]);return p}case cl:{const u=[],p=i([a,u],s);for(const h of s)(e||!Xi(ni(h)))&&u.push(o(h));return p}}const{message:c}=s;return i([a,{name:l,message:c}],s)};return o},lu=(e,{json:t,lossy:n}={})=>{const r=[];return a_(!(t||n),!!t,new Map,r)(e),r},Io=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?au(lu(e,t)):structuredClone(e):(e,t)=>au(lu(e,t));function l_(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function c_(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function u_(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||l_,r=e.options.footnoteBackLabel||c_,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const u=e.all(c),p=String(c.identifier).toUpperCase(),h=zr(p.toLowerCase());let f=0;const m=[],v=e.footnoteCounts.get(p);for(;v!==void 0&&++f<=v;){m.length>0&&m.push({type:"text",value:" "});let g=typeof n=="string"?n:n(l,f);typeof g=="string"&&(g={type:"text",value:g}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,f),className:["data-footnote-backref"]},children:Array.isArray(g)?g:[g]})}const y=u[u.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const g=y.children[y.children.length-1];g&&g.type==="text"?g.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...m)}else u.push(...m);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(u,!0)};e.patch(c,x),a.push(x)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Io(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
14
+ `});const c={type:"element",tagName:"li",properties:o,children:s};return e.patch(t,c),e.applyData(t,c)}function nE(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=zf(n[r])}return t}function zf(e){const t=e.spread;return t??e.children.length>1}function rE(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const s=r[i];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function iE(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function oE(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function sE(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aE(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],s),i.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=vl(t.children[1]),l=Sf(t.children[t.children.length-1]);a&&l&&(s.position={start:a,end:l}),i.push(s)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function lE(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:t.children.length;let l=-1;const c=[];for(;++l<a;){const p=t.children[l],h={},f=s?s[l]:void 0;f&&(h.align=f);let y={type:"element",tagName:o,properties:h,children:[]};p&&(y.children=e.all(p),e.patch(p,y),y=e.applyData(p,y)),c.push(y)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function cE(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const _u=9,Eu=32;function uE(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(Nu(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(Nu(t.slice(i),i>0,!1)),o.join("")}function Nu(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===_u||o===Eu;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===_u||o===Eu;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function dE(e,t){const n={type:"text",value:uE(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function pE(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const fE={blockquote:V_,break:U_,code:z_,delete:K_,emphasis:H_,footnoteReference:J_,heading:W_,html:Q_,imageReference:G_,image:X_,inlineCode:Y_,linkReference:Z_,link:eE,listItem:tE,list:rE,paragraph:iE,root:oE,strong:sE,table:aE,tableCell:cE,tableRow:lE,text:dE,thematicBreak:pE,toml:eo,yaml:eo,definition:eo,footnoteDefinition:eo};function eo(){}const Kf=-1,Uo=0,fi=1,So=2,Ol=3,_l=4,El=5,Nl=6,Hf=7,Jf=8,Tu=typeof self=="object"?self:globalThis,hE=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,s]=t[i];switch(o){case Uo:case Kf:return n(s,i);case fi:{const a=n([],i);for(const l of s)a.push(r(l));return a}case So:{const a=n({},i);for(const[l,c]of s)a[r(l)]=r(c);return a}case Ol:return n(new Date(s),i);case _l:{const{source:a,flags:l}=s;return n(new RegExp(a,l),i)}case El:{const a=n(new Map,i);for(const[l,c]of s)a.set(r(l),r(c));return a}case Nl:{const a=n(new Set,i);for(const l of s)a.add(r(l));return a}case Hf:{const{name:a,message:l}=s;return n(new Tu[a](l),i)}case Jf:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:a}=new Uint8Array(s);return n(new DataView(a),s)}}return n(new Tu[o](s),i)};return r},ku=e=>hE(new Map,e)(0),Ir="",{toString:mE}={},{keys:gE}=Object,ni=e=>{const t=typeof e;if(t!=="object"||!e)return[Uo,t];const n=mE.call(e).slice(8,-1);switch(n){case"Array":return[fi,Ir];case"Object":return[So,Ir];case"Date":return[Ol,Ir];case"RegExp":return[_l,Ir];case"Map":return[El,Ir];case"Set":return[Nl,Ir];case"DataView":return[fi,n]}return n.includes("Array")?[fi,n]:n.includes("Error")?[Hf,n]:[So,n]},to=([e,t])=>e===Uo&&(t==="function"||t==="symbol"),yE=(e,t,n,r)=>{const i=(s,a)=>{const l=r.push(s)-1;return n.set(a,l),l},o=s=>{if(n.has(s))return n.get(s);let[a,l]=ni(s);switch(a){case Uo:{let u=s;switch(l){case"bigint":a=Jf,u=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([Kf],s)}return i([a,u],s)}case fi:{if(l){let h=s;return l==="DataView"?h=new Uint8Array(s.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(s)),i([l,[...h]],s)}const u=[],p=i([a,u],s);for(const h of s)u.push(o(h));return p}case So:{if(l)switch(l){case"BigInt":return i([l,s.toString()],s);case"Boolean":case"Number":case"String":return i([l,s.valueOf()],s)}if(t&&"toJSON"in s)return o(s.toJSON());const u=[],p=i([a,u],s);for(const h of gE(s))(e||!to(ni(s[h])))&&u.push([o(h),o(s[h])]);return p}case Ol:return i([a,s.toISOString()],s);case _l:{const{source:u,flags:p}=s;return i([a,{source:u,flags:p}],s)}case El:{const u=[],p=i([a,u],s);for(const[h,f]of s)(e||!(to(ni(h))||to(ni(f))))&&u.push([o(h),o(f)]);return p}case Nl:{const u=[],p=i([a,u],s);for(const h of s)(e||!to(ni(h)))&&u.push(o(h));return p}}const{message:c}=s;return i([a,{name:l,message:c}],s)};return o},Ru=(e,{json:t,lossy:n}={})=>{const r=[];return yE(!(t||n),!!t,new Map,r)(e),r},Oo=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ku(Ru(e,t)):structuredClone(e):(e,t)=>ku(Ru(e,t));function vE(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function bE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function wE(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||vE,r=e.options.footnoteBackLabel||bE,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const u=e.all(c),p=String(c.identifier).toUpperCase(),h=Ur(p.toLowerCase());let f=0;const y=[],m=e.footnoteCounts.get(p);for(;m!==void 0&&++f<=m;){y.length>0&&y.push({type:"text",value:" "});let b=typeof n=="string"?n:n(l,f);typeof b=="string"&&(b={type:"text",value:b}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,f),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const g=u[u.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const b=g.children[g.children.length-1];b&&b.type==="text"?b.value+=" ":g.children.push({type:"text",value:" "}),g.children.push(...y)}else u.push(...y);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(u,!0)};e.patch(c,x),a.push(x)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Oo(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
14
15
  `},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
15
- `}]}}const cf=(function(e){if(e==null)return h_;if(typeof e=="function")return zo(e);if(typeof e=="object")return Array.isArray(e)?d_(e):p_(e);if(typeof e=="string")return f_(e);throw new Error("Expected function, string, or object as test")});function d_(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=cf(e[n]);return zo(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function p_(e){const t=e;return zo(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function f_(e){return zo(t);function t(n){return n&&n.type===e}}function zo(e){return t;function t(n,r,i){return!!(m_(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function h_(){return!0}function m_(e){return e!==null&&typeof e=="object"&&"type"in e}const uf=[],g_=!0,cu=!1,y_="skip";function v_(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=cf(i),s=r?-1:1;a(e,void 0,[])();function a(l,c,u){const p=l&&typeof l=="object"?l:{};if(typeof p.type=="string"){const f=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=uf,m,v,y;if((!t||o(l,c,u[u.length-1]||void 0))&&(f=b_(n(l,u)),f[0]===cu))return f;if("children"in l&&l.children){const x=l;if(x.children&&f[0]!==y_)for(v=(r?x.children.length:-1)+s,y=u.concat(x);v>-1&&v<x.children.length;){const g=x.children[v];if(m=a(g,v,y)(),m[0]===cu)return m;v=typeof m[1]=="number"?m[1]:v+s}}return f}}}function b_(e){return Array.isArray(e)?e:typeof e=="number"?[g_,e]:e==null?uf:[e]}function df(e,t,n,r){let i,o,s;typeof t=="function"&&typeof n!="function"?(o=void 0,s=t,i=n):(o=t,s=n,i=r),v_(e,o,a,i);function a(l,c){const u=c[c.length-1],p=u?u.children.indexOf(l):void 0;return s(l,p,u)}}const ua={}.hasOwnProperty,w_={};function x_(e,t){const n=t||w_,r=new Map,i=new Map,o=new Map,s={...r_,...n.handlers},a={all:c,applyData:C_,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:s,one:l,options:n,patch:I_,wrap:O_};return df(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const p=u.type==="definition"?r:i,h=String(u.identifier).toUpperCase();p.has(h)||p.set(h,u)}}),a;function l(u,p){const h=u.type,f=a.handlers[h];if(ua.call(a.handlers,h)&&f)return f(a,u,p);if(a.options.passThrough&&a.options.passThrough.includes(h)){if("children"in u){const{children:v,...y}=u,x=Io(y);return x.children=a.all(u),x}return Io(u)}return(a.options.unknownHandler||S_)(a,u,p)}function c(u){const p=[];if("children"in u){const h=u.children;let f=-1;for(;++f<h.length;){const m=a.one(h[f],u);if(m){if(f&&h[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=uu(m.value)),!Array.isArray(m)&&m.type==="element")){const v=m.children[0];v&&v.type==="text"&&(v.value=uu(v.value))}Array.isArray(m)?p.push(...m):p.push(m)}}}return p}}function I_(e,t){e.position&&(t.position=o0(e))}function C_(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const s="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:s}}n.type==="element"&&o&&Object.assign(n.properties,Io(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function S_(e,t){const n=t.data||{},r="value"in t&&!(ua.call(n,"hProperties")||ua.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function O_(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
16
+ `}]}}const Wf=(function(e){if(e==null)return SE;if(typeof e=="function")return zo(e);if(typeof e=="object")return Array.isArray(e)?xE(e):IE(e);if(typeof e=="string")return CE(e);throw new Error("Expected function, string, or object as test")});function xE(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Wf(e[n]);return zo(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function IE(e){const t=e;return zo(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function CE(e){return zo(t);function t(n){return n&&n.type===e}}function zo(e){return t;function t(n,r,i){return!!(OE(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function SE(){return!0}function OE(e){return e!==null&&typeof e=="object"&&"type"in e}const Qf=[],_E=!0,Au=!1,EE="skip";function NE(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=Wf(i),s=r?-1:1;a(e,void 0,[])();function a(l,c,u){const p=l&&typeof l=="object"?l:{};if(typeof p.type=="string"){const f=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=Qf,y,m,g;if((!t||o(l,c,u[u.length-1]||void 0))&&(f=TE(n(l,u)),f[0]===Au))return f;if("children"in l&&l.children){const x=l;if(x.children&&f[0]!==EE)for(m=(r?x.children.length:-1)+s,g=u.concat(x);m>-1&&m<x.children.length;){const b=x.children[m];if(y=a(b,m,g)(),y[0]===Au)return y;m=typeof y[1]=="number"?y[1]:m+s}}return f}}}function TE(e){return Array.isArray(e)?e:typeof e=="number"?[_E,e]:e==null?Qf:[e]}function Gf(e,t,n,r){let i,o,s;typeof t=="function"&&typeof n!="function"?(o=void 0,s=t,i=n):(o=t,s=n,i=r),NE(e,o,a,i);function a(l,c){const u=c[c.length-1],p=u?u.children.indexOf(l):void 0;return s(l,p,u)}}const ha={}.hasOwnProperty,kE={};function RE(e,t){const n=t||kE,r=new Map,i=new Map,o=new Map,s={...fE,...n.handlers},a={all:c,applyData:FE,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:s,one:l,options:n,patch:AE,wrap:jE};return Gf(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const p=u.type==="definition"?r:i,h=String(u.identifier).toUpperCase();p.has(h)||p.set(h,u)}}),a;function l(u,p){const h=u.type,f=a.handlers[h];if(ha.call(a.handlers,h)&&f)return f(a,u,p);if(a.options.passThrough&&a.options.passThrough.includes(h)){if("children"in u){const{children:m,...g}=u,x=Oo(g);return x.children=a.all(u),x}return Oo(u)}return(a.options.unknownHandler||PE)(a,u,p)}function c(u){const p=[];if("children"in u){const h=u.children;let f=-1;for(;++f<h.length;){const y=a.one(h[f],u);if(y){if(f&&h[f-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=Fu(y.value)),!Array.isArray(y)&&y.type==="element")){const m=y.children[0];m&&m.type==="text"&&(m.value=Fu(m.value))}Array.isArray(y)?p.push(...y):p.push(y)}}}return p}}function AE(e,t){e.position&&(t.position=mO(e))}function FE(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const s="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:s}}n.type==="element"&&o&&Object.assign(n.properties,Oo(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function PE(e,t){const n=t.data||{},r="value"in t&&!(ha.call(n,"hProperties")||ha.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function jE(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
16
17
  `});++r<e.length;)r&&n.push({type:"text",value:`
17
18
  `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
18
- `}),n}function uu(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function du(e,t){const n=x_(e,t),r=n.one(e,void 0),i=u_(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
19
- `},i),o}function __(e,t){return e&&"run"in e?async function(n,r){const i=du(n,{file:r,...t});await e.run(i,r)}:function(n,r){return du(n,{file:r,...e||t})}}function pu(e){if(e)throw e}var ys,fu;function E_(){if(fu)return ys;fu=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},o=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var u=e.call(c,"constructor"),p=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!p)return!1;var h;for(h in c);return typeof h>"u"||e.call(c,h)},s=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(e.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return ys=function l(){var c,u,p,h,f,m,v=arguments[0],y=1,x=arguments.length,g=!1;for(typeof v=="boolean"&&(g=v,v=arguments[1]||{},y=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});y<x;++y)if(c=arguments[y],c!=null)for(u in c)p=a(v,u),h=a(c,u),v!==h&&(g&&h&&(o(h)||(f=i(h)))?(f?(f=!1,m=p&&i(p)?p:[]):m=p&&o(p)?p:{},s(v,{name:u,newValue:l(g,m,h)})):typeof h<"u"&&s(v,{name:u,newValue:h}));return v},ys}var N_=E_();const vs=$r(N_);function da(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function T_(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...i);function a(l,...c){const u=e[++o];let p=-1;if(l){s(l);return}for(;++p<i.length;)(c[p]===null||c[p]===void 0)&&(c[p]=i[p]);i=c,u?k_(u,a)(...c):s(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function k_(e,t){let n;return r;function r(...s){const a=e.length>s.length;let l;a&&s.push(i);try{l=e.apply(this,s)}catch(c){const u=c;if(a&&n)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(s,...a){n||(n=!0,t(s,...a))}function o(s){i(null,s)}}const fn={basename:R_,dirname:A_,extname:F_,join:P_,sep:"/"};function R_(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ei(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else s<0&&(o=!0,s=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function A_(e){if(Ei(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function F_(e){Ei(e);let t=e.length,n=-1,r=0,i=-1,o=0,s;for(;t--;){const a=e.codePointAt(t);if(a===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),a===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function P_(...e){let t=-1,n;for(;++t<e.length;)Ei(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":j_(n)}function j_(e){Ei(e);const t=e.codePointAt(0)===47;let n=M_(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function M_(e,t){let n="",r=0,i=-1,o=0,s=-1,a,l;for(;++s<=e.length;){if(s<e.length)a=e.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(i===s-1||o===1))if(i!==s-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=s,o=0;continue}}else if(n.length>0){n="",r=0,i=s,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,o=0}else a===46&&o>-1?o++:o=-1}return n}function Ei(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const D_={cwd:L_};function L_(){return"/"}function pa(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function B_(e){if(typeof e=="string")e=new URL(e);else if(!pa(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return $_(e)}function $_(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const bs=["history","path","basename","stem","extname","dirname"];class pf{constructor(t){let n;t?pa(t)?n={path:t}:typeof t=="string"||q_(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":D_.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<bs.length;){const o=bs[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)bs.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?fn.basename(this.path):void 0}set basename(t){xs(t,"basename"),ws(t,"basename"),this.path=fn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?fn.dirname(this.path):void 0}set dirname(t){hu(this.basename,"dirname"),this.path=fn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?fn.extname(this.path):void 0}set extname(t){if(ws(t,"extname"),hu(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=fn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){pa(t)&&(t=B_(t)),xs(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?fn.basename(this.path,this.extname):void 0}set stem(t){xs(t,"stem"),ws(t,"stem"),this.path=fn.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new xt(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ws(e,t){if(e&&e.includes(fn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+fn.sep+"`")}function xs(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function hu(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function q_(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const V_=(function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),U_={}.hasOwnProperty;class ul extends V_{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=T_()}copy(){const t=new ul;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(vs(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ss("data",this.frozen),this.namespace[t]=n,this):U_.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ss("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Yi(t),r=this.parser||this.Parser;return Is("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Is("process",this.parser||this.Parser),Cs("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,s){const a=Yi(t),l=r.parse(a);r.run(l,a,function(u,p,h){if(u||!p||!h)return c(u);const f=p,m=r.stringify(f,h);H_(m)?h.value=m:h.result=m,c(u,h)});function c(u,p){u||!p?s(u):o?o(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),Is("processSync",this.parser||this.Parser),Cs("processSync",this.compiler||this.Compiler),this.process(t,i),gu("processSync","process",n),r;function i(o,s){n=!0,pu(o),r=s}}run(t,n,r){mu(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(s,a){const l=Yi(n);i.run(t,l,c);function c(u,p,h){const f=p||t;u?a(u):s?s(f):r(void 0,f,h)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),gu("runSync","run",r),i;function o(s,a){pu(s),i=a,r=!0}}stringify(t,n){this.freeze();const r=Yi(n),i=this.compiler||this.Compiler;return Cs("stringify",i),mu(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Ss("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...p]=c;l(u,p)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=vs(!0,i.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const p=c[u];o(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let p=-1,h=-1;for(;++p<r.length;)if(r[p][0]===c){h=p;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[f,...m]=u;const v=r[h][1];da(v)&&da(f)&&(f=vs(!0,v,f)),r[h]=[c,f,...m]}}}}const z_=new ul().freeze();function Is(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Cs(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ss(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function mu(e){if(!da(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function gu(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Yi(e){return K_(e)?e:new pf(e)}function K_(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function H_(e){return typeof e=="string"||J_(e)}function J_(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const W_="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",yu=[],vu={allowDangerousHtml:!0},Q_=/^(https?|ircs?|mailto|xmpp)$/i,G_=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function X_(e){const t=Y_(e),n=Z_(e);return eE(t.runSync(t.parse(n),n),e)}function Y_(e){const t=e.rehypePlugins||yu,n=e.remarkPlugins||yu,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...vu}:vu;return z_().use(R1).use(n).use(__,r).use(t)}function Z_(e){const t=e.children||"",n=new pf;return typeof t=="string"&&(n.value=t),n}function eE(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||tE;for(const u of G_)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+W_+u.id,void 0);return df(e,c),u0(e,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(u,p,h){if(u.type==="raw"&&h&&typeof p=="number")return s?h.children.splice(p,1):h.children[p]={type:"text",value:u.value},p;if(u.type==="element"){let f;for(f in hs)if(Object.hasOwn(hs,f)&&Object.hasOwn(u.properties,f)){const m=u.properties[f],v=hs[f];(v===null||v.includes(u.tagName))&&(u.properties[f]=l(String(m||""),f,u))}}if(u.type==="element"){let f=n?!n.includes(u.tagName):o?o.includes(u.tagName):!1;if(!f&&r&&typeof p=="number"&&(f=!r(u,p,h)),f&&h&&typeof p=="number")return a&&u.children?h.children.splice(p,1,...u.children):h.children.splice(p,1),p}}}function tE(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Q_.test(e.slice(0,t))?e:""}const nE="_container_r1dnc_1",rE="_code_r1dnc_9",bu={container:nE,code:rE};function iE({prompt:e}){return d.jsx("div",{className:bu.container,children:d.jsx(X_,{components:{p:({children:t})=>d.jsx(d.Fragment,{children:t}),code:({children:t})=>d.jsx("code",{className:bu.code,children:t})},children:e})})}function dl({url:e,providerDisplayName:t,credentialName:n,prompt:r}){return d.jsxs("div",{style:{marginBottom:"0.5rem"},children:[d.jsxs("p",{style:{color:"var(--amp-colors-text-muted)",marginBottom:r?"0.25rem":"0rem",lineHeight:"1.5"},children:[d.jsx(kp,{href:e,newTab:!0,children:d.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]}),r&&d.jsx(iE,{prompt:r})]})}const Fr=Math.min,or=Math.max,Co=Math.round,Zi=Math.floor,zn=e=>({x:e,y:e}),oE={left:"right",right:"left",bottom:"top",top:"bottom"},sE={start:"end",end:"start"};function fa(e,t,n){return or(e,Fr(t,n))}function Ni(e,t){return typeof e=="function"?e(t):e}function ur(e){return e.split("-")[0]}function Ti(e){return e.split("-")[1]}function ff(e){return e==="x"?"y":"x"}function pl(e){return e==="y"?"height":"width"}function Pr(e){return["top","bottom"].includes(ur(e))?"y":"x"}function fl(e){return ff(Pr(e))}function aE(e,t,n){n===void 0&&(n=!1);const r=Ti(e),i=fl(e),o=pl(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=So(s)),[s,So(s)]}function lE(e){const t=So(e);return[ha(e),t,ha(t)]}function ha(e){return e.replace(/start|end/g,t=>sE[t])}function cE(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 uE(e,t,n,r){const i=Ti(e);let o=cE(ur(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(ha)))),o}function So(e){return e.replace(/left|right|bottom|top/g,t=>oE[t])}function dE(e){return{top:0,right:0,bottom:0,left:0,...e}}function hf(e){return typeof e!="number"?dE(e):{top:e,right:e,bottom:e,left:e}}function Oo(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 wu(e,t,n){let{reference:r,floating:i}=e;const o=Pr(t),s=fl(t),a=pl(s),l=ur(t),c=o==="y",u=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let f;switch(l){case"top":f={x:u,y:r.y-i.height};break;case"bottom":f={x:u,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(Ti(t)){case"start":f[s]-=h*(n&&c?-1:1);break;case"end":f[s]+=h*(n&&c?-1:1);break}return f}const pE=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:p}=wu(c,r,l),h=r,f={},m=0;for(let v=0;v<a.length;v++){const{name:y,fn:x}=a[v],{x:g,y:b,data:I,reset:O}=await x({x:u,y:p,initialPlacement:r,placement:h,strategy:i,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=g??u,p=b??p,f={...f,[y]:{...f[y],...I}},O&&m<=50&&(m++,typeof O=="object"&&(O.placement&&(h=O.placement),O.rects&&(c=O.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):O.rects),{x:u,y:p}=wu(c,h,l)),v=-1)}return{x:u,y:p,placement:h,strategy:i,middlewareData:f}};async function mf(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:h=!1,padding:f=0}=Ni(t,e),m=hf(f),y=a[h?p==="floating"?"reference":"floating":p],x=Oo(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),g=p==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),I=await(o.isElement==null?void 0:o.isElement(b))?await(o.getScale==null?void 0:o.getScale(b))||{x:1,y:1}:{x:1,y:1},O=Oo(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:b,strategy:l}):g);return{top:(x.top-O.top+m.top)/I.y,bottom:(O.bottom-x.bottom+m.bottom)/I.y,left:(x.left-O.left+m.left)/I.x,right:(O.right-x.right+m.right)/I.x}}const fE=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=Ni(e,t)||{};if(c==null)return{};const p=hf(u),h={x:n,y:r},f=fl(i),m=pl(f),v=await s.getDimensions(c),y=f==="y",x=y?"top":"left",g=y?"bottom":"right",b=y?"clientHeight":"clientWidth",I=o.reference[m]+o.reference[f]-h[f]-o.floating[m],O=h[f]-o.reference[f],_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let R=_?_[b]:0;(!R||!await(s.isElement==null?void 0:s.isElement(_)))&&(R=a.floating[b]||o.floating[m]);const k=I/2-O/2,A=R/2-v[m]/2-1,F=Fr(p[x],A),j=Fr(p[g],A),L=F,H=R-v[m]-j,P=R/2-v[m]/2+k,B=fa(L,P,H),X=!l.arrow&&Ti(i)!=null&&P!==B&&o.reference[m]/2-(P<L?F:j)-v[m]/2<0,le=X?P<L?P-L:P-H:0;return{[f]:h[f]+le,data:{[f]:B,centerOffset:P-B-le,...X&&{alignmentOffset:le}},reset:X}}}),hE=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:l,elements:c}=t,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...y}=Ni(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const x=ur(i),g=Pr(a),b=ur(a)===a,I=await(l.isRTL==null?void 0:l.isRTL(c.floating)),O=h||(b||!v?[So(a)]:lE(a)),_=m!=="none";!h&&_&&O.push(...uE(a,v,m,I));const R=[a,...O],k=await mf(t,y),A=[];let F=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&A.push(k[x]),p){const P=aE(i,s,I);A.push(k[P[0]],k[P[1]])}if(F=[...F,{placement:i,overflows:A}],!A.every(P=>P<=0)){var j,L;const P=(((j=o.flip)==null?void 0:j.index)||0)+1,B=R[P];if(B)return{data:{index:P,overflows:F},reset:{placement:B}};let X=(L=F.filter(le=>le.overflows[0]<=0).sort((le,fe)=>le.overflows[1]-fe.overflows[1])[0])==null?void 0:L.placement;if(!X)switch(f){case"bestFit":{var H;const le=(H=F.filter(fe=>{if(_){const ge=Pr(fe.placement);return ge===g||ge==="y"}return!0}).map(fe=>[fe.placement,fe.overflows.filter(ge=>ge>0).reduce((ge,C)=>ge+C,0)]).sort((fe,ge)=>fe[1]-ge[1])[0])==null?void 0:H[0];le&&(X=le);break}case"initialPlacement":X=a;break}if(i!==X)return{reset:{placement:X}}}return{}}}};async function mE(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=ur(n),a=Ti(n),l=Pr(n)==="y",c=["left","top"].includes(s)?-1:1,u=o&&l?-1:1,p=Ni(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:m}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof m=="number"&&(f=a==="end"?m*-1:m),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}const gE=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,l=await mE(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},yE=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:y=>{let{x,y:g}=y;return{x,y:g}}},...l}=Ni(e,t),c={x:n,y:r},u=await mf(t,l),p=Pr(ur(i)),h=ff(p);let f=c[h],m=c[p];if(o){const y=h==="y"?"top":"left",x=h==="y"?"bottom":"right",g=f+u[y],b=f-u[x];f=fa(g,f,b)}if(s){const y=p==="y"?"top":"left",x=p==="y"?"bottom":"right",g=m+u[y],b=m-u[x];m=fa(g,m,b)}const v=a.fn({...t,[h]:f,[p]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:o,[p]:s}}}}}};function Ko(){return typeof window<"u"}function Kr(e){return gf(e)?(e.nodeName||"").toLowerCase():"#document"}function Lt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function wn(e){var t;return(t=(gf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function gf(e){return Ko()?e instanceof Node||e instanceof Lt(e).Node:!1}function on(e){return Ko()?e instanceof Element||e instanceof Lt(e).Element:!1}function yn(e){return Ko()?e instanceof HTMLElement||e instanceof Lt(e).HTMLElement:!1}function xu(e){return!Ko()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Lt(e).ShadowRoot}function ki(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=sn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function vE(e){return["table","td","th"].includes(Kr(e))}function Ho(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function hl(e){const t=ml(),n=on(e)?sn(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 bE(e){let t=Kn(e);for(;yn(t)&&!jr(t);){if(hl(t))return t;if(Ho(t))return null;t=Kn(t)}return null}function ml(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function jr(e){return["html","body","#document"].includes(Kr(e))}function sn(e){return Lt(e).getComputedStyle(e)}function Jo(e){return on(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Kn(e){if(Kr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||xu(e)&&e.host||wn(e);return xu(t)?t.host:t}function yf(e){const t=Kn(e);return jr(t)?e.ownerDocument?e.ownerDocument.body:e.body:yn(t)&&ki(t)?t:yf(t)}function xi(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=yf(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=Lt(i);if(o){const a=ma(s);return t.concat(s,s.visualViewport||[],ki(i)?i:[],a&&n?xi(a):[])}return t.concat(i,xi(i,[],n))}function ma(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vf(e){const t=sn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=yn(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=Co(n)!==o||Co(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function gl(e){return on(e)?e:e.contextElement}function Nr(e){const t=gl(e);if(!yn(t))return zn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=vf(t);let s=(o?Co(n.width):n.width)/r,a=(o?Co(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const wE=zn(0);function bf(e){const t=Lt(e);return!ml()||!t.visualViewport?wE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Lt(e)?!1:t}function dr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=gl(e);let s=zn(1);t&&(r?on(r)&&(s=Nr(r)):s=Nr(e));const a=xE(o,n,r)?bf(o):zn(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,p=i.height/s.y;if(o){const h=Lt(o),f=r&&on(r)?Lt(r):r;let m=h,v=ma(m);for(;v&&r&&f!==m;){const y=Nr(v),x=v.getBoundingClientRect(),g=sn(v),b=x.left+(v.clientLeft+parseFloat(g.paddingLeft))*y.x,I=x.top+(v.clientTop+parseFloat(g.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,p*=y.y,l+=b,c+=I,m=Lt(v),v=ma(m)}}return Oo({width:u,height:p,x:l,y:c})}function IE(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=wn(r),a=t?Ho(t.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=zn(1);const u=zn(0),p=yn(r);if((p||!p&&!o)&&((Kr(r)!=="body"||ki(s))&&(l=Jo(r)),yn(r))){const h=dr(r);c=Nr(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function CE(e){return Array.from(e.getClientRects())}function ga(e,t){const n=Jo(e).scrollLeft;return t?t.left+n:dr(wn(e)).left+n}function SE(e){const t=wn(e),n=Jo(e),r=e.ownerDocument.body,i=or(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=or(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+ga(e);const a=-n.scrollTop;return sn(r).direction==="rtl"&&(s+=or(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function OE(e,t){const n=Lt(e),r=wn(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const c=ml();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function _E(e,t){const n=dr(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=yn(e)?Nr(e):zn(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function Iu(e,t,n){let r;if(t==="viewport")r=OE(e,n);else if(t==="document")r=SE(wn(e));else if(on(t))r=_E(t,n);else{const i=bf(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Oo(r)}function wf(e,t){const n=Kn(e);return n===t||!on(n)||jr(n)?!1:sn(n).position==="fixed"||wf(n,t)}function EE(e,t){const n=t.get(e);if(n)return n;let r=xi(e,[],!1).filter(a=>on(a)&&Kr(a)!=="body"),i=null;const o=sn(e).position==="fixed";let s=o?Kn(e):e;for(;on(s)&&!jr(s);){const a=sn(s),l=hl(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||ki(s)&&!l&&wf(e,s))?r=r.filter(u=>u!==s):i=a,s=Kn(s)}return t.set(e,r),r}function NE(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Ho(t)?[]:EE(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const p=Iu(t,u,i);return c.top=or(p.top,c.top),c.right=Fr(p.right,c.right),c.bottom=Fr(p.bottom,c.bottom),c.left=or(p.left,c.left),c},Iu(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function TE(e){const{width:t,height:n}=vf(e);return{width:t,height:n}}function kE(e,t,n){const r=yn(t),i=wn(t),o=n==="fixed",s=dr(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=zn(0);if(r||!r&&!o)if((Kr(t)!=="body"||ki(i))&&(a=Jo(t)),r){const f=dr(t,!0,o,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else i&&(l.x=ga(i));let c=0,u=0;if(i&&!r&&!o){const f=i.getBoundingClientRect();u=f.top+a.scrollTop,c=f.left+a.scrollLeft-ga(i,f)}const p=s.left+a.scrollLeft-l.x-c,h=s.top+a.scrollTop-l.y-u;return{x:p,y:h,width:s.width,height:s.height}}function Os(e){return sn(e).position==="static"}function Cu(e,t){if(!yn(e)||sn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return wn(e)===n&&(n=n.ownerDocument.body),n}function xf(e,t){const n=Lt(e);if(Ho(e))return n;if(!yn(e)){let i=Kn(e);for(;i&&!jr(i);){if(on(i)&&!Os(i))return i;i=Kn(i)}return n}let r=Cu(e,t);for(;r&&vE(r)&&Os(r);)r=Cu(r,t);return r&&jr(r)&&Os(r)&&!hl(r)?n:r||bE(e)||n}const RE=async function(e){const t=this.getOffsetParent||xf,n=this.getDimensions,r=await n(e.floating);return{reference:kE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function AE(e){return sn(e).direction==="rtl"}const FE={convertOffsetParentRelativeRectToViewportRelativeRect:IE,getDocumentElement:wn,getClippingRect:NE,getOffsetParent:xf,getElementRects:RE,getClientRects:CE,getDimensions:TE,getScale:Nr,isElement:on,isRTL:AE};function PE(e,t){let n=null,r;const i=wn(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const{left:c,top:u,width:p,height:h}=e.getBoundingClientRect();if(a||t(),!p||!h)return;const f=Zi(u),m=Zi(i.clientWidth-(c+p)),v=Zi(i.clientHeight-(u+h)),y=Zi(c),g={rootMargin:-f+"px "+-m+"px "+-v+"px "+-y+"px",threshold:or(0,Fr(1,l))||1};let b=!0;function I(O){const _=O[0].intersectionRatio;if(_!==l){if(!b)return s();_?s(!1,_):r=setTimeout(()=>{s(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(I,{...g,root:i.ownerDocument})}catch{n=new IntersectionObserver(I,g)}n.observe(e)}return s(!0),o}function jE(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:l=!1}=r,c=gl(e),u=i||o?[...c?xi(c):[],...xi(t)]:[];u.forEach(x=>{i&&x.addEventListener("scroll",n,{passive:!0}),o&&x.addEventListener("resize",n)});const p=c&&a?PE(c,n):null;let h=-1,f=null;s&&(f=new ResizeObserver(x=>{let[g]=x;g&&g.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var b;(b=f)==null||b.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let m,v=l?dr(e):null;l&&y();function y(){const x=dr(e);v&&(x.x!==v.x||x.y!==v.y||x.width!==v.width||x.height!==v.height)&&n(),v=x,m=requestAnimationFrame(y)}return n(),()=>{var x;u.forEach(g=>{i&&g.removeEventListener("scroll",n),o&&g.removeEventListener("resize",n)}),p?.(),(x=f)==null||x.disconnect(),f=null,l&&cancelAnimationFrame(m)}}const ME=gE,DE=yE,LE=hE,BE=fE,Su=(e,t,n)=>{const r=new Map,i={platform:FE,...n},o={...i.platform,_c:r};return pE(e,t,{...i,platform:o})};const $E="react-tooltip-core-styles",qE="react-tooltip-base-styles",Ou={core:!1,base:!1};function _u({css:e,id:t=qE,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||Ou[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=$E),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.id=t,l.type="text/css",s==="top"&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e)),Ou[n]=!0}const Eu=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[ME(Number(i)),LE({fallbackAxisSideDirection:"start"}),DE({padding:5})],border:a,arrowSize:l=8})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(BE({element:n,padding:5})),Su(e,t,{placement:r,strategy:o,middleware:c}).then((({x:u,y:p,placement:h,middlewareData:f})=>{var m,v;const y={left:`${u}px`,top:`${p}px`,border:a},{x,y:g}=(m=f.arrow)!==null&&m!==void 0?m:{x:0,y:0},b=(v={top:"bottom",right:"left",bottom:"top",left:"right"}[h.split("-")[0]])!==null&&v!==void 0?v:"bottom",I=a&&{borderBottom:a,borderRight:a};let O=0;if(a){const _=`${a}`.match(/(\d+)px/);O=_?.[1]?Number(_[1]):1}return{tooltipStyles:y,tooltipArrowStyles:{left:x!=null?`${x}px`:"",top:g!=null?`${g}px`:"",right:"",bottom:"",...I,[b]:`-${l/2+O}px`},place:h}}))):Su(e,t,{placement:"bottom",strategy:o,middleware:c}).then((({x:u,y:p,placement:h})=>({tooltipStyles:{left:`${u}px`,top:`${p}px`},tooltipArrowStyles:{},place:h})))},Nu=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Tu=(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},ku=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",ya=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((i,o)=>ya(i,t[o])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!ku(e)||!ku(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((i=>ya(e[i],t[i])))},VE=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"}))},Ru=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(VE(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},UE=typeof window<"u"?w.useLayoutEffect:w.useEffect,Ht=e=>{e.current&&(clearTimeout(e.current),e.current=null)},zE="DEFAULT_TOOLTIP_ID",KE={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},HE=w.createContext({getTooltipData:()=>KE});function If(e=zE){return w.useContext(HE).getTooltipData(e)}var Sr={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"},_s={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 JE=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i="dark",anchorId:o,anchorSelect:s,place:a="top",offset:l=10,events:c=["hover"],openOnClick:u=!1,positionStrategy:p="absolute",middlewares:h,wrapper:f,delayShow:m=0,delayHide:v=0,float:y=!1,hidden:x=!1,noArrow:g=!1,clickable:b=!1,closeOnEsc:I=!1,closeOnScroll:O=!1,closeOnResize:_=!1,openEvents:R,closeEvents:k,globalCloseEvents:A,imperativeModeOnly:F,style:j,position:L,afterShow:H,afterHide:P,disableTooltip:B,content:X,contentWrapperRef:le,isOpen:fe,defaultIsOpen:ge=!1,setIsOpen:C,previousActiveAnchor:W,activeAnchor:$,setActiveAnchor:S,border:U,opacity:V,arrowColor:Y,arrowSize:ie=8,role:ne="tooltip"})=>{var se;const ee=w.useRef(null),me=w.useRef(null),q=w.useRef(null),ye=w.useRef(null),Z=w.useRef(null),[$e,Fe]=w.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ae,We]=w.useState(!1),[et,tt]=w.useState(!1),[xe,at]=w.useState(null),It=w.useRef(!1),dt=w.useRef(null),{anchorRefs:Ge,setActiveAnchor:D}=If(t),K=w.useRef(!1),[M,re]=w.useState([]),ce=w.useRef(!1),Ue=u||c.includes("click"),Ct=Ue||R?.click||R?.dblclick||R?.mousedown,pt=R?{...R}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!R&&Ue&&Object.assign(pt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const gt=k?{...k}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!k&&Ue&&Object.assign(gt,{mouseleave:!1,blur:!1,mouseout:!1});const Pe=A?{...A}:{escape:I||!1,scroll:O||!1,resize:_||!1,clickOutsideAnchor:Ct||!1};F&&(Object.assign(pt,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(gt,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Pe,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),UE((()=>(ce.current=!0,()=>{ce.current=!1})),[]);const Oe=te=>{ce.current&&(te&&tt(!0),setTimeout((()=>{ce.current&&(C?.(te),fe===void 0&&We(te))}),10))};w.useEffect((()=>{if(t){if(Ae){pe(W);const ue=te($),Se=[...new Set([...ue,t])].filter(Boolean).join(" ");$?.setAttribute("aria-describedby",Se)}else pe($);return()=>{pe($),pe(W)}}function te(ue){var Se;return((Se=ue?.getAttribute("aria-describedby"))===null||Se===void 0?void 0:Se.split(" "))||[]}function pe(ue){const Se=te(ue).filter((Me=>Me!==t));Se.length?ue?.setAttribute("aria-describedby",Se.join(" ")):ue?.removeAttribute("aria-describedby")}}),[$,Ae,t,W]),w.useEffect((()=>{if(fe===void 0)return()=>null;fe&&tt(!0);const te=setTimeout((()=>{We(fe)}),10);return()=>{clearTimeout(te)}}),[fe]),w.useEffect((()=>{if(Ae!==It.current)if(Ht(Z),It.current=Ae,Ae)H?.();else{const te=(pe=>{const ue=pe.match(/^([\d.]+)(ms|s)$/);if(!ue)return 0;const[,Se,Me]=ue;return Number(Se)*(Me==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));Z.current=setTimeout((()=>{tt(!1),at(null),P?.()}),te+25)}}),[Ae]);const St=te=>{Fe((pe=>ya(pe,te)?pe:te))},ft=(te=m)=>{Ht(q),et?Oe(!0):q.current=setTimeout((()=>{Oe(!0)}),te)},Et=(te=v)=>{Ht(ye),ye.current=setTimeout((()=>{K.current||Oe(!1)}),te)},An=te=>{var pe;if(!te)return;const ue=(pe=te.currentTarget)!==null&&pe!==void 0?pe:te.target;if(!ue?.isConnected)return S(null),void D({current:null});m?ft():Oe(!0),S(ue),D({current:ue}),Ht(ye)},Fn=()=>{b?Et(v||100):v?Et():Oe(!1),Ht(q)},Pn=({x:te,y:pe})=>{var ue;const Se={getBoundingClientRect:()=>({x:te,y:pe,width:0,height:0,top:pe,left:te,right:te,bottom:pe})};Eu({place:(ue=xe?.place)!==null&&ue!==void 0?ue:a,offset:l,elementReference:Se,tooltipReference:ee.current,tooltipArrowReference:me.current,strategy:p,middlewares:h,border:U,arrowSize:ie}).then((Me=>{St(Me)}))},dn=te=>{if(!te)return;const pe=te,ue={x:pe.clientX,y:pe.clientY};Pn(ue),dt.current=ue},Yt=te=>{var pe;if(!Ae)return;const ue=te.target;ue.isConnected&&(!((pe=ee.current)===null||pe===void 0)&&pe.contains(ue)||[document.querySelector(`[id='${o}']`),...M].some((Se=>Se?.contains(ue)))||(Oe(!1),Ht(q)))},jn=Tu(An,50),ze=Tu(Fn,50),nt=te=>{ze.cancel(),jn(te)},de=()=>{jn.cancel(),ze()},Ce=w.useCallback((()=>{var te,pe;const ue=(te=xe?.position)!==null&&te!==void 0?te:L;ue?Pn(ue):y?dt.current&&Pn(dt.current):$?.isConnected&&Eu({place:(pe=xe?.place)!==null&&pe!==void 0?pe:a,offset:l,elementReference:$,tooltipReference:ee.current,tooltipArrowReference:me.current,strategy:p,middlewares:h,border:U,arrowSize:ie}).then((Se=>{ce.current&&St(Se)}))}),[Ae,$,X,j,a,xe?.place,l,p,L,xe?.position,y,ie]);w.useEffect((()=>{var te,pe;const ue=new Set(Ge);M.forEach((_e=>{B?.(_e)||ue.add({current:_e})}));const Se=document.querySelector(`[id='${o}']`);Se&&!B?.(Se)&&ue.add({current:Se});const Me=()=>{Oe(!1)},Vt=Ru($),Ut=Ru(ee.current);Pe.scroll&&(window.addEventListener("scroll",Me),Vt?.addEventListener("scroll",Me),Ut?.addEventListener("scroll",Me));let ht=null;Pe.resize?window.addEventListener("resize",Me):$&&ee.current&&(ht=jE($,ee.current,Ce,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const Nt=_e=>{_e.key==="Escape"&&Oe(!1)};Pe.escape&&window.addEventListener("keydown",Nt),Pe.clickOutsideAnchor&&window.addEventListener("click",Yt);const De=[],yt=_e=>!!(_e?.target&&$?.contains(_e.target)),Zo=_e=>{Ae&&yt(_e)||An(_e)},es=_e=>{Ae&&yt(_e)&&Fn()},ji=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Mi=["click","dblclick","mousedown","mouseup"];Object.entries(pt).forEach((([_e,Zt])=>{Zt&&(ji.includes(_e)?De.push({event:_e,listener:nt}):Mi.includes(_e)&&De.push({event:_e,listener:Zo}))})),Object.entries(gt).forEach((([_e,Zt])=>{Zt&&(ji.includes(_e)?De.push({event:_e,listener:de}):Mi.includes(_e)&&De.push({event:_e,listener:es}))})),y&&De.push({event:"pointermove",listener:dn});const Di=()=>{K.current=!0},pn=()=>{K.current=!1,Fn()},Li=b&&(gt.mouseout||gt.mouseleave);return Li&&((te=ee.current)===null||te===void 0||te.addEventListener("mouseover",Di),(pe=ee.current)===null||pe===void 0||pe.addEventListener("mouseout",pn)),De.forEach((({event:_e,listener:Zt})=>{ue.forEach((Jr=>{var Xn;(Xn=Jr.current)===null||Xn===void 0||Xn.addEventListener(_e,Zt)}))})),()=>{var _e,Zt;Pe.scroll&&(window.removeEventListener("scroll",Me),Vt?.removeEventListener("scroll",Me),Ut?.removeEventListener("scroll",Me)),Pe.resize?window.removeEventListener("resize",Me):ht?.(),Pe.clickOutsideAnchor&&window.removeEventListener("click",Yt),Pe.escape&&window.removeEventListener("keydown",Nt),Li&&((_e=ee.current)===null||_e===void 0||_e.removeEventListener("mouseover",Di),(Zt=ee.current)===null||Zt===void 0||Zt.removeEventListener("mouseout",pn)),De.forEach((({event:Jr,listener:Xn})=>{ue.forEach((vr=>{var Wr;(Wr=vr.current)===null||Wr===void 0||Wr.removeEventListener(Jr,Xn)}))}))}}),[$,Ce,et,Ge,M,R,k,A,Ue,m,v]),w.useEffect((()=>{var te,pe;let ue=(pe=(te=xe?.anchorSelect)!==null&&te!==void 0?te:s)!==null&&pe!==void 0?pe:"";!ue&&t&&(ue=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Se=new MutationObserver((Me=>{const Vt=[],Ut=[];Me.forEach((ht=>{if(ht.type==="attributes"&&ht.attributeName==="data-tooltip-id"&&(ht.target.getAttribute("data-tooltip-id")===t?Vt.push(ht.target):ht.oldValue===t&&Ut.push(ht.target)),ht.type==="childList"){if($){const Nt=[...ht.removedNodes].filter((De=>De.nodeType===1));if(ue)try{Ut.push(...Nt.filter((De=>De.matches(ue)))),Ut.push(...Nt.flatMap((De=>[...De.querySelectorAll(ue)])))}catch{}Nt.some((De=>{var yt;return!!(!((yt=De?.contains)===null||yt===void 0)&&yt.call(De,$))&&(tt(!1),Oe(!1),S(null),Ht(q),Ht(ye),!0)}))}if(ue)try{const Nt=[...ht.addedNodes].filter((De=>De.nodeType===1));Vt.push(...Nt.filter((De=>De.matches(ue)))),Vt.push(...Nt.flatMap((De=>[...De.querySelectorAll(ue)])))}catch{}}})),(Vt.length||Ut.length)&&re((ht=>[...ht.filter((Nt=>!Ut.includes(Nt))),...Vt]))}));return Se.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Se.disconnect()}}),[t,s,xe?.anchorSelect,$]),w.useEffect((()=>{Ce()}),[Ce]),w.useEffect((()=>{if(!le?.current)return()=>null;const te=new ResizeObserver((()=>{setTimeout((()=>Ce()))}));return te.observe(le.current),()=>{te.disconnect()}}),[X,le?.current]),w.useEffect((()=>{var te;const pe=document.querySelector(`[id='${o}']`),ue=[...M,pe];$&&ue.includes($)||S((te=M[0])!==null&&te!==void 0?te:pe)}),[o,M,$]),w.useEffect((()=>(ge&&Oe(!0),()=>{Ht(q),Ht(ye)})),[]),w.useEffect((()=>{var te;let pe=(te=xe?.anchorSelect)!==null&&te!==void 0?te:s;if(!pe&&t&&(pe=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),pe)try{const ue=Array.from(document.querySelectorAll(pe));re(ue)}catch{re([])}}),[t,s,xe?.anchorSelect]),w.useEffect((()=>{q.current&&(Ht(q),ft(m))}),[m]);const Ot=(se=xe?.content)!==null&&se!==void 0?se:X,xn=Ae&&Object.keys($e.tooltipStyles).length>0;return w.useImperativeHandle(e,(()=>({open:te=>{if(te?.anchorSelect)try{document.querySelector(te.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${te.anchorSelect}" is not a valid CSS selector`)}at(te??null),te?.delay?ft(te.delay):Oe(!0)},close:te=>{te?.delay?Et(te.delay):Oe(!1)},activeAnchor:$,place:$e.place,isOpen:!!(et&&!x&&Ot&&xn)}))),et&&!x&&Ot?w.createElement(f,{id:t,role:ne,className:Gt("react-tooltip",Sr.tooltip,_s.tooltip,_s[i],n,`react-tooltip__place-${$e.place}`,Sr[xn?"show":"closing"],xn?"react-tooltip__show":"react-tooltip__closing",p==="fixed"&&Sr.fixed,b&&Sr.clickable),onTransitionEnd:te=>{Ht(Z),Ae||te.propertyName!=="opacity"||(tt(!1),at(null),P?.())},style:{...j,...$e.tooltipStyles,opacity:V!==void 0&&xn?V:void 0},ref:ee},Ot,w.createElement(f,{className:Gt("react-tooltip-arrow",Sr.arrow,_s.arrow,r,g&&Sr.noArrow),style:{...$e.tooltipArrowStyles,background:Y?`linear-gradient(to right bottom, transparent 50%, ${Y} 50%)`:void 0,"--rt-arrow-size":`${ie}px`},ref:me})):null},WE=({content:e})=>w.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),QE=w.forwardRef((({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:o,className:s,classNameArrow:a,variant:l="dark",place:c="top",offset:u=10,wrapper:p="div",children:h=null,events:f=["hover"],openOnClick:m=!1,positionStrategy:v="absolute",middlewares:y,delayShow:x=0,delayHide:g=0,float:b=!1,hidden:I=!1,noArrow:O=!1,clickable:_=!1,closeOnEsc:R=!1,closeOnScroll:k=!1,closeOnResize:A=!1,openEvents:F,closeEvents:j,globalCloseEvents:L,imperativeModeOnly:H=!1,style:P,position:B,isOpen:X,defaultIsOpen:le=!1,disableStyleInjection:fe=!1,border:ge,opacity:C,arrowColor:W,arrowSize:$,setIsOpen:S,afterShow:U,afterHide:V,disableTooltip:Y,role:ie="tooltip"},ne)=>{const[se,ee]=w.useState(r),[me,q]=w.useState(i),[ye,Z]=w.useState(c),[$e,Fe]=w.useState(l),[Ae,We]=w.useState(u),[et,tt]=w.useState(x),[xe,at]=w.useState(g),[It,dt]=w.useState(b),[Ge,D]=w.useState(I),[K,M]=w.useState(p),[re,ce]=w.useState(f),[Ue,Ct]=w.useState(v),[pt,gt]=w.useState(null),[Pe,Oe]=w.useState(null),St=w.useRef(null),ft=w.useRef(fe),{anchorRefs:Et,activeAnchor:An}=If(e),Fn=ze=>ze?.getAttributeNames().reduce(((nt,de)=>{var Ce;return de.startsWith("data-tooltip-")&&(nt[de.replace(/^data-tooltip-/,"")]=(Ce=ze?.getAttribute(de))!==null&&Ce!==void 0?Ce:null),nt}),{}),Pn=ze=>{const nt={place:de=>{var Ce;Z((Ce=de)!==null&&Ce!==void 0?Ce:c)},content:de=>{ee(de??r)},html:de=>{q(de??i)},variant:de=>{var Ce;Fe((Ce=de)!==null&&Ce!==void 0?Ce:l)},offset:de=>{We(de===null?u:Number(de))},wrapper:de=>{var Ce;M((Ce=de)!==null&&Ce!==void 0?Ce:p)},events:de=>{const Ce=de?.split(" ");ce(Ce??f)},"position-strategy":de=>{var Ce;Ct((Ce=de)!==null&&Ce!==void 0?Ce:v)},"delay-show":de=>{tt(de===null?x:Number(de))},"delay-hide":de=>{at(de===null?g:Number(de))},float:de=>{dt(de===null?b:de==="true")},hidden:de=>{D(de===null?I:de==="true")},"class-name":de=>{gt(de)}};Object.values(nt).forEach((de=>de(null))),Object.entries(ze).forEach((([de,Ce])=>{var Ot;(Ot=nt[de])===null||Ot===void 0||Ot.call(nt,Ce)}))};w.useEffect((()=>{ee(r)}),[r]),w.useEffect((()=>{q(i)}),[i]),w.useEffect((()=>{Z(c)}),[c]),w.useEffect((()=>{Fe(l)}),[l]),w.useEffect((()=>{We(u)}),[u]),w.useEffect((()=>{tt(x)}),[x]),w.useEffect((()=>{at(g)}),[g]),w.useEffect((()=>{dt(b)}),[b]),w.useEffect((()=>{D(I)}),[I]),w.useEffect((()=>{Ct(v)}),[v]),w.useEffect((()=>{ft.current!==fe&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[fe]),w.useEffect((()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:fe==="core",disableBase:fe}}))}),[]),w.useEffect((()=>{var ze;const nt=new Set(Et);let de=n;if(!de&&e&&(de=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),de)try{document.querySelectorAll(de).forEach((pe=>{nt.add({current:pe})}))}catch{console.warn(`[react-tooltip] "${de}" is not a valid CSS selector`)}const Ce=document.querySelector(`[id='${t}']`);if(Ce&&nt.add({current:Ce}),!nt.size)return()=>null;const Ot=(ze=Pe??Ce)!==null&&ze!==void 0?ze:An.current,xn=new MutationObserver((pe=>{pe.forEach((ue=>{var Se;if(!Ot||ue.type!=="attributes"||!(!((Se=ue.attributeName)===null||Se===void 0)&&Se.startsWith("data-tooltip-")))return;const Me=Fn(Ot);Pn(Me)}))})),te={attributes:!0,childList:!1,subtree:!1};if(Ot){const pe=Fn(Ot);Pn(pe),xn.observe(Ot,te)}return()=>{xn.disconnect()}}),[Et,An,Pe,t,n]),w.useEffect((()=>{P?.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),ge&&!Nu("border",`${ge}`)&&console.warn(`[react-tooltip] "${ge}" is not a valid \`border\`.`),P?.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),C&&!Nu("opacity",`${C}`)&&console.warn(`[react-tooltip] "${C}" is not a valid \`opacity\`.`)}),[]);let dn=h;const Yt=w.useRef(null);if(o){const ze=o({content:Pe?.getAttribute("data-tooltip-content")||se||null,activeAnchor:Pe});dn=ze?w.createElement("div",{ref:Yt,className:"react-tooltip-content-wrapper"},ze):null}else se&&(dn=se);me&&(dn=w.createElement(WE,{content:me}));const jn={forwardRef:ne,id:e,anchorId:t,anchorSelect:n,className:Gt(s,pt),classNameArrow:a,content:dn,contentWrapperRef:Yt,place:ye,variant:$e,offset:Ae,wrapper:K,events:re,openOnClick:m,positionStrategy:Ue,middlewares:y,delayShow:et,delayHide:xe,float:It,hidden:Ge,noArrow:O,clickable:_,closeOnEsc:R,closeOnScroll:k,closeOnResize:A,openEvents:F,closeEvents:j,globalCloseEvents:L,imperativeModeOnly:H,style:P,position:B,isOpen:X,defaultIsOpen:le,border:ge,opacity:C,arrowColor:W,arrowSize:$,setIsOpen:S,afterShow:U,afterHide:V,disableTooltip:Y,activeAnchor:Pe,previousActiveAnchor:St.current,setActiveAnchor:ze=>{Oe((nt=>(ze?.isSameNode(nt)||(St.current=nt),ze)))},role:ie};return w.createElement(JE,{...jn})}));typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||_u({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;--rt-arrow-size:8px}.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;z-index:-1}.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||_u({css:`
20
- .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:var(--rt-arrow-size);height:var(--rt-arrow-size)}[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 GE(){return d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[d.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[d.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"}),d.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),d.jsx("defs",{children:d.jsx("clipPath",{id:"clip0_2896_16290",children:d.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function Cf({id:e,tooltipText:t}){return d.jsxs(d.Fragment,{children:[d.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:GE()}),d.jsx(QE,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function Sf({url:e,prompt:t,inputName:n}){return d.jsx("p",{style:{color:"var(--amp-colors-text-muted)",display:"flex",justifyContent:"space-between"},children:d.jsxs("span",{children:[e?d.jsx(kp,{href:e,newTab:!0,children:d.jsx("span",{style:{textDecoration:"underline"},children:n})}):d.jsx("span",{children:n})," ",t&&d.jsx(Cf,{id:`docs-helper-text-${EI(n||t?.slice(0,50))}`,tooltipText:t})]})})}const XE="_metadataInputWrapper_1266b_1",YE={metadataInputWrapper:XE};function Hr({metadata:e,onChange:t,providerName:n,variant:r="standard",defaultValue:i}){return d.jsxs("div",{className:YE.metadataInputWrapper,children:[e.docsURL&&r==="standard"&&d.jsx(dl,{url:e.docsURL,providerDisplayName:n||"",credentialName:e.displayName||Xt(e.name.toLowerCase()),prompt:e.prompt}),r==="header"&&d.jsx(Sf,{url:e.docsURL,prompt:e.prompt,inputName:e.displayName||e.name}),d.jsx(En.Input,{id:e.name,name:e.name,type:"text",placeholder:e.displayName||e.name,defaultValue:i,onChange:t})]})}function Ri(e,t){const n={},r=[];if(e.forEach(i=>{const o=t[i.name];!o||o.trim()===""?r.push(i.displayName||i.name):n[i.name]={value:o,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function Hn(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function ZE(e,t){const n=t?.modules;if(!(n&&Object.keys(n).length>0))return{module:"",error:null};const i=e||t.defaultModule;return i?{module:i,error:null}:{module:"",error:`Could not determine module for provider ${t?.name}`}}function eN(e,t){if(t==="")return e;const n=t.toLowerCase();return e.filter(r=>r.moduleDependencies?Object.keys(r.moduleDependencies).some(i=>i.toLowerCase()===n):!0)}function tN(e,t){if(t.length===0)return!1;const n=e.providerMetadata||{};return t.some(r=>{const i=n[r.name];return!i||!i.value||i.value.trim()===""})}function nN(e,t){if(!e||!t)return null;const n=t.modules;if(!(n&&Object.keys(n).length>0))return null;if(!Object.keys(n).some(o=>o.toLowerCase()===e.toLowerCase())){const o=Object.keys(n).join(", ");return`Invalid module "${e}" for provider ${t.name}. Valid modules: ${o}`}return null}function Of({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i,submitButtonType:o,metadataInputs:s}){const[a,l]=w.useState({apiKey:""}),c=x=>{const{name:g,value:b}=x.currentTarget;l(I=>({...I,[g]:b.trim()}))},{apiKey:u}=a,{providerName:p}=ut(e),h=u.length>0,f=Hn(s,a),m=r||!h||!f,v=t.apiKeyOpts?.docsURL,y=()=>{const x=Ri(s,a);n({apiKey:u,providerMetadata:x})};return d.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&d.jsx(dl,{url:v,providerDisplayName:p||Xt(e),credentialName:"API key"}),d.jsx(En.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:c}),s.map(x=>d.jsx(Hr,{metadata:x,onChange:c,providerName:p||Xt(e)},x.name)),d.jsx(je,{style:{marginTop:"1em",width:"100%"},disabled:m,type:o||"submit",onClick:y,variant:i,children:"Next"})]})}function rN({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i,metadataInputs:o}){const{providerName:s}=ut(e);return d.jsxs(Wn,{children:[d.jsx(Qn,{children:`Set up ${s} integration`}),d.jsx(bn,{error:r}),d.jsx(Of,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i||!!r,metadataInputs:o})]})}function iN({...e}){return d.jsx(rN,{...e})}const oN={backgroundColor:"var(--amp-colors-status-success-muted)",borderColor:"var(--amp-colors-status-success-muted)",color:"var(--amp-colors-status-success-dark)",padding:".5rem 1rem"};function Ai({children:e,style:t}){return d.jsx(kn,{style:{...oN,...t},children:e})}const Wo=()=>{const e=wt(),t=Ze(),[n,r]=w.useState(null);return{...Nn({mutationKey:["updateConnection"],mutationFn:async o=>(await e()).connectionApi.updateConnection(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},sN="_divider_1kmoj_1",Au={divider:sN};function Qo({className:e,style:t}){return d.jsx("hr",{className:e?`${Au.divider} ${e}`:Au.divider,style:t})}function $t({string:e}){return d.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[d.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),d.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:d.jsx(Qo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function aN({provider:e}){const{projectIdOrName:t}=Ke(),{providerName:n,data:r}=ut(e),{selectedConnection:i,isConnectionsLoading:o}=cn(),{mutateAsync:s,isPending:a,error:l}=Wo(),[c,u]=w.useState(null),[p,h]=w.useState(!1),f=()=>h(!1),m=()=>{h(!0),u(null)},v=l?.message||c||null,y=async x=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:i?.id||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:x.apiKey}}},{onError:g=>{console.error("Update connection error:",g),Ye(g,u)},onSuccess:()=>{m()}})}catch(g){console.error("Update connection caught error:",g),Ye(g,u)}};return r?d.jsxs(d.Fragment,{children:[d.jsx($t,{string:"Update connection"}),d.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[d.jsx("p",{children:`Update ${n} API Key`}),p&&d.jsx(Ai,{children:"Connection updated successfully"}),v&&d.jsx(Oi,{children:`Error updating connection ${v}`}),d.jsx(Of,{provider:r?.name,providerInfo:r,handleSubmit:y,isButtonDisabled:a||o,buttonVariant:"ghost",submitButtonType:"button",metadataInputs:[]})]})]}):null}function _f({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i,metadataInputs:o}){const[s,a]=w.useState({username:"",password:""}),{username:l,password:c}=s,{providerName:u}=ut(e),p=y=>{const{name:x,value:g}=y.currentTarget;a(b=>({...b,[x]:g.trim()}))},h=Hn(o,s),f=r||!h,m=()=>{const y=Ri(o,s);n({user:l,pass:c,providerMetadata:y})},v=t.basicOpts?.docsURL;return d.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&d.jsx(dl,{url:v,providerDisplayName:u||Xt(e),credentialName:"credentials"}),d.jsx(En.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:p}),d.jsx(En.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:p}),o.map(y=>d.jsx(Hr,{metadata:y,onChange:p,providerName:u||Xt(e)},y.name)),d.jsx(je,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"button",onClick:m,variant:i,children:"Next"})]})}function lN({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i,metadataInputs:o}){const{providerName:s}=ut(e);return d.jsxs(Wn,{children:[d.jsx(Qn,{children:`Set up ${s} integration`}),d.jsx(bn,{error:r}),d.jsx(_f,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i||!!r,metadataInputs:o})]})}function cN({...e}){return d.jsx(lN,{...e})}function uN({provider:e}){const{projectIdOrName:t}=Ke(),{providerName:n,data:r}=ut(e),{selectedConnection:i,isConnectionsLoading:o}=cn(),{mutateAsync:s,isPending:a,error:l}=Wo(),[c,u]=w.useState(null),[p,h]=w.useState(!1),f=()=>h(!1),m=()=>{h(!0),u(null)},v=l?.message||c||null,y=async x=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:i?.id||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:x.user,password:x.pass}}}},{onError:g=>{console.error(g),Ye(g,u)},onSuccess:()=>{m()}})}catch(g){console.error(g),Ye(g,u)}};return r?d.jsxs(d.Fragment,{children:[d.jsx($t,{string:"Update connection"}),d.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[d.jsx("p",{children:`Update ${n} credentials`}),p&&d.jsx(Ai,{children:"Connection updated successfully"}),v&&d.jsx(Oi,{children:`Error updating connection: ${v}`}),d.jsx(_f,{provider:r?.name,providerInfo:r,handleSubmit:y,isButtonDisabled:a||o,buttonVariant:"ghost",metadataInputs:[]})]})]}):null}function Ef({handleSubmit:e,isButtonDisabled:t,explicitScopesRequired:n,buttonVariant:r,metadataInputs:i,providerName:o}){const[s,a]=w.useState({clientSecret:"",clientId:"",scopes:""}),[l,c]=w.useState(null),u=b=>{const{name:I,value:O}=b.currentTarget;a(_=>({..._,[I]:O.trim()})),c(null)},{clientSecret:p,clientId:h,scopes:f}=s,m=p.length>0,v=h.length>0,y=Hn(i,s),x=t||!m||!v||!y,g=()=>{const b=Ri(i,s),I={clientId:h,clientSecret:p,providerMetadata:b};n&&f.length>0&&(I.scopes=OI(f)),e(I)};return d.jsxs(d.Fragment,{children:[d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[d.jsx(En.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:u}),d.jsx(En.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:u}),n&&d.jsx(En.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:u}),i.map(b=>d.jsx(Hr,{metadata:b,onChange:u,providerName:o},b.name))]}),d.jsx(bn,{error:l}),d.jsx("br",{}),d.jsx(je,{style:{width:"100%"},disabled:x,type:"button",onClick:g,variant:r,children:"Next"})]})}function dN({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:i,metadataInputs:o}){return d.jsxs(Wn,{children:[d.jsx(Qn,{children:`Set up ${r} integration`}),d.jsx(bn,{error:t}),d.jsx("br",{}),d.jsx(Ef,{handleSubmit:e,isButtonDisabled:n||!!t,explicitScopesRequired:i,metadataInputs:o,providerName:r})]})}function pN({provider:e}){const{projectIdOrName:t}=Ke(),{selectedConnection:n,isConnectionsLoading:r}=cn(),{providerName:i,data:o}=ut(e),{mutateAsync:s,isPending:a,error:l}=Wo(),[c,u]=w.useState(null),[p,h]=w.useState(!1),f=()=>{h(!1)},m=()=>{h(!0),u(null)},v=o?.oauth2Opts?.explicitScopesRequired,y=l?.message||c||null,x=async g=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:n?.id||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:g.clientId,clientSecret:g.clientSecret,scopes:g.scopes}}}}),m()}catch(b){Ye(b,u)}};return d.jsxs(d.Fragment,{children:[d.jsx($t,{string:"Update connection"}),d.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[d.jsx("p",{children:`Re-authenticate to ${i}`}),p&&d.jsx(Ai,{children:"Connection updated successfully"}),y&&d.jsx(Oi,{children:`Error updating connection ${y}`}),d.jsx(Ef,{handleSubmit:x,isButtonDisabled:a||r,explicitScopesRequired:v,buttonVariant:"ghost",metadataInputs:[]})]})]})}const Fu=600,Pu=600,fN="AUTHORIZATION_SUCCEEDED",hN="AUTHORIZATION_FAILED";function mN(e,t,n,r){return w.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-Fu)/2,o=window.screenY+(window.outerHeight-Pu)/2.5,s=`width=${Fu},height=${Pu},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function gN(e,t,n,r){const i=Ze();return w.useCallback(o=>{if(o.origin===tp){if(o.data.eventType===fN){const s=o.data.data?.connection;s?(e(s),i.setQueriesData({queryKey:["amp","connections"]},()=>[s]),t?.close(),r?.(),i.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:o})}o.data.eventType===hN&&(console.error("OAuth failed: ",{event:o}),n?.(o?.data?.message??"Something went wrong, try refreshing this page, and then try again."))}},[t,n,i,e,r])}function yN({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i,onSuccessConnect:o,isSuccessConnect:s,onWindowClose:a}){const[l,c]=w.useState(null),[u,p]=w.useState(null),h=Ze(),f=w.useRef(null),m=gN(c,u,r,o),v=mN(n,p,m,t);w.useEffect(()=>{t&&!u&&!l&&!i&&!s&&(r?.(null),v())},[t,u,v,l,i,s,r]);const y=w.useCallback(()=>{h.invalidateQueries({queryKey:["amp","connections"]}),p(null),!l&&!i?console.error("Window closed and no connection was found. Please try again."):l&&r?.(null),a?.()},[l,i,r,a,h]);return w.useEffect(()=>{if(u)return f.current=setInterval(()=>{u?.closed&&(f.current&&clearInterval(f.current),f.current=null,y())},500),()=>{f.current&&(clearInterval(f.current),f.current=null),window.removeEventListener("message",m)}},[y,u,m]),d.jsx("div",{children:e})}const vN=()=>{const e=wt(),t=Ze();return Nn({mutationKey:["updateOauthConnection"],mutationFn:async n=>!n.projectIdOrName||!n.connectionId?Promise.reject(new Error("Project ID and connection ID are required")):(await e()).oAuthApi.oauthUpdate(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function bN({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return d.jsxs("div",{style:{padding:"1rem 0"},children:[d.jsx("p",{children:`Re-authenticate to ${r}`}),d.jsx(bn,{error:t}),d.jsx(je,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function wN({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=cn(),r=t?.id,i=t?.projectId,{providerName:o}=ut(e),{mutateAsync:s,isPending:a,error:l}=vN(),[c,u]=w.useState(null),[p,h]=w.useState(!1),[f,m]=w.useState(null),v=()=>{h(!1)},y=()=>{h(!0),u(null),m(null)},x=l?.message||c||null,g=async()=>{v(),u(null);try{const I=await s({projectIdOrName:i||"",connectionId:r||""});m(I)}catch(I){Ye(I,u)}},b=w.useCallback(I=>{u(I)},[]);return d.jsxs(d.Fragment,{children:[d.jsx($t,{string:"Update connection"}),p&&d.jsx(Ai,{children:"Connection updated successfully"}),d.jsx(yN,{windowTitle:`Connect to ${o}`,oauthUrl:f||null,onError:b,error:x,isSuccessConnect:p,onSuccessConnect:y,children:d.jsx(bN,{handleSubmit:g,error:x,providerName:o,isButtonDisabled:a||n||p})})]})}function yl({provider:e}){const{data:t}=pp(e);if(t?.authType===nc.Basic)return d.jsx(uN,{provider:e});if(t?.authType===nc.ApiKey)return d.jsx(aN,{provider:e});const n=t?.oauth2Opts?.grantType;if(n){if(n===is.AuthorizationCode||n===is.AuthorizationCodePkce)return d.jsx(wN,{provider:e});if(n===is.ClientCredentials)return d.jsx(pN,{provider:e})}return null}const xN=()=>{const e=wt(),t=Ze(),[n,r]=w.useState(null);return{...Nn({mutationKey:["deleteConnection"],mutationFn:async o=>(await e()).connectionApi.deleteConnection(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)},onError:o=>{console.error("Error deleting connection"),Ye(o,r)}}),errorMsg:n}};function Nf({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i,onDisconnectError:o}){const{projectIdOrName:s}=Ke(),{selectedConnection:a}=cn(),{mutate:l,isPending:c}=xN(),u=!s||!a||!a.id||c,p=async()=>{u||(console.warn("deleting connection",{projectIdOrName:s,connectionId:a?.id}),l({projectIdOrName:s,connectionId:a?.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a?.id),r?.(a),i()},onError:m=>{Ye(m,o)}}))},h=c?"Pending...":e;return d.jsx(je,{type:"button",onClick:p,disabled:u,variant:t,style:n,children:h})}function Tf({resetComponent:e,onDisconnectSuccess:t}){return d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[d.jsx($t,{string:"Remove connection"}),d.jsx("p",{children:"Click to disconnect your connection from the provider."}),d.jsx(Nf,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}function IN({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,i]=w.useState(!1);return d.jsxs(d.Fragment,{children:[r===!1&&d.jsxs(d.Fragment,{children:[d.jsx($t,{string:"Manage connection"}),d.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[d.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),d.jsx(je,{type:"button",onClick:()=>i(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&d.jsxs(d.Fragment,{children:[d.jsx(yl,{provider:n}),d.jsx(Tf,{resetComponent:e,onDisconnectSuccess:t})]})]})}function va({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=an(),{providerName:i}=ut(e),o=`You have successfully connected your ${i} account to ${r}.`;return d.jsx(Ga,{text:o,children:d.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:d.jsx(IN,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function Fi(){const e=wt(),t=Ze();return Nn({mutationKey:["createConnection"],mutationFn:async n=>(await e()).connectionApi.generateConnection(n),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error creating connection and loading provider info"),Ye(n)}})}function CN({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=Ke(),p=Fi(),h=w.useCallback(f=>{const{apiKey:m,providerMetadata:v}=f,y={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:v?.workspace?.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:m,...v&&{providerMetadata:v}}};p.mutate(y)},[u,o,i,r,n,e,p]);return a===null?d.jsx(iN,{provider:e,providerInfo:t,handleSubmit:h,error:c||null,metadataInputs:l}):s}function SN({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=Ke(),p=Fi(),h=w.useCallback(f=>{const{user:m,pass:v,providerMetadata:y}=f,x={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:y?.workspace?.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m,password:v},...y&&{providerMetadata:y}}};p.mutate(x)},[u,o,i,r,n,e,p]);return a===null?d.jsx(cN,{provider:e,providerInfo:t,handleSubmit:h,error:c||null,metadataInputs:l}):s}function ON({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r,metadataInputs:i}){const[o,s]=w.useState({}),a=h=>{const{name:f,value:m}=h.currentTarget;s(v=>({...v,[f]:m.trim()}))},l=Hn(i,o),c=n||!l,u=e.customOpts?.inputs||[],p=()=>{const h=Ri(i,o),f=Object.fromEntries(u.map(m=>[m.name,o[m.name]]));t({customAuth:f,providerMetadata:h})};return d.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[u.map(h=>d.jsxs("div",{children:[d.jsx(Sf,{url:h.docsURL,prompt:h.prompt,inputName:h.displayName}),d.jsx(En.PasswordInput,{id:h.name,name:h.name,onChange:a,placeholder:""})]},h.name)),i.map(h=>d.jsx(Hr,{metadata:h,onChange:a,variant:"header"},h.name)),d.jsx(je,{style:{marginTop:"1em",width:"100%"},disabled:c,type:"submit",onClick:p,variant:r,children:"Next"})]})}function _N({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r,metadataInputs:i}){return d.jsxs(Wn,{children:[d.jsx(Qn,{children:`Set up ${e.displayName} integration`}),d.jsx(bn,{error:n}),d.jsx(ON,{providerInfo:e,handleSubmit:t,isButtonDisabled:r||!!n,metadataInputs:i})]})}function EN({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,metadataInputs:a,moduleError:l}){const{projectIdOrName:c}=Ke(),u=Fi(),[p,h]=w.useState(l||null),f=w.useCallback(m=>{const{customAuth:v,providerMetadata:y}=m;h(null);const x={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:y?.workspace?.value,groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:v,...y&&{providerMetadata:y}}};u.mutate(x,{onError:g=>{Ye(g,h)},onSuccess:()=>{h(null)}})},[c,i,r,n,t,e.name,u]);return s===null?d.jsx(_N,{providerInfo:e,handleSubmit:f,error:p,metadataInputs:a}):o}function NN({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 d.jsxs(Wn,{children:[d.jsx(Qn,{children:o||`Set up ${r} integration`}),d.jsx(bn,{error:t}),i,d.jsx(je,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function TN({...e}){return d.jsx(NN,{...e})}function kN({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,providerName:a,moduleError:l}){const{projectIdOrName:c}=Ke(),u=Fi(),p=w.useCallback(()=>{const h={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e}};u.mutate(h)},[c,i,r,n,t,e,u]);return s===null?d.jsx(TN,{handleSubmit:p,error:l||null,providerName:a}):o}const RN=()=>{const e=wt(),t=Ze();return Nn({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})},AN=Ba("VITE_AMP_ENABLE_CSRF",!1),FN=Ba("NEXT_AMP_ENABLE_CSRF",!1),PN=Ba("REACT_APP_AMP_ENABLE_CSRF",!1),jN=!!AN||!!FN||!!PN;function MN({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return d.jsxs(Wn,{children:[d.jsx(Qn,{children:`Set up ${r} integration`}),d.jsx(FS,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),d.jsx(bn,{error:t}),d.jsx(je,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n&&!t?"Loading...":"Next"})]})}function DN(e){return null}function LN({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,provider:i,providerName:o,metadataInputs:s}){const l=i.startsWith("salesforce")?DN():null,[c,u]=w.useState("authorize");return d.jsx(Wn,{children:d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[d.jsxs(Qn,{children:["Enter your ",o," workspace"]}),l,d.jsx(bn,{error:n}),s.map(p=>d.jsx(Hr,{metadata:p,onChange:h=>t(p.name,h.currentTarget.value),providerName:o},p.name)),d.jsx(je,{style:{width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})})}const ju=600,Mu=600;function BN({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o,metadataInputs:s,moduleError:a}){const{projectId:l}=an(),c=Ze(),u=w.useRef(null),[p,h]=w.useState(a||null),[f,m]=w.useState({}),[v,y]=w.useState({}),{mutateAsync:x,isPending:g}=RN(),{isFetching:b,refetch:I}=La({groupRef:r,provider:e});w.useEffect(()=>{const k=A=>{A.origin===tp&&(A.data?.eventType==="AUTHORIZATION_SUCCEEDED"?(h(null),console.debug("New connection:",A.data.data.connection),c.invalidateQueries({queryKey:["amp","connections"]})):A.data?.eventType==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",A.data.data.error),c.invalidateQueries({queryKey:["amp","connections"]}),h(A.data.data.error||"An error occurred. Please try again.")),u.current?.close())};return window.addEventListener("message",k),()=>window.removeEventListener("message",k)},[c]);const O=(k,A)=>{m(F=>({...F,[k]:A})),y(F=>({...F,[k]:{value:A,source:"input"}}))},_=async()=>{h(null);try{const{data:k}=await I();if(k&&k.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(s.length>0&&!Hn(s,f)){h("Please fill in all required fields");return}try{const k=await x({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:l||"",consumerName:n,groupName:i,providerWorkspaceRef:v?.workspace?.value,providerMetadata:v,enableCSRFProtection:jN}});if(k){const A=window.screenX+(window.outerWidth-ju)/2,F=window.screenY+(window.outerHeight-Mu)/2.5,j=`width=${ju},height=${Mu},left=${A},top=${F}`;u.current=window.open(k,"OAuthPopup",j)}}catch(k){console.error(k),h(k instanceof Error?k.message:String(k)||"An error occurred. Please try again.")}},R=s.length>0?d.jsx(LN,{handleSubmit:_,setFormData:O,error:p,isButtonDisabled:!Hn(s,f)||g||b||!!p,provider:e,providerName:o,metadataInputs:s}):d.jsx(MN,{handleSubmit:_,error:p,providerName:o,isButtonDisabled:g||b||!!p});return d.jsx("div",{children:R})}function $N({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=Ke(),p=Fi(),[h,f]=w.useState(c||null),m=w.useCallback(v=>{f(null);const y={projectIdOrName:u,generateConnectionParams:{groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:v.providerMetadata?.workspace?.value,oauth2ClientCredentials:{clientId:v.clientId,clientSecret:v.clientSecret,scopes:v.scopes},...v.providerMetadata&&{providerMetadata:v.providerMetadata}}};p.mutate(y,{onError:()=>f("Error loading provider info")})},[u,o,i,r,n,e,p]);return a===null?d.jsx(dN,{providerName:t,handleSubmit:m,error:h,explicitScopesRequired:s,metadataInputs:l}):d.jsx(vi,{})}function qN({...e}){return d.jsx($N,{...e})}const VN="authorizationCode",UN="authorizationCodePKCE",zN="clientCredentials";function KN({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:a,metadataInputs:l,moduleError:c}){const{providerName:u}=ut(e);if(t.oauth2Opts===void 0)return d.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:p,explicitScopesRequired:h}=t.oauth2Opts,f={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:u,metadataInputs:l,moduleError:c};return p===VN||p===UN?d.jsx(BN,{...f}):p===zN?d.jsx(qN,{...f,explicitScopesRequired:h,selectedConnection:s,setSelectedConnection:a}):p==="password"?d.jsx("em",{children:"Password flow not supported yet"}):d.jsxs("em",{children:["Unsupported grant type: ",p]})}function HN({connection:e,metadataInputs:t,providerName:n,onSuccess:r}){const{projectIdOrName:i}=Ke(),o=e.providerMetadata||{},s={};t.forEach(v=>{const y=o[v.name];y?.value&&(s[v.name]=y.value)});const[a,l]=w.useState(s),[c,u]=w.useState(null),{mutateAsync:p,isPending:h}=Wo(),f=(v,y)=>{l(x=>({...x,[v]:y}))},m=async()=>{if(u(null),!Hn(t,a)){u("Please fill in all required fields");return}try{const v=Ri(t,a),y={...o,...v};await p({projectIdOrName:i||"",connectionId:e.id,updateConnectionRequest:{updateMask:["providerMetadata"],connection:{providerMetadata:y}}}),r()}catch(v){console.error("Error updating connection metadata:",v),u(v instanceof Error?v.message:"An error occurred while updating the connection.")}};return d.jsxs(Wn,{children:[d.jsxs(Qn,{children:["Additional information needed for ",n]}),d.jsx(bn,{error:c}),d.jsx("br",{}),t.map(v=>d.jsx(Hr,{metadata:v,onChange:y=>f(v.name,y.currentTarget.value),providerName:n,defaultValue:s[v.name]},v.name)),d.jsx(je,{style:{marginTop:"1em",width:"100%"},disabled:!Hn(t,a)||h,type:"submit",onClick:m,children:"Submit"})]})}function JN(e){const{selectedConnection:t}=cn();w.useEffect(()=>{e&&t&&e(t)},[e,t])}function WN({onSuccess:e}){JN(e)}function vl({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,module:o,children:s,onSuccess:a,onDisconnectSuccess:l,resetComponent:c}){const{data:u,isLoading:p,isError:h,error:f,providerName:m,selectedProvider:v}=ut(e),{provider:y,isIntegrationDeleted:x,integrationObj:g}=st(),{selectedConnection:b,setSelectedConnection:I}=cn();WN({onSuccess:a});const O=Ze(),_=u,R=o||g?.latestRevision?.content?.module,{module:k,error:A}=ZE(R,_),F=_?.metadata?.input||[],j=eN(F,k);w.useEffect(()=>{h&&(console.error("Error loading provider info."),Ye(f))},[h,f]);const L=w.useCallback(()=>{O.clear(),c()},[c,O]);if(!e&&!y)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(x)return d.jsx(Ga,{text:"Integration successfully uninstalled.",children:d.jsx(je,{type:"button",onClick:L,style:{width:"100%"},children:"Reinstall Integration"})});const H=nN(o,_);if(b)return H?d.jsx(ot,{message:H}):tN(b,j)?d.jsx(HN,{connection:b,metadataInputs:j,providerName:m,onSuccess:()=>{O.invalidateQueries({queryKey:["amp","connections"]})}}):s;if(p)return d.jsx(mr,{});if(_==null)return d.jsx(ot,{message:"Provider info was not found."});if(H)return d.jsx(ot,{message:H});const P={provider:v,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:b,setSelectedConnection:I,providerName:m,providerInfo:_,onDisconnectSuccess:l,metadataInputs:j,moduleError:A||H};return _.authType==="none"?d.jsx(kN,{...P,children:s}):_.authType==="basic"?d.jsx(SN,{...P,children:s}):_.authType==="apiKey"?d.jsx(CN,{...P,children:s}):_.authType==="custom"?d.jsx(EN,{...P,children:s}):d.jsx(KN,{...P})}const QN="_connectStep_ywqni_1",GN="_connected_ywqni_8",eo={connectStep:QN,connected:GN};function XN({consumerRef:e,consumerName:t,groupRef:n,groupName:r,resetComponent:i}){const{goToStep:o}=un(),{provider:s}=st(),{selectedConnection:a}=cn(),l=w.useRef(!!a);return w.useEffect(()=>{!l.current&&a&&o(Qt.SelectObjects)},[a,o]),l.current&&a?d.jsx("div",{className:eo.connectStep,children:d.jsxs("div",{className:eo.connected,children:[d.jsx(va,{provider:s,resetComponent:i}),d.jsx(bo,{showBack:!1,onNext:()=>o(Qt.SelectObjects)})]})}):d.jsx("div",{className:eo.connectStep,children:d.jsx(vl,{consumerRef:e,consumerName:t,groupRef:n,groupName:r,resetComponent:i,children:d.jsxs("div",{className:eo.connected,children:[d.jsx(va,{provider:s,resetComponent:i}),d.jsx(bo,{showBack:!1,onNext:()=>o(Qt.SelectObjects)})]})})})}const YN="_header_1akgr_1",ZN="_title_1akgr_5",eT="_description_1akgr_12",Es={header:YN,title:ZN,description:eT};function kf({title:e,description:t}){return d.jsxs("div",{className:Es.header,children:[d.jsx("h2",{className:Es.title,children:e}),d.jsx("p",{className:Es.description,children:t})]})}const tT="_reviewStep_6lrjz_1",nT="_summaryList_6lrjz_6",rT="_summaryCard_6lrjz_13",iT="_cardHeader_6lrjz_22",oT="_objectName_6lrjz_29",sT="_objectDescription_6lrjz_35",aT="_cardDetails_6lrjz_40",lT="_pill_6lrjz_46",cT="_cardMappings_6lrjz_56",uT="_mappingPill_6lrjz_63",dT="_error_6lrjz_73",pT="_actions_6lrjz_82",fT="_createButton_6lrjz_92",Tt={reviewStep:tT,summaryList:nT,summaryCard:rT,cardHeader:iT,objectName:oT,objectDescription:sT,cardDetails:aT,pill:lT,cardMappings:cT,mappingPill:uT,error:dT,actions:pT,createButton:fT};function hT(){const{state:e,prevStep:t,nextStep:n,setSubmissionError:r}=un(),{selectedObjects:i}=e,o=Tn(),s=Mo(),{createInstallation:a,isPending:l}=qa(),{onInstallSuccess:c,setInstallation:u}=st(),p=w.useMemo(()=>i.map(f=>{const m=o.getReadObject(f),v=s.readObject(f),y=(m?.getRequiredFields("no-mappings")??[]).filter(A=>"fieldName"in A).map(A=>"fieldName"in A?A.displayName||A.fieldName:""),x=(m?.getOptionalFields("no-mappings")??[]).filter(A=>{const F="fieldName"in A?A.fieldName:"";return F&&v?.getSelectedField(F)}).map(A=>"fieldName"in A?A.displayName||A.fieldName:""),g=[...m?.getRequiredMapFields()??[],...m?.getOptionalMapFields()??[]],b=o.getCustomerFieldsForObject(f).allFields??{},I=g.map(A=>{const F=v?.getFieldMapping(A.mapToName);if(!F)return null;const j=b[F]?.displayName||F,L=A.mapToDisplayName??A.mapToName;return{sourceLabel:j,destLabel:L,key:A.mapToName}}).filter(Boolean),O=m?.object?.mapToDisplayName||m?.object?.mapToName||null,R=!!s.writeObject(f).object,k=R;return{objectName:f,displayName:m?.object?.displayName||f,requiredFields:y,selectedOptionalFields:x,configuredMappings:I,objectMapTo:O,writeEnabled:R,bidirectional:k}}),[i,o,s]),h=w.useCallback(()=>{r(null),a({config:s.draft,onSuccess:f=>{u(f),c?.(f.id,f.config),n()},onError:f=>{r(f.message)}})},[a,s.draft,r,u,c,n]);return d.jsxs("div",{className:Tt.reviewStep,children:[d.jsx(kf,{title:"Review & Create",description:"Review your configuration before creating the installation."}),d.jsx("div",{className:Tt.summaryList,children:p.map(f=>d.jsxs("div",{className:Tt.summaryCard,children:[d.jsxs("div",{className:Tt.cardHeader,children:[d.jsx("span",{className:Tt.objectName,children:f.displayName}),d.jsxs("span",{className:Tt.objectDescription,children:["Reads",f.writeEnabled?" and writes":"",f.objectMapTo?` to ${f.objectMapTo}`:""]})]}),d.jsxs("div",{className:Tt.cardDetails,children:[f.requiredFields.map(m=>d.jsx("span",{className:Tt.pill,children:m},m)),f.selectedOptionalFields.map(m=>d.jsx("span",{className:Tt.pill,children:m},m))]}),f.configuredMappings.length>0&&d.jsx("div",{className:Tt.cardMappings,children:f.configuredMappings.map(m=>d.jsxs("span",{className:Tt.mappingPill,children:[m.sourceLabel," ",d.jsx(Wa,{})," ",m.destLabel]},m.key))})]},f.objectName))}),e.submissionError&&d.jsx("div",{className:Tt.error,children:e.submissionError}),d.jsxs("div",{className:Tt.actions,children:[d.jsx(je,{type:"button",variant:"ghost",onClick:t,children:"Back"}),d.jsx(je,{type:"button",className:Tt.createButton,onClick:h,disabled:l,children:l?"Creating...":"Create Installation"})]})]})}const mT="_selectObjects_im90z_1",gT="_objectList_im90z_6",yT="_objectCard_im90z_12",vT="_selected_im90z_29",bT="_checkbox_im90z_34",wT="_objectInfo_im90z_42",xT="_objectName_im90z_49",IT="_writeToggle_im90z_69",CT="_writeToggleLabel_im90z_77",ST="_toggleSwitch_im90z_83",OT="_toggleSlider_im90z_97",_T="_loading_im90z_126",ET="_error_im90z_127",NT="_empty_im90z_128",bt={selectObjects:mT,objectList:gT,objectCard:yT,selected:vT,checkbox:bT,objectInfo:wT,objectName:xT,writeToggle:IT,writeToggleLabel:CT,toggleSwitch:ST,toggleSlider:OT,loading:_T,error:ET,empty:NT};function TT(){const e=Tn(),t=Mo(),{state:n,setSelectedObjects:r,nextStep:i,prevStep:o}=un(),{providerName:s}=ut(),{appName:a}=an(),l=a||"Your App",[c,u]=w.useState(()=>new Set(n.selectedObjects)),[p,h]=w.useState(()=>{const b=new Set;return n.selectedObjects.forEach(I=>{t.writeObject(I).object&&b.add(I)}),b}),f=e.getReadObjects(),m=w.useMemo(()=>{const b=new Set;return f.forEach(I=>{e.getWriteObject(I.objectName)?.object&&b.add(I.objectName)}),b},[f,e]),v=w.useCallback(b=>{u(I=>{const O=new Set(I);return O.has(b)?O.delete(b):O.add(b),O})},[]),y=w.useCallback(b=>{h(I=>{const O=new Set(I);return O.has(b)?O.delete(b):O.add(b),O})},[]),x=w.useCallback(()=>{const b=Array.from(c),I=new Set(n.selectedObjects);r(b),b.forEach(O=>{t.readObject(O).setEnableRead()}),I.forEach(O=>{c.has(O)||t.removeObject(O)}),b.forEach(O=>{if(m.has(O)){const _=t.writeObject(O);p.has(O)?_.setEnableWrite():_.setDisableWrite()}}),i()},[c,n.selectedObjects,r,t,m,p,i]),g=c.size>0;return e.isLoading||e.isPending?d.jsx("div",{className:bt.loading,children:"Loading available objects..."}):e.isError?d.jsx("div",{className:bt.error,children:"Error loading manifest. Please try again."}):f.length===0?d.jsx("div",{className:bt.empty,children:"No objects available for this integration."}):d.jsxs("div",{className:bt.selectObjects,children:[d.jsx(kf,{title:"Select Objects",description:`Choose which objects you want to read from ${s}. You can configure each object later.`}),d.jsx("div",{className:bt.objectList,children:f.map(b=>{const I=c.has(b.objectName),O=m.has(b.objectName),_=p.has(b.objectName);return d.jsxs("div",{role:"checkbox","aria-checked":I,tabIndex:0,className:`${bt.objectCard} ${I?bt.selected:""}`,onClick:R=>{R.target.closest(`.${bt.writeToggle}`)||v(b.objectName)},onKeyDown:R=>{R.target.closest(`.${bt.writeToggle}`)||(R.key===" "||R.key==="Enter")&&(R.preventDefault(),v(b.objectName))},children:[d.jsx("input",{type:"checkbox",className:bt.checkbox,checked:I,tabIndex:-1,onChange:()=>v(b.objectName),onClick:R=>R.stopPropagation()}),d.jsx("div",{className:bt.objectInfo,children:d.jsx("span",{className:bt.objectName,children:b.displayName||b.objectName})}),O&&I&&d.jsxs("label",{className:bt.writeToggle,children:[d.jsx("span",{className:bt.writeToggleLabel,children:"Write Enabled"}),d.jsx(Ep,{text:`Allow ${l} to write back to ${b.displayName||b.objectName}`}),d.jsxs("span",{className:bt.toggleSwitch,children:[d.jsx("input",{type:"checkbox","aria-label":`Enable write for ${b.displayName||b.objectName}`,checked:_,onChange:()=>y(b.objectName)}),d.jsx("span",{className:bt.toggleSlider})]})]})]},b.objectName)})}),d.jsx(bo,{onNext:x,onBack:o,nextDisabled:!g,nextLabel:"Next"})]})}const kT="_container_wo5lv_1",RT="_title_wo5lv_10",AT="_description_wo5lv_16",Ns={container:kT,title:RT,description:AT};function FT({onEditConfiguration:e}){return d.jsxs("div",{className:Ns.container,children:[d.jsx(Np,{}),d.jsx("h2",{className:Ns.title,children:"Integration Installation Successful"}),d.jsx("p",{className:Ns.description,children:"Your integration has been configured and is now active."}),e&&d.jsx(je,{type:"button",onClick:e,children:"Edit Configuration"})]})}const PT="_stepper_whwir_1",jT="_step_whwir_1",MT="_stepIndicator_whwir_19",DT="_active_whwir_34",LT="_complete_whwir_39",BT="_stepNumber_whwir_44",$T="_checkIcon_whwir_48",qT="_stepLabel_whwir_53",VT="_connector_whwir_71",On={stepper:PT,step:jT,stepIndicator:MT,active:DT,complete:LT,stepNumber:BT,checkIcon:$T,stepLabel:qT,connector:VT};function UT(){const{state:e}=un(),{currentStep:t}=e;return d.jsx("div",{className:On.stepper,children:Array.from({length:Nc},(n,r)=>{const i=r,o=i<t,s=i===t;return d.jsxs("div",{className:`${On.step} ${s?On.active:""} ${o?On.complete:""}`,children:[d.jsx("div",{className:On.stepIndicator,children:o?d.jsx("svg",{className:On.checkIcon,viewBox:"0 0 16 16",fill:"none",children:d.jsx("path",{d:"M13.3 4.3L6 11.6L2.7 8.3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):d.jsx("span",{className:On.stepNumber,children:r+1})}),d.jsx("span",{className:On.stepLabel,children:FI[i]}),r<Nc-1&&d.jsx("div",{className:On.connector})]},i)})})}const zT="_layout_1ssk7_1",KT="_content_1ssk7_9",Du={layout:zT,content:KT};function HT({children:e}){const{state:t}=un(),n=t.currentStep!==Qt.Success;return d.jsxs("div",{className:Du.layout,children:[n&&d.jsx(UT,{}),d.jsx("div",{className:Du.content,children:e})]})}function ri({step:e,children:t}){const{state:n}=un();return n.currentStep!==e?null:d.jsx(d.Fragment,{children:t})}const JT="_installWizard_13z45_1",WT={installWizard:JT},QT="_resetContainer_1d2b0_4",bl={resetContainer:QT},GT=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,onEditConfiguration:c})=>{const{projectIdOrName:u,isLoading:p,isError:h}=an(),{isLoading:f,isError:m}=Si(),{seed:v,reset:y}=Va();return p||f?d.jsx(mr,{}):h?d.jsx(ot,{message:`Error loading project ${u}`}):m?d.jsx(ot,{message:"Error retrieving integrations for the project, double check the API key"}):d.jsx("div",{className:bl.resetContainer,children:d.jsx(ap,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,resetComponent:y,children:d.jsx($a,{children:d.jsx(MI,{children:d.jsx("div",{className:WT.installWizard,children:d.jsxs(HT,{children:[d.jsx(ri,{step:Qt.Connect,children:d.jsx(XN,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,resetComponent:y})}),d.jsx(ri,{step:Qt.SelectObjects,children:d.jsx(TT,{})}),d.jsx(ri,{step:Qt.ConfigureObjects,children:d.jsx(SS,{})}),d.jsx(ri,{step:Qt.Review,children:d.jsx(hT,{})}),d.jsx(ri,{step:Qt.Success,children:d.jsx(FT,{onEditConfiguration:c})})]})})})})},v)})};function XT(e){return d.jsx(Lo,{fallback:d.jsx(ot,{message:"Something went wrong, couldn't find integration information"}),children:d.jsx(Do,{integration:e.integration,consumerRef:e.consumerRef,consumerName:e.consumerName,groupRef:e.groupRef,groupName:e.groupName,children:d.jsx(GT,{...e})})})}var ai={exports:{}};ai.exports;var Lu;function YT(){return Lu||(Lu=1,(function(e,t){var n=9007199254740991,r="[object Arguments]",i="[object Function]",o="[object GeneratorFunction]",s="[object Map]",a="[object Object]",l="[object Promise]",c="[object Set]",u="[object WeakMap]",p="[object DataView]",h=/[\\^$.*+?()[\]{}|]/g,f=/^\[object .+?Constructor\]$/,m=typeof $n=="object"&&$n&&$n.Object===Object&&$n,v=typeof self=="object"&&self&&self.Object===Object&&self,y=m||v||Function("return this")(),x=t&&!t.nodeType&&t,g=x&&!0&&e&&!e.nodeType&&e,b=g&&g.exports===x;function I(M,re){return M?.[re]}function O(M){var re=!1;if(M!=null&&typeof M.toString!="function")try{re=!!(M+"")}catch{}return re}function _(M,re){return function(ce){return M(re(ce))}}var R=Function.prototype,k=Object.prototype,A=y["__core-js_shared__"],F=(function(){var M=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||"");return M?"Symbol(src)_1."+M:""})(),j=R.toString,L=k.hasOwnProperty,H=k.toString,P=RegExp("^"+j.call(L).replace(h,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),B=b?y.Buffer:void 0,X=k.propertyIsEnumerable,le=B?B.isBuffer:void 0,fe=_(Object.keys,Object),ge=q(y,"DataView"),C=q(y,"Map"),W=q(y,"Promise"),$=q(y,"Set"),S=q(y,"WeakMap"),U=!X.call({valueOf:1},"valueOf"),V=Fe(ge),Y=Fe(C),ie=Fe(W),ne=Fe($),se=Fe(S);function ee(M){return H.call(M)}function me(M){if(!Ge(M)||Z(M))return!1;var re=It(M)||O(M)?P:f;return re.test(Fe(M))}function q(M,re){var ce=I(M,re);return me(ce)?ce:void 0}var ye=ee;(ge&&ye(new ge(new ArrayBuffer(1)))!=p||C&&ye(new C)!=s||W&&ye(W.resolve())!=l||$&&ye(new $)!=c||S&&ye(new S)!=u)&&(ye=function(M){var re=H.call(M),ce=re==a?M.constructor:void 0,Ue=ce?Fe(ce):void 0;if(Ue)switch(Ue){case V:return p;case Y:return s;case ie:return l;case ne:return c;case se:return u}return re});function Z(M){return!!F&&F in M}function $e(M){var re=M&&M.constructor,ce=typeof re=="function"&&re.prototype||k;return M===ce}function Fe(M){if(M!=null){try{return j.call(M)}catch{}try{return M+""}catch{}}return""}function Ae(M){return tt(M)&&L.call(M,"callee")&&(!X.call(M,"callee")||H.call(M)==r)}var We=Array.isArray;function et(M){return M!=null&&dt(M.length)&&!It(M)}function tt(M){return D(M)&&et(M)}var xe=le||K;function at(M){if(et(M)&&(We(M)||typeof M=="string"||typeof M.splice=="function"||xe(M)||Ae(M)))return!M.length;var re=ye(M);if(re==s||re==c)return!M.size;if(U||$e(M))return!fe(M).length;for(var ce in M)if(L.call(M,ce))return!1;return!0}function It(M){var re=Ge(M)?H.call(M):"";return re==i||re==o}function dt(M){return typeof M=="number"&&M>-1&&M%1==0&&M<=n}function Ge(M){var re=typeof M;return!!M&&(re=="object"||re=="function")}function D(M){return!!M&&typeof M=="object"}function K(){return!1}e.exports=at})(ai,ai.exports)),ai.exports}var ZT=YT();const ek=$r(ZT),Mr="other",_o="manage-tab";function Rf(e,t){return e?.objects?.find(n=>n.objectName===t)||null}const Af=(e,t)=>e?.content?.read?.objects?.[t],Ff=(e,t)=>{const n=[];return t.content?.read?.objects?.forEach(r=>{const i=e?Af(e,r.objectName):void 0;n.push({name:r?.objectName,displayName:r?.mapToDisplayName||r?.displayName||r?.objectName&&Xt(r?.objectName),completed:!!i,disabled:i?.disabled})}),n},Pf=e=>({name:Mr,completed:e?!!e?.content?.write:!1});function tk(e,t){const n=Ff(e,t),i=!!t?.content?.write?Pf(e):void 0;return i&&n.push(i),n}function jf(e,t,n){const r=e?.filter(o=>!t?.[o?.mapToName])||[],i=r.map(o=>o.mapToName);return n(Ie.MAPPING,i),r?.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Bu(e,t){return ek(e)?!0:Object.values(e).every(t)}function wl(e,t,n){const r=Bu(e,n),i=Bu(t,n);return r&&i?!0:r!==i?!1:Wd(e,t)}function Mf(e,t){return wl(e,t,n=>n===!1||n===void 0)}function Df(e,t){return wl(e,t,n=>!n||n==="")}function Lf(e,t){return wl(e,t,n=>!n||typeof n!="object"?!0:Object.keys(n).length===0)}function Bf(e,t){const n=new Set(Object.values(e).map(i=>i?.objectName)),r=new Set(Object.values(t).map(i=>i?.objectName));return n.size===r.size&&[...n].every(i=>r.has(i))}const nk=(e,t,n)=>{if(!e)return null;const r=Rf(e,t),i=r&&ja(r),o=r&&Qd(r),s=r&&Gd(r),a=r?.allFields||[],l=r?.allFieldsMetadata||{},c=n?.content,u=c?.read?.objects?.[t]?.selectedValueMappings||{},p=c?.read?.objects?.[t]?.selectedFieldMappings||{},h=xl(n,{content:{read:e}},t);return{allFields:a,allFieldsMetadata:l,optionalFields:i,requiredMapFields:o,optionalMapFields:s,selectedOptionalFields:h,selectedFieldMappings:p,selectedValueMappings:u}},rk=(e,t)=>{if(!e)return null;const n=t?.content?.write?.objects;return{writeObjects:e?.objects||[],selectedWriteObjects:n||{}}};function $f(e,t,n){const r=e?.content?.read,i=e?.content?.write;return{read:nk(r,t,n),write:rk(i,n)}}const qf=(e,t,n,r)=>{const i=$f(e,n,t);r(n,i)},ik=(e,t,n)=>{const r=tk(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=$f(e,o,t))}),n(i)},Vf=e=>{const{selectedOptionalFields:t}=e?.read||{};return t||{}},Uf=e=>{const{selectedFieldMappings:t}=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},zf=(e,t)=>!t||!t[e]?[]:t[e],Kf=e=>{const{selectedValueMappings:t}=e?.read||{};return t},xl=(e,t,n)=>{if(!e||!t)return{};const r=t?.content?.read;if(!r)return{};const i=Rf(r,n),o=i&&ja(i),s=new Set(o?.filter(c=>!fr(c)&&!!c.fieldName).map(c=>c.fieldName)||[]),a=e?.content?.read?.objects?.[n]?.selectedFields||{};return Object.entries(a).reduce((c,[u,p])=>(s.has(u)&&(c[u]=p),c),{})},Hf=(e,t)=>!e||!t?{}:e?.content?.read?.objects?.[t]?.selectedFieldMappings||{};function Jf(e,t){return t[e]||void 0}const ok=(e,t,n,r,i)=>{const o=Vf(e),s=Uf(e),a=zf(t,i),l=Kf(e);return{createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:l||{}}}}}}};function Wf(e){return e.content.proxy?.enabled}const Qf=e=>({...e.write?.selectedWriteObjects}),sk=e=>e.content.write?.objects,ak=(e,t,n)=>{if(!sk(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=Qf(e),o={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return Wf(t)&&(o.content.proxy={enabled:!0}),o},lk=()=>{const e=wt(),t=Ze();return Nn({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:i})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:i}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),Ye(n)}})};function Il({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=Ke(),{integrationId:i,installation:o,setIntegrationDeleted:s,onUninstallSuccess:a}=st(),[l,c]=w.useState(!1),u=!r||!i||!o?.id||l,p=lk(),h=async()=>{u||(c(!0),console.warn("uninstalling installation",{projectIdOrName:r,integrationId:i,installationId:o.id}),p.mutate({projectIdOrName:r,integrationId:i,installationId:o.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",o.id),a?.(o?.id),s()},onSettled:()=>c(!1)}))},f=l?"Uninstalling...":e,m=d.jsx(je,{type:"button",onClick:h,disabled:u,variant:t,style:n,children:f});return o?.id?m:null}const Gf=w.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),yr=()=>{const e=w.useContext(Gf);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function ck({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r,installation:i}=st(),{isError:o,removeError:s,setError:a}=vn(),l=r?.name||n,[c,u]=w.useState(null),[p,h]=w.useState(null),{data:f,isLoading:m,isError:v,error:y,isSuccess:x}=Tn();w.useEffect(()=>{!x&&!v||(v?(a(Ie.HYDRATED_REVISION,l),y&&Ye(y,u)):(s(Ie.HYDRATED_REVISION,l),u(null),h(null)))},[v,x,l,a,s,y,u]);const g=w.useMemo(()=>({hydratedRevision:f||null,loading:m,readAction:f?.content?.read,writeObjects:f?.content?.write?.objects||[]}),[f,m]),b=r?.provider||"provider",I=r?.name||n||"unknown integration";if(o(Ie.HYDRATED_REVISION,l)){const O=`${c?Xt(c):`Error retrieving objects from ${b} or integration details for ${I}`}`;return d.jsx(ot,{message:O,children:d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[d.jsx(yl,{provider:b}),i?d.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before uninstalling the integration."}):d.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),p&&d.jsx(rp,{message:p}),i?d.jsx(Il,{buttonText:"Uninstall",buttonVariant:"danger"}):d.jsx(Nf,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:_=>h(_)})]})})}return m?d.jsx(mr,{}):d.jsx(Gf.Provider,{value:g,children:e})}const Xf=w.createContext(null);function Cl(){const e=w.useContext(Xf);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const Yf=w.createContext(()=>{});function uk(){const e=w.useContext(Yf);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const Zf=w.createContext(void 0),dk={};function Sl(){const e=w.useContext(Zf);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function pk({children:e}){const{installation:t}=st(),{hydratedRevision:n,loading:r}=yr(),[i,o]=w.useState(dk),s=t?.config;w.useEffect(()=>{n?.content&&!r&&s&&!(Object.entries(i).length>0)&&ik(n,s,o)},[n,r,s,i]);const a=w.useCallback((u,p)=>{o(h=>ct(h,f=>{f[u]=ct(f[u],p)}))},[o]),l=w.useCallback((u,p)=>{o(h=>ct(h,f=>{f[u]=p}))},[o]),c=w.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:l}),[i,l,a]);return d.jsx(Zf.Provider,{value:c,children:e})}const qt=()=>{const{appName:e}=an(),{objectConfigurationsState:t,setConfigureState:n}=Sl(),{selectedObjectName:r}=Cl(),i=Jf(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}},eh=()=>{const{hydratedRevision:e}=yr(),{selectedObjectName:t}=Cl(),n=e?.content?.read?.objects?.find(i=>i.objectName===t),r=n?.displayName||t&&Xt(t);return{selectedObject:n,displayName:r}};function th(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=Jn(),{data:n}=hr(t),{installation:r}=ln(),{mutate:i,isIdle:o,isPending:s,error:a,errorMsg:l}=up();return{toggleReadingObject:({objectName:u,disabled:p,onSuccess:h,onError:f,onSettled:m})=>{if(!r){const x=new Error("Installation not created yet. Try creating the installation first.");f?.(x),m?.();return}if(!n){const x=new Error("No integration found");f?.(x),m?.();return}if(!r?.config?.content?.read?.objects?.[u]){const x=new Error(`Object "${u}" not found in installation read configuration`);f?.(x),m?.();return}const v=[`config.content.read.objects.${u}.disabled`],y={projectIdOrName:e,integrationId:n.id,installationId:r.id,installationUpdate:{updateMask:v,installation:{config:{content:{read:{objects:{[u]:{disabled:p}}}}}}}};return i(y,{onSuccess:x=>{h?.(x)},onError:x=>{f?.(x)},onSettled:()=>{m?.()}})},isIdle:o,isPending:s,error:a,errorMsg:l}}function fk(){const{installation:e}=ln(),[t,n]=w.useState(!1),{selectedObjectName:r}=qt(),{displayName:i}=eh(),{toggleReadingObject:o,isPending:s}=th(),a=r?e?.config?.content?.read?.objects?.[r]:void 0;if(!a||a.disabled)return null;const c=()=>{r&&o({objectName:r,disabled:!0,onSuccess:()=>{n(!1)},onError:u=>{console.error("Error stopping read from object:",u)}})};return t?d.jsxs(d.Fragment,{children:[d.jsxs("p",{style:{padding:"1rem 0",color:"var(--amp-colors-text-muted)",fontSize:"0.875rem"},children:["Are you sure you want to stop reading from"," ",d.jsx("b",{children:i}),"?"]}),d.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[d.jsx(je,{type:"button",variant:"ghost",style:{flex:1},onClick:()=>n(!1),children:"Cancel"}),d.jsx(je,{type:"button",variant:"danger",style:{flex:1},onClick:c,disabled:s,children:s?"Stopping...":"Stop reading"})]})]}):d.jsxs("button",{type:"button",onClick:()=>n(!0),style:{background:"none",border:"none",cursor:"pointer",textDecoration:"underline",paddingTop:"1rem",margin:0,fontFamily:"inherit",color:"var(--amp-colors-text-muted)"},children:["Stop reading from ",d.jsx("b",{children:i})]})}function _n(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 we(){return we=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},we.apply(null,arguments)}function ba(e,t){return ba=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ba(e,t)}function hk(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ba(e,t)}var to={exports:{}},no={exports:{}},Ne={};var $u;function mk(){if($u)return Ne;$u=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,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function b(O){if(typeof O=="object"&&O!==null){var _=O.$$typeof;switch(_){case t:switch(O=O.type,O){case l:case c:case r:case o:case i:case p:return O;default:switch(O=O&&O.$$typeof,O){case a:case u:case m:case f:case s:return O;default:return _}}case n:return _}}}function I(O){return b(O)===c}return Ne.AsyncMode=l,Ne.ConcurrentMode=c,Ne.ContextConsumer=a,Ne.ContextProvider=s,Ne.Element=t,Ne.ForwardRef=u,Ne.Fragment=r,Ne.Lazy=m,Ne.Memo=f,Ne.Portal=n,Ne.Profiler=o,Ne.StrictMode=i,Ne.Suspense=p,Ne.isAsyncMode=function(O){return I(O)||b(O)===l},Ne.isConcurrentMode=I,Ne.isContextConsumer=function(O){return b(O)===a},Ne.isContextProvider=function(O){return b(O)===s},Ne.isElement=function(O){return typeof O=="object"&&O!==null&&O.$$typeof===t},Ne.isForwardRef=function(O){return b(O)===u},Ne.isFragment=function(O){return b(O)===r},Ne.isLazy=function(O){return b(O)===m},Ne.isMemo=function(O){return b(O)===f},Ne.isPortal=function(O){return b(O)===n},Ne.isProfiler=function(O){return b(O)===o},Ne.isStrictMode=function(O){return b(O)===i},Ne.isSuspense=function(O){return b(O)===p},Ne.isValidElementType=function(O){return typeof O=="string"||typeof O=="function"||O===r||O===c||O===o||O===i||O===p||O===h||typeof O=="object"&&O!==null&&(O.$$typeof===m||O.$$typeof===f||O.$$typeof===s||O.$$typeof===a||O.$$typeof===u||O.$$typeof===y||O.$$typeof===x||O.$$typeof===g||O.$$typeof===v)},Ne.typeOf=b,Ne}var Te={};var qu;function gk(){return qu||(qu=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,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function b(q){return typeof q=="string"||typeof q=="function"||q===r||q===c||q===o||q===i||q===p||q===h||typeof q=="object"&&q!==null&&(q.$$typeof===m||q.$$typeof===f||q.$$typeof===s||q.$$typeof===a||q.$$typeof===u||q.$$typeof===y||q.$$typeof===x||q.$$typeof===g||q.$$typeof===v)}function I(q){if(typeof q=="object"&&q!==null){var ye=q.$$typeof;switch(ye){case t:var Z=q.type;switch(Z){case l:case c:case r:case o:case i:case p:return Z;default:var $e=Z&&Z.$$typeof;switch($e){case a:case u:case m:case f:case s:return $e;default:return ye}}case n:return ye}}}var O=l,_=c,R=a,k=s,A=t,F=u,j=r,L=m,H=f,P=n,B=o,X=i,le=p,fe=!1;function ge(q){return fe||(fe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),C(q)||I(q)===l}function C(q){return I(q)===c}function W(q){return I(q)===a}function $(q){return I(q)===s}function S(q){return typeof q=="object"&&q!==null&&q.$$typeof===t}function U(q){return I(q)===u}function V(q){return I(q)===r}function Y(q){return I(q)===m}function ie(q){return I(q)===f}function ne(q){return I(q)===n}function se(q){return I(q)===o}function ee(q){return I(q)===i}function me(q){return I(q)===p}Te.AsyncMode=O,Te.ConcurrentMode=_,Te.ContextConsumer=R,Te.ContextProvider=k,Te.Element=A,Te.ForwardRef=F,Te.Fragment=j,Te.Lazy=L,Te.Memo=H,Te.Portal=P,Te.Profiler=B,Te.StrictMode=X,Te.Suspense=le,Te.isAsyncMode=ge,Te.isConcurrentMode=C,Te.isContextConsumer=W,Te.isContextProvider=$,Te.isElement=S,Te.isForwardRef=U,Te.isFragment=V,Te.isLazy=Y,Te.isMemo=ie,Te.isPortal=ne,Te.isProfiler=se,Te.isStrictMode=ee,Te.isSuspense=me,Te.isValidElementType=b,Te.typeOf=I})()),Te}var Vu;function nh(){return Vu||(Vu=1,process.env.NODE_ENV==="production"?no.exports=mk():no.exports=gk()),no.exports}var Ts,Uu;function yk(){if(Uu)return Ts;Uu=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 l=Object.getOwnPropertyNames(s).map(function(u){return s[u]});if(l.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ts=i()?Object.assign:function(o,s){for(var a,l=r(o),c,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var p in a)t.call(a,p)&&(l[p]=a[p]);if(e){c=e(a);for(var h=0;h<c.length;h++)n.call(a,c[h])&&(l[c[h]]=a[c[h]])}}return l},Ts}var ks,zu;function Ol(){if(zu)return ks;zu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ks=e,ks}var Rs,Ku;function rh(){return Ku||(Ku=1,Rs=Function.call.bind(Object.prototype.hasOwnProperty)),Rs}var As,Hu;function vk(){if(Hu)return As;Hu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Ol(),n={},r=rh();e=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,a,l,c){if(process.env.NODE_ENV!=="production"){for(var u in o)if(r(o,u)){var p;try{if(typeof o[u]!="function"){var h=Error((l||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}p=o[u](s,u,l,a,null,t)}catch(m){p=m}if(p&&!(p instanceof Error)&&e((l||"React class")+": type specification of "+a+" `"+u+"` 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=c?c():"";e("Failed "+a+" type: "+p.message+(f??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},As=i,As}var Fs,Ju;function bk(){if(Ju)return Fs;Ju=1;var e=nh(),t=yk(),n=Ol(),r=rh(),i=vk(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return Fs=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function p(C){var W=C&&(c&&C[c]||C[u]);if(typeof W=="function")return W}var h="<<anonymous>>",f={array:x("array"),bigint:x("bigint"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:g(),arrayOf:b,element:I(),elementType:O(),instanceOf:_,node:F(),objectOf:k,oneOf:R,oneOfType:A,shape:L,exact:H};function m(C,W){return C===W?C!==0||1/C===1/W:C!==C&&W!==W}function v(C,W){this.message=C,this.data=W&&typeof W=="object"?W:{},this.stack=""}v.prototype=Error.prototype;function y(C){if(process.env.NODE_ENV!=="production")var W={},$=0;function S(V,Y,ie,ne,se,ee,me){if(ne=ne||h,ee=ee||ie,me!==n){if(l){var q=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 q.name="Invariant Violation",q}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ye=ne+":"+ie;!W[ye]&&$<3&&(o("You are manually calling a React.PropTypes validation function for the `"+ee+"` prop on `"+ne+"`. 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."),W[ye]=!0,$++)}}return Y[ie]==null?V?Y[ie]===null?new v("The "+se+" `"+ee+"` is marked as required "+("in `"+ne+"`, but its value is `null`.")):new v("The "+se+" `"+ee+"` is marked as required in "+("`"+ne+"`, but its value is `undefined`.")):null:C(Y,ie,ne,se,ee)}var U=S.bind(null,!1);return U.isRequired=S.bind(null,!0),U}function x(C){function W($,S,U,V,Y,ie){var ne=$[S],se=X(ne);if(se!==C){var ee=le(ne);return new v("Invalid "+V+" `"+Y+"` of type "+("`"+ee+"` supplied to `"+U+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return y(W)}function g(){return y(s)}function b(C){function W($,S,U,V,Y){if(typeof C!="function")return new v("Property `"+Y+"` of component `"+U+"` has invalid PropType notation inside arrayOf.");var ie=$[S];if(!Array.isArray(ie)){var ne=X(ie);return new v("Invalid "+V+" `"+Y+"` of type "+("`"+ne+"` supplied to `"+U+"`, expected an array."))}for(var se=0;se<ie.length;se++){var ee=C(ie,se,U,V,Y+"["+se+"]",n);if(ee instanceof Error)return ee}return null}return y(W)}function I(){function C(W,$,S,U,V){var Y=W[$];if(!a(Y)){var ie=X(Y);return new v("Invalid "+U+" `"+V+"` of type "+("`"+ie+"` supplied to `"+S+"`, expected a single ReactElement."))}return null}return y(C)}function O(){function C(W,$,S,U,V){var Y=W[$];if(!e.isValidElementType(Y)){var ie=X(Y);return new v("Invalid "+U+" `"+V+"` of type "+("`"+ie+"` supplied to `"+S+"`, expected a single ReactElement type."))}return null}return y(C)}function _(C){function W($,S,U,V,Y){if(!($[S]instanceof C)){var ie=C.name||h,ne=ge($[S]);return new v("Invalid "+V+" `"+Y+"` of type "+("`"+ne+"` supplied to `"+U+"`, expected ")+("instance of `"+ie+"`."))}return null}return y(W)}function R(C){if(!Array.isArray(C))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 W($,S,U,V,Y){for(var ie=$[S],ne=0;ne<C.length;ne++)if(m(ie,C[ne]))return null;var se=JSON.stringify(C,function(me,q){var ye=le(q);return ye==="symbol"?String(q):q});return new v("Invalid "+V+" `"+Y+"` of value `"+String(ie)+"` "+("supplied to `"+U+"`, expected one of "+se+"."))}return y(W)}function k(C){function W($,S,U,V,Y){if(typeof C!="function")return new v("Property `"+Y+"` of component `"+U+"` has invalid PropType notation inside objectOf.");var ie=$[S],ne=X(ie);if(ne!=="object")return new v("Invalid "+V+" `"+Y+"` of type "+("`"+ne+"` supplied to `"+U+"`, expected an object."));for(var se in ie)if(r(ie,se)){var ee=C(ie,se,U,V,Y+"."+se,n);if(ee instanceof Error)return ee}return null}return y(W)}function A(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var W=0;W<C.length;W++){var $=C[W];if(typeof $!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+fe($)+" at index "+W+"."),s}function S(U,V,Y,ie,ne){for(var se=[],ee=0;ee<C.length;ee++){var me=C[ee],q=me(U,V,Y,ie,ne,n);if(q==null)return null;q.data&&r(q.data,"expectedType")&&se.push(q.data.expectedType)}var ye=se.length>0?", expected one of type ["+se.join(", ")+"]":"";return new v("Invalid "+ie+" `"+ne+"` supplied to "+("`"+Y+"`"+ye+"."))}return y(S)}function F(){function C(W,$,S,U,V){return P(W[$])?null:new v("Invalid "+U+" `"+V+"` supplied to "+("`"+S+"`, expected a ReactNode."))}return y(C)}function j(C,W,$,S,U){return new v((C||"React class")+": "+W+" type `"+$+"."+S+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+U+"`.")}function L(C){function W($,S,U,V,Y){var ie=$[S],ne=X(ie);if(ne!=="object")return new v("Invalid "+V+" `"+Y+"` of type `"+ne+"` "+("supplied to `"+U+"`, expected `object`."));for(var se in C){var ee=C[se];if(typeof ee!="function")return j(U,V,Y,se,le(ee));var me=ee(ie,se,U,V,Y+"."+se,n);if(me)return me}return null}return y(W)}function H(C){function W($,S,U,V,Y){var ie=$[S],ne=X(ie);if(ne!=="object")return new v("Invalid "+V+" `"+Y+"` of type `"+ne+"` "+("supplied to `"+U+"`, expected `object`."));var se=t({},$[S],C);for(var ee in se){var me=C[ee];if(r(C,ee)&&typeof me!="function")return j(U,V,Y,ee,le(me));if(!me)return new v("Invalid "+V+" `"+Y+"` key `"+ee+"` supplied to `"+U+"`.\nBad object: "+JSON.stringify($[S],null," ")+`
21
- Valid keys: `+JSON.stringify(Object.keys(C),null," "));var q=me(ie,ee,U,V,Y+"."+ee,n);if(q)return q}return null}return y(W)}function P(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(P);if(C===null||a(C))return!0;var W=p(C);if(W){var $=W.call(C),S;if(W!==C.entries){for(;!(S=$.next()).done;)if(!P(S.value))return!1}else for(;!(S=$.next()).done;){var U=S.value;if(U&&!P(U[1]))return!1}}else return!1;return!0;default:return!1}}function B(C,W){return C==="symbol"?!0:W?W["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&W instanceof Symbol:!1}function X(C){var W=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":B(W,C)?"symbol":W}function le(C){if(typeof C>"u"||C===null)return""+C;var W=X(C);if(W==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return W}function fe(C){var W=le(C);switch(W){case"array":case"object":return"an "+W;case"boolean":case"date":case"regexp":return"a "+W;default:return W}}function ge(C){return!C.constructor||!C.constructor.name?h:C.constructor.name}return f.checkPropTypes=i,f.resetWarningCache=i.resetWarningCache,f.PropTypes=f,f},Fs}var Ps,Wu;function wk(){if(Wu)return Ps;Wu=1;var e=Ol();function t(){}function n(){}return n.resetWarningCache=t,Ps=function(){function r(s,a,l,c,u,p){if(p!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},Ps}var Qu;function xk(){if(Qu)return to.exports;if(Qu=1,process.env.NODE_ENV!=="production"){var e=nh(),t=!0;to.exports=bk()(e.isElement,t)}else to.exports=wk()();return to.exports}var Ik=xk();const G=$r(Ik);var ro={exports:{}},ke={};var Gu;function Ck(){if(Gu)return ke;Gu=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"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),m;m=Symbol.for("react.module.reference");function v(y){if(typeof y=="object"&&y!==null){var x=y.$$typeof;switch(x){case e:switch(y=y.type,y){case n:case i:case r:case c:case u:return y;default:switch(y=y&&y.$$typeof,y){case a:case s:case l:case h:case p:case o:return y;default:return x}}case t:return x}}}return ke.ContextConsumer=s,ke.ContextProvider=o,ke.Element=e,ke.ForwardRef=l,ke.Fragment=n,ke.Lazy=h,ke.Memo=p,ke.Portal=t,ke.Profiler=i,ke.StrictMode=r,ke.Suspense=c,ke.SuspenseList=u,ke.isAsyncMode=function(){return!1},ke.isConcurrentMode=function(){return!1},ke.isContextConsumer=function(y){return v(y)===s},ke.isContextProvider=function(y){return v(y)===o},ke.isElement=function(y){return typeof y=="object"&&y!==null&&y.$$typeof===e},ke.isForwardRef=function(y){return v(y)===l},ke.isFragment=function(y){return v(y)===n},ke.isLazy=function(y){return v(y)===h},ke.isMemo=function(y){return v(y)===p},ke.isPortal=function(y){return v(y)===t},ke.isProfiler=function(y){return v(y)===i},ke.isStrictMode=function(y){return v(y)===r},ke.isSuspense=function(y){return v(y)===c},ke.isSuspenseList=function(y){return v(y)===u},ke.isValidElementType=function(y){return typeof y=="string"||typeof y=="function"||y===n||y===i||y===r||y===c||y===u||y===f||typeof y=="object"&&y!==null&&(y.$$typeof===h||y.$$typeof===p||y.$$typeof===o||y.$$typeof===s||y.$$typeof===l||y.$$typeof===m||y.getModuleId!==void 0)},ke.typeOf=v,ke}var Re={};var Xu;function Sk(){return Xu||(Xu=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"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),m=!1,v=!1,y=!1,x=!1,g=!1,b;b=Symbol.for("react.module.reference");function I(Z){return!!(typeof Z=="string"||typeof Z=="function"||Z===n||Z===i||g||Z===r||Z===c||Z===u||x||Z===f||m||v||y||typeof Z=="object"&&Z!==null&&(Z.$$typeof===h||Z.$$typeof===p||Z.$$typeof===o||Z.$$typeof===s||Z.$$typeof===l||Z.$$typeof===b||Z.getModuleId!==void 0))}function O(Z){if(typeof Z=="object"&&Z!==null){var $e=Z.$$typeof;switch($e){case e:var Fe=Z.type;switch(Fe){case n:case i:case r:case c:case u:return Fe;default:var Ae=Fe&&Fe.$$typeof;switch(Ae){case a:case s:case l:case h:case p:case o:return Ae;default:return $e}}case t:return $e}}}var _=s,R=o,k=e,A=l,F=n,j=h,L=p,H=t,P=i,B=r,X=c,le=u,fe=!1,ge=!1;function C(Z){return fe||(fe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function W(Z){return ge||(ge=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function $(Z){return O(Z)===s}function S(Z){return O(Z)===o}function U(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===e}function V(Z){return O(Z)===l}function Y(Z){return O(Z)===n}function ie(Z){return O(Z)===h}function ne(Z){return O(Z)===p}function se(Z){return O(Z)===t}function ee(Z){return O(Z)===i}function me(Z){return O(Z)===r}function q(Z){return O(Z)===c}function ye(Z){return O(Z)===u}Re.ContextConsumer=_,Re.ContextProvider=R,Re.Element=k,Re.ForwardRef=A,Re.Fragment=F,Re.Lazy=j,Re.Memo=L,Re.Portal=H,Re.Profiler=P,Re.StrictMode=B,Re.Suspense=X,Re.SuspenseList=le,Re.isAsyncMode=C,Re.isConcurrentMode=W,Re.isContextConsumer=$,Re.isContextProvider=S,Re.isElement=U,Re.isForwardRef=V,Re.isFragment=Y,Re.isLazy=ie,Re.isMemo=ne,Re.isPortal=se,Re.isProfiler=ee,Re.isStrictMode=me,Re.isSuspense=q,Re.isSuspenseList=ye,Re.isValidElementType=I,Re.typeOf=O})()),Re}var Yu;function Ok(){return Yu||(Yu=1,process.env.NODE_ENV==="production"?ro.exports=Ck():ro.exports=Sk()),ro.exports}var Zu=Ok();const ed=e=>typeof e=="object"&&e!=null&&e.nodeType===1,td=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",js=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return td(n.overflowY,t)||td(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},io=(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,_k=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Ek=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{inline:s,boundary:a,skipOverflowHiddenElements:l}=t,c=typeof a=="function"?a:H=>H!==a;if(!ed(e))throw new TypeError("Invalid target");const u=document.scrollingElement||document.documentElement,p=[];let h=e;for(;ed(h)&&c(h);){if(h=_k(h),h===u){p.push(h);break}h!=null&&h===document.body&&js(h)&&!js(document.documentElement)||h!=null&&js(h,l)&&p.push(h)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,m=(o=(i=window.visualViewport)==null?void 0:i.height)!=null?o:innerHeight,{scrollX:v,scrollY:y}=window,{height:x,width:g,top:b,right:I,bottom:O,left:_}=e.getBoundingClientRect(),{top:R,right:k,left:A}=(H=>{const P=window.getComputedStyle(H);return{top:parseFloat(P.scrollMarginTop)||0,right:parseFloat(P.scrollMarginRight)||0,bottom:parseFloat(P.scrollMarginBottom)||0,left:parseFloat(P.scrollMarginLeft)||0}})(e);let F=b-R,j=s==="center"?_+g/2-A+k:s==="end"?I+k:_-A;const L=[];for(let H=0;H<p.length;H++){const P=p[H],{height:B,width:X,top:le,right:fe,bottom:ge,left:C}=P.getBoundingClientRect();if(b>=0&&_>=0&&O<=m&&I<=f&&b>=le&&O<=ge&&_>=C&&I<=fe)return L;const W=getComputedStyle(P),$=parseInt(W.borderLeftWidth,10),S=parseInt(W.borderTopWidth,10),U=parseInt(W.borderRightWidth,10),V=parseInt(W.borderBottomWidth,10);let Y=0,ie=0;const ne="offsetWidth"in P?P.offsetWidth-P.clientWidth-$-U:0,se="offsetHeight"in P?P.offsetHeight-P.clientHeight-S-V:0,ee="offsetWidth"in P?P.offsetWidth===0?0:X/P.offsetWidth:0,me="offsetHeight"in P?P.offsetHeight===0?0:B/P.offsetHeight:0;if(u===P)Y=io(y,y+m,m,S,V,y+F,y+F+x,x),ie=s==="start"?j:s==="center"?j-f/2:s==="end"?j-f:io(v,v+f,f,$,U,v+j,v+j+g,g),Y=Math.max(0,Y+y),ie=Math.max(0,ie+v);else{Y=io(le,ge,B,S,V+se,F,F+x,x),ie=s==="start"?j-C-$:s==="center"?j-(C+X/2)+ne/2:s==="end"?j-fe+U+ne:io(C,fe,X,$,U+ne,j,j+g,g);const{scrollLeft:q,scrollTop:ye}=P;Y=me===0?0:Math.max(0,Math.min(ye+Y/me,P.scrollHeight-B/me+se)),ie=ee===0?0:Math.max(0,Math.min(q+ie/ee,P.scrollWidth-X/ee+ne)),F+=ye-Y,j+=q-ie}L.push({el:P,top:Y,left:ie})}return L};var Dr=function(){return Dr=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},Dr.apply(this,arguments)};var Nk=0;function nd(e){return typeof e=="function"?e:Mt}function Mt(){}function ih(e,t){if(e){var n=Ek(e,{boundary:t});n.forEach(function(r){var i=r.el,o=r.top,s=r.left;i.scrollTop=o,i.scrollLeft=s})}}function rd(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function _l(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 rt(){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 Or(){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 oh(){return String(Nk++)}function Tk(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 id(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function sh(e){return typeof e.type=="string"}function ah(e){return e.props}function kk(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Rk=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function oo(e){e===void 0&&(e={});var t={};return Rk.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Eo(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=No(t,r)?t[r]:e[r],n},{})}function No(e,t){return e[t]!==void 0}function wa(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Ak(e){return Object.prototype.toString.call(e)==="[object Object]"}function ir(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 l=Lr(a,t<0,n,r,i);return l===-1?e>=o?-1:e:l}function Lr(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?Lr(t?o-1:0,t,n,r):-1}function To(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(rd(i,e,n)||r&&rd(i,n.document.activeElement,n))})}var El=Mt;process.env.NODE_ENV!=="production"&&(El=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 Fk=_l(function(e){lh(e).textContent=""},500);function lh(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 ch(e,t){if(!(!e||!t)){var n=lh(t);n.textContent=e,Fk(t)}}function Pk(e){var t=e?.getElementById("a11y-status-message");t&&t.remove()}var uh=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,dh=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,ph=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,co=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,uo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,fh=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,hh=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,mh=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,gh=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,yh=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,vh=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,bh=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,wh=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,xa=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,xh=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Ih=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Ch=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,jk=Object.freeze({__proto__:null,blurButton:xh,blurInput:vh,changeInput:bh,clickButton:xa,clickItem:yh,controlledPropUpdatedSelectedItem:Ih,itemMouseEnter:ph,keyDownArrowDown:uo,keyDownArrowUp:co,keyDownEnd:gh,keyDownEnter:hh,keyDownEscape:fh,keyDownHome:mh,keyDownSpaceButton:wh,mouseUp:dh,touchEnd:Ch,unknown:uh}),Mk=["refKey","ref"],Dk=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Lk=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Bk=["refKey","ref"],$k=["onMouseMove","onMouseDown","onClick","onPress","index","item"],qk=(function(){var e=(function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+oh(),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(g){return o.id+"-item-"+g},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(g,b){var I=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(O){return O!==I}),g()},b);o.timeoutIds.push(I)},o.setItemCount=function(g){o.itemCount=g},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(g,b){var I=o.getItemNodeFromIndex(b);return I&&I.hasAttribute("disabled")},o.setHighlightedIndex=function(g,b){g===void 0&&(g=o.props.defaultHighlightedIndex),b===void 0&&(b={}),b=oo(b),o.internalSetState(we({highlightedIndex:g},b))},o.clearSelection=function(g){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},g)},o.selectItem=function(g,b,I){b=oo(b),o.internalSetState(we({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:g,inputValue:o.props.itemToString(g)},b),I)},o.selectItemAtIndex=function(g,b,I){var O=o.items[g];O!=null&&o.selectItem(O,b,I)},o.selectHighlightedItem=function(g,b){return o.selectItemAtIndex(o.getState().highlightedIndex,g,b)},o.internalSetState=function(g,b){var I,O,_={},R=typeof g=="function";return!R&&g.hasOwnProperty("inputValue")&&o.props.onInputValueChange(g.inputValue,we({},o.getStateAndHelpers(),g)),o.setState(function(k){var A;k=o.getState(k);var F=R?g(k):g;F=o.props.stateReducer(k,F),I=F.hasOwnProperty("selectedItem");var j={};return I&&F.selectedItem!==k.selectedItem&&(O=F.selectedItem),(A=F).type||(A.type=uh),Object.keys(F).forEach(function(L){k[L]!==F[L]&&(_[L]=F[L]),L!=="type"&&(F[L],No(o.props,L)||(j[L]=F[L]))}),R&&F.hasOwnProperty("inputValue")&&o.props.onInputValueChange(F.inputValue,we({},o.getStateAndHelpers(),F)),j},function(){nd(b)();var k=Object.keys(_).length>1;k&&o.props.onStateChange(_,o.getStateAndHelpers()),I&&o.props.onSelect(g.selectedItem,o.getStateAndHelpers()),O!==void 0&&o.props.onChange(O,o.getStateAndHelpers()),o.props.onUserAction(_,o.getStateAndHelpers())})},o.rootRef=function(g){return o._rootNode=g},o.getRootProps=function(g,b){var I,O=g===void 0?{}:g,_=O.refKey,R=_===void 0?"ref":_,k=O.ref,A=_n(O,Mk),F=b===void 0?{}:b,j=F.suppressRefError,L=j===void 0?!1:j;o.getRootProps.called=!0,o.getRootProps.refKey=R,o.getRootProps.suppressRefError=L;var H=o.getState(),P=H.isOpen;return we((I={},I[R]=Or(k,o.rootRef),I.role="combobox",I["aria-expanded"]=P,I["aria-haspopup"]="listbox",I["aria-owns"]=P?o.menuId:void 0,I["aria-labelledby"]=o.labelId,I),A)},o.keyDownHandlers={ArrowDown:function(b){var I=this;if(b.preventDefault(),this.getState().isOpen){var O=b.shiftKey?5:1;this.moveHighlightedIndex(O,{type:uo})}else this.internalSetState({isOpen:!0,type:uo},function(){var _=I.getItemCount();if(_>0){var R=I.getState(),k=R.highlightedIndex,A=ir(k,1,{length:_},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:uo})}})},ArrowUp:function(b){var I=this;if(b.preventDefault(),this.getState().isOpen){var O=b.shiftKey?-5:-1;this.moveHighlightedIndex(O,{type:co})}else this.internalSetState({isOpen:!0,type:co},function(){var _=I.getItemCount();if(_>0){var R=I.getState(),k=R.highlightedIndex,A=ir(k,-1,{length:_},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:co})}})},Enter:function(b){if(b.which!==229){var I=this.getState(),O=I.isOpen,_=I.highlightedIndex;if(O&&_!=null){b.preventDefault();var R=this.items[_],k=this.getItemNodeFromIndex(_);if(R==null||k&&k.hasAttribute("disabled"))return;this.selectHighlightedItem({type:hh})}}},Escape:function(b){b.preventDefault(),this.reset(we({type:fh},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=we({},o.keyDownHandlers,{" ":function(b){b.preventDefault(),this.toggleMenu({type:wh})}}),o.inputKeyDownHandlers=we({},o.keyDownHandlers,{Home:function(b){var I=this.getState(),O=I.isOpen;if(O){b.preventDefault();var _=this.getItemCount();if(!(_<=0||!O)){var R=Lr(0,!1,{length:_},this.isItemDisabled);this.setHighlightedIndex(R,{type:mh})}}},End:function(b){var I=this.getState(),O=I.isOpen;if(O){b.preventDefault();var _=this.getItemCount();if(!(_<=0||!O)){var R=Lr(_-1,!0,{length:_},this.isItemDisabled);this.setHighlightedIndex(R,{type:gh})}}}}),o.getToggleButtonProps=function(g){var b=g===void 0?{}:g,I=b.onClick;b.onPress;var O=b.onKeyDown,_=b.onKeyUp,R=b.onBlur,k=_n(b,Dk),A=o.getState(),F=A.isOpen,j={onClick:rt(I,o.buttonHandleClick),onKeyDown:rt(O,o.buttonHandleKeyDown),onKeyUp:rt(_,o.buttonHandleKeyUp),onBlur:rt(R,o.buttonHandleBlur)},L=k.disabled?{}:j;return we({type:"button",role:"button","aria-label":F?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},L,k)},o.buttonHandleKeyUp=function(g){g.preventDefault()},o.buttonHandleKeyDown=function(g){var b=wa(g);o.buttonKeyDownHandlers[b]&&o.buttonKeyDownHandlers[b].call(o,g)},o.buttonHandleClick=function(g){if(g.preventDefault(),o.props.environment){var b=o.props.environment.document,I=b.body,O=b.activeElement;I&&I===O&&g.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:xa}):o.internalSetTimeout(function(){return o.toggleMenu({type:xa})})},o.buttonHandleBlur=function(g){var b=g.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var I=o.props.environment.document.activeElement;(I==null||I.id!==o.inputId)&&I!==b&&o.reset({type:xh})}})},o.getLabelProps=function(g){return we({htmlFor:o.inputId,id:o.labelId},g)},o.getInputProps=function(g){var b=g===void 0?{}:g,I=b.onKeyDown,O=b.onBlur,_=b.onChange,R=b.onInput;b.onChangeText;var k=_n(b,Lk),A,F={};A="onChange";var j=o.getState(),L=j.inputValue,H=j.isOpen,P=j.highlightedIndex;if(!k.disabled){var B;F=(B={},B[A]=rt(_,R,o.inputHandleChange),B.onKeyDown=rt(I,o.inputHandleKeyDown),B.onBlur=rt(O,o.inputHandleBlur),B)}return we({"aria-autocomplete":"list","aria-activedescendant":H&&typeof P=="number"&&P>=0?o.getItemId(P):void 0,"aria-controls":H?o.menuId:void 0,"aria-labelledby":k&&k["aria-label"]?void 0:o.labelId,autoComplete:"off",value:L,id:o.inputId},F,k)},o.inputHandleKeyDown=function(g){var b=wa(g);b&&o.inputKeyDownHandlers[b]&&o.inputKeyDownHandlers[b].call(o,g)},o.inputHandleChange=function(g){o.internalSetState({type:bh,isOpen:!0,inputValue:g.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var g;if(!(o.isMouseDown||!o.props.environment)){var b=o.props.environment.document.activeElement,I=(b==null||(g=b.dataset)==null?void 0:g.toggle)&&o._rootNode&&o._rootNode.contains(b);I||o.reset({type:vh})}})},o.menuRef=function(g){o._menuNode=g},o.getMenuProps=function(g,b){var I,O=g===void 0?{}:g,_=O.refKey,R=_===void 0?"ref":_,k=O.ref,A=_n(O,Bk),F=b===void 0?{}:b,j=F.suppressRefError,L=j===void 0?!1:j;return o.getMenuProps.called=!0,o.getMenuProps.refKey=R,o.getMenuProps.suppressRefError=L,we((I={},I[R]=Or(k,o.menuRef),I.role="listbox",I["aria-labelledby"]=A&&A["aria-label"]?void 0:o.labelId,I.id=o.menuId,I),A)},o.getItemProps=function(g){var b,I=g===void 0?{}:g,O=I.onMouseMove,_=I.onMouseDown,R=I.onClick;I.onPress;var k=I.index,A=I.item,F=A===void 0?process.env.NODE_ENV==="production"?void 0:kk("getItemProps","item"):A,j=_n(I,$k);k===void 0?(o.items.push(F),k=o.items.indexOf(F)):o.items[k]=F;var L="onClick",H=R,P=(b={onMouseMove:rt(O,function(){k!==o.getState().highlightedIndex&&(o.setHighlightedIndex(k,{type:ph}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:rt(_,function(X){X.preventDefault()})},b[L]=rt(H,function(){o.selectItemAtIndex(k,{type:yh})}),b),B=j.disabled?{onMouseDown:P.onMouseDown}:P;return we({id:o.getItemId(k),role:"option","aria-selected":o.getState().highlightedIndex===k},B,j)},o.clearItems=function(){o.items=[]},o.reset=function(g,b){g===void 0&&(g={}),g=oo(g),o.internalSetState(function(I){var O=I.selectedItem;return we({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(O)},g)},b)},o.toggleMenu=function(g,b){g===void 0&&(g={}),g=oo(g),o.internalSetState(function(I){var O=I.isOpen;return we({isOpen:!O},O&&{highlightedIndex:o.props.defaultHighlightedIndex},g)},function(){var I=o.getState(),O=I.isOpen,_=I.highlightedIndex;O&&o.getItemCount()>0&&typeof _=="number"&&o.setHighlightedIndex(_,g),nd(b)()})},o.openMenu=function(g){o.internalSetState({isOpen:!0},g)},o.closeMenu=function(g){o.internalSetState({isOpen:!1},g)},o.updateStatus=_l(function(){var g;if((g=o.props)!=null&&(g=g.environment)!=null&&g.document){var b=o.getState(),I=o.items[b.highlightedIndex],O=o.getItemCount(),_=o.props.getA11yStatusMessage(we({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:O,highlightedItem:I},b));o.previousResultCount=O,ch(_,o.props.environment.document)}},200);var s=o.props,a=s.defaultHighlightedIndex,l=s.initialHighlightedIndex,c=l===void 0?a:l,u=s.defaultIsOpen,p=s.initialIsOpen,h=p===void 0?u:p,f=s.initialInputValue,m=f===void 0?"":f,v=s.initialSelectedItem,y=v===void 0?null:v,x=o.getState({highlightedIndex:c,isOpen:h,inputValue:m,selectedItem:y});return x.selectedItem!=null&&o.props.initialInputValue===void 0&&(x.inputValue=o.props.itemToString(x.selectedItem)),o.state=x,o}hk(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),Eo(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(),l=this.getState(),c=l.highlightedIndex;if(a>0){var u=ir(c,o,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(u,s)}},r.getStateAndHelpers=function(){var o=this.getState(),s=o.highlightedIndex,a=o.inputValue,l=o.selectedItem,c=o.isOpen,u=this.props.itemToString,p=this.id,h=this.getRootProps,f=this.getToggleButtonProps,m=this.getLabelProps,v=this.getMenuProps,y=this.getInputProps,x=this.getItemProps,g=this.openMenu,b=this.closeMenu,I=this.toggleMenu,O=this.selectItem,_=this.selectItemAtIndex,R=this.selectHighlightedItem,k=this.setHighlightedIndex,A=this.clearSelection,F=this.clearItems,j=this.reset,L=this.setItemCount,H=this.unsetItemCount,P=this.internalSetState;return{getRootProps:h,getToggleButtonProps:f,getLabelProps:m,getMenuProps:v,getInputProps:y,getItemProps:x,reset:j,openMenu:g,closeMenu:b,toggleMenu:I,selectItem:O,selectItemAtIndex:_,selectHighlightedItem:R,setHighlightedIndex:k,clearSelection:A,clearItems:F,setItemCount:L,unsetItemCount:H,setState:P,itemToString:u,id:p,highlightedIndex:s,inputValue:a,isOpen:c,selectedItem:l}},r.componentDidMount=function(){var o=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&od(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 m=To(f.target,[o._rootNode,o._menuNode],o.props.environment);!m&&o.getState().isOpen&&o.reset({type:dh},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},l=function(){o.isTouchMove=!1},c=function(){o.isTouchMove=!0},u=function(f){var m=To(f.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!m&&o.getState().isOpen&&o.reset({type:Ch},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},p=this.props.environment;p.addEventListener("mousedown",s),p.addEventListener("mouseup",a),p.addEventListener("touchstart",l),p.addEventListener("touchmove",c),p.addEventListener("touchend",u),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),p.removeEventListener("mousedown",s),p.removeEventListener("mouseup",a),p.removeEventListener("touchstart",l),p.removeEventListener("touchmove",c),p.removeEventListener("touchend",u)}}},r.shouldScroll=function(o,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,l=a.highlightedIndex,c=s.highlightedIndex===void 0?o:s,u=c.highlightedIndex,p=l&&this.getState().isOpen&&!o.isOpen,h=l!==u;return p||h},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(El(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&od(this._menuNode,this.getMenuProps)),No(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Ih,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=id(this.props.children,Mt);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=id(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&&Vk(s,this.getRootProps),s;if(sh(s))return w.cloneElement(s,this.getRootProps(ah(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n})(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Tk,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Ak(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:Mt,onInputValueChange:Mt,onUserAction:Mt,onChange:Mt,onSelect:Mt,onOuterClick:Mt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:ih},e.stateChangeTypes=jk,e})();process.env.NODE_ENV!=="production"&&(qk.propTypes={children:G.func,defaultHighlightedIndex:G.number,defaultIsOpen:G.bool,initialHighlightedIndex:G.number,initialSelectedItem:G.any,initialInputValue:G.string,initialIsOpen:G.bool,getA11yStatusMessage:G.func,itemToString:G.func,onChange:G.func,onSelect:G.func,onStateChange:G.func,onInputValueChange:G.func,onUserAction:G.func,onOuterClick:G.func,selectedItemChanged:G.func,stateReducer:G.func,itemCount:G.number,id:G.string,environment:G.shape({addEventListener:G.func.isRequired,removeEventListener:G.func.isRequired,document:G.shape({createElement:G.func.isRequired,getElementById:G.func.isRequired,activeElement:G.any.isRequired,body:G.any.isRequired}).isRequired,Node:G.func.isRequired}),suppressRefError:G.bool,scrollIntoView:G.func,selectedItem:G.any,isOpen:G.bool,inputValue:G.string,highlightedIndex:G.number,labelId:G.string,inputId:G.string,menuId:G.string,getItemId:G.func});function od(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 Vk(e,t){var n=t.refKey,r=n!=="ref",i=!sh(e);i&&!r&&!Zu.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+'"'),!Zu.isForwardRef(e)&&!ah(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Sh={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Uk(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){zk(s,e,t,n),n[s]!==t[s]&&(o[s]=n[s])}),r.onStateChange&&Object.keys(o).length&&r.onStateChange(we({type:i},o))}function zk(e,t,n,r){var i=t.props,o=t.type,s="on"+Nl(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](we({type:o},r))}function Kk(e,t){return t.changes}var sd=_l(function(e,t){ch(e,t)},200),Hk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,Jk="useId"in w?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,a=t.inputId,l="downshift-"+w.useId();n||(n=l);var c=w.useRef({labelId:r||n+"-label",menuId:i||n+"-menu",getItemId:o||function(u){return n+"-item-"+u},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return c.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+oh():n,i=t.labelId,o=t.menuId,s=t.getItemId,a=t.toggleButtonId,l=t.inputId,c=w.useRef({labelId:i||r+"-label",menuId:o||r+"-menu",getItemId:s||function(u){return r+"-item-"+u},toggleButtonId:a||r+"-toggle-button",inputId:l||r+"-input"});return c.current};function Wk(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 Nl(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Oh(e){var t=w.useRef(e);return t.current=e,t}function Qk(e,t,n,r){var i=w.useRef(),o=w.useRef(),s=w.useCallback(function(f,m){o.current=m,f=Eo(f,m.props);var v=e(f,m),y=m.props.stateReducer(f,we({},m,{changes:v}));return y},[e]),a=w.useReducer(s,t,n),l=a[0],c=a[1],u=Oh(t),p=w.useCallback(function(f){return c(we({props:u.current},f))},[u]),h=o.current;return w.useEffect(function(){var f=Eo(i.current,h?.props),m=h&&i.current&&!r(f,l);m&&Uk(h,f,l),i.current=l},[l,h,r]),[l,p]}var di={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:Kk,scrollIntoView:ih,environment:typeof window>"u"?void 0:window};function Un(e,t,n){n===void 0&&(n=Sh);var r=e["default"+Nl(t)];return r!==void 0?r:n[t]}function pi(e,t,n){n===void 0&&(n=Sh);var r=e[t];if(r!==void 0)return r;var i=e["initial"+Nl(t)];return i!==void 0?i:Un(e,t,n)}function Gk(e){var t=pi(e,"selectedItem"),n=pi(e,"isOpen"),r=tR(e),i=pi(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 fi(e,t,n){var r=e.items,i=e.initialHighlightedIndex,o=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,l=t.selectedItem,c=t.highlightedIndex;return r.length===0?-1:i!==void 0&&c===i&&!s(r[i],i)?i:o!==void 0&&!s(r[o],o)?o:l?r.findIndex(function(u){return a(l)===a(u)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function Xk(e,t,n){var r=w.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return w.useEffect(function(){if(!e)return Mt;var i=n.map(function(u){return u.current});function o(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(u){r.current.isMouseDown=!1,To(u.target,i,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function l(){r.current.isTouchMove=!0}function c(u){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!To(u.target,i,e,!1)&&t()}return e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",l),e.addEventListener("touchend",c),function(){e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",l),e.removeEventListener("touchend",c)}},[n,e,t]),r.current}var _h=function(){return Mt};process.env.NODE_ENV!=="production"&&(_h=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=w.useRef(n.reduce(function(s,a){return s[a]={},s},{}));w.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 l=a.suppressRefError,c=a.refKey,u=a.elementRef;l||u!=null&&u.current||console.error('downshift: The ref prop "'+c+'" from '+s+" was not applied correctly on your element.")})},[]);var o=w.useCallback(function(s,a,l,c){i.current[s]={suppressRefError:a,refKey:l,elementRef:c}},[]);return o});function Yk(e,t,n,r){r===void 0&&(r={});var i=r.document,o=Go();w.useEffect(function(){if(!(!e||o||!i)){var s=e(t);sd(s,i)}},n),w.useEffect(function(){return function(){sd.cancel(),Pk(i)}},[i])}function Zk(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,o=e.menuElement,s=e.scrollIntoView,a=w.useRef(!0);return Hk(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var Eh=Mt;process.env.NODE_ENV!=="production"&&(Eh=function(t){var n=t.props,r=t.state,i=w.useRef(n),o=Go();w.useEffect(function(){o||(El(r,i.current,n),i.current=n)},[r,n,o])});function ad(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return we({isOpen:!1,highlightedIndex:-1},i&&we({selectedItem:e.items[t],isOpen:Un(e,"isOpen"),highlightedIndex:Un(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function eR(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Go(){var e=w.useRef(!0);return w.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Ia(e){var t=Un(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function tR(e){var t=pi(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var po={environment:G.shape({addEventListener:G.func.isRequired,removeEventListener:G.func.isRequired,document:G.shape({createElement:G.func.isRequired,getElementById:G.func.isRequired,activeElement:G.any.isRequired,body:G.any.isRequired}).isRequired,Node:G.func.isRequired}),itemToString:G.func,itemToKey:G.func,stateReducer:G.func},Nh=we({},po,{getA11yStatusMessage:G.func,highlightedIndex:G.number,defaultHighlightedIndex:G.number,initialHighlightedIndex:G.number,isOpen:G.bool,defaultIsOpen:G.bool,initialIsOpen:G.bool,selectedItem:G.any,initialSelectedItem:G.any,defaultSelectedItem:G.any,id:G.string,labelId:G.string,menuId:G.string,getItemId:G.func,toggleButtonId:G.string,onSelectedItemChange:G.func,onHighlightedIndexChange:G.func,onStateChange:G.func,onIsOpenChange:G.func,scrollIntoView:G.func});function nR(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:fi(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:fi(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:Ia(i),isOpen:Un(i,"isOpen"),selectedItem:Un(i,"selectedItem"),inputValue:Un(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return we({},e,o)}Dr(Dr({},Nh),{items:G.array.isRequired,isItemDisabled:G.func});Dr(Dr({},di),{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 Tl=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,kl=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Rl=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Al=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Fl=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Pl=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,jl=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Ml=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Dl=process.env.NODE_ENV!=="production"?"__input_change__":8,ko=process.env.NODE_ENV!=="production"?"__input_blur__":9,Ll=process.env.NODE_ENV!=="production"?"__input_click__":10,Th=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,kh=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,Bl=process.env.NODE_ENV!=="production"?"__item_click__":13,Rh=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Ah=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Fh=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Ph=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,jh=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,$l=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Mh=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Dh=process.env.NODE_ENV!=="production"?"__function_reset__":21,ql=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Lh=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ql,FunctionCloseMenu:Ph,FunctionOpenMenu:Fh,FunctionReset:Dh,FunctionSelectItem:$l,FunctionSetHighlightedIndex:jh,FunctionSetInputValue:Mh,FunctionToggleMenu:Ah,InputBlur:ko,InputChange:Dl,InputClick:Ll,InputKeyDownArrowDown:Tl,InputKeyDownArrowUp:kl,InputKeyDownEnd:Fl,InputKeyDownEnter:Ml,InputKeyDownEscape:Rl,InputKeyDownHome:Al,InputKeyDownPageDown:jl,InputKeyDownPageUp:Pl,ItemClick:Bl,ItemMouseMove:kh,MenuMouseLeave:Th,ToggleButtonClick:Rh});function rR(e){var t=Gk(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)),we({},t,{inputValue:r})}var iR=we({},Nh,{items:G.array.isRequired,isItemDisabled:G.func,inputValue:G.string,defaultInputValue:G.string,initialInputValue:G.string,inputId:G.string,onInputValueChange:G.func});function oR(e,t,n,r){var i=w.useRef(),o=Qk(e,t,n,r),s=o[0],a=o[1],l=Go();return w.useEffect(function(){if(No(t,"selectedItem")){if(!l){var c=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);c&&a({type:ql,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Eo(s,t),a]}var Bh=Mt;process.env.NODE_ENV!=="production"&&(Bh=function(t,n){G.checkPropTypes(iR,t,"prop",n.name)});var sR=we({},di,{isItemDisabled:function(){return!1}});function aR(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case Bl:s={isOpen:Un(i,"isOpen"),highlightedIndex:Ia(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case Tl:e.isOpen?s={highlightedIndex:ir(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:fi(i,e,1),isOpen:i.items.length>=0};break;case kl:e.isOpen?o?s=ad(i,e.highlightedIndex):s={highlightedIndex:ir(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:fi(i,e,-1),isOpen:i.items.length>=0};break;case Ml:s=ad(i,e.highlightedIndex);break;case Rl:s=we({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Pl:s={highlightedIndex:ir(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case jl:s={highlightedIndex:ir(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case Al:s={highlightedIndex:Lr(0,!1,i.items,i.isItemDisabled)};break;case Fl:s={highlightedIndex:Lr(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case ko:s=we({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 Dl:s={isOpen:!0,highlightedIndex:Ia(i),inputValue:t.inputValue};break;case Ll:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:fi(i,e,0)};break;case $l:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case ql:s={inputValue:t.inputValue};break;default:return nR(e,t,Lh)}return we({},e,s)}var lR=["onMouseLeave","refKey","ref"],cR=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],uR=["onClick","onPress","refKey","ref"],dR=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Vl.stateChangeTypes=Lh;function Vl(e){e===void 0&&(e={}),Bh(e,Vl);var t=we({},sR,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=oR(aR,t,rR,eR),a=s[0],l=s[1],c=a.isOpen,u=a.highlightedIndex,p=a.selectedItem,h=a.inputValue,f=w.useRef(null),m=w.useRef({}),v=w.useRef(null),y=w.useRef(null),x=Go(),g=Jk(t),b=w.useRef(),I=Oh({state:a,props:t}),O=w.useCallback(function($){return m.current[g.getItemId($)]},[g]);Yk(o,a,[c,u,p,h],i);var _=Zk({menuElement:f.current,highlightedIndex:u,isOpen:c,itemRefs:m,scrollIntoView:r,getItemNodeFromIndex:O});Eh({props:t,state:a}),w.useEffect(function(){var $=pi(t,"isOpen");$&&v.current&&v.current.focus()},[]),w.useEffect(function(){x||(b.current=n.length)});var R=Xk(i,w.useCallback(function(){I.current.state.isOpen&&l({type:ko,selectItem:!1})},[l,I]),w.useMemo(function(){return[f,y,v]},[f.current,y.current,v.current])),k=_h("getInputProps","getMenuProps");w.useEffect(function(){c||(m.current={})},[c]),w.useEffect(function(){var $;!c||!(i!=null&&i.document)||!(v!=null&&($=v.current)!=null&&$.focus)||i.document.activeElement!==v.current&&v.current.focus()},[c,i]);var A=w.useMemo(function(){return{ArrowDown:function(S){S.preventDefault(),l({type:Tl,altKey:S.altKey})},ArrowUp:function(S){S.preventDefault(),l({type:kl,altKey:S.altKey})},Home:function(S){I.current.state.isOpen&&(S.preventDefault(),l({type:Al}))},End:function(S){I.current.state.isOpen&&(S.preventDefault(),l({type:Fl}))},Escape:function(S){var U=I.current.state;(U.isOpen||U.inputValue||U.selectedItem||U.highlightedIndex>-1)&&(S.preventDefault(),l({type:Rl}))},Enter:function(S){var U=I.current.state;!U.isOpen||S.which===229||(S.preventDefault(),l({type:Ml}))},PageUp:function(S){I.current.state.isOpen&&(S.preventDefault(),l({type:Pl}))},PageDown:function(S){I.current.state.isOpen&&(S.preventDefault(),l({type:jl}))}}},[l,I]),F=w.useCallback(function($){return we({id:g.labelId,htmlFor:g.inputId},$)},[g]),j=w.useCallback(function($,S){var U,V=$===void 0?{}:$,Y=V.onMouseLeave,ie=V.refKey,ne=ie===void 0?"ref":ie,se=V.ref,ee=_n(V,lR),me=S===void 0?{}:S,q=me.suppressRefError,ye=q===void 0?!1:q;return k("getMenuProps",ye,ne,f),we((U={},U[ne]=Or(se,function(Z){f.current=Z}),U.id=g.menuId,U.role="listbox",U["aria-labelledby"]=ee&&ee["aria-label"]?void 0:""+g.labelId,U.onMouseLeave=rt(Y,function(){l({type:Th})}),U),ee)},[l,k,g]),L=w.useCallback(function($){var S,U,V=$===void 0?{}:$,Y=V.item,ie=V.index,ne=V.refKey,se=ne===void 0?"ref":ne,ee=V.ref,me=V.onMouseMove,q=V.onMouseDown,ye=V.onClick;V.onPress;var Z=V.disabled,$e=_n(V,cR);Z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Fe=I.current,Ae=Fe.props,We=Fe.state,et=Wk(Y,ie,Ae.items,"Pass either item or index to getItemProps!"),tt=et[0],xe=et[1],at=Ae.isItemDisabled(tt,xe),It="onClick",dt=ye,Ge=function(){R.isTouchEnd||xe===We.highlightedIndex||(_.current=!1,l({type:kh,index:xe,disabled:at}))},D=function(){l({type:Bl,index:xe})},K=function(re){return re.preventDefault()};return we((S={},S[se]=Or(ee,function(M){M&&(m.current[g.getItemId(xe)]=M)}),S["aria-disabled"]=at,S["aria-selected"]=xe===We.highlightedIndex,S.id=g.getItemId(xe),S.role="option",S),!at&&(U={},U[It]=rt(dt,D),U),{onMouseMove:rt(me,Ge),onMouseDown:rt(q,K)},$e)},[l,g,I,R,_]),H=w.useCallback(function($){var S,U=$===void 0?{}:$,V=U.onClick;U.onPress;var Y=U.refKey,ie=Y===void 0?"ref":Y,ne=U.ref,se=_n(U,uR),ee=I.current.state,me=function(){l({type:Rh})};return we((S={},S[ie]=Or(ne,function(q){y.current=q}),S["aria-controls"]=g.menuId,S["aria-expanded"]=ee.isOpen,S.id=g.toggleButtonId,S.tabIndex=-1,S),!se.disabled&&we({},{onClick:rt(V,me)}),se)},[l,I,g]),P=w.useCallback(function($,S){var U,V=$===void 0?{}:$,Y=V.onKeyDown,ie=V.onChange,ne=V.onInput,se=V.onBlur;V.onChangeText;var ee=V.onClick,me=V.refKey,q=me===void 0?"ref":me,ye=V.ref,Z=_n(V,dR),$e=S===void 0?{}:S,Fe=$e.suppressRefError,Ae=Fe===void 0?!1:Fe;k("getInputProps",Ae,q,v);var We=I.current.state,et=function(K){var M=wa(K);M&&A[M]&&A[M](K)},tt=function(K){l({type:Dl,inputValue:K.target.value})},xe=function(K){if(i!=null&&i.document&&We.isOpen&&!R.isMouseDown){var M=K.relatedTarget===null&&i.document.activeElement!==i.document.body;l({type:ko,selectItem:!M})}},at=function(){l({type:Ll})},It="onChange",dt={};if(!Z.disabled){var Ge;dt=(Ge={},Ge[It]=rt(ie,ne,tt),Ge.onKeyDown=rt(Y,et),Ge.onBlur=rt(se,xe),Ge.onClick=rt(ee,at),Ge)}return we((U={},U[q]=Or(ye,function(D){v.current=D}),U["aria-activedescendant"]=We.isOpen&&We.highlightedIndex>-1?g.getItemId(We.highlightedIndex):"",U["aria-autocomplete"]="list",U["aria-controls"]=g.menuId,U["aria-expanded"]=We.isOpen,U["aria-labelledby"]=Z&&Z["aria-label"]?void 0:g.labelId,U.autoComplete="off",U.id=g.inputId,U.role="combobox",U.value=We.inputValue,U),dt,Z)},[l,g,i,A,I,R,k]),B=w.useCallback(function(){l({type:Ah})},[l]),X=w.useCallback(function(){l({type:Ph})},[l]),le=w.useCallback(function(){l({type:Fh})},[l]),fe=w.useCallback(function($){l({type:jh,highlightedIndex:$})},[l]),ge=w.useCallback(function($){l({type:$l,selectedItem:$})},[l]),C=w.useCallback(function($){l({type:Mh,inputValue:$})},[l]),W=w.useCallback(function(){l({type:Dh})},[l]);return{getItemProps:L,getLabelProps:F,getMenuProps:j,getInputProps:P,getToggleButtonProps:H,toggleMenu:B,openMenu:le,closeMenu:X,setHighlightedIndex:fe,setInputValue:C,selectItem:ge,reset:W,highlightedIndex:u,isOpen:c,selectedItem:p,inputValue:h}}po.stateReducer,po.itemToKey,po.environment,G.array,G.array,G.array,G.func,G.number,G.number,G.number,G.func,G.func,G.string,G.string;di.itemToKey,di.stateReducer,di.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 pR="_comboboxContainer_1lcc8_1",fR="_inputContainer_1lcc8_12",hR="_input_1lcc8_12",mR="_toggleButton_1lcc8_33",gR="_menu_1lcc8_39",yR="_menuBottom_1lcc8_55",vR="_menuTop_1lcc8_61",bR="_menuItem_1lcc8_66",wR="_highlighted_1lcc8_73",xR="_selected_1lcc8_77",IR="_hidden_1lcc8_81",tn={comboboxContainer:pR,inputContainer:fR,input:hR,toggleButton:mR,menu:gR,menuBottom:yR,menuTop:vR,menuItem:bR,highlighted:wR,selected:xR,hidden:IR};function CR(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function $h({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:i,style:o,menuPosition:s="bottom"}){const[a,l]=w.useState(e),c=w.useRef(null);w.useEffect(()=>l(e),[e]);const u=w.useCallback(_=>{_?.length>0?l(e.filter(CR(_))):l(e)},[e]),{isOpen:p,getToggleButtonProps:h,getMenuProps:f,getInputProps:m,highlightedIndex:v,getItemProps:y,setInputValue:x}=Vl({items:a,selectedItem:t?e.find(_=>_.value===t):null,itemToString:_=>_?.label||"",onInputValueChange:({inputValue:_})=>u(_),onSelectedItemChange:({selectedItem:_})=>{n(_),c.current?.blur()}}),g=()=>{x(""),l(e)},b=()=>g(),I=w.useMemo(()=>e.find(_=>_.value===t)?.label,[e,t]),O=()=>{x(t&&I?I:"")};return d.jsxs("div",{style:{position:"relative",...o},children:[d.jsx("div",{className:tn.comboboxContainer,children:d.jsxs("div",{className:tn.inputContainer,children:[d.jsx("input",{style:{border:"none"},disabled:i,placeholder:r,className:tn.input,...m({onFocus:b,onBlur:O,ref:c})}),d.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:tn.toggleButton,type:"button",...h(),children:p?d.jsx(d.Fragment,{children:"↑"}):d.jsx(d.Fragment,{children:"↓"})})]})}),d.jsx("ul",{className:`${tn.menu} ${p&&e.length?"":tn.hidden} ${s==="top"?tn.menuTop:tn.menuBottom}`,...f(),children:p&&a.map((_,R)=>d.jsx("li",{className:`${tn.menuItem} ${v===R?tn.highlighted:""} ${t===_?.value?tn.selected:""}`,...y({item:_,index:R}),children:d.jsx("span",{children:_.label})},_.id))})]})}function SR(e,t){const n=e?.read?.selectedFieldMappings||{};t.forEach(r=>{const{field:i,value:o}=r;if(o===null){const s=n[i];delete n[i],s&&e?.read?.selectedValueMappings&&e.read.selectedValueMappings[s]&&delete e.read.selectedValueMappings[s]}else{const s=n[i];n[i]=o,s&&s!==o&&e?.read?.selectedValueMappings&&e.read.selectedValueMappings[s]&&delete e.read.selectedValueMappings[s]}})}function Ii(e,t,n){t(e,r=>SR(r,n))}const OR="Each field must be mapped to a unique value";function Ul({field:e,onSelectChange:t,allFields:n}){const{configureState:r,selectedObjectName:i,setConfigureState:o}=qt(),[s,a]=w.useState(!0),{isError:l,removeError:c,getError:u}=vn(),h=r?.read?.selectedFieldMappings?.[e.mapToName];w.useEffect(()=>{e._default&&!h&&i&&r&&Ii(i,o,[{field:e.mapToName,value:e._default}]),a(!1)},[e,o,i,h,r]);const f=w.useMemo(()=>n.map(g=>({id:g.fieldName,label:g.displayName,value:g.fieldName})),[n]),m=d.jsx($h,{disabled:s,items:f,selectedValue:h||null,onSelectedItemChange:g=>{t({target:{name:e.mapToName,value:g?.value}})},placeholder:"Please select one",style:{width:"100%"}}),v=w.useCallback(()=>{i&&(Ii(i,o,[{field:e.mapToName,value:null}]),l(Ie.MAPPING,i)&&c(Ie.MAPPING,i))},[e.mapToName,i,o,l,c]),{hasDuplicationError:y,errorMessage:x}=w.useMemo(()=>{const g=u(Ie.MAPPING,i),b=Array.isArray(g)&&g.length>0&&g.includes(e.mapToName);return{hasDuplicationError:b,errorMessage:b?OR:""}},[i,u,e.mapToName]);return d.jsxs(d.Fragment,{children:[d.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[d.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[d.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),d.jsx("span",{children:e?.prompt&&d.jsx(Cf,{id:`tooltip-id-${e?.prompt}`,tooltipText:e?.prompt})})]}),d.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[m,d.jsx(je,{type:"button",variant:"ghost",onClick:v,children:"Clear"})]})]},e.mapToName),y&&d.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",x," "]},e.mapToName)]})}const _R="_formControl_9qd8d_1",ER="_formLabel_9qd8d_5",NR="_formLabelRequired_9qd8d_11",TR="_formInput_9qd8d_16",kR="_formInputInvalid_9qd8d_20",RR="_formError_9qd8d_24",AR="_disabled_9qd8d_30",tr={formControl:_R,formLabel:ER,formLabelRequired:NR,formInput:TR,formInputInvalid:kR,formError:RR,disabled:AR};function Xo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return d.jsxs("div",{className:Gt(tr.formControl,{[tr.disabled]:r}),children:[t&&d.jsx("label",{htmlFor:e,className:Gt(tr.formLabel,{[tr.formLabelRequired]:n}),children:t}),d.jsx("div",{id:e,className:Gt(tr.formInput,{[tr.formInputInvalid]:i}),children:s}),i&&o&&d.jsx("div",{className:tr.formError,role:"alert",children:o})]})}function qh({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:i}){if(!e||!t)return!1;if(Object.values(e).some(s=>s===r&&s!==n)){console.error("Each field must be mapped to a unique value",e);const s=Object.keys(e).filter(l=>e[l]===r),a=[n,...s];return i(Ie.MAPPING,t,a),!0}return!1}function FR({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?d.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>d.jsx(Xo,{id:r.mapToName,children:d.jsx(Ul,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function PR(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=qt(),{isError:r,removeError:i,setError:o}=vn(),s=t?.read?.allFields||[],{fieldMapping:a}=st(),l=t?.read?.selectedFieldMappings,c=m=>{const{value:v,name:y}=m.target;!v||qh({selectedFieldMappings:l,selectedObjectName:e,fieldName:y,fieldValue:v,setError:o})||(e&&Ii(e,n,[{field:y,value:v}]),r(Ie.MAPPING,y)&&i(Ie.MAPPING,y),e&&r(Ie.MAPPING,e)&&i(Ie.MAPPING,e))},u=w.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(m=>!m.fieldName),[a,e]),p=w.useMemo(()=>(t?.read?.optionalMapFields||[]).filter(y=>!u.some(x=>x.mapToName===y.mapToName)),[t,u]),h=u.length>0;return p.length>0||h?d.jsxs(d.Fragment,{children:[d.jsx($t,{string:"Map the following optional fields"}),d.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[p?.map(m=>d.jsx(Xo,{id:m.mapToName,children:d.jsx(Ul,{allFields:s,field:m,onSelectChange:c})},m.mapToName)),h&&d.jsx(FR,{dynamicFieldMappings:u,onSelectChange:c,allFields:s})]})]}):null}function jR(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=qt(),{isError:r,removeError:i,setError:o}=vn(),s=t?.read?.selectedFieldMappings,a=c=>{const{value:u,name:p}=c.target;!u||qh({selectedFieldMappings:s,selectedObjectName:e,fieldName:p,fieldValue:u,setError:o})||(e&&Ii(e,n,[{field:p,value:u}]),r(Ie.MAPPING,p)&&i(Ie.MAPPING,p),e&&r(Ie.MAPPING,e)&&i(Ie.MAPPING,e))},l=w.useMemo(()=>t?.read?.requiredMapFields||[],[t]);return l?.length?d.jsxs(d.Fragment,{children:[d.jsx($t,{string:"Map the following fields"}),d.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.map(c=>d.jsx(Xo,{id:c.mapToName,isInvalid:r(Ie.MAPPING,c.mapToName),errorMessage:"* required",children:d.jsx(Ul,{allFields:t?.read?.allFields||[],field:c,onSelectChange:a})},c.mapToName))})]}):null}const MR=(e,t)=>e.filter(n=>!t.has(n));function DR(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=qt(),{fieldMapping:r}=st(),i=t?.read?.selectedFieldMappings||{},o=Object.keys(i),s=t?.read?.requiredMapFields||[],a=t?.read?.optionalMapFields||[],l=e&&r?Object.values(r[e]||{}).flat().filter(h=>!h.fieldName):[],c=s.concat(l,a).map(h=>h.mapToName),u=new Set(c),p=MR(o,u);w.useEffect(()=>{e&&p.length&&Ii(e,n,p.map(h=>({field:h,value:null})))},[e,n,p])}const LR={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function Vh({children:e,style:t}){return d.jsx(kn,{style:{...LR,...t},children:e})}function BR(){const{data:e}=an(),{hydratedRevision:t}=yr(),{selectedObjectName:n}=qt(),{providerName:r}=ut(),i=e?.appName,o=t?.content?.read?.objects?.find(c=>c.objectName===n),s=o?.displayName||n&&Xt(n),a=o?.mapToName,l=o?.mapToDisplayName||a&&Xt(a);return l&&i&&r?d.jsx(Vh,{style:{marginTop:"1rem"},children:d.jsxs("p",{style:{margin:"1rem 0"},children:[d.jsx("b",{children:l})," in ",i," is mapped to"," ",d.jsx("b",{children:s})," in ",r,"."]})}):null}function $R(e,t,n){const r=e?.read?.selectedOptionalFields||{};r[t]=n,n||delete r[t]}function qR(e,t,n,r){t(e,i=>$R(i,n,r))}function VR(){const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=qt(),i=t?.read?.selectedOptionalFields,o=t?.read?.optionalFields,s=(c,u)=>{r&&t&&qR(r,n,c,u)},a=w.useMemo(()=>o?.filter(c=>!fr(c)&&"fieldName"in c&&"displayName"in c).map(c=>({id:c.fieldName,label:c.displayName,isChecked:!!i?.[c.fieldName]})).sort((c,u)=>c.label.localeCompare(u.label))||[],[o,i]);return!!(o&&o.length>0)&&d.jsxs(d.Fragment,{children:[d.jsx($t,{string:`${e} reads the following optional fields`}),d.jsx(Qa,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${o?.length}`)]})}function UR(){return d.jsx(VR,{})}function zR(){const{installation:e}=ln(),{selectedObjectName:t}=qt(),{displayName:n}=eh(),{toggleReadingObject:r,isPending:i}=th(),o=t?e?.config?.content?.read?.objects?.[t]:void 0;if(!o)return null;if(!o.disabled)return d.jsx(Ai,{children:d.jsxs("p",{children:["Reading from ",n," is enabled."]})});const a=()=>{t&&r({objectName:t,disabled:!1,onError:l=>{console.error("Error re-enabling read object:",l)}})};return d.jsx(d.Fragment,{children:d.jsxs(Vh,{style:{backgroundColor:"var(--amp-colors-status-critical-muted)"},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[d.jsx(Sp,{style:{width:"16px",height:"16px",flexShrink:0}}),d.jsx("span",{style:{fontWeight:600},children:"Reading is currently disabled"})]}),d.jsxs("p",{style:{marginTop:"0.5rem",fontSize:"0.875rem"},children:["This object is not being synced. Click below to re-enable reading from"," ",d.jsx("b",{children:n}),"."]}),d.jsx(je,{type:"button",onClick:a,variant:"ghost",style:{marginTop:"1rem",width:"100%"},disabled:i,children:i?"Re-enabling...":`Re-enable reading from ${n}`})]})})}const KR={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 HR({children:e,style:t,...n}){return d.jsx("span",{style:{...KR,...t},...n,children:e})}const JR="_errorAlert_1tcao_1",WR="_errorHeader_1tcao_11",QR="_errorIcon_1tcao_17",GR="_errorTitle_1tcao_24",XR="_errorMessage_1tcao_30",ii={errorAlert:JR,errorHeader:WR,errorIcon:QR,errorTitle:GR,errorMessage:XR};function YR({error:e}){return d.jsxs("div",{className:ii.errorAlert,children:[d.jsxs("div",{className:ii.errorHeader,children:[d.jsx(Sp,{className:ii.errorIcon}),d.jsx("span",{className:ii.errorTitle,children:"Unable to load object"})]}),d.jsx("div",{className:ii.errorMessage,children:e})]})}function ZR(){const{data:e}=Tn(),{selectedObjectName:t}=qt(),{appName:n}=an(),r=e?.content?.read?.objects?.find(s=>s.objectName===t),i=r?.error,o=r?.requiredFields;return i?d.jsx(YR,{error:i}):d.jsxs(d.Fragment,{children:[d.jsx($t,{string:`${n} reads the following fields`}),d.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:o?.length?o.map(s=>fr(s)?null:d.jsx(HR,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function eA(e,t,n,r,i){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[i]||(e.read.selectedValueMappings[i]={}),r===""&&e.read.selectedValueMappings[i][n]?delete e.read.selectedValueMappings[i][n]:e.read.selectedValueMappings[i][n]=r)}function Uh(e,t,n,r,i){t(e,o=>eA(o,e,n,r,i))}function Ms(e){return e.mapToDisplayName||e.mapToName||e.fieldName||""}function tA(e,t){if(!e.fieldName)return{isValid:!1,errorMessage:"Field name is missing"};const n=t?.valueType;if(!["singleSelect","multiSelect"].includes(n||""))return{isValid:!1,errorMessage:"fieldName is not a singleSelect or multiSelect"};const r=t?.values;if(!r)return{isValid:!1,errorMessage:"Field values array is missing"};const i=Object.keys(r).length,o=Object.keys(e?.mappedValues||[]).length;return i!==o?{isValid:!1,errorMessage:"field values and the values to be mapped are not of the same length"}:{isValid:!0}}function nA(e,t,n){const r=Object.values(t).filter(Boolean),i=t[n];return e.filter(o=>{const s=o.value===i,a=r.includes(o.value);return s||!a})}function rA({string:e,fieldName:t}){return d.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[d.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,d.jsx("b",{children:t})]}),d.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:d.jsx(Qo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function iA({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r}){const{configureState:i,selectedObjectName:o,setConfigureState:s}=qt(),a=w.useMemo(()=>i?.read?.selectedValueMappings?.[n]||{},[i?.read?.selectedValueMappings,n]),l=w.useMemo(()=>a?.[e.mappedValue],[a,e.mappedValue]),c=w.useMemo(()=>r.map(f=>({id:f.value,label:f.displayValue,value:f.value})),[r]),u=w.useCallback(f=>{f&&t({target:{name:e.mappedValue,value:f.value,fieldName:n}})},[t,n,e.mappedValue]),p=w.useMemo(()=>d.jsx($h,{items:c,selectedValue:l||null,onSelectedItemChange:u,placeholder:"Please select one",style:{borderRadius:"8px",width:"100%"}},l),[l,c,u]),h=w.useCallback(()=>{o&&Uh(o,s,e.mappedValue,"",n)},[o,s,e.mappedValue,n]);return d.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[d.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:d.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),d.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[p,d.jsx(je,{type:"button",variant:"ghost",onClick:h,children:"Clear"})]})]},e.mappedValue)}function oA(){const{fieldMapping:e}=st(),{selectedObjectName:t,configureState:n,setConfigureState:r}=qt(),i=n?.read?.selectedFieldMappings,o=n?.read?.selectedValueMappings,s=w.useMemo(()=>{const l=t&&e?Object.values(e[t]||{}).flat().filter(c=>c.mappedValues).map(c=>({...c})):[];if(i)for(let c=0;c<l.length;c+=1){const{mapToName:u}=l[c];i?.[u]&&(l[c].fieldName=i[u])}return l},[t,e,i]),a=w.useCallback(l=>{const{value:c,name:u,fieldName:p}=l.target;c&&t&&Uh(t,r,u,c,p)},[t,r]);return s?.length?d.jsx(d.Fragment,{children:s.map(l=>{const c=n?.read?.allFieldsMetadata?.[l.fieldName],u=tA(l,c);return u.isValid?d.jsxs(d.Fragment,{children:[d.jsx(rA,{string:"Map the values for ",fieldName:Ms(l)}),d.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:d.jsx(Xo,{id:Ms(l),children:l?.mappedValues?.map(p=>{const h=c?.values||[],f=o?.[l.fieldName]||{},m=nA(h,f,p.mappedValue);return d.jsx(iA,{allValueOptions:m,mappedValue:p,onSelectChange:a,fieldName:l?.fieldName||""},`${p.mappedValue}-${l.fieldName}`)})},Ms(l))})]}):(console.error(u.errorMessage,l),null)})}):null}function sA(){return DR(),d.jsxs(d.Fragment,{children:[d.jsx(zR,{}),d.jsx(BR,{}),d.jsx(ZR,{}),d.jsx(jR,{}),d.jsx(PR,{}),d.jsx(oA,{}),d.jsx(UR,{}),d.jsx(fk,{})]})}function aA(e,t,n){if(e?.write?.selectedWriteObjects===null&&(e.write.selectedWriteObjects={}),e?.write){const r=e.write.selectedWriteObjects;n&&(r[t]={objectName:t}),n||delete r[t]}}function lA(e,t,n,r){t(e,i=>{aA(i,n,r)})}function cA(){const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=qt(),i=n?.write?.selectedWriteObjects,o=n?.write?.writeObjects,s=(c,u)=>{t&&n&&lA(t,r,c,u)},a=!!o,l=o?.map(c=>({id:c.objectName,label:c.displayName,isChecked:!!i?.[c.objectName]}))||[];return a&&d.jsxs(d.Fragment,{children:[d.jsx($t,{string:`Allow ${e} to write to these objects`}),d.jsx(Qa,{items:l,onItemChange:s,showSelectAll:o.length>=2,searchPlaceholder:"Search objects...",itemName:"objects"})]})}function uA(){return d.jsx(d.Fragment,{children:d.jsx(cA,{})})}const dA="_authenticationRow_1g2ms_1",pA="_field_1g2ms_8",fA="_value_1g2ms_12",Ds={authenticationRow:dA,field:pA,value:fA};function ld({label:e,value:t}){return d.jsxs("div",{className:Ds.authenticationRow,children:[d.jsx("div",{className:Ds.field,children:e}),d.jsx("div",{className:Ds.value,children:t})]})}function hA(){const{selectedConnection:e}=cn(),{providerName:t}=ut(),r=e?.provider==="salesforce"?"subdomain":"workspace",i=`${t} ${r}`;return d.jsxs(d.Fragment,{children:[d.jsx($t,{string:"Connection details"}),d.jsxs("div",{style:{paddingBottom:"1rem"},children:[d.jsx(ld,{label:i,value:e?.providerWorkspaceRef}),d.jsx(ld,{label:"Status",value:Xt(e?.status||"")})]})]})}function mA(){const{installation:e}=st(),{providerName:t}=ut();return e?d.jsxs(d.Fragment,{children:[d.jsx($t,{string:"Uninstall entire integration"}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e?.id?d.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall the entire ",t," ","integration. You will lose any configuration you've set up."]}):d.jsx("p",{children:"You've successfully uninstalled the integration."}),d.jsx(Il,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function gA(){const{installation:e,resetComponent:t}=st();return d.jsxs(d.Fragment,{children:[d.jsx(hA,{}),d.jsx(yl,{}),e&&d.jsx(mA,{}),!e&&d.jsx(Tf,{resetComponent:t})]})}function zh({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){const{installation:o}=ln(),{hydratedRevision:s,loading:a}=yr(),{configureState:l,selectedObjectName:c}=qt(),u=o?.config,p=u&&c&&!!Af(u,c)||!1,h=c?Hf(u,c):void 0,f=l?.read?.selectedFieldMappings,m=!Df(h,f),v=s&&c?xl(u,s,c):void 0,y=l?.read?.selectedOptionalFields,x=!Mf(v,y),g=c?u?.content?.read?.objects?.[c]?.selectedValueMappings:void 0,b=l?.read?.selectedValueMappings,I=!Lf(g,b),O=u?.content?.write?.objects,_=l?.write?.selectedWriteObjects,R=!Bf(O||{},_||{}),j=x||m||I||R||r||c!==Mr&&!p,L=!!s?.content?.read?.objects?.find(fe=>fe.objectName===c)?.error,H=a||n||!l||!c||!j||L,P=c===Mr,B=c===_o,X=d.jsx(je,{type:"submit",disabled:H,children:r?"Install":"Save"}),le=d.jsx(je,{type:"button",onClick:t,disabled:H,variant:"ghost",children:"Reset"});return n?d.jsx(vi,{}):d.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[d.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!B&&d.jsxs(d.Fragment,{children:[X,le]})}),d.jsxs(kn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&d.jsx(Oi,{children:typeof i=="string"?i:"Installation Failed."}),a&&d.jsx(vi,{}),s&&!P&&!B&&d.jsx(sA,{}),s&&P&&!B&&d.jsx(uA,{}),!a&&B&&d.jsx(gA,{})]})]})}const Kh=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o,fieldMapping:s}=st(),{hydratedRevision:a,loading:l}=yr(),{selectedObjectName:c}=Cl(),{selectedConnection:u}=cn(),p=Bd(),{projectIdOrName:h}=Ke(),{resetBoundary:f,setErrors:m,setError:v,getError:y}=vn(),{resetConfigureState:x,objectConfigurationsState:g}=Sl(),b=Jf(c||"",g),{onNextIncompleteTab:I}=uk(),O=w.useCallback(()=>{f(Ie.INSTALLATION_MUTATION)},[f]),_=w.useCallback(k=>k?A=>{v(Ie.INSTALLATION_MUTATION,k,A)}:A=>{console.error("objectName is required to set installation error: ",A)},[v]),R=w.useCallback(k=>k?y(Ie.INSTALLATION_MUTATION,k):"",[y]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:a,loading:l,selectedObjectName:c,selectedConnection:u,apiKey:p,projectIdOrName:h,resetBoundary:f,setErrors:m,setMutateInstallationError:_,getMutateInstallationError:R,resetMutateInstallationErrorState:O,resetConfigureState:x,objectConfigurationsState:g,configureState:b,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:I,fieldMapping:s}},yA=void 0;function vA(){const{consumerRef:e,setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:i,selectedConnection:o,resetBoundary:s,setErrors:a,setMutateInstallationError:l,getMutateInstallationError:c,resetMutateInstallationErrorState:u,resetConfigureState:p,objectConfigurationsState:h,configureState:f,onInstallSuccess:m,onNextIncompleteTab:v,fieldMapping:y}=Kh(),[x,g]=w.useState(!1),{createInstallation:b}=qa(),I=i===Mr,O=c(i),_=w.useCallback(()=>{s(Ie.MAPPING),n?.content&&!r&&i&&qf(n,yA,i,p)},[s,n,r,i,p]);w.useEffect(()=>{!f&&n?.content&&!r&&_()},[f,h,n,r,_]);const R=()=>{u();const{requiredMapFields:F,selectedFieldMappings:j}=f?.read||{},{errorList:L}=jf(F,j,a);if(!(L.length>0))if(i&&o?.id&&e&&n){g(!0);const H=ok(f,i,n,e,y);if(!H){console.error("Error when generating createConfig from configureState"),g(!1);return}b({config:H.content,onSuccess:P=>{t(P),m?.(P.id,P.config),g(!1),v()},onError:P=>{l(i)(P.message),g(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},k=()=>{if(u(),i&&o?.id&&e&&n){g(!0);const F=ak(f,n,e);if(!F){console.error("Error when generating createConfig from configureState"),g(!1);return}b({config:F.content,onSuccess:j=>{t(j),m?.(j.id,j.config),g(!1),v()},onError:j=>{l(i)(j.message),g(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},A=F=>{F.preventDefault(),I?k():R()};return d.jsx(zh,{errorMsg:O,isCreateMode:!0,isLoading:x,onSave:A,onReset:_})}const bA=(e,t,n)=>{const r=Vf(e),i=Uf(e),o=zf(t,n),s=Kf(e);return{content:{read:{objects:{[t]:{objectName:t,selectedFields:r,selectedFieldMappings:i,dynamicMappingsInput:o,selectedValueMappings:s||{}}}}}}},wA=e=>({content:{write:{objects:Qf(e)}}});function xA({installation:e}){const{setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:i,resetBoundary:o,setErrors:s,setMutateInstallationError:a,getMutateInstallationError:l,resetConfigureState:c,configureState:u,onUpdateSuccess:p,onNextIncompleteTab:h,fieldMapping:f}=Kh(),{updateInstallation:m}=dp(),[v,y]=w.useState(!1),x=i===Mr,g=l(i),{config:b}=e,I=w.useCallback(()=>{o(Ie.MAPPING),n?.content&&!r&&i&&qf(n,b,i,c)},[o,n,r,i,b,c]);w.useEffect(()=>{u||I()},[u,I]);const O=w.useMemo(()=>n?.content?.read?.objects?.find(F=>F?.objectName===i),[n,i]),_=()=>{const{requiredMapFields:A,selectedFieldMappings:F}=u?.read||{},{errorList:j}=jf(A,F,s);if(!(j.length>0))if(n&&u&&i&&O){y(!0);const L=bA(u,i,f);if(!L){console.error("Error when generating updateConfig from configureState"),y(!1);return}m({config:L.content,onSuccess:H=>{t(H),p?.(H.id,H.config),y(!1),h()},onError:H=>{a(i)(H.message),y(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},R=()=>{if(u&&n){y(!0);const A=wA(u);if(!A){console.error("Error when generating write updateConfig from configureState"),y(!1);return}m({config:A.content,onSuccess:F=>{t(F),p?.(F.id,F.config),y(!1),h()},onError:F=>{a(i)(F.message),y(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},k=A=>{A.preventDefault(),x?R():_()};return d.jsx(zh,{errorMsg:g,onSave:k,onReset:I,isLoading:v})}function IA(){const{integrationObj:e,installation:t}=st();return e?t&&e?d.jsx(xA,{installation:t}):d.jsx(vA,{}):d.jsx(ip,{message:"We can't load the integration"})}function CA({provider:e}){const{providerName:t}=ut(e),n=`You have successfully installed your ${t} integration.`;return d.jsx(Ga,{text:n,children:d.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:d.jsx(Il,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const SA=e=>{const{read:t,write:n}=e?.content??{};return!t&&!n};function OA({children:e}){const t=w.useRef(!1),{projectIdOrName:n}=Ke(),{hydratedRevision:r,loading:i}=yr(),{integrationObj:o,installation:s,groupRef:a,consumerRef:l,onInstallSuccess:c,isIntegrationDeleted:u}=st(),{mutate:p,isIdle:h,isPending:f,error:m,errorMsg:v}=cp(),{selectedConnection:y,isConnectionsLoading:x}=cn(),g=i||f||x,b=r?.content?.provider,I=SA(r);return w.useEffect(()=>{if(!g&&!x&&r&&I&&!s&&y&&o?.id&&!u&&b){const O={projectIdOrName:n,integrationId:o?.id,installation:{groupRef:a,connectionId:y?.id,config:{content:{provider:b}}}};Wf(r)===!0&&(O.installation.config.content.proxy=r?.content?.proxy),h&&!t.current&&p(O,{onSuccess:_=>{t.current||(c?.(_?.id,_.config),t.current=!0)}})}},[r,I,s,y,n,o?.id,a,l,g,c,u,x,b,p,h]),I&&b&&s?d.jsx(CA,{provider:b}):m?d.jsx(ot,{message:v??"Create installation failed"}):o?g?d.jsx(mr,{}):d.jsx("div",{children:e}):d.jsx(ot,{message:"We can't load the integration"})}function _A(e){const t=e+"CollectionProvider",[n,r]=Bo(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:y,children:x}=v,g=w.useRef(null),b=w.useRef(new Map).current;return d.jsx(i,{scope:y,itemMap:b,collectionRef:g,children:x})};s.displayName=t;const a=e+"CollectionSlot",l=ta(a),c=w.forwardRef((v,y)=>{const{scope:x,children:g}=v,b=o(a,x),I=Rr(y,b.collectionRef);return d.jsx(l,{ref:I,children:g})});c.displayName=a;const u=e+"CollectionItemSlot",p="data-radix-collection-item",h=ta(u),f=w.forwardRef((v,y)=>{const{scope:x,children:g,...b}=v,I=w.useRef(null),O=Rr(y,I),_=o(u,x);return w.useEffect(()=>(_.itemMap.set(I,{ref:I,...b}),()=>{_.itemMap.delete(I)})),d.jsx(h,{[p]:"",ref:O,children:g})});f.displayName=u;function m(v){const y=o(e+"CollectionConsumer",v);return w.useCallback(()=>{const g=y.collectionRef.current;if(!g)return[];const b=Array.from(g.querySelectorAll(`[${p}]`));return Array.from(y.itemMap.values()).sort((_,R)=>b.indexOf(_.ref.current)-b.indexOf(R.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},m,r]}var EA=J[" useId ".trim().toString()]||(()=>{}),NA=0;function Hh(e){const[t,n]=J.useState(EA());return bi(()=>{n(r=>r??String(NA++))},[e]),e||(t?`radix-${t}`:"")}function TA(e){const t=J.useRef(e);return J.useEffect(()=>{t.current=e}),J.useMemo(()=>(...n)=>t.current?.(...n),[])}var kA=J.createContext(void 0);function Jh(e){const t=J.useContext(kA);return e||t||"ltr"}var Ls="rovingFocusGroup.onEntryFocus",RA={bubbles:!1,cancelable:!0},Pi="RovingFocusGroup",[Ca,Wh,AA]=_A(Pi),[FA,Qh]=Bo(Pi,[AA]),[PA,jA]=FA(Pi),Gh=J.forwardRef((e,t)=>d.jsx(Ca.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Ca.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(MA,{...e,ref:t})})}));Gh.displayName=Pi;var MA=J.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...p}=e,h=J.useRef(null),f=Rr(t,h),m=Jh(o),[v,y]=Ua({prop:s,defaultProp:a??null,onChange:l,caller:Pi}),[x,g]=J.useState(!1),b=TA(c),I=Wh(n),O=J.useRef(!1),[_,R]=J.useState(0);return J.useEffect(()=>{const k=h.current;if(k)return k.addEventListener(Ls,b),()=>k.removeEventListener(Ls,b)},[b]),d.jsx(PA,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:v,onItemFocus:J.useCallback(k=>y(k),[y]),onItemShiftTab:J.useCallback(()=>g(!0),[]),onFocusableItemAdd:J.useCallback(()=>R(k=>k+1),[]),onFocusableItemRemove:J.useCallback(()=>R(k=>k-1),[]),children:d.jsx(Rn.div,{tabIndex:x||_===0?-1:0,"data-orientation":r,...p,ref:f,style:{outline:"none",...e.style},onMouseDown:rn(e.onMouseDown,()=>{O.current=!0}),onFocus:rn(e.onFocus,k=>{const A=!O.current;if(k.target===k.currentTarget&&A&&!x){const F=new CustomEvent(Ls,RA);if(k.currentTarget.dispatchEvent(F),!F.defaultPrevented){const j=I().filter(X=>X.focusable),L=j.find(X=>X.active),H=j.find(X=>X.id===v),B=[L,H,...j].filter(Boolean).map(X=>X.ref.current);Zh(B,u)}}O.current=!1}),onBlur:rn(e.onBlur,()=>g(!1))})})}),Xh="RovingFocusGroupItem",Yh=J.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=e,l=Hh(),c=o||l,u=jA(Xh,n),p=u.currentTabStopId===c,h=Wh(n),{onFocusableItemAdd:f,onFocusableItemRemove:m,currentTabStopId:v}=u;return J.useEffect(()=>{if(r)return f(),()=>m()},[r,f,m]),d.jsx(Ca.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:d.jsx(Rn.span,{tabIndex:p?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:rn(e.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:rn(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:rn(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=BA(y,u.orientation,u.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let b=h().filter(I=>I.focusable).map(I=>I.ref.current);if(x==="last")b.reverse();else if(x==="prev"||x==="next"){x==="prev"&&b.reverse();const I=b.indexOf(y.currentTarget);b=u.loop?$A(b,I+1):b.slice(I+1)}setTimeout(()=>Zh(b))}}),children:typeof s=="function"?s({isCurrentTabStop:p,hasTabStop:v!=null}):s})})});Yh.displayName=Xh;var DA={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function LA(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function BA(e,t,n){const r=LA(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return DA[r]}function Zh(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function $A(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var qA=Gh,VA=Yh,Yo="Tabs",[UA]=Bo(Yo,[Qh]),em=Qh(),[zA,zl]=UA(Yo),tm=J.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=Jh(a),[p,h]=Ua({prop:r,onChange:i,defaultProp:o??"",caller:Yo});return d.jsx(zA,{scope:n,baseId:Hh(),value:p,onValueChange:h,orientation:s,dir:u,activationMode:l,children:d.jsx(Rn.div,{dir:u,"data-orientation":s,...c,ref:t})})});tm.displayName=Yo;var nm="TabsList",rm=J.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=zl(nm,n),s=em(n);return d.jsx(qA,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:d.jsx(Rn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});rm.displayName=nm;var im="TabsTrigger",om=J.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=zl(im,n),a=em(n),l=am(s.baseId,r),c=lm(s.baseId,r),u=r===s.value;return d.jsx(VA,{asChild:!0,...a,focusable:!i,active:u,children:d.jsx(Rn.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...o,ref:t,onMouseDown:rn(e.onMouseDown,p=>{!i&&p.button===0&&p.ctrlKey===!1?s.onValueChange(r):p.preventDefault()}),onKeyDown:rn(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&s.onValueChange(r)}),onFocus:rn(e.onFocus,()=>{const p=s.activationMode!=="manual";!u&&!i&&p&&s.onValueChange(r)})})})});om.displayName=im;var sm="TabsContent",KA=J.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=zl(sm,n),l=am(a.baseId,r),c=lm(a.baseId,r),u=r===a.value,p=J.useRef(u);return J.useEffect(()=>{const h=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(h)},[]),d.jsx(za,{present:i||u,children:({present:h})=>d.jsx(Rn.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:h&&o})})});KA.displayName=sm;function am(e,t){return`${e}-trigger-${t}`}function lm(e,t){return`${e}-content-${t}`}var HA=tm,JA=rm,cm=om;const WA=d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[d.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),d.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function QA(e,t){return t?w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},w.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?WA:d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:d.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function GA(){return d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("path",{d:"M8 11C9.65685 11 11 9.65685 11 8C11 6.34315 9.65685 5 8 5C6.34315 5 5 6.34315 5 8C5 9.65685 6.34315 11 8 11Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M12.3378 5.04365C12.4882 5.25907 12.62 5.48699 12.7315 5.7249L14.3503 6.6249C14.5524 7.5302 14.5545 8.4687 14.3565 9.3749L12.7315 10.2749C12.62 10.5128 12.4882 10.7407 12.3378 10.9562L12.369 12.8124C11.683 13.4375 10.871 13.9085 9.98776 14.1937L8.39401 13.2374C8.13185 13.2562 7.86868 13.2562 7.60651 13.2374L6.01901 14.1874C5.13295 13.9075 4.31832 13.4383 3.63151 12.8124L3.66276 10.9624C3.51356 10.744 3.38189 10.5141 3.26901 10.2749L1.65026 9.3749C1.44814 8.46961 1.446 7.53111 1.64401 6.6249L3.26901 5.7249C3.38056 5.48699 3.5123 5.25907 3.66276 5.04365L3.63151 3.1874C4.31754 2.56226 5.1295 2.09128 6.01276 1.80615L7.60651 2.7624C7.86868 2.74365 8.13185 2.74365 8.39401 2.7624L9.98151 1.8124C10.8676 2.09234 11.6822 2.5615 12.369 3.1874L12.3378 5.04365Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const XA="_tabsRoot_ktpr0_1",YA="_tabsList_ktpr0_6",ZA="_tabTrigger_ktpr0_12",Ro={tabsRoot:XA,tabsList:YA,tabTrigger:ZA};function eF(){return d.jsxs(d.Fragment,{children:[d.jsx(Qo,{style:{margin:"1rem 0"}}),d.jsx(cm,{value:_o,className:Ro.tabTrigger,children:d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[d.jsx(GA,{}),d.jsx("span",{children:"Manage"})]})})]})}function um({objectName:e,completed:t,pending:n,displayName:r,disabled:i}){return d.jsx(cm,{value:e,className:Ro.tabTrigger,children:d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[QA(!i&&t,n),d.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[d.jsx("span",{children:r||e}),n&&d.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function tF({completed:e,pending:t,displayName:n}){return d.jsxs(d.Fragment,{children:[d.jsx(Qo,{style:{margin:"1rem 0"}}),d.jsx(um,{objectName:Mr,completed:e,pending:t,displayName:n},"other-write")]})}function nF({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i}){const{data:o}=Xd(),{installation:s}=ln(),a=s?.config,l=a?.content?.write?.objects,c=r?.other?.write?.selectedWriteObjects;return d.jsx(HA,{value:e,className:Ro.tabsRoot,onValueChange:n,children:d.jsxs(JA,{className:Ro.tabsList,children:[t.map(u=>{const p=a?.content?.read?.objects?.[u.name],h=r?.[u.name],f=Hf(a,u.name),m=h?.read?.selectedFieldMappings,v=!Df(f,m),y=o?xl(a,o,u.name):void 0,x=h?.read?.selectedOptionalFields,g=!Mf(y,x),b=p?.selectedValueMappings,I=h?.read?.selectedValueMappings,O=!Lf(b,I),_=g||v||O||!1;return d.jsx(um,{objectName:u.name,displayName:u.displayName,completed:u.completed,disabled:u.disabled,pending:_},u.name)}),i&&(()=>{const u=!Bf(l||{},c||{});return d.jsx(tF,{completed:i.completed,pending:u,displayName:"Write"})})(),d.jsx(eF,{})]})})}function rF(e,t){return t===_o?{name:_o,completed:!1}:e.find(n=>n.name===t)}function iF({children:e}){const{data:t}=an(),{installation:n}=st(),{providerName:r}=ut(),{hydratedRevision:i}=yr(),{objectConfigurationsState:o}=Sl(),[s,a]=w.useState(""),l=t?.appName||"",c=n?.config,u=i&&Ff(c,i),p=u!==null,h=!!i?.content?.write,f=h?Pf(c):void 0,m=w.useMemo(()=>{const x=[...u||[]];return f&&h&&x.push(f),x},[u,f,h]),v=rF(m,s),y=w.useCallback(()=>{const x=m.find(g=>v!==g&&!g.completed);x&&a(x.name)},[m,v]);return w.useEffect(()=>{!s&&m.length>0&&a(m[0].name)},[m,s,y]),d.jsx(Yf.Provider,{value:y,children:d.jsx(Xf.Provider,{value:v?.name,children:d.jsxs(qr,{style:{maxWidth:"55rem"},children:[d.jsxs(kn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[d.jsxs("div",{style:{width:"20rem"},children:[d.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),d.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:l}),p&&d.jsx(nF,{value:s,readNavObjects:u,onValueChange:x=>a(x),objectConfigurationsState:o,writeNavObject:f})]}),e]}),d.jsx(Tp,{})]})})})}function oF({...e}){return d.jsx(iF,{...e})}const sF=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,variant:c})=>{const{installation:u,isPending:p}=ln(),{projectIdOrName:h,isLoading:f}=an(),{isLoading:m}=Si(),{isError:v,errorState:y}=vn(),{seed:x,reset:g}=Va(),b=w.useRef(!1),[I,O]=w.useState(!1),_=w.useRef(x);return w.useEffect(()=>{_.current!==x&&(_.current=x,O(!1))},[x]),w.useEffect(()=>{c==="wizard"&&!u&&!p&&(b.current=!0)},[c,u,p]),f||m?d.jsx(mr,{}):v(Ie.PROJECT,h)?d.jsx(ot,{message:`Error loading project ${h}`}):v(Ie.INTEGRATION_LIST,h)?d.jsx(ot,{message:"Error retrieving integrations for the project, double check the API key"}):y[Ie.INTEGRATION_LIST]?.apiError?d.jsx(ot,{message:"Something went wrong, couldn't find integration information"}):b.current&&!I?d.jsx(XT,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,fieldMapping:l,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,onEditConfiguration:()=>O(!0)},x+1):d.jsx("div",{className:bl.resetContainer,children:d.jsx(ap,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,resetComponent:g,children:d.jsx($a,{children:d.jsx(vl,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,resetComponent:g,children:d.jsx(ck,{resetComponent:g,children:d.jsx(OA,{children:d.jsx(pk,{children:d.jsx(oF,{children:d.jsx(IA,{})})})})})})})},x)})};function aF(e){const{integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o}=e;return d.jsx(Lo,{fallback:d.jsx(ot,{message:"Something went wrong, couldn't find integration information"}),children:d.jsx(Do,{integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:d.jsx(sF,{...e})})})}function lF(){return d.jsxs(qr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[d.jsx(vi,{}),d.jsx("p",{children:"Redirecting"})]})}function cF({redirectURL:e,children:t}){return w.useEffect(()=>{e&&window.location.replace(e)},[e]),e?d.jsx(lF,{}):t}function uF({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,module:s,onSuccess:a,onDisconnectSuccess:l,onConnectSuccess:c}){const{seed:u,reset:p}=Va(),h=w.useCallback(f=>{a?a(f.id):c&&c(f)},[a,c]);return d.jsx(Lo,{fallback:d.jsx(ot,{message:"Something went wrong with the connection. Please try again."}),children:d.jsx("div",{className:bl.resetContainer,children:d.jsx(Do,{integration:"connect-provider-dummy-string",consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:d.jsx($a,{groupRef:r,provider:e,children:d.jsx(vl,{resetComponent:p,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,module:s,onSuccess:h,onDisconnectSuccess:l,children:d.jsx(cF,{redirectURL:o,children:d.jsx(va,{resetComponent:p,provider:e,onDisconnectSuccess:l})})})})})},u)})}const dF=(e,t,n)=>{const{data:r,isLoading:i,isError:o,error:s}=Pa(e,t,n),a=(r?.length||0)>0,l=!!r&&!i,u=r?.[0]?.config;return w.useEffect(()=>{o&&Ye(s)},[o,s]),{isLoaded:l,isIntegrationInstalled:a,isLoading:i,config:u,isError:o,error:s}};exports.AmpersandContext=Ra;exports.AmpersandErrorBoundary=Lo;exports.AmpersandProvider=Ux;exports.ConnectProvider=uF;exports.FieldSettingWriteOnCreateEnum=Mg;exports.FieldSettingWriteOnUpdateEnum=Dg;exports.InstallIntegration=aF;exports.InstallationProvider=Do;exports.useAmpersandProviderProps=Ke;exports.useConfig=aI;exports.useConnection=Ma;exports.useCreateInstallation=qa;exports.useDeleteInstallation=AI;exports.useInstallation=ln;exports.useIsIntegrationInstalled=dF;exports.useLocalConfig=Mo;exports.useManifest=Tn;exports.useUpdateInstallation=dp;
19
+ `}),n}function Fu(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Pu(e,t){const n=RE(e,t),r=n.one(e,void 0),i=wE(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
20
+ `},i),o}function ME(e,t){return e&&"run"in e?async function(n,r){const i=Pu(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Pu(n,{file:r,...e||t})}}function ju(e){if(e)throw e}var Ss,Mu;function DE(){if(Mu)return Ss;Mu=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},o=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var u=e.call(c,"constructor"),p=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!p)return!1;var h;for(h in c);return typeof h>"u"||e.call(c,h)},s=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(e.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return Ss=function l(){var c,u,p,h,f,y,m=arguments[0],g=1,x=arguments.length,b=!1;for(typeof m=="boolean"&&(b=m,m=arguments[1]||{},g=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});g<x;++g)if(c=arguments[g],c!=null)for(u in c)p=a(m,u),h=a(c,u),m!==h&&(b&&h&&(o(h)||(f=i(h)))?(f?(f=!1,y=p&&i(p)?p:[]):y=p&&o(p)?p:{},s(m,{name:u,newValue:l(b,y,h)})):typeof h<"u"&&s(m,{name:u,newValue:h}));return m},Ss}var LE=DE();const Os=Br(LE);function ma(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function BE(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...i);function a(l,...c){const u=e[++o];let p=-1;if(l){s(l);return}for(;++p<i.length;)(c[p]===null||c[p]===void 0)&&(c[p]=i[p]);i=c,u?qE(u,a)(...c):s(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function qE(e,t){let n;return r;function r(...s){const a=e.length>s.length;let l;a&&s.push(i);try{l=e.apply(this,s)}catch(c){const u=c;if(a&&n)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(s,...a){n||(n=!0,t(s,...a))}function o(s){i(null,s)}}const fn={basename:$E,dirname:VE,extname:UE,join:zE,sep:"/"};function $E(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');_i(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else s<0&&(o=!0,s=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function VE(e){if(_i(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function UE(e){_i(e);let t=e.length,n=-1,r=0,i=-1,o=0,s;for(;t--;){const a=e.codePointAt(t);if(a===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),a===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function zE(...e){let t=-1,n;for(;++t<e.length;)_i(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":KE(n)}function KE(e){_i(e);const t=e.codePointAt(0)===47;let n=HE(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function HE(e,t){let n="",r=0,i=-1,o=0,s=-1,a,l;for(;++s<=e.length;){if(s<e.length)a=e.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(i===s-1||o===1))if(i!==s-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=s,o=0;continue}}else if(n.length>0){n="",r=0,i=s,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,o=0}else a===46&&o>-1?o++:o=-1}return n}function _i(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const JE={cwd:WE};function WE(){return"/"}function ga(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function QE(e){if(typeof e=="string")e=new URL(e);else if(!ga(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return GE(e)}function GE(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const _s=["history","path","basename","stem","extname","dirname"];class Xf{constructor(t){let n;t?ga(t)?n={path:t}:typeof t=="string"||XE(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":JE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<_s.length;){const o=_s[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)_s.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?fn.basename(this.path):void 0}set basename(t){Ns(t,"basename"),Es(t,"basename"),this.path=fn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?fn.dirname(this.path):void 0}set dirname(t){Du(this.basename,"dirname"),this.path=fn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?fn.extname(this.path):void 0}set extname(t){if(Es(t,"extname"),Du(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=fn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ga(t)&&(t=QE(t)),Ns(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?fn.basename(this.path,this.extname):void 0}set stem(t){Ns(t,"stem"),Es(t,"stem"),this.path=fn.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new xt(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Es(e,t){if(e&&e.includes(fn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+fn.sep+"`")}function Ns(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Du(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function XE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const YE=(function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),ZE={}.hasOwnProperty;class Tl extends YE{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=BE()}copy(){const t=new Tl;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Os(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Rs("data",this.frozen),this.namespace[t]=n,this):ZE.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Rs("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=no(t),r=this.parser||this.Parser;return Ts("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ts("process",this.parser||this.Parser),ks("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,s){const a=no(t),l=r.parse(a);r.run(l,a,function(u,p,h){if(u||!p||!h)return c(u);const f=p,y=r.stringify(f,h);nN(y)?h.value=y:h.result=y,c(u,h)});function c(u,p){u||!p?s(u):o?o(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),Ts("processSync",this.parser||this.Parser),ks("processSync",this.compiler||this.Compiler),this.process(t,i),Bu("processSync","process",n),r;function i(o,s){n=!0,ju(o),r=s}}run(t,n,r){Lu(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(s,a){const l=no(n);i.run(t,l,c);function c(u,p,h){const f=p||t;u?a(u):s?s(f):r(void 0,f,h)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),Bu("runSync","run",r),i;function o(s,a){ju(s),i=a,r=!0}}stringify(t,n){this.freeze();const r=no(n),i=this.compiler||this.Compiler;return ks("stringify",i),Lu(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Rs("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...p]=c;l(u,p)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=Os(!0,i.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const p=c[u];o(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let p=-1,h=-1;for(;++p<r.length;)if(r[p][0]===c){h=p;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[f,...y]=u;const m=r[h][1];ma(m)&&ma(f)&&(f=Os(!0,m,f)),r[h]=[c,f,...y]}}}}const eN=new Tl().freeze();function Ts(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ks(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Rs(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Lu(e){if(!ma(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Bu(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function no(e){return tN(e)?e:new Xf(e)}function tN(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function nN(e){return typeof e=="string"||rN(e)}function rN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const iN="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",qu=[],$u={allowDangerousHtml:!0},oN=/^(https?|ircs?|mailto|xmpp)$/i,sN=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function aN(e){const t=lN(e),n=cN(e);return uN(t.runSync(t.parse(n),n),e)}function lN(e){const t=e.rehypePlugins||qu,n=e.remarkPlugins||qu,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...$u}:$u;return eN().use($_).use(n).use(ME,r).use(t)}function cN(e){const t=e.children||"",n=new Xf;return typeof t=="string"&&(n.value=t),n}function uN(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||dN;for(const u of sN)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+iN+u.id,void 0);return Gf(e,c),wO(e,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(u,p,h){if(u.type==="raw"&&h&&typeof p=="number")return s?h.children.splice(p,1):h.children[p]={type:"text",value:u.value},p;if(u.type==="element"){let f;for(f in xs)if(Object.hasOwn(xs,f)&&Object.hasOwn(u.properties,f)){const y=u.properties[f],m=xs[f];(m===null||m.includes(u.tagName))&&(u.properties[f]=l(String(y||""),f,u))}}if(u.type==="element"){let f=n?!n.includes(u.tagName):o?o.includes(u.tagName):!1;if(!f&&r&&typeof p=="number"&&(f=!r(u,p,h)),f&&h&&typeof p=="number")return a&&u.children?h.children.splice(p,1,...u.children):h.children.splice(p,1),p}}}function dN(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||oN.test(e.slice(0,t))?e:""}const pN="_container_r1dnc_1",fN="_code_r1dnc_9",Vu={container:pN,code:fN};function hN({prompt:e}){return d.jsx("div",{className:Vu.container,children:d.jsx(aN,{components:{p:({children:t})=>d.jsx(d.Fragment,{children:t}),code:({children:t})=>d.jsx("code",{className:Vu.code,children:t})},children:e})})}function kl({url:e,providerDisplayName:t,credentialName:n,prompt:r}){return d.jsxs("div",{style:{marginBottom:"0.5rem"},children:[d.jsxs("p",{style:{color:"var(--amp-colors-text-muted)",marginBottom:r?"0.25rem":"0rem",lineHeight:"1.5"},children:[d.jsx(gf,{href:e,newTab:!0,children:d.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]}),r&&d.jsx(hN,{prompt:r})]})}const Pr=Math.min,or=Math.max,_o=Math.round,ro=Math.floor,zn=e=>({x:e,y:e}),mN={left:"right",right:"left",bottom:"top",top:"bottom"},gN={start:"end",end:"start"};function ya(e,t,n){return or(e,Pr(t,n))}function Ei(e,t){return typeof e=="function"?e(t):e}function ur(e){return e.split("-")[0]}function Ni(e){return e.split("-")[1]}function Yf(e){return e==="x"?"y":"x"}function Rl(e){return e==="y"?"height":"width"}function jr(e){return["top","bottom"].includes(ur(e))?"y":"x"}function Al(e){return Yf(jr(e))}function yN(e,t,n){n===void 0&&(n=!1);const r=Ni(e),i=Al(e),o=Rl(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Eo(s)),[s,Eo(s)]}function vN(e){const t=Eo(e);return[va(e),t,va(t)]}function va(e){return e.replace(/start|end/g,t=>gN[t])}function bN(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 wN(e,t,n,r){const i=Ni(e);let o=bN(ur(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(va)))),o}function Eo(e){return e.replace(/left|right|bottom|top/g,t=>mN[t])}function xN(e){return{top:0,right:0,bottom:0,left:0,...e}}function Zf(e){return typeof e!="number"?xN(e):{top:e,right:e,bottom:e,left:e}}function No(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 Uu(e,t,n){let{reference:r,floating:i}=e;const o=jr(t),s=Al(t),a=Rl(s),l=ur(t),c=o==="y",u=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let f;switch(l){case"top":f={x:u,y:r.y-i.height};break;case"bottom":f={x:u,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(Ni(t)){case"start":f[s]-=h*(n&&c?-1:1);break;case"end":f[s]+=h*(n&&c?-1:1);break}return f}const IN=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:p}=Uu(c,r,l),h=r,f={},y=0;for(let m=0;m<a.length;m++){const{name:g,fn:x}=a[m],{x:b,y:v,data:I,reset:O}=await x({x:u,y:p,initialPlacement:r,placement:h,strategy:i,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=b??u,p=v??p,f={...f,[g]:{...f[g],...I}},O&&y<=50&&(y++,typeof O=="object"&&(O.placement&&(h=O.placement),O.rects&&(c=O.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):O.rects),{x:u,y:p}=Uu(c,h,l)),m=-1)}return{x:u,y:p,placement:h,strategy:i,middlewareData:f}};async function eh(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:h=!1,padding:f=0}=Ei(t,e),y=Zf(f),g=a[h?p==="floating"?"reference":"floating":p],x=No(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b=p==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),I=await(o.isElement==null?void 0:o.isElement(v))?await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1}:{x:1,y:1},O=No(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:v,strategy:l}):b);return{top:(x.top-O.top+y.top)/I.y,bottom:(O.bottom-x.bottom+y.bottom)/I.y,left:(x.left-O.left+y.left)/I.x,right:(O.right-x.right+y.right)/I.x}}const CN=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=Ei(e,t)||{};if(c==null)return{};const p=Zf(u),h={x:n,y:r},f=Al(i),y=Rl(f),m=await s.getDimensions(c),g=f==="y",x=g?"top":"left",b=g?"bottom":"right",v=g?"clientHeight":"clientWidth",I=o.reference[y]+o.reference[f]-h[f]-o.floating[y],O=h[f]-o.reference[f],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let R=E?E[v]:0;(!R||!await(s.isElement==null?void 0:s.isElement(E)))&&(R=a.floating[v]||o.floating[y]);const T=I/2-O/2,A=R/2-m[y]/2-1,F=Pr(p[x],A),j=Pr(p[b],A),L=F,H=R-m[y]-j,P=R/2-m[y]/2+T,B=ya(L,P,H),X=!l.arrow&&Ni(i)!=null&&P!==B&&o.reference[y]/2-(P<L?F:j)-m[y]/2<0,le=X?P<L?P-L:P-H:0;return{[f]:h[f]+le,data:{[f]:B,centerOffset:P-B-le,...X&&{alignmentOffset:le}},reset:X}}}),SN=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:l,elements:c}=t,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:m=!0,...g}=Ei(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const x=ur(i),b=jr(a),v=ur(a)===a,I=await(l.isRTL==null?void 0:l.isRTL(c.floating)),O=h||(v||!m?[Eo(a)]:vN(a)),E=y!=="none";!h&&E&&O.push(...wN(a,m,y,I));const R=[a,...O],T=await eh(t,g),A=[];let F=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&A.push(T[x]),p){const P=yN(i,s,I);A.push(T[P[0]],T[P[1]])}if(F=[...F,{placement:i,overflows:A}],!A.every(P=>P<=0)){var j,L;const P=(((j=o.flip)==null?void 0:j.index)||0)+1,B=R[P];if(B)return{data:{index:P,overflows:F},reset:{placement:B}};let X=(L=F.filter(le=>le.overflows[0]<=0).sort((le,fe)=>le.overflows[1]-fe.overflows[1])[0])==null?void 0:L.placement;if(!X)switch(f){case"bestFit":{var H;const le=(H=F.filter(fe=>{if(E){const ge=jr(fe.placement);return ge===b||ge==="y"}return!0}).map(fe=>[fe.placement,fe.overflows.filter(ge=>ge>0).reduce((ge,C)=>ge+C,0)]).sort((fe,ge)=>fe[1]-ge[1])[0])==null?void 0:H[0];le&&(X=le);break}case"initialPlacement":X=a;break}if(i!==X)return{reset:{placement:X}}}return{}}}};async function ON(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=ur(n),a=Ni(n),l=jr(n)==="y",c=["left","top"].includes(s)?-1:1,u=o&&l?-1:1,p=Ei(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:y}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof y=="number"&&(f=a==="end"?y*-1:y),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}const _N=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,l=await ON(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},EN=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x,y:b}=g;return{x,y:b}}},...l}=Ei(e,t),c={x:n,y:r},u=await eh(t,l),p=jr(ur(i)),h=Yf(p);let f=c[h],y=c[p];if(o){const g=h==="y"?"top":"left",x=h==="y"?"bottom":"right",b=f+u[g],v=f-u[x];f=ya(b,f,v)}if(s){const g=p==="y"?"top":"left",x=p==="y"?"bottom":"right",b=y+u[g],v=y-u[x];y=ya(b,y,v)}const m=a.fn({...t,[h]:f,[p]:y});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:o,[p]:s}}}}}};function Ko(){return typeof window<"u"}function zr(e){return th(e)?(e.nodeName||"").toLowerCase():"#document"}function Lt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function wn(e){var t;return(t=(th(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function th(e){return Ko()?e instanceof Node||e instanceof Lt(e).Node:!1}function on(e){return Ko()?e instanceof Element||e instanceof Lt(e).Element:!1}function yn(e){return Ko()?e instanceof HTMLElement||e instanceof Lt(e).HTMLElement:!1}function zu(e){return!Ko()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Lt(e).ShadowRoot}function Ti(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=sn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function NN(e){return["table","td","th"].includes(zr(e))}function Ho(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Fl(e){const t=Pl(),n=on(e)?sn(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 TN(e){let t=Kn(e);for(;yn(t)&&!Mr(t);){if(Fl(t))return t;if(Ho(t))return null;t=Kn(t)}return null}function Pl(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Mr(e){return["html","body","#document"].includes(zr(e))}function sn(e){return Lt(e).getComputedStyle(e)}function Jo(e){return on(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Kn(e){if(zr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||zu(e)&&e.host||wn(e);return zu(t)?t.host:t}function nh(e){const t=Kn(e);return Mr(t)?e.ownerDocument?e.ownerDocument.body:e.body:yn(t)&&Ti(t)?t:nh(t)}function xi(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=nh(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=Lt(i);if(o){const a=ba(s);return t.concat(s,s.visualViewport||[],Ti(i)?i:[],a&&n?xi(a):[])}return t.concat(i,xi(i,[],n))}function ba(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function rh(e){const t=sn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=yn(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=_o(n)!==o||_o(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function jl(e){return on(e)?e:e.contextElement}function Er(e){const t=jl(e);if(!yn(t))return zn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=rh(t);let s=(o?_o(n.width):n.width)/r,a=(o?_o(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const kN=zn(0);function ih(e){const t=Lt(e);return!Pl()||!t.visualViewport?kN:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function RN(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Lt(e)?!1:t}function dr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=jl(e);let s=zn(1);t&&(r?on(r)&&(s=Er(r)):s=Er(e));const a=RN(o,n,r)?ih(o):zn(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,p=i.height/s.y;if(o){const h=Lt(o),f=r&&on(r)?Lt(r):r;let y=h,m=ba(y);for(;m&&r&&f!==y;){const g=Er(m),x=m.getBoundingClientRect(),b=sn(m),v=x.left+(m.clientLeft+parseFloat(b.paddingLeft))*g.x,I=x.top+(m.clientTop+parseFloat(b.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,p*=g.y,l+=v,c+=I,y=Lt(m),m=ba(y)}}return No({width:u,height:p,x:l,y:c})}function AN(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=wn(r),a=t?Ho(t.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=zn(1);const u=zn(0),p=yn(r);if((p||!p&&!o)&&((zr(r)!=="body"||Ti(s))&&(l=Jo(r)),yn(r))){const h=dr(r);c=Er(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function FN(e){return Array.from(e.getClientRects())}function wa(e,t){const n=Jo(e).scrollLeft;return t?t.left+n:dr(wn(e)).left+n}function PN(e){const t=wn(e),n=Jo(e),r=e.ownerDocument.body,i=or(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=or(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+wa(e);const a=-n.scrollTop;return sn(r).direction==="rtl"&&(s+=or(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function jN(e,t){const n=Lt(e),r=wn(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const c=Pl();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function MN(e,t){const n=dr(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=yn(e)?Er(e):zn(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function Ku(e,t,n){let r;if(t==="viewport")r=jN(e,n);else if(t==="document")r=PN(wn(e));else if(on(t))r=MN(t,n);else{const i=ih(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return No(r)}function oh(e,t){const n=Kn(e);return n===t||!on(n)||Mr(n)?!1:sn(n).position==="fixed"||oh(n,t)}function DN(e,t){const n=t.get(e);if(n)return n;let r=xi(e,[],!1).filter(a=>on(a)&&zr(a)!=="body"),i=null;const o=sn(e).position==="fixed";let s=o?Kn(e):e;for(;on(s)&&!Mr(s);){const a=sn(s),l=Fl(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Ti(s)&&!l&&oh(e,s))?r=r.filter(u=>u!==s):i=a,s=Kn(s)}return t.set(e,r),r}function LN(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Ho(t)?[]:DN(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const p=Ku(t,u,i);return c.top=or(p.top,c.top),c.right=Pr(p.right,c.right),c.bottom=Pr(p.bottom,c.bottom),c.left=or(p.left,c.left),c},Ku(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function BN(e){const{width:t,height:n}=rh(e);return{width:t,height:n}}function qN(e,t,n){const r=yn(t),i=wn(t),o=n==="fixed",s=dr(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=zn(0);if(r||!r&&!o)if((zr(t)!=="body"||Ti(i))&&(a=Jo(t)),r){const f=dr(t,!0,o,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else i&&(l.x=wa(i));let c=0,u=0;if(i&&!r&&!o){const f=i.getBoundingClientRect();u=f.top+a.scrollTop,c=f.left+a.scrollLeft-wa(i,f)}const p=s.left+a.scrollLeft-l.x-c,h=s.top+a.scrollTop-l.y-u;return{x:p,y:h,width:s.width,height:s.height}}function As(e){return sn(e).position==="static"}function Hu(e,t){if(!yn(e)||sn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return wn(e)===n&&(n=n.ownerDocument.body),n}function sh(e,t){const n=Lt(e);if(Ho(e))return n;if(!yn(e)){let i=Kn(e);for(;i&&!Mr(i);){if(on(i)&&!As(i))return i;i=Kn(i)}return n}let r=Hu(e,t);for(;r&&NN(r)&&As(r);)r=Hu(r,t);return r&&Mr(r)&&As(r)&&!Fl(r)?n:r||TN(e)||n}const $N=async function(e){const t=this.getOffsetParent||sh,n=this.getDimensions,r=await n(e.floating);return{reference:qN(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function VN(e){return sn(e).direction==="rtl"}const UN={convertOffsetParentRelativeRectToViewportRelativeRect:AN,getDocumentElement:wn,getClippingRect:LN,getOffsetParent:sh,getElementRects:$N,getClientRects:FN,getDimensions:BN,getScale:Er,isElement:on,isRTL:VN};function zN(e,t){let n=null,r;const i=wn(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const{left:c,top:u,width:p,height:h}=e.getBoundingClientRect();if(a||t(),!p||!h)return;const f=ro(u),y=ro(i.clientWidth-(c+p)),m=ro(i.clientHeight-(u+h)),g=ro(c),b={rootMargin:-f+"px "+-y+"px "+-m+"px "+-g+"px",threshold:or(0,Pr(1,l))||1};let v=!0;function I(O){const E=O[0].intersectionRatio;if(E!==l){if(!v)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}v=!1}try{n=new IntersectionObserver(I,{...b,root:i.ownerDocument})}catch{n=new IntersectionObserver(I,b)}n.observe(e)}return s(!0),o}function KN(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:l=!1}=r,c=jl(e),u=i||o?[...c?xi(c):[],...xi(t)]:[];u.forEach(x=>{i&&x.addEventListener("scroll",n,{passive:!0}),o&&x.addEventListener("resize",n)});const p=c&&a?zN(c,n):null;let h=-1,f=null;s&&(f=new ResizeObserver(x=>{let[b]=x;b&&b.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let y,m=l?dr(e):null;l&&g();function g(){const x=dr(e);m&&(x.x!==m.x||x.y!==m.y||x.width!==m.width||x.height!==m.height)&&n(),m=x,y=requestAnimationFrame(g)}return n(),()=>{var x;u.forEach(b=>{i&&b.removeEventListener("scroll",n),o&&b.removeEventListener("resize",n)}),p?.(),(x=f)==null||x.disconnect(),f=null,l&&cancelAnimationFrame(y)}}const HN=_N,JN=EN,WN=SN,QN=CN,Ju=(e,t,n)=>{const r=new Map,i={platform:UN,...n},o={...i.platform,_c:r};return IN(e,t,{...i,platform:o})};const GN="react-tooltip-core-styles",XN="react-tooltip-base-styles",Wu={core:!1,base:!1};function Qu({css:e,id:t=XN,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||Wu[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=GN),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.id=t,l.type="text/css",s==="top"&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e)),Wu[n]=!0}const Gu=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[HN(Number(i)),WN({fallbackAxisSideDirection:"start"}),JN({padding:5})],border:a,arrowSize:l=8})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(QN({element:n,padding:5})),Ju(e,t,{placement:r,strategy:o,middleware:c}).then((({x:u,y:p,placement:h,middlewareData:f})=>{var y,m;const g={left:`${u}px`,top:`${p}px`,border:a},{x,y:b}=(y=f.arrow)!==null&&y!==void 0?y:{x:0,y:0},v=(m={top:"bottom",right:"left",bottom:"top",left:"right"}[h.split("-")[0]])!==null&&m!==void 0?m:"bottom",I=a&&{borderBottom:a,borderRight:a};let O=0;if(a){const E=`${a}`.match(/(\d+)px/);O=E?.[1]?Number(E[1]):1}return{tooltipStyles:g,tooltipArrowStyles:{left:x!=null?`${x}px`:"",top:b!=null?`${b}px`:"",right:"",bottom:"",...I,[v]:`-${l/2+O}px`},place:h}}))):Ju(e,t,{placement:"bottom",strategy:o,middleware:c}).then((({x:u,y:p,placement:h})=>({tooltipStyles:{left:`${u}px`,top:`${p}px`},tooltipArrowStyles:{},place:h})))},Xu=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Yu=(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},Zu=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",xa=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((i,o)=>xa(i,t[o])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Zu(e)||!Zu(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((i=>xa(e[i],t[i])))},YN=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"}))},ed=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(YN(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},ZN=typeof window<"u"?w.useLayoutEffect:w.useEffect,Jt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},eT="DEFAULT_TOOLTIP_ID",tT={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},nT=w.createContext({getTooltipData:()=>tT});function ah(e=eT){return w.useContext(nT).getTooltipData(e)}var Cr={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"},Fs={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 rT=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i="dark",anchorId:o,anchorSelect:s,place:a="top",offset:l=10,events:c=["hover"],openOnClick:u=!1,positionStrategy:p="absolute",middlewares:h,wrapper:f,delayShow:y=0,delayHide:m=0,float:g=!1,hidden:x=!1,noArrow:b=!1,clickable:v=!1,closeOnEsc:I=!1,closeOnScroll:O=!1,closeOnResize:E=!1,openEvents:R,closeEvents:T,globalCloseEvents:A,imperativeModeOnly:F,style:j,position:L,afterShow:H,afterHide:P,disableTooltip:B,content:X,contentWrapperRef:le,isOpen:fe,defaultIsOpen:ge=!1,setIsOpen:C,previousActiveAnchor:W,activeAnchor:q,setActiveAnchor:S,border:U,opacity:V,arrowColor:Y,arrowSize:ie=8,role:ne="tooltip"})=>{var se;const ee=w.useRef(null),me=w.useRef(null),$=w.useRef(null),ye=w.useRef(null),Z=w.useRef(null),[qe,Fe]=w.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ae,Qe]=w.useState(!1),[et,tt]=w.useState(!1),[xe,at]=w.useState(null),It=w.useRef(!1),dt=w.useRef(null),{anchorRefs:Xe,setActiveAnchor:D}=ah(t),K=w.useRef(!1),[M,re]=w.useState([]),ce=w.useRef(!1),Ue=u||c.includes("click"),Ct=Ue||R?.click||R?.dblclick||R?.mousedown,pt=R?{...R}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!R&&Ue&&Object.assign(pt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const gt=T?{...T}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!T&&Ue&&Object.assign(gt,{mouseleave:!1,blur:!1,mouseout:!1});const Pe=A?{...A}:{escape:I||!1,scroll:O||!1,resize:E||!1,clickOutsideAnchor:Ct||!1};F&&(Object.assign(pt,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(gt,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Pe,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),ZN((()=>(ce.current=!0,()=>{ce.current=!1})),[]);const Oe=te=>{ce.current&&(te&&tt(!0),setTimeout((()=>{ce.current&&(C?.(te),fe===void 0&&Qe(te))}),10))};w.useEffect((()=>{if(t){if(Ae){pe(W);const ue=te(q),Se=[...new Set([...ue,t])].filter(Boolean).join(" ");q?.setAttribute("aria-describedby",Se)}else pe(q);return()=>{pe(q),pe(W)}}function te(ue){var Se;return((Se=ue?.getAttribute("aria-describedby"))===null||Se===void 0?void 0:Se.split(" "))||[]}function pe(ue){const Se=te(ue).filter((je=>je!==t));Se.length?ue?.setAttribute("aria-describedby",Se.join(" ")):ue?.removeAttribute("aria-describedby")}}),[q,Ae,t,W]),w.useEffect((()=>{if(fe===void 0)return()=>null;fe&&tt(!0);const te=setTimeout((()=>{Qe(fe)}),10);return()=>{clearTimeout(te)}}),[fe]),w.useEffect((()=>{if(Ae!==It.current)if(Jt(Z),It.current=Ae,Ae)H?.();else{const te=(pe=>{const ue=pe.match(/^([\d.]+)(ms|s)$/);if(!ue)return 0;const[,Se,je]=ue;return Number(Se)*(je==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));Z.current=setTimeout((()=>{tt(!1),at(null),P?.()}),te+25)}}),[Ae]);const St=te=>{Fe((pe=>xa(pe,te)?pe:te))},ft=(te=y)=>{Jt($),et?Oe(!0):$.current=setTimeout((()=>{Oe(!0)}),te)},Et=(te=m)=>{Jt(ye),ye.current=setTimeout((()=>{K.current||Oe(!1)}),te)},An=te=>{var pe;if(!te)return;const ue=(pe=te.currentTarget)!==null&&pe!==void 0?pe:te.target;if(!ue?.isConnected)return S(null),void D({current:null});y?ft():Oe(!0),S(ue),D({current:ue}),Jt(ye)},Fn=()=>{v?Et(m||100):m?Et():Oe(!1),Jt($)},Pn=({x:te,y:pe})=>{var ue;const Se={getBoundingClientRect:()=>({x:te,y:pe,width:0,height:0,top:pe,left:te,right:te,bottom:pe})};Gu({place:(ue=xe?.place)!==null&&ue!==void 0?ue:a,offset:l,elementReference:Se,tooltipReference:ee.current,tooltipArrowReference:me.current,strategy:p,middlewares:h,border:U,arrowSize:ie}).then((je=>{St(je)}))},dn=te=>{if(!te)return;const pe=te,ue={x:pe.clientX,y:pe.clientY};Pn(ue),dt.current=ue},Zt=te=>{var pe;if(!Ae)return;const ue=te.target;ue.isConnected&&(!((pe=ee.current)===null||pe===void 0)&&pe.contains(ue)||[document.querySelector(`[id='${o}']`),...M].some((Se=>Se?.contains(ue)))||(Oe(!1),Jt($)))},jn=Yu(An,50),ze=Yu(Fn,50),nt=te=>{ze.cancel(),jn(te)},de=()=>{jn.cancel(),ze()},Ce=w.useCallback((()=>{var te,pe;const ue=(te=xe?.position)!==null&&te!==void 0?te:L;ue?Pn(ue):g?dt.current&&Pn(dt.current):q?.isConnected&&Gu({place:(pe=xe?.place)!==null&&pe!==void 0?pe:a,offset:l,elementReference:q,tooltipReference:ee.current,tooltipArrowReference:me.current,strategy:p,middlewares:h,border:U,arrowSize:ie}).then((Se=>{ce.current&&St(Se)}))}),[Ae,q,X,j,a,xe?.place,l,p,L,xe?.position,g,ie]);w.useEffect((()=>{var te,pe;const ue=new Set(Xe);M.forEach((_e=>{B?.(_e)||ue.add({current:_e})}));const Se=document.querySelector(`[id='${o}']`);Se&&!B?.(Se)&&ue.add({current:Se});const je=()=>{Oe(!1)},Vt=ed(q),Ut=ed(ee.current);Pe.scroll&&(window.addEventListener("scroll",je),Vt?.addEventListener("scroll",je),Ut?.addEventListener("scroll",je));let ht=null;Pe.resize?window.addEventListener("resize",je):q&&ee.current&&(ht=KN(q,ee.current,Ce,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const Nt=_e=>{_e.key==="Escape"&&Oe(!1)};Pe.escape&&window.addEventListener("keydown",Nt),Pe.clickOutsideAnchor&&window.addEventListener("click",Zt);const Me=[],yt=_e=>!!(_e?.target&&q?.contains(_e.target)),Zo=_e=>{Ae&&yt(_e)||An(_e)},es=_e=>{Ae&&yt(_e)&&Fn()},Pi=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],ji=["click","dblclick","mousedown","mouseup"];Object.entries(pt).forEach((([_e,en])=>{en&&(Pi.includes(_e)?Me.push({event:_e,listener:nt}):ji.includes(_e)&&Me.push({event:_e,listener:Zo}))})),Object.entries(gt).forEach((([_e,en])=>{en&&(Pi.includes(_e)?Me.push({event:_e,listener:de}):ji.includes(_e)&&Me.push({event:_e,listener:es}))})),g&&Me.push({event:"pointermove",listener:dn});const Mi=()=>{K.current=!0},pn=()=>{K.current=!1,Fn()},Di=v&&(gt.mouseout||gt.mouseleave);return Di&&((te=ee.current)===null||te===void 0||te.addEventListener("mouseover",Mi),(pe=ee.current)===null||pe===void 0||pe.addEventListener("mouseout",pn)),Me.forEach((({event:_e,listener:en})=>{ue.forEach((Hr=>{var Xn;(Xn=Hr.current)===null||Xn===void 0||Xn.addEventListener(_e,en)}))})),()=>{var _e,en;Pe.scroll&&(window.removeEventListener("scroll",je),Vt?.removeEventListener("scroll",je),Ut?.removeEventListener("scroll",je)),Pe.resize?window.removeEventListener("resize",je):ht?.(),Pe.clickOutsideAnchor&&window.removeEventListener("click",Zt),Pe.escape&&window.removeEventListener("keydown",Nt),Di&&((_e=ee.current)===null||_e===void 0||_e.removeEventListener("mouseover",Mi),(en=ee.current)===null||en===void 0||en.removeEventListener("mouseout",pn)),Me.forEach((({event:Hr,listener:Xn})=>{ue.forEach((vr=>{var Jr;(Jr=vr.current)===null||Jr===void 0||Jr.removeEventListener(Hr,Xn)}))}))}}),[q,Ce,et,Xe,M,R,T,A,Ue,y,m]),w.useEffect((()=>{var te,pe;let ue=(pe=(te=xe?.anchorSelect)!==null&&te!==void 0?te:s)!==null&&pe!==void 0?pe:"";!ue&&t&&(ue=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Se=new MutationObserver((je=>{const Vt=[],Ut=[];je.forEach((ht=>{if(ht.type==="attributes"&&ht.attributeName==="data-tooltip-id"&&(ht.target.getAttribute("data-tooltip-id")===t?Vt.push(ht.target):ht.oldValue===t&&Ut.push(ht.target)),ht.type==="childList"){if(q){const Nt=[...ht.removedNodes].filter((Me=>Me.nodeType===1));if(ue)try{Ut.push(...Nt.filter((Me=>Me.matches(ue)))),Ut.push(...Nt.flatMap((Me=>[...Me.querySelectorAll(ue)])))}catch{}Nt.some((Me=>{var yt;return!!(!((yt=Me?.contains)===null||yt===void 0)&&yt.call(Me,q))&&(tt(!1),Oe(!1),S(null),Jt($),Jt(ye),!0)}))}if(ue)try{const Nt=[...ht.addedNodes].filter((Me=>Me.nodeType===1));Vt.push(...Nt.filter((Me=>Me.matches(ue)))),Vt.push(...Nt.flatMap((Me=>[...Me.querySelectorAll(ue)])))}catch{}}})),(Vt.length||Ut.length)&&re((ht=>[...ht.filter((Nt=>!Ut.includes(Nt))),...Vt]))}));return Se.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Se.disconnect()}}),[t,s,xe?.anchorSelect,q]),w.useEffect((()=>{Ce()}),[Ce]),w.useEffect((()=>{if(!le?.current)return()=>null;const te=new ResizeObserver((()=>{setTimeout((()=>Ce()))}));return te.observe(le.current),()=>{te.disconnect()}}),[X,le?.current]),w.useEffect((()=>{var te;const pe=document.querySelector(`[id='${o}']`),ue=[...M,pe];q&&ue.includes(q)||S((te=M[0])!==null&&te!==void 0?te:pe)}),[o,M,q]),w.useEffect((()=>(ge&&Oe(!0),()=>{Jt($),Jt(ye)})),[]),w.useEffect((()=>{var te;let pe=(te=xe?.anchorSelect)!==null&&te!==void 0?te:s;if(!pe&&t&&(pe=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),pe)try{const ue=Array.from(document.querySelectorAll(pe));re(ue)}catch{re([])}}),[t,s,xe?.anchorSelect]),w.useEffect((()=>{$.current&&(Jt($),ft(y))}),[y]);const Ot=(se=xe?.content)!==null&&se!==void 0?se:X,xn=Ae&&Object.keys(qe.tooltipStyles).length>0;return w.useImperativeHandle(e,(()=>({open:te=>{if(te?.anchorSelect)try{document.querySelector(te.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${te.anchorSelect}" is not a valid CSS selector`)}at(te??null),te?.delay?ft(te.delay):Oe(!0)},close:te=>{te?.delay?Et(te.delay):Oe(!1)},activeAnchor:q,place:qe.place,isOpen:!!(et&&!x&&Ot&&xn)}))),et&&!x&&Ot?w.createElement(f,{id:t,role:ne,className:Xt("react-tooltip",Cr.tooltip,Fs.tooltip,Fs[i],n,`react-tooltip__place-${qe.place}`,Cr[xn?"show":"closing"],xn?"react-tooltip__show":"react-tooltip__closing",p==="fixed"&&Cr.fixed,v&&Cr.clickable),onTransitionEnd:te=>{Jt(Z),Ae||te.propertyName!=="opacity"||(tt(!1),at(null),P?.())},style:{...j,...qe.tooltipStyles,opacity:V!==void 0&&xn?V:void 0},ref:ee},Ot,w.createElement(f,{className:Xt("react-tooltip-arrow",Cr.arrow,Fs.arrow,r,b&&Cr.noArrow),style:{...qe.tooltipArrowStyles,background:Y?`linear-gradient(to right bottom, transparent 50%, ${Y} 50%)`:void 0,"--rt-arrow-size":`${ie}px`},ref:me})):null},iT=({content:e})=>w.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),oT=w.forwardRef((({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:o,className:s,classNameArrow:a,variant:l="dark",place:c="top",offset:u=10,wrapper:p="div",children:h=null,events:f=["hover"],openOnClick:y=!1,positionStrategy:m="absolute",middlewares:g,delayShow:x=0,delayHide:b=0,float:v=!1,hidden:I=!1,noArrow:O=!1,clickable:E=!1,closeOnEsc:R=!1,closeOnScroll:T=!1,closeOnResize:A=!1,openEvents:F,closeEvents:j,globalCloseEvents:L,imperativeModeOnly:H=!1,style:P,position:B,isOpen:X,defaultIsOpen:le=!1,disableStyleInjection:fe=!1,border:ge,opacity:C,arrowColor:W,arrowSize:q,setIsOpen:S,afterShow:U,afterHide:V,disableTooltip:Y,role:ie="tooltip"},ne)=>{const[se,ee]=w.useState(r),[me,$]=w.useState(i),[ye,Z]=w.useState(c),[qe,Fe]=w.useState(l),[Ae,Qe]=w.useState(u),[et,tt]=w.useState(x),[xe,at]=w.useState(b),[It,dt]=w.useState(v),[Xe,D]=w.useState(I),[K,M]=w.useState(p),[re,ce]=w.useState(f),[Ue,Ct]=w.useState(m),[pt,gt]=w.useState(null),[Pe,Oe]=w.useState(null),St=w.useRef(null),ft=w.useRef(fe),{anchorRefs:Et,activeAnchor:An}=ah(e),Fn=ze=>ze?.getAttributeNames().reduce(((nt,de)=>{var Ce;return de.startsWith("data-tooltip-")&&(nt[de.replace(/^data-tooltip-/,"")]=(Ce=ze?.getAttribute(de))!==null&&Ce!==void 0?Ce:null),nt}),{}),Pn=ze=>{const nt={place:de=>{var Ce;Z((Ce=de)!==null&&Ce!==void 0?Ce:c)},content:de=>{ee(de??r)},html:de=>{$(de??i)},variant:de=>{var Ce;Fe((Ce=de)!==null&&Ce!==void 0?Ce:l)},offset:de=>{Qe(de===null?u:Number(de))},wrapper:de=>{var Ce;M((Ce=de)!==null&&Ce!==void 0?Ce:p)},events:de=>{const Ce=de?.split(" ");ce(Ce??f)},"position-strategy":de=>{var Ce;Ct((Ce=de)!==null&&Ce!==void 0?Ce:m)},"delay-show":de=>{tt(de===null?x:Number(de))},"delay-hide":de=>{at(de===null?b:Number(de))},float:de=>{dt(de===null?v:de==="true")},hidden:de=>{D(de===null?I:de==="true")},"class-name":de=>{gt(de)}};Object.values(nt).forEach((de=>de(null))),Object.entries(ze).forEach((([de,Ce])=>{var Ot;(Ot=nt[de])===null||Ot===void 0||Ot.call(nt,Ce)}))};w.useEffect((()=>{ee(r)}),[r]),w.useEffect((()=>{$(i)}),[i]),w.useEffect((()=>{Z(c)}),[c]),w.useEffect((()=>{Fe(l)}),[l]),w.useEffect((()=>{Qe(u)}),[u]),w.useEffect((()=>{tt(x)}),[x]),w.useEffect((()=>{at(b)}),[b]),w.useEffect((()=>{dt(v)}),[v]),w.useEffect((()=>{D(I)}),[I]),w.useEffect((()=>{Ct(m)}),[m]),w.useEffect((()=>{ft.current!==fe&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[fe]),w.useEffect((()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:fe==="core",disableBase:fe}}))}),[]),w.useEffect((()=>{var ze;const nt=new Set(Et);let de=n;if(!de&&e&&(de=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),de)try{document.querySelectorAll(de).forEach((pe=>{nt.add({current:pe})}))}catch{console.warn(`[react-tooltip] "${de}" is not a valid CSS selector`)}const Ce=document.querySelector(`[id='${t}']`);if(Ce&&nt.add({current:Ce}),!nt.size)return()=>null;const Ot=(ze=Pe??Ce)!==null&&ze!==void 0?ze:An.current,xn=new MutationObserver((pe=>{pe.forEach((ue=>{var Se;if(!Ot||ue.type!=="attributes"||!(!((Se=ue.attributeName)===null||Se===void 0)&&Se.startsWith("data-tooltip-")))return;const je=Fn(Ot);Pn(je)}))})),te={attributes:!0,childList:!1,subtree:!1};if(Ot){const pe=Fn(Ot);Pn(pe),xn.observe(Ot,te)}return()=>{xn.disconnect()}}),[Et,An,Pe,t,n]),w.useEffect((()=>{P?.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),ge&&!Xu("border",`${ge}`)&&console.warn(`[react-tooltip] "${ge}" is not a valid \`border\`.`),P?.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),C&&!Xu("opacity",`${C}`)&&console.warn(`[react-tooltip] "${C}" is not a valid \`opacity\`.`)}),[]);let dn=h;const Zt=w.useRef(null);if(o){const ze=o({content:Pe?.getAttribute("data-tooltip-content")||se||null,activeAnchor:Pe});dn=ze?w.createElement("div",{ref:Zt,className:"react-tooltip-content-wrapper"},ze):null}else se&&(dn=se);me&&(dn=w.createElement(iT,{content:me}));const jn={forwardRef:ne,id:e,anchorId:t,anchorSelect:n,className:Xt(s,pt),classNameArrow:a,content:dn,contentWrapperRef:Zt,place:ye,variant:qe,offset:Ae,wrapper:K,events:re,openOnClick:y,positionStrategy:Ue,middlewares:g,delayShow:et,delayHide:xe,float:It,hidden:Xe,noArrow:O,clickable:E,closeOnEsc:R,closeOnScroll:T,closeOnResize:A,openEvents:F,closeEvents:j,globalCloseEvents:L,imperativeModeOnly:H,style:P,position:B,isOpen:X,defaultIsOpen:le,border:ge,opacity:C,arrowColor:W,arrowSize:q,setIsOpen:S,afterShow:U,afterHide:V,disableTooltip:Y,activeAnchor:Pe,previousActiveAnchor:St.current,setActiveAnchor:ze=>{Oe((nt=>(ze?.isSameNode(nt)||(St.current=nt),ze)))},role:ie};return w.createElement(rT,{...jn})}));typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||Qu({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;--rt-arrow-size:8px}.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;z-index:-1}.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||Qu({css:`
21
+ .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:var(--rt-arrow-size);height:var(--rt-arrow-size)}[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 sT(){return d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[d.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[d.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"}),d.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),d.jsx("defs",{children:d.jsx("clipPath",{id:"clip0_2896_16290",children:d.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function lh({id:e,tooltipText:t}){return d.jsxs(d.Fragment,{children:[d.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:sT()}),d.jsx(oT,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function ch({url:e,prompt:t,inputName:n}){return d.jsx("p",{style:{color:"var(--amp-colors-text-muted)",display:"flex",justifyContent:"space-between"},children:d.jsxs("span",{children:[e?d.jsx(gf,{href:e,newTab:!0,children:d.jsx("span",{style:{textDecoration:"underline"},children:n})}):d.jsx("span",{children:n})," ",t&&d.jsx(lh,{id:`docs-helper-text-${EI(n||t?.slice(0,50))}`,tooltipText:t})]})})}const aT="_metadataInputWrapper_1266b_1",lT={metadataInputWrapper:aT};function Kr({metadata:e,onChange:t,providerName:n,variant:r="standard",defaultValue:i}){return d.jsxs("div",{className:lT.metadataInputWrapper,children:[e.docsURL&&r==="standard"&&d.jsx(kl,{url:e.docsURL,providerDisplayName:n||"",credentialName:e.displayName||Yt(e.name.toLowerCase()),prompt:e.prompt}),r==="header"&&d.jsx(ch,{url:e.docsURL,prompt:e.prompt,inputName:e.displayName||e.name}),d.jsx(En.Input,{id:e.name,name:e.name,type:"text",placeholder:e.displayName||e.name,defaultValue:i,onChange:t})]})}function ki(e,t){const n={},r=[];if(e.forEach(i=>{const o=t[i.name];!o||o.trim()===""?r.push(i.displayName||i.name):n[i.name]={value:o,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function Hn(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function cT(e,t){const n=t?.modules;if(!(n&&Object.keys(n).length>0))return{module:"",error:null};const i=e||t.defaultModule;return i?{module:i,error:null}:{module:"",error:`Could not determine module for provider ${t?.name}`}}function uT(e,t){if(t==="")return e;const n=t.toLowerCase();return e.filter(r=>r.moduleDependencies?Object.keys(r.moduleDependencies).some(i=>i.toLowerCase()===n):!0)}function dT(e,t){if(t.length===0)return!1;const n=e.providerMetadata||{};return t.some(r=>{const i=n[r.name];return!i||!i.value||i.value.trim()===""})}function pT(e,t){if(!e||!t)return null;const n=t.modules;if(!(n&&Object.keys(n).length>0))return null;if(!Object.keys(n).some(o=>o.toLowerCase()===e.toLowerCase())){const o=Object.keys(n).join(", ");return`Invalid module "${e}" for provider ${t.name}. Valid modules: ${o}`}return null}function uh({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i,submitButtonType:o,metadataInputs:s}){const[a,l]=w.useState({apiKey:""}),c=x=>{const{name:b,value:v}=x.currentTarget;l(I=>({...I,[b]:v.trim()}))},{apiKey:u}=a,{providerName:p}=ut(e),h=u.length>0,f=Hn(s,a),y=r||!h||!f,m=t.apiKeyOpts?.docsURL,g=()=>{const x=ki(s,a);n({apiKey:u,providerMetadata:x})};return d.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[m&&d.jsx(kl,{url:m,providerDisplayName:p||Yt(e),credentialName:"API key"}),d.jsx(En.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:c}),s.map(x=>d.jsx(Kr,{metadata:x,onChange:c,providerName:p||Yt(e)},x.name)),d.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:y,type:o||"submit",onClick:g,variant:i,children:"Next"})]})}function fT({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i,metadataInputs:o}){const{providerName:s}=ut(e);return d.jsxs(Wn,{children:[d.jsx(Qn,{children:`Set up ${s} integration`}),d.jsx(bn,{error:r}),d.jsx(uh,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i||!!r,metadataInputs:o})]})}function hT({...e}){return d.jsx(fT,{...e})}const mT={backgroundColor:"var(--amp-colors-status-success-muted)",borderColor:"var(--amp-colors-status-success-muted)",color:"var(--amp-colors-status-success-dark)",padding:".5rem 1rem"};function Ri({children:e,style:t}){return d.jsx(kn,{style:{...mT,...t},children:e})}const Wo=()=>{const e=wt(),t=Ze(),[n,r]=w.useState(null);return{...Nn({mutationKey:["updateConnection"],mutationFn:async o=>(await e()).connectionApi.updateConnection(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},gT="_divider_1kmoj_1",td={divider:gT};function Qo({className:e,style:t}){return d.jsx("hr",{className:e?`${td.divider} ${e}`:td.divider,style:t})}function qt({string:e}){return d.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[d.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),d.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:d.jsx(Qo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function yT({provider:e}){const{projectIdOrName:t}=He(),{providerName:n,data:r}=ut(e),{selectedConnection:i,isConnectionsLoading:o}=cn(),{mutateAsync:s,isPending:a,error:l}=Wo(),[c,u]=w.useState(null),[p,h]=w.useState(!1),f=()=>h(!1),y=()=>{h(!0),u(null)},m=l?.message||c||null,g=async x=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:i?.id||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:x.apiKey}}},{onError:b=>{console.error("Update connection error:",b),Ke(b,u)},onSuccess:()=>{y()}})}catch(b){console.error("Update connection caught error:",b),Ke(b,u)}};return r?d.jsxs(d.Fragment,{children:[d.jsx(qt,{string:"Update connection"}),d.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[d.jsx("p",{children:`Update ${n} API Key`}),p&&d.jsx(Ri,{children:"Connection updated successfully"}),m&&d.jsx(Si,{children:`Error updating connection ${m}`}),d.jsx(uh,{provider:r?.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||o,buttonVariant:"ghost",submitButtonType:"button",metadataInputs:[]})]})]}):null}function dh({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i,metadataInputs:o}){const[s,a]=w.useState({username:"",password:""}),{username:l,password:c}=s,{providerName:u}=ut(e),p=g=>{const{name:x,value:b}=g.currentTarget;a(v=>({...v,[x]:b.trim()}))},h=Hn(o,s),f=r||!h,y=()=>{const g=ki(o,s);n({user:l,pass:c,providerMetadata:g})},m=t.basicOpts?.docsURL;return d.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[m&&d.jsx(kl,{url:m,providerDisplayName:u||Yt(e),credentialName:"credentials"}),d.jsx(En.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:p}),d.jsx(En.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:p}),o.map(g=>d.jsx(Kr,{metadata:g,onChange:p,providerName:u||Yt(e)},g.name)),d.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"button",onClick:y,variant:i,children:"Next"})]})}function vT({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i,metadataInputs:o}){const{providerName:s}=ut(e);return d.jsxs(Wn,{children:[d.jsx(Qn,{children:`Set up ${s} integration`}),d.jsx(bn,{error:r}),d.jsx(dh,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i||!!r,metadataInputs:o})]})}function bT({...e}){return d.jsx(vT,{...e})}function wT({provider:e}){const{projectIdOrName:t}=He(),{providerName:n,data:r}=ut(e),{selectedConnection:i,isConnectionsLoading:o}=cn(),{mutateAsync:s,isPending:a,error:l}=Wo(),[c,u]=w.useState(null),[p,h]=w.useState(!1),f=()=>h(!1),y=()=>{h(!0),u(null)},m=l?.message||c||null,g=async x=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:i?.id||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:x.user,password:x.pass}}}},{onError:b=>{console.error(b),Ke(b,u)},onSuccess:()=>{y()}})}catch(b){console.error(b),Ke(b,u)}};return r?d.jsxs(d.Fragment,{children:[d.jsx(qt,{string:"Update connection"}),d.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[d.jsx("p",{children:`Update ${n} credentials`}),p&&d.jsx(Ri,{children:"Connection updated successfully"}),m&&d.jsx(Si,{children:`Error updating connection: ${m}`}),d.jsx(dh,{provider:r?.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||o,buttonVariant:"ghost",metadataInputs:[]})]})]}):null}function ph({handleSubmit:e,isButtonDisabled:t,explicitScopesRequired:n,buttonVariant:r,metadataInputs:i,providerName:o}){const[s,a]=w.useState({clientSecret:"",clientId:"",scopes:""}),[l,c]=w.useState(null),u=v=>{const{name:I,value:O}=v.currentTarget;a(E=>({...E,[I]:O.trim()})),c(null)},{clientSecret:p,clientId:h,scopes:f}=s,y=p.length>0,m=h.length>0,g=Hn(i,s),x=t||!y||!m||!g,b=()=>{const v=ki(i,s),I={clientId:h,clientSecret:p,providerMetadata:v};n&&f.length>0&&(I.scopes=OI(f)),e(I)};return d.jsxs(d.Fragment,{children:[d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[d.jsx(En.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:u}),d.jsx(En.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:u}),n&&d.jsx(En.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:u}),i.map(v=>d.jsx(Kr,{metadata:v,onChange:u,providerName:o},v.name))]}),d.jsx(bn,{error:l}),d.jsx("br",{}),d.jsx(Be,{style:{width:"100%"},disabled:x,type:"button",onClick:b,variant:r,children:"Next"})]})}function xT({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:i,metadataInputs:o}){return d.jsxs(Wn,{children:[d.jsx(Qn,{children:`Set up ${r} integration`}),d.jsx(bn,{error:t}),d.jsx("br",{}),d.jsx(ph,{handleSubmit:e,isButtonDisabled:n||!!t,explicitScopesRequired:i,metadataInputs:o,providerName:r})]})}function IT({provider:e}){const{projectIdOrName:t}=He(),{selectedConnection:n,isConnectionsLoading:r}=cn(),{providerName:i,data:o}=ut(e),{mutateAsync:s,isPending:a,error:l}=Wo(),[c,u]=w.useState(null),[p,h]=w.useState(!1),f=()=>{h(!1)},y=()=>{h(!0),u(null)},m=o?.oauth2Opts?.explicitScopesRequired,g=l?.message||c||null,x=async b=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:n?.id||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:b.clientId,clientSecret:b.clientSecret,scopes:b.scopes}}}}),y()}catch(v){Ke(v,u)}};return d.jsxs(d.Fragment,{children:[d.jsx(qt,{string:"Update connection"}),d.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[d.jsx("p",{children:`Re-authenticate to ${i}`}),p&&d.jsx(Ri,{children:"Connection updated successfully"}),g&&d.jsx(Si,{children:`Error updating connection ${g}`}),d.jsx(ph,{handleSubmit:x,isButtonDisabled:a||r,explicitScopesRequired:m,buttonVariant:"ghost",metadataInputs:[]})]})]})}const nd=600,rd=600,CT="AUTHORIZATION_SUCCEEDED",ST="AUTHORIZATION_FAILED";function OT(e,t,n,r){return w.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-nd)/2,o=window.screenY+(window.outerHeight-rd)/2.5,s=`width=${nd},height=${rd},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function _T(e,t,n,r){const i=Ze();return w.useCallback(o=>{if(o.origin===np){if(o.data.eventType===CT){const s=o.data.data?.connection;s?(e(s),i.setQueriesData({queryKey:["amp","connections"]},()=>[s]),t?.close(),r?.(),i.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:o})}o.data.eventType===ST&&(console.error("OAuth failed: ",{event:o}),n?.(o?.data?.message??"Something went wrong, try refreshing this page, and then try again."))}},[t,n,i,e,r])}function ET({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i,onSuccessConnect:o,isSuccessConnect:s,onWindowClose:a}){const[l,c]=w.useState(null),[u,p]=w.useState(null),h=Ze(),f=w.useRef(null),y=_T(c,u,r,o),m=OT(n,p,y,t);w.useEffect(()=>{t&&!u&&!l&&!i&&!s&&(r?.(null),m())},[t,u,m,l,i,s,r]);const g=w.useCallback(()=>{h.invalidateQueries({queryKey:["amp","connections"]}),p(null),!l&&!i?console.error("Window closed and no connection was found. Please try again."):l&&r?.(null),a?.()},[l,i,r,a,h]);return w.useEffect(()=>{if(u)return f.current=setInterval(()=>{u?.closed&&(f.current&&clearInterval(f.current),f.current=null,g())},500),()=>{f.current&&(clearInterval(f.current),f.current=null),window.removeEventListener("message",y)}},[g,u,y]),d.jsx("div",{children:e})}const NT=()=>{const e=wt(),t=Ze();return Nn({mutationKey:["updateOauthConnection"],mutationFn:async n=>!n.projectIdOrName||!n.connectionId?Promise.reject(new Error("Project ID and connection ID are required")):(await e()).oAuthApi.oauthUpdate(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function TT({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return d.jsxs("div",{style:{padding:"1rem 0"},children:[d.jsx("p",{children:`Re-authenticate to ${r}`}),d.jsx(bn,{error:t}),d.jsx(Be,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function kT({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=cn(),r=t?.id,i=t?.projectId,{providerName:o}=ut(e),{mutateAsync:s,isPending:a,error:l}=NT(),[c,u]=w.useState(null),[p,h]=w.useState(!1),[f,y]=w.useState(null),m=()=>{h(!1)},g=()=>{h(!0),u(null),y(null)},x=l?.message||c||null,b=async()=>{m(),u(null);try{const I=await s({projectIdOrName:i||"",connectionId:r||""});y(I)}catch(I){Ke(I,u)}},v=w.useCallback(I=>{u(I)},[]);return d.jsxs(d.Fragment,{children:[d.jsx(qt,{string:"Update connection"}),p&&d.jsx(Ri,{children:"Connection updated successfully"}),d.jsx(ET,{windowTitle:`Connect to ${o}`,oauthUrl:f||null,onError:v,error:x,isSuccessConnect:p,onSuccessConnect:g,children:d.jsx(TT,{handleSubmit:b,error:x,providerName:o,isButtonDisabled:a||n||p})})]})}function Ml({provider:e}){const{data:t}=fp(e);if(t?.authType===rc.Basic)return d.jsx(wT,{provider:e});if(t?.authType===rc.ApiKey)return d.jsx(yT,{provider:e});const n=t?.oauth2Opts?.grantType;if(n){if(n===is.AuthorizationCode||n===is.AuthorizationCodePkce)return d.jsx(kT,{provider:e});if(n===is.ClientCredentials)return d.jsx(IT,{provider:e})}return null}const RT=()=>{const e=wt(),t=Ze(),[n,r]=w.useState(null);return{...Nn({mutationKey:["deleteConnection"],mutationFn:async o=>(await e()).connectionApi.deleteConnection(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)},onError:o=>{console.error("Error deleting connection"),Ke(o,r)}}),errorMsg:n}};function fh({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i,onDisconnectError:o}){const{projectIdOrName:s}=He(),{selectedConnection:a}=cn(),{mutate:l,isPending:c}=RT(),u=!s||!a||!a.id||c,p=async()=>{u||(console.warn("deleting connection",{projectIdOrName:s,connectionId:a?.id}),l({projectIdOrName:s,connectionId:a?.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a?.id),r?.(a),i()},onError:y=>{Ke(y,o)}}))},h=c?"Pending...":e;return d.jsx(Be,{type:"button",onClick:p,disabled:u,variant:t,style:n,children:h})}function hh({resetComponent:e,onDisconnectSuccess:t}){return d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[d.jsx(qt,{string:"Remove connection"}),d.jsx("p",{children:"Click to disconnect your connection from the provider."}),d.jsx(fh,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}function AT({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,i]=w.useState(!1);return d.jsxs(d.Fragment,{children:[r===!1&&d.jsxs(d.Fragment,{children:[d.jsx(qt,{string:"Manage connection"}),d.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[d.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),d.jsx(Be,{type:"button",onClick:()=>i(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&d.jsxs(d.Fragment,{children:[d.jsx(Ml,{provider:n}),d.jsx(hh,{resetComponent:e,onDisconnectSuccess:t})]})]})}function Ia({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=an(),{providerName:i}=ut(e),o=`You have successfully connected your ${i} account to ${r}.`;return d.jsx(ml,{text:o,children:d.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:d.jsx(AT,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function Ai(){const e=wt(),t=Ze();return Nn({mutationKey:["createConnection"],mutationFn:async n=>(await e()).connectionApi.generateConnection(n),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error creating connection and loading provider info"),Ke(n)}})}function FT({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=He(),p=Ai(),h=w.useCallback(f=>{const{apiKey:y,providerMetadata:m}=f,g={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:m?.workspace?.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:y,...m&&{providerMetadata:m}}};p.mutate(g)},[u,o,i,r,n,e,p]);return a===null?d.jsx(hT,{provider:e,providerInfo:t,handleSubmit:h,error:c||null,metadataInputs:l}):s}function PT({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=He(),p=Ai(),h=w.useCallback(f=>{const{user:y,pass:m,providerMetadata:g}=f,x={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:g?.workspace?.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:y,password:m},...g&&{providerMetadata:g}}};p.mutate(x)},[u,o,i,r,n,e,p]);return a===null?d.jsx(bT,{provider:e,providerInfo:t,handleSubmit:h,error:c||null,metadataInputs:l}):s}function jT({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r,metadataInputs:i}){const[o,s]=w.useState({}),a=h=>{const{name:f,value:y}=h.currentTarget;s(m=>({...m,[f]:y.trim()}))},l=Hn(i,o),c=n||!l,u=e.customOpts?.inputs||[],p=()=>{const h=ki(i,o),f=Object.fromEntries(u.map(y=>[y.name,o[y.name]]));t({customAuth:f,providerMetadata:h})};return d.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[u.map(h=>d.jsxs("div",{children:[d.jsx(ch,{url:h.docsURL,prompt:h.prompt,inputName:h.displayName}),d.jsx(En.PasswordInput,{id:h.name,name:h.name,onChange:a,placeholder:""})]},h.name)),i.map(h=>d.jsx(Kr,{metadata:h,onChange:a,variant:"header"},h.name)),d.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:c,type:"submit",onClick:p,variant:r,children:"Next"})]})}function MT({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r,metadataInputs:i}){return d.jsxs(Wn,{children:[d.jsx(Qn,{children:`Set up ${e.displayName} integration`}),d.jsx(bn,{error:n}),d.jsx(jT,{providerInfo:e,handleSubmit:t,isButtonDisabled:r||!!n,metadataInputs:i})]})}function DT({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,metadataInputs:a,moduleError:l}){const{projectIdOrName:c}=He(),u=Ai(),[p,h]=w.useState(l||null),f=w.useCallback(y=>{const{customAuth:m,providerMetadata:g}=y;h(null);const x={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:g?.workspace?.value,groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:m,...g&&{providerMetadata:g}}};u.mutate(x,{onError:b=>{Ke(b,h)},onSuccess:()=>{h(null)}})},[c,i,r,n,t,e.name,u]);return s===null?d.jsx(MT,{providerInfo:e,handleSubmit:f,error:p,metadataInputs:a}):o}function LT({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 d.jsxs(Wn,{children:[d.jsx(Qn,{children:o||`Set up ${r} integration`}),d.jsx(bn,{error:t}),i,d.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function BT({...e}){return d.jsx(LT,{...e})}function qT({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,providerName:a,moduleError:l}){const{projectIdOrName:c}=He(),u=Ai(),p=w.useCallback(()=>{const h={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e}};u.mutate(h)},[c,i,r,n,t,e,u]);return s===null?d.jsx(BT,{handleSubmit:p,error:l||null,providerName:a}):o}const $T=()=>{const e=wt(),t=Ze();return Nn({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})},VT=Ba("VITE_AMP_ENABLE_CSRF",!1),UT=Ba("NEXT_AMP_ENABLE_CSRF",!1),zT=Ba("REACT_APP_AMP_ENABLE_CSRF",!1),KT=!!VT||!!UT||!!zT;function HT({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return d.jsxs(Wn,{children:[d.jsx(Qn,{children:`Set up ${r} integration`}),d.jsx(U0,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),d.jsx(bn,{error:t}),d.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n&&!t?"Loading...":"Next"})]})}function JT(e){return null}function WT({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,provider:i,providerName:o,metadataInputs:s}){const l=i.startsWith("salesforce")?JT():null,[c,u]=w.useState("authorize");return d.jsx(Wn,{children:d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[d.jsxs(Qn,{children:["Enter your ",o," workspace"]}),l,d.jsx(bn,{error:n}),s.map(p=>d.jsx(Kr,{metadata:p,onChange:h=>t(p.name,h.currentTarget.value),providerName:o},p.name)),d.jsx(Be,{style:{width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})})}const id=600,od=600;function QT({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o,metadataInputs:s,moduleError:a}){const{projectId:l}=an(),c=Ze(),u=w.useRef(null),[p,h]=w.useState(a||null),[f,y]=w.useState({}),[m,g]=w.useState({}),{mutateAsync:x,isPending:b}=$T(),{isFetching:v,refetch:I}=La({groupRef:r,provider:e});w.useEffect(()=>{const T=A=>{A.origin===np&&(A.data?.eventType==="AUTHORIZATION_SUCCEEDED"?(h(null),console.debug("New connection:",A.data.data.connection),c.invalidateQueries({queryKey:["amp","connections"]})):A.data?.eventType==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",A.data.data.error),c.invalidateQueries({queryKey:["amp","connections"]}),h(A.data.data.error||"An error occurred. Please try again.")),u.current?.close())};return window.addEventListener("message",T),()=>window.removeEventListener("message",T)},[c]);const O=(T,A)=>{y(F=>({...F,[T]:A})),g(F=>({...F,[T]:{value:A,source:"input"}}))},E=async()=>{h(null);try{const{data:T}=await I();if(T&&T.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(s.length>0&&!Hn(s,f)){h("Please fill in all required fields");return}try{const T=await x({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:l||"",consumerName:n,groupName:i,providerWorkspaceRef:m?.workspace?.value,providerMetadata:m,enableCSRFProtection:KT}});if(T){const A=window.screenX+(window.outerWidth-id)/2,F=window.screenY+(window.outerHeight-od)/2.5,j=`width=${id},height=${od},left=${A},top=${F}`;u.current=window.open(T,"OAuthPopup",j)}}catch(T){console.error(T),h(T instanceof Error?T.message:String(T)||"An error occurred. Please try again.")}},R=s.length>0?d.jsx(WT,{handleSubmit:E,setFormData:O,error:p,isButtonDisabled:!Hn(s,f)||b||v||!!p,provider:e,providerName:o,metadataInputs:s}):d.jsx(HT,{handleSubmit:E,error:p,providerName:o,isButtonDisabled:b||v||!!p});return d.jsx("div",{children:R})}function GT({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=He(),p=Ai(),[h,f]=w.useState(c||null),y=w.useCallback(m=>{f(null);const g={projectIdOrName:u,generateConnectionParams:{groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:m.providerMetadata?.workspace?.value,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes},...m.providerMetadata&&{providerMetadata:m.providerMetadata}}};p.mutate(g,{onError:()=>f("Error loading provider info")})},[u,o,i,r,n,e,p]);return a===null?d.jsx(xT,{providerName:t,handleSubmit:y,error:h,explicitScopesRequired:s,metadataInputs:l}):d.jsx(vi,{})}function XT({...e}){return d.jsx(GT,{...e})}const YT="authorizationCode",ZT="authorizationCodePKCE",ek="clientCredentials";function tk({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:a,metadataInputs:l,moduleError:c}){const{providerName:u}=ut(e);if(t.oauth2Opts===void 0)return d.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:p,explicitScopesRequired:h}=t.oauth2Opts,f={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:u,metadataInputs:l,moduleError:c};return p===YT||p===ZT?d.jsx(QT,{...f}):p===ek?d.jsx(XT,{...f,explicitScopesRequired:h,selectedConnection:s,setSelectedConnection:a}):p==="password"?d.jsx("em",{children:"Password flow not supported yet"}):d.jsxs("em",{children:["Unsupported grant type: ",p]})}function nk({connection:e,metadataInputs:t,providerName:n,onSuccess:r}){const{projectIdOrName:i}=He(),o=e.providerMetadata||{},s={};t.forEach(m=>{const g=o[m.name];g?.value&&(s[m.name]=g.value)});const[a,l]=w.useState(s),[c,u]=w.useState(null),{mutateAsync:p,isPending:h}=Wo(),f=(m,g)=>{l(x=>({...x,[m]:g}))},y=async()=>{if(u(null),!Hn(t,a)){u("Please fill in all required fields");return}try{const m=ki(t,a),g={...o,...m};await p({projectIdOrName:i||"",connectionId:e.id,updateConnectionRequest:{updateMask:["providerMetadata"],connection:{providerMetadata:g}}}),r()}catch(m){console.error("Error updating connection metadata:",m),u(m instanceof Error?m.message:"An error occurred while updating the connection.")}};return d.jsxs(Wn,{children:[d.jsxs(Qn,{children:["Additional information needed for ",n]}),d.jsx(bn,{error:c}),d.jsx("br",{}),t.map(m=>d.jsx(Kr,{metadata:m,onChange:g=>f(m.name,g.currentTarget.value),providerName:n,defaultValue:s[m.name]},m.name)),d.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:!Hn(t,a)||h,type:"submit",onClick:y,children:"Submit"})]})}function rk(e){const{selectedConnection:t}=cn();w.useEffect(()=>{e&&t&&e(t)},[e,t])}function ik({onSuccess:e}){rk(e)}function Dl({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,module:o,children:s,onSuccess:a,onDisconnectSuccess:l,resetComponent:c}){const{data:u,isLoading:p,isError:h,error:f,providerName:y,selectedProvider:m}=ut(e),{provider:g,isIntegrationDeleted:x,integrationObj:b}=st(),{selectedConnection:v,setSelectedConnection:I}=cn();ik({onSuccess:a});const O=Ze(),E=u,R=o||b?.latestRevision?.content?.module,{module:T,error:A}=cT(R,E),F=E?.metadata?.input||[],j=uT(F,T);w.useEffect(()=>{h&&(console.error("Error loading provider info."),Ke(f))},[h,f]);const L=w.useCallback(()=>{O.clear(),c()},[c,O]);if(!e&&!g)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(x)return d.jsx(ml,{text:"Integration successfully uninstalled.",children:d.jsx(Be,{type:"button",onClick:L,style:{width:"100%"},children:"Reinstall Integration"})});const H=pT(o,E);if(v)return H?d.jsx(ot,{message:H}):dT(v,j)?d.jsx(nk,{connection:v,metadataInputs:j,providerName:y,onSuccess:()=>{O.invalidateQueries({queryKey:["amp","connections"]})}}):s;if(p)return d.jsx(mr,{});if(E==null)return d.jsx(ot,{message:"Provider info was not found."});if(H)return d.jsx(ot,{message:H});const P={provider:m,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:v,setSelectedConnection:I,providerName:y,providerInfo:E,onDisconnectSuccess:l,metadataInputs:j,moduleError:A||H};return E.authType==="none"?d.jsx(qT,{...P,children:s}):E.authType==="basic"?d.jsx(PT,{...P,children:s}):E.authType==="apiKey"?d.jsx(FT,{...P,children:s}):E.authType==="custom"?d.jsx(DT,{...P,children:s}):d.jsx(tk,{...P})}const ok="_connectStep_ywqni_1",sk="_connected_ywqni_8",io={connectStep:ok,connected:sk};function ak({consumerRef:e,consumerName:t,groupRef:n,groupName:r,resetComponent:i}){const{goToStep:o}=un(),{provider:s}=st(),{selectedConnection:a}=cn(),l=w.useRef(!!a);return w.useEffect(()=>{!l.current&&a&&o(Gt.SelectObjects)},[a,o]),l.current&&a?d.jsx("div",{className:io.connectStep,children:d.jsxs("div",{className:io.connected,children:[d.jsx(Ia,{provider:s,resetComponent:i}),d.jsx(vo,{showBack:!1,onNext:()=>o(Gt.SelectObjects)})]})}):d.jsx("div",{className:io.connectStep,children:d.jsx(Dl,{consumerRef:e,consumerName:t,groupRef:n,groupName:r,resetComponent:i,children:d.jsxs("div",{className:io.connected,children:[d.jsx(Ia,{provider:s,resetComponent:i}),d.jsx(vo,{showBack:!1,onNext:()=>o(Gt.SelectObjects)})]})})})}const lk="_header_1akgr_1",ck="_title_1akgr_5",uk="_description_1akgr_12",Ps={header:lk,title:ck,description:uk};function mh({title:e,description:t}){return d.jsxs("div",{className:Ps.header,children:[d.jsx("h2",{className:Ps.title,children:e}),d.jsx("p",{className:Ps.description,children:t})]})}const dk="_reviewStep_6lrjz_1",pk="_summaryList_6lrjz_6",fk="_summaryCard_6lrjz_13",hk="_cardHeader_6lrjz_22",mk="_objectName_6lrjz_29",gk="_objectDescription_6lrjz_35",yk="_cardDetails_6lrjz_40",vk="_pill_6lrjz_46",bk="_cardMappings_6lrjz_56",wk="_mappingPill_6lrjz_63",xk="_error_6lrjz_73",Ik="_actions_6lrjz_82",Ck="_createButton_6lrjz_92",Tt={reviewStep:dk,summaryList:pk,summaryCard:fk,cardHeader:hk,objectName:mk,objectDescription:gk,cardDetails:yk,pill:vk,cardMappings:bk,mappingPill:wk,error:xk,actions:Ik,createButton:Ck};function Sk(){const{state:e,prevStep:t,nextStep:n,setSubmissionError:r}=un(),{selectedObjects:i}=e,o=Tn(),s=jo(),{createInstallation:a,isPending:l}=$a(),{onInstallSuccess:c,setInstallation:u}=st(),p=w.useMemo(()=>i.map(f=>{const y=o.getReadObject(f),m=s.readObject(f),g=(y?.getRequiredFields("no-mappings")??[]).filter(A=>"fieldName"in A).map(A=>"fieldName"in A?A.displayName||A.fieldName:""),x=(y?.getOptionalFields("no-mappings")??[]).filter(A=>{const F="fieldName"in A?A.fieldName:"";return F&&m?.getSelectedField(F)}).map(A=>"fieldName"in A?A.displayName||A.fieldName:""),b=[...y?.getRequiredMapFields()??[],...y?.getOptionalMapFields()??[]],v=o.getCustomerFieldsForObject(f).allFields??{},I=b.map(A=>{const F=m?.getFieldMapping(A.mapToName);if(!F)return null;const j=v[F]?.displayName||F,L=A.mapToDisplayName??A.mapToName;return{sourceLabel:j,destLabel:L,key:A.mapToName}}).filter(Boolean),O=y?.object?.mapToDisplayName||y?.object?.mapToName||null,R=!!s.writeObject(f).object,T=R;return{objectName:f,displayName:y?.object?.displayName||f,requiredFields:g,selectedOptionalFields:x,configuredMappings:I,objectMapTo:O,writeEnabled:R,bidirectional:T}}),[i,o,s]),h=w.useCallback(()=>{r(null),a({config:s.draft,onSuccess:f=>{u(f),c?.(f.id,f.config),n()},onError:f=>{r(f.message)}})},[a,s.draft,r,u,c,n]);return d.jsxs("div",{className:Tt.reviewStep,children:[d.jsx(mh,{title:"Review & Create",description:"Review your configuration before creating the installation."}),d.jsx("div",{className:Tt.summaryList,children:p.map(f=>d.jsxs("div",{className:Tt.summaryCard,children:[d.jsxs("div",{className:Tt.cardHeader,children:[d.jsx("span",{className:Tt.objectName,children:f.displayName}),d.jsxs("span",{className:Tt.objectDescription,children:["Reads",f.writeEnabled?" and writes":"",f.objectMapTo?` to ${f.objectMapTo}`:""]})]}),d.jsxs("div",{className:Tt.cardDetails,children:[f.requiredFields.map(y=>d.jsx("span",{className:Tt.pill,children:y},y)),f.selectedOptionalFields.map(y=>d.jsx("span",{className:Tt.pill,children:y},y))]}),f.configuredMappings.length>0&&d.jsx("div",{className:Tt.cardMappings,children:f.configuredMappings.map(y=>d.jsxs("span",{className:Tt.mappingPill,children:[y.sourceLabel," ",d.jsx(Wa,{})," ",y.destLabel]},y.key))})]},f.objectName))}),e.submissionError&&d.jsx("div",{className:Tt.error,children:e.submissionError}),d.jsxs("div",{className:Tt.actions,children:[d.jsx(Be,{type:"button",variant:"ghost",onClick:t,children:"Back"}),d.jsx(Be,{type:"button",className:Tt.createButton,onClick:h,disabled:l,children:l?"Creating...":"Create Installation"})]})]})}const Ok="_selectObjects_im90z_1",_k="_objectList_im90z_6",Ek="_objectCard_im90z_12",Nk="_selected_im90z_29",Tk="_checkbox_im90z_34",kk="_objectInfo_im90z_42",Rk="_objectName_im90z_49",Ak="_writeToggle_im90z_69",Fk="_writeToggleLabel_im90z_77",Pk="_toggleSwitch_im90z_83",jk="_toggleSlider_im90z_97",Mk="_loading_im90z_126",Dk="_error_im90z_127",Lk="_empty_im90z_128",bt={selectObjects:Ok,objectList:_k,objectCard:Ek,selected:Nk,checkbox:Tk,objectInfo:kk,objectName:Rk,writeToggle:Ak,writeToggleLabel:Fk,toggleSwitch:Pk,toggleSlider:jk,loading:Mk,error:Dk,empty:Lk};function Bk(){const e=Tn(),t=jo(),{state:n,setSelectedObjects:r,nextStep:i,prevStep:o}=un(),{providerName:s}=ut(),{appName:a}=an(),l=a||"Your App",[c,u]=w.useState(()=>new Set(n.selectedObjects)),[p,h]=w.useState(()=>{const v=new Set;return n.selectedObjects.forEach(I=>{t.writeObject(I).object&&v.add(I)}),v}),f=e.getReadObjects(),y=w.useMemo(()=>{const v=new Set;return f.forEach(I=>{e.getWriteObject(I.objectName)?.object&&v.add(I.objectName)}),v},[f,e]),m=w.useCallback(v=>{u(I=>{const O=new Set(I);return O.has(v)?O.delete(v):O.add(v),O})},[]),g=w.useCallback(v=>{h(I=>{const O=new Set(I);return O.has(v)?O.delete(v):O.add(v),O})},[]),x=w.useCallback(()=>{const v=Array.from(c),I=new Set(n.selectedObjects);r(v),v.forEach(O=>{t.readObject(O).setEnableRead()}),I.forEach(O=>{c.has(O)||t.removeObject(O)}),v.forEach(O=>{if(y.has(O)){const E=t.writeObject(O);p.has(O)?E.setEnableWrite():E.setDisableWrite()}}),i()},[c,n.selectedObjects,r,t,y,p,i]),b=c.size>0;return e.isLoading||e.isPending?d.jsx("div",{className:bt.loading,children:"Loading available objects..."}):e.isError?d.jsx("div",{className:bt.error,children:"Error loading manifest. Please try again."}):f.length===0?d.jsx("div",{className:bt.empty,children:"No objects available for this integration."}):d.jsxs("div",{className:bt.selectObjects,children:[d.jsx(mh,{title:"Select Objects",description:`Choose which objects you want to read from ${s}. You can configure each object later.`}),d.jsx("div",{className:bt.objectList,children:f.map(v=>{const I=c.has(v.objectName),O=y.has(v.objectName),E=p.has(v.objectName);return d.jsxs("div",{role:"checkbox","aria-checked":I,tabIndex:0,className:`${bt.objectCard} ${I?bt.selected:""}`,onClick:R=>{R.target.closest(`.${bt.writeToggle}`)||m(v.objectName)},onKeyDown:R=>{R.target.closest(`.${bt.writeToggle}`)||(R.key===" "||R.key==="Enter")&&(R.preventDefault(),m(v.objectName))},children:[d.jsx("input",{type:"checkbox",className:bt.checkbox,checked:I,tabIndex:-1,onChange:()=>m(v.objectName),onClick:R=>R.stopPropagation()}),d.jsx("div",{className:bt.objectInfo,children:d.jsx("span",{className:bt.objectName,children:v.displayName||v.objectName})}),O&&I&&d.jsxs("label",{className:bt.writeToggle,children:[d.jsx("span",{className:bt.writeToggleLabel,children:"Write Enabled"}),d.jsx(ff,{text:`Allow ${l} to write back to ${v.displayName||v.objectName}`}),d.jsxs("span",{className:bt.toggleSwitch,children:[d.jsx("input",{type:"checkbox","aria-label":`Enable write for ${v.displayName||v.objectName}`,checked:E,onChange:()=>g(v.objectName)}),d.jsx("span",{className:bt.toggleSlider})]})]})]},v.objectName)})}),d.jsx(vo,{onNext:x,onBack:o,nextDisabled:!b,nextLabel:"Next"})]})}const qk="_container_wo5lv_1",$k="_title_wo5lv_10",Vk="_description_wo5lv_16",js={container:qk,title:$k,description:Vk};function Uk({onEditConfiguration:e}){return d.jsxs("div",{className:js.container,children:[d.jsx(hf,{}),d.jsx("h2",{className:js.title,children:"Integration Installation Successful"}),d.jsx("p",{className:js.description,children:"Your integration has been configured and is now active."}),e&&d.jsx(Be,{type:"button",onClick:e,children:"Edit Configuration"})]})}const zk="_stepper_whwir_1",Kk="_step_whwir_1",Hk="_stepIndicator_whwir_19",Jk="_active_whwir_34",Wk="_complete_whwir_39",Qk="_stepNumber_whwir_44",Gk="_checkIcon_whwir_48",Xk="_stepLabel_whwir_53",Yk="_connector_whwir_71",On={stepper:zk,step:Kk,stepIndicator:Hk,active:Jk,complete:Wk,stepNumber:Qk,checkIcon:Gk,stepLabel:Xk,connector:Yk};function Zk(){const{state:e}=un(),{currentStep:t}=e;return d.jsx("div",{className:On.stepper,children:Array.from({length:Tc},(n,r)=>{const i=r,o=i<t,s=i===t;return d.jsxs("div",{className:`${On.step} ${s?On.active:""} ${o?On.complete:""}`,children:[d.jsx("div",{className:On.stepIndicator,children:o?d.jsx("svg",{className:On.checkIcon,viewBox:"0 0 16 16",fill:"none",children:d.jsx("path",{d:"M13.3 4.3L6 11.6L2.7 8.3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):d.jsx("span",{className:On.stepNumber,children:r+1})}),d.jsx("span",{className:On.stepLabel,children:FI[i]}),r<Tc-1&&d.jsx("div",{className:On.connector})]},i)})})}const eR="_layout_1ssk7_1",tR="_content_1ssk7_9",sd={layout:eR,content:tR};function nR({children:e}){const{state:t}=un(),n=t.currentStep!==Gt.Success;return d.jsxs("div",{className:sd.layout,children:[n&&d.jsx(Zk,{}),d.jsx("div",{className:sd.content,children:e})]})}function ri({step:e,children:t}){const{state:n}=un();return n.currentStep!==e?null:d.jsx(d.Fragment,{children:t})}const rR="_installWizard_13z45_1",iR={installWizard:rR},oR="_resetContainer_1d2b0_4",Ll={resetContainer:oR},sR=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,onEditConfiguration:c})=>{const{projectIdOrName:u,isLoading:p,isError:h}=an(),{isLoading:f,isError:y}=Ci(),{seed:m,reset:g}=Va();return p||f?d.jsx(mr,{}):h?d.jsx(ot,{message:`Error loading project ${u}`}):y?d.jsx(ot,{message:"Error retrieving integrations for the project, double check the API key"}):d.jsx("div",{className:Ll.resetContainer,children:d.jsx(lp,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,resetComponent:g,children:d.jsx(qa,{children:d.jsx(MI,{children:d.jsx("div",{className:iR.installWizard,children:d.jsxs(nR,{children:[d.jsx(ri,{step:Gt.Connect,children:d.jsx(ak,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,resetComponent:g})}),d.jsx(ri,{step:Gt.SelectObjects,children:d.jsx(Bk,{})}),d.jsx(ri,{step:Gt.ConfigureObjects,children:d.jsx(P0,{})}),d.jsx(ri,{step:Gt.Review,children:d.jsx(Sk,{})}),d.jsx(ri,{step:Gt.Success,children:d.jsx(Uk,{onEditConfiguration:c})})]})})})})},m)})};function aR(e){return d.jsx(Do,{fallback:d.jsx(ot,{message:"Something went wrong, couldn't find integration information"}),children:d.jsx(Mo,{integration:e.integration,consumerRef:e.consumerRef,consumerName:e.consumerName,groupRef:e.groupRef,groupName:e.groupName,children:d.jsx(sR,{...e})})})}var ai={exports:{}};ai.exports;var ad;function lR(){return ad||(ad=1,(function(e,t){var n=9007199254740991,r="[object Arguments]",i="[object Function]",o="[object GeneratorFunction]",s="[object Map]",a="[object Object]",l="[object Promise]",c="[object Set]",u="[object WeakMap]",p="[object DataView]",h=/[\\^$.*+?()[\]{}|]/g,f=/^\[object .+?Constructor\]$/,y=typeof qn=="object"&&qn&&qn.Object===Object&&qn,m=typeof self=="object"&&self&&self.Object===Object&&self,g=y||m||Function("return this")(),x=t&&!t.nodeType&&t,b=x&&!0&&e&&!e.nodeType&&e,v=b&&b.exports===x;function I(M,re){return M?.[re]}function O(M){var re=!1;if(M!=null&&typeof M.toString!="function")try{re=!!(M+"")}catch{}return re}function E(M,re){return function(ce){return M(re(ce))}}var R=Function.prototype,T=Object.prototype,A=g["__core-js_shared__"],F=(function(){var M=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||"");return M?"Symbol(src)_1."+M:""})(),j=R.toString,L=T.hasOwnProperty,H=T.toString,P=RegExp("^"+j.call(L).replace(h,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),B=v?g.Buffer:void 0,X=T.propertyIsEnumerable,le=B?B.isBuffer:void 0,fe=E(Object.keys,Object),ge=$(g,"DataView"),C=$(g,"Map"),W=$(g,"Promise"),q=$(g,"Set"),S=$(g,"WeakMap"),U=!X.call({valueOf:1},"valueOf"),V=Fe(ge),Y=Fe(C),ie=Fe(W),ne=Fe(q),se=Fe(S);function ee(M){return H.call(M)}function me(M){if(!Xe(M)||Z(M))return!1;var re=It(M)||O(M)?P:f;return re.test(Fe(M))}function $(M,re){var ce=I(M,re);return me(ce)?ce:void 0}var ye=ee;(ge&&ye(new ge(new ArrayBuffer(1)))!=p||C&&ye(new C)!=s||W&&ye(W.resolve())!=l||q&&ye(new q)!=c||S&&ye(new S)!=u)&&(ye=function(M){var re=H.call(M),ce=re==a?M.constructor:void 0,Ue=ce?Fe(ce):void 0;if(Ue)switch(Ue){case V:return p;case Y:return s;case ie:return l;case ne:return c;case se:return u}return re});function Z(M){return!!F&&F in M}function qe(M){var re=M&&M.constructor,ce=typeof re=="function"&&re.prototype||T;return M===ce}function Fe(M){if(M!=null){try{return j.call(M)}catch{}try{return M+""}catch{}}return""}function Ae(M){return tt(M)&&L.call(M,"callee")&&(!X.call(M,"callee")||H.call(M)==r)}var Qe=Array.isArray;function et(M){return M!=null&&dt(M.length)&&!It(M)}function tt(M){return D(M)&&et(M)}var xe=le||K;function at(M){if(et(M)&&(Qe(M)||typeof M=="string"||typeof M.splice=="function"||xe(M)||Ae(M)))return!M.length;var re=ye(M);if(re==s||re==c)return!M.size;if(U||qe(M))return!fe(M).length;for(var ce in M)if(L.call(M,ce))return!1;return!0}function It(M){var re=Xe(M)?H.call(M):"";return re==i||re==o}function dt(M){return typeof M=="number"&&M>-1&&M%1==0&&M<=n}function Xe(M){var re=typeof M;return!!M&&(re=="object"||re=="function")}function D(M){return!!M&&typeof M=="object"}function K(){return!1}e.exports=at})(ai,ai.exports)),ai.exports}var cR=lR();const uR=Br(cR),Dr="other",To="manage-tab";function gh(e,t){return e?.objects?.find(n=>n.objectName===t)||null}const yh=(e,t)=>e?.content?.read?.objects?.[t],vh=(e,t)=>{const n=[];return t.content?.read?.objects?.forEach(r=>{const i=e?yh(e,r.objectName):void 0;n.push({name:r?.objectName,displayName:r?.mapToDisplayName||r?.displayName||r?.objectName&&Yt(r?.objectName),completed:!!i,disabled:i?.disabled})}),n},bh=e=>({name:Dr,completed:e?!!e?.content?.write:!1});function dR(e,t){const n=vh(e,t),i=!!t?.content?.write?bh(e):void 0;return i&&n.push(i),n}function wh(e,t,n){const r=e?.filter(o=>!t?.[o?.mapToName])||[],i=r.map(o=>o.mapToName);return n(Ie.MAPPING,i),r?.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function ld(e,t){return uR(e)?!0:Object.values(e).every(t)}function Bl(e,t,n){const r=ld(e,n),i=ld(t,n);return r&&i?!0:r!==i?!1:Qd(e,t)}function xh(e,t){return Bl(e,t,n=>n===!1||n===void 0)}function Ih(e,t){return Bl(e,t,n=>!n||n==="")}function Ch(e,t){return Bl(e,t,n=>!n||typeof n!="object"?!0:Object.keys(n).length===0)}function Sh(e,t){const n=new Set(Object.values(e).map(i=>i?.objectName)),r=new Set(Object.values(t).map(i=>i?.objectName));return n.size===r.size&&[...n].every(i=>r.has(i))}const pR=(e,t,n)=>{if(!e)return null;const r=gh(e,t),i=r&&ja(r),o=r&&Gd(r),s=r&&Xd(r),a=r?.allFields||[],l=r?.allFieldsMetadata||{},c=n?.content,u=c?.read?.objects?.[t]?.selectedValueMappings||{},p=c?.read?.objects?.[t]?.selectedFieldMappings||{};c?.read?.objects?.[t]||[...o||[],...s||[]].forEach(m=>{m._default&&!p[m.mapToName]&&(p[m.mapToName]=m._default)});const f=ql(n,{content:{read:e}},t);return{allFields:a,allFieldsMetadata:l,optionalFields:i,requiredMapFields:o,optionalMapFields:s,selectedOptionalFields:f,selectedFieldMappings:p,selectedValueMappings:u}},fR=(e,t)=>{if(!e)return null;const n=t?.content?.write?.objects;return{writeObjects:e?.objects||[],selectedWriteObjects:n||{}}};function Oh(e,t,n){const r=e?.content?.read,i=e?.content?.write;return{read:pR(r,t,n),write:fR(i,n)}}const _h=(e,t,n,r)=>{const i=Oh(e,n,t);r(n,i)},hR=(e,t,n)=>{const r=dR(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=Oh(e,o,t))}),n(i)},Eh=e=>{const{selectedOptionalFields:t}=e?.read||{};return t||{}},Nh=e=>{const{selectedFieldMappings:t}=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},Th=(e,t)=>!t||!t[e]?[]:t[e],kh=e=>{const{selectedValueMappings:t}=e?.read||{};return t},ql=(e,t,n)=>{if(!e||!t)return{};const r=t?.content?.read;if(!r)return{};const i=gh(r,n),o=i&&ja(i),s=new Set(o?.filter(c=>!fr(c)&&!!c.fieldName).map(c=>c.fieldName)||[]),a=e?.content?.read?.objects?.[n]?.selectedFields||{};return Object.entries(a).reduce((c,[u,p])=>(s.has(u)&&(c[u]=p),c),{})},Rh=(e,t)=>!e||!t?{}:e?.content?.read?.objects?.[t]?.selectedFieldMappings||{};function Ah(e,t){return t[e]||void 0}const mR=(e,t,n,r,i)=>{const o=Eh(e),s=Nh(e),a=Th(t,i),l=kh(e);return{createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:l||{}}}}}}};function Fh(e){return e.content.proxy?.enabled}const Ph=e=>({...e.write?.selectedWriteObjects}),gR=e=>e.content.write?.objects,yR=(e,t,n)=>{if(!gR(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=Ph(e),o={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return Fh(t)&&(o.content.proxy={enabled:!0}),o},vR=()=>{const e=wt(),t=Ze();return Nn({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:i})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:i}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),Ke(n)}})};function $l({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=He(),{integrationId:i,installation:o,setIntegrationDeleted:s,onUninstallSuccess:a}=st(),[l,c]=w.useState(!1),u=!r||!i||!o?.id||l,p=vR(),h=async()=>{u||(c(!0),console.warn("uninstalling installation",{projectIdOrName:r,integrationId:i,installationId:o.id}),p.mutate({projectIdOrName:r,integrationId:i,installationId:o.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",o.id),a?.(o?.id),s()},onSettled:()=>c(!1)}))},f=l?"Uninstalling...":e,y=d.jsx(Be,{type:"button",onClick:h,disabled:u,variant:t,style:n,children:f});return o?.id?y:null}const jh=w.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),yr=()=>{const e=w.useContext(jh);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function bR({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r,installation:i}=st(),{isError:o,removeError:s,setError:a}=vn(),l=r?.name||n,[c,u]=w.useState(null),[p,h]=w.useState(null),{data:f,isLoading:y,isError:m,error:g,isSuccess:x}=Tn();w.useEffect(()=>{!x&&!m||(m?(a(Ie.HYDRATED_REVISION,l),g&&Ke(g,u)):(s(Ie.HYDRATED_REVISION,l),u(null),h(null)))},[m,x,l,a,s,g,u]);const b=w.useMemo(()=>({hydratedRevision:f||null,loading:y,readAction:f?.content?.read,writeObjects:f?.content?.write?.objects||[]}),[f,y]),v=r?.provider||"provider",I=r?.name||n||"unknown integration";if(o(Ie.HYDRATED_REVISION,l)){const O=`${c?Yt(c):`Error retrieving objects from ${v} or integration details for ${I}`}`;return d.jsx(ot,{message:O,children:d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[d.jsx(Ml,{provider:v}),i?d.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before uninstalling the integration."}):d.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),p&&d.jsx(ip,{message:p}),i?d.jsx($l,{buttonText:"Uninstall",buttonVariant:"danger"}):d.jsx(fh,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:E=>h(E)})]})})}return y?d.jsx(mr,{}):d.jsx(jh.Provider,{value:b,children:e})}const Mh=w.createContext(null);function Vl(){const e=w.useContext(Mh);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const Dh=w.createContext(()=>{});function wR(){const e=w.useContext(Dh);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const Lh=w.createContext(void 0),xR={};function Ul(){const e=w.useContext(Lh);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function IR({children:e}){const{installation:t}=st(),{hydratedRevision:n,loading:r}=yr(),[i,o]=w.useState(xR),s=t?.config;w.useEffect(()=>{n?.content&&!r&&s&&!(Object.entries(i).length>0)&&hR(n,s,o)},[n,r,s,i]);const a=w.useCallback((u,p)=>{o(h=>ct(h,f=>{f[u]=ct(f[u],p)}))},[o]),l=w.useCallback((u,p)=>{o(h=>ct(h,f=>{f[u]=p}))},[o]),c=w.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:l}),[i,l,a]);return d.jsx(Lh.Provider,{value:c,children:e})}const $t=()=>{const{appName:e}=an(),{objectConfigurationsState:t,setConfigureState:n}=Ul(),{selectedObjectName:r}=Vl(),i=Ah(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}},Bh=()=>{const{hydratedRevision:e}=yr(),{selectedObjectName:t}=Vl(),n=e?.content?.read?.objects?.find(i=>i.objectName===t),r=n?.displayName||t&&Yt(t);return{selectedObject:n,displayName:r}};function qh(){const{projectIdOrName:e}=He(),{integrationNameOrId:t}=Jn(),{data:n}=hr(t),{installation:r}=ln(),{mutate:i,isIdle:o,isPending:s,error:a,errorMsg:l}=dp();return{toggleReadingObject:({objectName:u,disabled:p,onSuccess:h,onError:f,onSettled:y})=>{if(!r){const x=new Error("Installation not created yet. Try creating the installation first.");f?.(x),y?.();return}if(!n){const x=new Error("No integration found");f?.(x),y?.();return}if(!r?.config?.content?.read?.objects?.[u]){const x=new Error(`Object "${u}" not found in installation read configuration`);f?.(x),y?.();return}const m=[`config.content.read.objects.${u}.disabled`],g={projectIdOrName:e,integrationId:n.id,installationId:r.id,installationUpdate:{updateMask:m,installation:{config:{content:{read:{objects:{[u]:{disabled:p}}}}}}}};return i(g,{onSuccess:x=>{h?.(x)},onError:x=>{f?.(x)},onSettled:()=>{y?.()}})},isIdle:o,isPending:s,error:a,errorMsg:l}}function CR(){const{installation:e}=ln(),[t,n]=w.useState(!1),{selectedObjectName:r}=$t(),{displayName:i}=Bh(),{toggleReadingObject:o,isPending:s}=qh(),a=r?e?.config?.content?.read?.objects?.[r]:void 0;if(!a||a.disabled)return null;const c=()=>{r&&o({objectName:r,disabled:!0,onSuccess:()=>{n(!1)},onError:u=>{console.error("Error stopping read from object:",u)}})};return t?d.jsxs(d.Fragment,{children:[d.jsxs("p",{style:{padding:"1rem 0",color:"var(--amp-colors-text-muted)",fontSize:"0.875rem"},children:["Are you sure you want to stop reading from"," ",d.jsx("b",{children:i}),"?"]}),d.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[d.jsx(Be,{type:"button",variant:"ghost",style:{flex:1},onClick:()=>n(!1),children:"Cancel"}),d.jsx(Be,{type:"button",variant:"danger",style:{flex:1},onClick:c,disabled:s,children:s?"Stopping...":"Stop reading"})]})]}):d.jsxs("button",{type:"button",onClick:()=>n(!0),style:{background:"none",border:"none",cursor:"pointer",textDecoration:"underline",paddingTop:"1rem",margin:0,fontFamily:"inherit",color:"var(--amp-colors-text-muted)"},children:["Stop reading from ",d.jsx("b",{children:i})]})}function SR(e,t){const n=e?.read?.selectedFieldMappings||{};t.forEach(r=>{const{field:i,value:o}=r;if(o===null){const s=n[i];delete n[i],s&&e?.read?.selectedValueMappings&&e.read.selectedValueMappings[s]&&delete e.read.selectedValueMappings[s]}else{const s=n[i];n[i]=o,s&&s!==o&&e?.read?.selectedValueMappings&&e.read.selectedValueMappings[s]&&delete e.read.selectedValueMappings[s]}})}function Go(e,t,n){t(e,r=>SR(r,n))}const OR="Each field must be mapped to a unique value";function zl({field:e,onSelectChange:t,allFields:n}){const{configureState:r,selectedObjectName:i,setConfigureState:o}=$t(),{isError:s,removeError:a,getError:l}=vn(),u=r?.read?.selectedFieldMappings?.[e.mapToName],p=w.useMemo(()=>n.map(m=>({id:m.fieldName,label:m.displayName,value:m.fieldName})).sort((m,g)=>m.label.localeCompare(g.label)),[n]),h=d.jsx(hl,{items:p,selectedValue:u||null,onSelectedItemChange:m=>{m?t({target:{name:e.mapToName,value:m.value}}):i&&(Go(i,o,[{field:e.mapToName,value:null}]),s(Ie.MAPPING,i)&&a(Ie.MAPPING,i))},placeholder:"Please select one",style:{width:"100%"},clearable:!0}),{hasDuplicationError:f,errorMessage:y}=w.useMemo(()=>{const m=l(Ie.MAPPING,i),g=Array.isArray(m)&&m.length>0&&m.includes(e.mapToName);return{hasDuplicationError:g,errorMessage:g?OR:""}},[i,l,e.mapToName]);return d.jsxs(d.Fragment,{children:[d.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[d.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[d.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),d.jsx("span",{children:e?.prompt&&d.jsx(lh,{id:`tooltip-id-${e?.prompt}`,tooltipText:e?.prompt})})]}),d.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:h})]},e.mapToName),f&&d.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",y," "]},e.mapToName)]})}const _R="_formControl_9qd8d_1",ER="_formLabel_9qd8d_5",NR="_formLabelRequired_9qd8d_11",TR="_formInput_9qd8d_16",kR="_formInputInvalid_9qd8d_20",RR="_formError_9qd8d_24",AR="_disabled_9qd8d_30",tr={formControl:_R,formLabel:ER,formLabelRequired:NR,formInput:TR,formInputInvalid:kR,formError:RR,disabled:AR};function Xo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return d.jsxs("div",{className:Xt(tr.formControl,{[tr.disabled]:r}),children:[t&&d.jsx("label",{htmlFor:e,className:Xt(tr.formLabel,{[tr.formLabelRequired]:n}),children:t}),d.jsx("div",{id:e,className:Xt(tr.formInput,{[tr.formInputInvalid]:i}),children:s}),i&&o&&d.jsx("div",{className:tr.formError,role:"alert",children:o})]})}function $h({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:i}){if(!e||!t)return!1;if(Object.values(e).some(s=>s===r&&s!==n)){console.error("Each field must be mapped to a unique value",e);const s=Object.keys(e).filter(l=>e[l]===r),a=[n,...s];return i(Ie.MAPPING,t,a),!0}return!1}function FR({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?d.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>d.jsx(Xo,{id:r.mapToName,children:d.jsx(zl,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function PR(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=$t(),{isError:r,removeError:i,setError:o}=vn(),s=t?.read?.allFields||[],{fieldMapping:a}=st(),l=t?.read?.selectedFieldMappings,c=y=>{const{value:m,name:g}=y.target;!m||$h({selectedFieldMappings:l,selectedObjectName:e,fieldName:g,fieldValue:m,setError:o})||(e&&Go(e,n,[{field:g,value:m}]),r(Ie.MAPPING,g)&&i(Ie.MAPPING,g),e&&r(Ie.MAPPING,e)&&i(Ie.MAPPING,e))},u=w.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(y=>!y.fieldName),[a,e]),p=w.useMemo(()=>(t?.read?.optionalMapFields||[]).filter(g=>!u.some(x=>x.mapToName===g.mapToName)),[t,u]),h=u.length>0;return p.length>0||h?d.jsxs(d.Fragment,{children:[d.jsx(qt,{string:"Map the following optional fields"}),d.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[p?.map(y=>d.jsx(Xo,{id:y.mapToName,children:d.jsx(zl,{allFields:s,field:y,onSelectChange:c})},y.mapToName)),h&&d.jsx(FR,{dynamicFieldMappings:u,onSelectChange:c,allFields:s})]})]}):null}function jR(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=$t(),{isError:r,removeError:i,setError:o}=vn(),s=t?.read?.selectedFieldMappings,a=c=>{const{value:u,name:p}=c.target;!u||$h({selectedFieldMappings:s,selectedObjectName:e,fieldName:p,fieldValue:u,setError:o})||(e&&Go(e,n,[{field:p,value:u}]),r(Ie.MAPPING,p)&&i(Ie.MAPPING,p),e&&r(Ie.MAPPING,e)&&i(Ie.MAPPING,e))},l=w.useMemo(()=>t?.read?.requiredMapFields||[],[t]);return l?.length?d.jsxs(d.Fragment,{children:[d.jsx(qt,{string:"Map the following fields"}),d.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.map(c=>d.jsx(Xo,{id:c.mapToName,isInvalid:r(Ie.MAPPING,c.mapToName),errorMessage:"* required",children:d.jsx(zl,{allFields:t?.read?.allFields||[],field:c,onSelectChange:a})},c.mapToName))})]}):null}const MR=(e,t)=>e.filter(n=>!t.has(n));function DR(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=$t(),{fieldMapping:r}=st(),i=t?.read?.selectedFieldMappings||{},o=Object.keys(i),s=t?.read?.requiredMapFields||[],a=t?.read?.optionalMapFields||[],l=e&&r?Object.values(r[e]||{}).flat().filter(h=>!h.fieldName):[],c=s.concat(l,a).map(h=>h.mapToName),u=new Set(c),p=MR(o,u);w.useEffect(()=>{e&&p.length&&Go(e,n,p.map(h=>({field:h,value:null})))},[e,n,p])}const LR={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function Vh({children:e,style:t}){return d.jsx(kn,{style:{...LR,...t},children:e})}function BR(){const{data:e}=an(),{hydratedRevision:t}=yr(),{selectedObjectName:n}=$t(),{providerName:r}=ut(),i=e?.appName,o=t?.content?.read?.objects?.find(c=>c.objectName===n),s=o?.displayName||n&&Yt(n),a=o?.mapToName,l=o?.mapToDisplayName||a&&Yt(a);return l&&i&&r?d.jsx(Vh,{style:{marginTop:"1rem"},children:d.jsxs("p",{style:{margin:"1rem 0"},children:[d.jsx("b",{children:l})," in ",i," is mapped to"," ",d.jsx("b",{children:s})," in ",r,"."]})}):null}function qR(e,t,n){const r=e?.read?.selectedOptionalFields||{};r[t]=n,n||delete r[t]}function $R(e,t,n,r){t(e,i=>qR(i,n,r))}function VR(){const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=$t(),i=t?.read?.selectedOptionalFields,o=t?.read?.optionalFields,s=(c,u)=>{r&&t&&$R(r,n,c,u)},a=w.useMemo(()=>o?.filter(c=>!fr(c)&&"fieldName"in c&&"displayName"in c).map(c=>({id:c.fieldName,label:c.displayName,isChecked:!!i?.[c.fieldName]})).sort((c,u)=>c.label.localeCompare(u.label))||[],[o,i]);return!!(o&&o.length>0)&&d.jsxs(d.Fragment,{children:[d.jsx(qt,{string:`${e} reads the following optional fields`}),d.jsx(Qa,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${o?.length}`)]})}function UR(){return d.jsx(VR,{})}function zR(){const{installation:e}=ln(),{selectedObjectName:t}=$t(),{displayName:n}=Bh(),{toggleReadingObject:r,isPending:i}=qh(),o=t?e?.config?.content?.read?.objects?.[t]:void 0;if(!o)return null;if(!o.disabled)return d.jsx(Ri,{children:d.jsxs("p",{children:["Reading from ",n," is enabled."]})});const a=()=>{t&&r({objectName:t,disabled:!1,onError:l=>{console.error("Error re-enabling read object:",l)}})};return d.jsx(d.Fragment,{children:d.jsxs(Vh,{style:{backgroundColor:"var(--amp-colors-status-critical-muted)"},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[d.jsx(Op,{style:{width:"16px",height:"16px",flexShrink:0}}),d.jsx("span",{style:{fontWeight:600},children:"Reading is currently disabled"})]}),d.jsxs("p",{style:{marginTop:"0.5rem",fontSize:"0.875rem"},children:["This object is not being synced. Click below to re-enable reading from"," ",d.jsx("b",{children:n}),"."]}),d.jsx(Be,{type:"button",onClick:a,variant:"ghost",style:{marginTop:"1rem",width:"100%"},disabled:i,children:i?"Re-enabling...":`Re-enable reading from ${n}`})]})})}const KR={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 HR({children:e,style:t,...n}){return d.jsx("span",{style:{...KR,...t},...n,children:e})}const JR="_errorAlert_1tcao_1",WR="_errorHeader_1tcao_11",QR="_errorIcon_1tcao_17",GR="_errorTitle_1tcao_24",XR="_errorMessage_1tcao_30",ii={errorAlert:JR,errorHeader:WR,errorIcon:QR,errorTitle:GR,errorMessage:XR};function YR({error:e}){return d.jsxs("div",{className:ii.errorAlert,children:[d.jsxs("div",{className:ii.errorHeader,children:[d.jsx(Op,{className:ii.errorIcon}),d.jsx("span",{className:ii.errorTitle,children:"Unable to load object"})]}),d.jsx("div",{className:ii.errorMessage,children:e})]})}function ZR(){const{data:e}=Tn(),{selectedObjectName:t}=$t(),{appName:n}=an(),r=e?.content?.read?.objects?.find(s=>s.objectName===t),i=r?.error,o=r?.requiredFields;return i?d.jsx(YR,{error:i}):d.jsxs(d.Fragment,{children:[d.jsx(qt,{string:`${n} reads the following fields`}),d.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:o?.length?o.map(s=>fr(s)?null:d.jsx(HR,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function eA(e,t,n,r,i){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[i]||(e.read.selectedValueMappings[i]={}),r===""&&e.read.selectedValueMappings[i][n]?delete e.read.selectedValueMappings[i][n]:e.read.selectedValueMappings[i][n]=r)}function Uh(e,t,n,r,i){t(e,o=>eA(o,e,n,r,i))}function Ms(e){return e.mapToDisplayName||e.mapToName||e.fieldName||""}function tA(e,t){if(!e.fieldName)return{isValid:!1,errorMessage:"Field name is missing"};const n=t?.valueType;if(!["singleSelect","multiSelect"].includes(n||""))return{isValid:!1,errorMessage:"fieldName is not a singleSelect or multiSelect"};const r=t?.values;if(!r)return{isValid:!1,errorMessage:"Field values array is missing"};const i=Object.keys(r).length,o=Object.keys(e?.mappedValues||[]).length;return i!==o?{isValid:!1,errorMessage:"field values and the values to be mapped are not of the same length"}:{isValid:!0}}function nA(e,t,n){const r=Object.values(t).filter(Boolean),i=t[n];return e.filter(o=>{const s=o.value===i,a=r.includes(o.value);return s||!a})}function rA({string:e,fieldName:t}){return d.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[d.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,d.jsx("b",{children:t})]}),d.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:d.jsx(Qo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function iA({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r}){const{configureState:i,selectedObjectName:o,setConfigureState:s}=$t(),a=w.useMemo(()=>i?.read?.selectedValueMappings?.[n]||{},[i?.read?.selectedValueMappings,n]),l=w.useMemo(()=>a?.[e.mappedValue],[a,e.mappedValue]),c=w.useMemo(()=>r.map(h=>({id:h.value,label:h.displayValue,value:h.value})),[r]),u=w.useCallback(h=>{h?t({target:{name:e.mappedValue,value:h.value,fieldName:n}}):o&&Uh(o,s,e.mappedValue,"",n)},[t,n,e.mappedValue,o,s]),p=w.useMemo(()=>d.jsx(hl,{items:c,selectedValue:l||null,onSelectedItemChange:u,placeholder:"Please select one",style:{borderRadius:"8px",width:"100%"},clearable:!0},l),[l,c,u]);return d.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[d.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:d.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),d.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:p})]},e.mappedValue)}function oA(){const{fieldMapping:e}=st(),{selectedObjectName:t,configureState:n,setConfigureState:r}=$t(),i=n?.read?.selectedFieldMappings,o=n?.read?.selectedValueMappings,s=w.useMemo(()=>{const l=t&&e?Object.values(e[t]||{}).flat().filter(c=>c.mappedValues).map(c=>({...c})):[];if(i)for(let c=0;c<l.length;c+=1){const{mapToName:u}=l[c];i?.[u]&&(l[c].fieldName=i[u])}return l},[t,e,i]),a=w.useCallback(l=>{const{value:c,name:u,fieldName:p}=l.target;c&&t&&Uh(t,r,u,c,p)},[t,r]);return s?.length?d.jsx(d.Fragment,{children:s.map(l=>{const c=n?.read?.allFieldsMetadata?.[l.fieldName],u=tA(l,c);return u.isValid?d.jsxs(d.Fragment,{children:[d.jsx(rA,{string:"Map the values for ",fieldName:Ms(l)}),d.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:d.jsx(Xo,{id:Ms(l),children:l?.mappedValues?.map(p=>{const h=c?.values||[],f=o?.[l.fieldName]||{},y=nA(h,f,p.mappedValue);return d.jsx(iA,{allValueOptions:y,mappedValue:p,onSelectChange:a,fieldName:l?.fieldName||""},`${p.mappedValue}-${l.fieldName}`)})},Ms(l))})]}):(console.error(u.errorMessage,l),null)})}):null}function sA(){return DR(),d.jsxs(d.Fragment,{children:[d.jsx(zR,{}),d.jsx(BR,{}),d.jsx(ZR,{}),d.jsx(jR,{}),d.jsx(PR,{}),d.jsx(oA,{}),d.jsx(UR,{}),d.jsx(CR,{})]})}function aA(e,t,n){if(e?.write?.selectedWriteObjects===null&&(e.write.selectedWriteObjects={}),e?.write){const r=e.write.selectedWriteObjects;n&&(r[t]={objectName:t}),n||delete r[t]}}function lA(e,t,n,r){t(e,i=>{aA(i,n,r)})}function cA(){const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=$t(),i=n?.write?.selectedWriteObjects,o=n?.write?.writeObjects,s=(c,u)=>{t&&n&&lA(t,r,c,u)},a=!!o,l=o?.map(c=>({id:c.objectName,label:c.displayName,isChecked:!!i?.[c.objectName]}))||[];return a&&d.jsxs(d.Fragment,{children:[d.jsx(qt,{string:`Allow ${e} to write to these objects`}),d.jsx(Qa,{items:l,onItemChange:s,showSelectAll:o.length>=2,searchPlaceholder:"Search objects...",itemName:"objects"})]})}function uA(){return d.jsx(d.Fragment,{children:d.jsx(cA,{})})}const dA="_authenticationRow_1g2ms_1",pA="_field_1g2ms_8",fA="_value_1g2ms_12",Ds={authenticationRow:dA,field:pA,value:fA};function cd({label:e,value:t}){return d.jsxs("div",{className:Ds.authenticationRow,children:[d.jsx("div",{className:Ds.field,children:e}),d.jsx("div",{className:Ds.value,children:t})]})}function hA(){const{selectedConnection:e}=cn(),{providerName:t}=ut(),r=e?.provider==="salesforce"?"subdomain":"workspace",i=`${t} ${r}`;return d.jsxs(d.Fragment,{children:[d.jsx(qt,{string:"Connection details"}),d.jsxs("div",{style:{paddingBottom:"1rem"},children:[d.jsx(cd,{label:i,value:e?.providerWorkspaceRef}),d.jsx(cd,{label:"Status",value:Yt(e?.status||"")})]})]})}function mA(){const{installation:e}=st(),{providerName:t}=ut();return e?d.jsxs(d.Fragment,{children:[d.jsx(qt,{string:"Uninstall entire integration"}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e?.id?d.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall the entire ",t," ","integration. You will lose any configuration you've set up."]}):d.jsx("p",{children:"You've successfully uninstalled the integration."}),d.jsx($l,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function gA(){const{installation:e,resetComponent:t}=st();return d.jsxs(d.Fragment,{children:[d.jsx(hA,{}),d.jsx(Ml,{}),e&&d.jsx(mA,{}),!e&&d.jsx(hh,{resetComponent:t})]})}function zh({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){const{installation:o}=ln(),{hydratedRevision:s,loading:a}=yr(),{configureState:l,selectedObjectName:c}=$t(),u=o?.config,p=u&&c&&!!yh(u,c)||!1,h=c?Rh(u,c):void 0,f=l?.read?.selectedFieldMappings,y=!Ih(h,f),m=s&&c?ql(u,s,c):void 0,g=l?.read?.selectedOptionalFields,x=!xh(m,g),b=c?u?.content?.read?.objects?.[c]?.selectedValueMappings:void 0,v=l?.read?.selectedValueMappings,I=!Ch(b,v),O=u?.content?.write?.objects,E=l?.write?.selectedWriteObjects,R=!Sh(O||{},E||{}),j=x||y||I||R||r||c!==Dr&&!p,L=!!s?.content?.read?.objects?.find(fe=>fe.objectName===c)?.error,H=a||n||!l||!c||!j||L,P=c===Dr,B=c===To,X=d.jsx(Be,{type:"submit",disabled:H,children:r?"Install":"Save"}),le=d.jsx(Be,{type:"button",onClick:t,disabled:H,variant:"ghost",children:"Reset"});return n?d.jsx(vi,{}):d.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[d.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!B&&d.jsxs(d.Fragment,{children:[X,le]})}),d.jsxs(kn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&d.jsx(Si,{children:typeof i=="string"?i:"Installation Failed."}),a&&d.jsx(vi,{}),s&&!P&&!B&&d.jsx(sA,{}),s&&P&&!B&&d.jsx(uA,{}),!a&&B&&d.jsx(gA,{})]})]})}const Kh=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o,fieldMapping:s}=st(),{hydratedRevision:a,loading:l}=yr(),{selectedObjectName:c}=Vl(),{selectedConnection:u}=cn(),p=qd(),{projectIdOrName:h}=He(),{resetBoundary:f,setErrors:y,setError:m,getError:g}=vn(),{resetConfigureState:x,objectConfigurationsState:b}=Ul(),v=Ah(c||"",b),{onNextIncompleteTab:I}=wR(),O=w.useCallback(()=>{f(Ie.INSTALLATION_MUTATION)},[f]),E=w.useCallback(T=>T?A=>{m(Ie.INSTALLATION_MUTATION,T,A)}:A=>{console.error("objectName is required to set installation error: ",A)},[m]),R=w.useCallback(T=>T?g(Ie.INSTALLATION_MUTATION,T):"",[g]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:a,loading:l,selectedObjectName:c,selectedConnection:u,apiKey:p,projectIdOrName:h,resetBoundary:f,setErrors:y,setMutateInstallationError:E,getMutateInstallationError:R,resetMutateInstallationErrorState:O,resetConfigureState:x,objectConfigurationsState:b,configureState:v,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:I,fieldMapping:s}},yA=void 0;function vA(){const{consumerRef:e,setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:i,selectedConnection:o,resetBoundary:s,setErrors:a,setMutateInstallationError:l,getMutateInstallationError:c,resetMutateInstallationErrorState:u,resetConfigureState:p,objectConfigurationsState:h,configureState:f,onInstallSuccess:y,onNextIncompleteTab:m,fieldMapping:g}=Kh(),[x,b]=w.useState(!1),{createInstallation:v}=$a(),I=i===Dr,O=c(i),E=w.useCallback(()=>{s(Ie.MAPPING),n?.content&&!r&&i&&_h(n,yA,i,p)},[s,n,r,i,p]);w.useEffect(()=>{!f&&n?.content&&!r&&E()},[f,h,n,r,E]);const R=()=>{u();const{requiredMapFields:F,selectedFieldMappings:j}=f?.read||{},{errorList:L}=wh(F,j,a);if(!(L.length>0))if(i&&o?.id&&e&&n){b(!0);const H=mR(f,i,n,e,g);if(!H){console.error("Error when generating createConfig from configureState"),b(!1);return}v({config:H.content,onSuccess:P=>{t(P),y?.(P.id,P.config),b(!1),m()},onError:P=>{Ke(P,l(i)),b(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},T=()=>{if(u(),i&&o?.id&&e&&n){b(!0);const F=yR(f,n,e);if(!F){console.error("Error when generating createConfig from configureState"),b(!1);return}v({config:F.content,onSuccess:j=>{t(j),y?.(j.id,j.config),b(!1),m()},onError:j=>{Ke(j,l(i)),b(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},A=F=>{F.preventDefault(),I?T():R()};return d.jsx(zh,{errorMsg:O,isCreateMode:!0,isLoading:x,onSave:A,onReset:E})}const bA=(e,t,n)=>{const r=Eh(e),i=Nh(e),o=Th(t,n),s=kh(e);return{content:{read:{objects:{[t]:{objectName:t,selectedFields:r,selectedFieldMappings:i,dynamicMappingsInput:o,selectedValueMappings:s||{}}}}}}},wA=e=>({content:{write:{objects:Ph(e)}}});function xA({installation:e}){const{setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:i,resetBoundary:o,setErrors:s,setMutateInstallationError:a,getMutateInstallationError:l,resetConfigureState:c,configureState:u,onUpdateSuccess:p,onNextIncompleteTab:h,fieldMapping:f}=Kh(),{updateInstallation:y}=pp(),[m,g]=w.useState(!1),x=i===Dr,b=l(i),{config:v}=e,I=w.useCallback(()=>{o(Ie.MAPPING),n?.content&&!r&&i&&_h(n,v,i,c)},[o,n,r,i,v,c]);w.useEffect(()=>{u||I()},[u,I]);const O=w.useMemo(()=>n?.content?.read?.objects?.find(F=>F?.objectName===i),[n,i]),E=()=>{const{requiredMapFields:A,selectedFieldMappings:F}=u?.read||{},{errorList:j}=wh(A,F,s);if(!(j.length>0))if(n&&u&&i&&O){g(!0);const L=bA(u,i,f);if(!L){console.error("Error when generating updateConfig from configureState"),g(!1);return}y({config:L.content,onSuccess:H=>{t(H),p?.(H.id,H.config),g(!1),h()},onError:H=>{Ke(H,a(i)),g(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},R=()=>{if(u&&n){g(!0);const A=wA(u);if(!A){console.error("Error when generating write updateConfig from configureState"),g(!1);return}y({config:A.content,onSuccess:F=>{t(F),p?.(F.id,F.config),g(!1),h()},onError:F=>{Ke(F,a(i)),g(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},T=A=>{A.preventDefault(),x?R():E()};return d.jsx(zh,{errorMsg:b,onSave:T,onReset:I,isLoading:m})}function IA(){const{integrationObj:e,installation:t}=st();return e?t&&e?d.jsx(xA,{installation:t}):d.jsx(vA,{}):d.jsx(op,{message:"We can't load the integration"})}function CA({provider:e}){const{providerName:t}=ut(e),n=`You have successfully installed your ${t} integration.`;return d.jsx(ml,{text:n,children:d.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:d.jsx($l,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const SA=e=>{const{read:t,write:n}=e?.content??{};return!t&&!n};function OA({children:e}){const t=w.useRef(!1),{projectIdOrName:n}=He(),{hydratedRevision:r,loading:i}=yr(),{integrationObj:o,installation:s,groupRef:a,consumerRef:l,onInstallSuccess:c,isIntegrationDeleted:u}=st(),{mutate:p,isIdle:h,isPending:f,error:y,errorMsg:m}=up(),{selectedConnection:g,isConnectionsLoading:x}=cn(),b=i||f||x,v=r?.content?.provider,I=SA(r);return w.useEffect(()=>{if(!b&&!x&&r&&I&&!s&&g&&o?.id&&!u&&v){const O={projectIdOrName:n,integrationId:o?.id,installation:{groupRef:a,connectionId:g?.id,config:{content:{provider:v}}}};Fh(r)===!0&&(O.installation.config.content.proxy=r?.content?.proxy),h&&!t.current&&p(O,{onSuccess:E=>{t.current||(c?.(E?.id,E.config),t.current=!0)}})}},[r,I,s,g,n,o?.id,a,l,b,c,u,x,v,p,h]),I&&v&&s?d.jsx(CA,{provider:v}):y?d.jsx(ot,{message:m??"Create installation failed"}):o?b?d.jsx(mr,{}):d.jsx("div",{children:e}):d.jsx(ot,{message:"We can't load the integration"})}function _A(e){const t=e+"CollectionProvider",[n,r]=Lo(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:g,children:x}=m,b=w.useRef(null),v=w.useRef(new Map).current;return d.jsx(i,{scope:g,itemMap:v,collectionRef:b,children:x})};s.displayName=t;const a=e+"CollectionSlot",l=ta(a),c=w.forwardRef((m,g)=>{const{scope:x,children:b}=m,v=o(a,x),I=kr(g,v.collectionRef);return d.jsx(l,{ref:I,children:b})});c.displayName=a;const u=e+"CollectionItemSlot",p="data-radix-collection-item",h=ta(u),f=w.forwardRef((m,g)=>{const{scope:x,children:b,...v}=m,I=w.useRef(null),O=kr(g,I),E=o(u,x);return w.useEffect(()=>(E.itemMap.set(I,{ref:I,...v}),()=>{E.itemMap.delete(I)})),d.jsx(h,{[p]:"",ref:O,children:b})});f.displayName=u;function y(m){const g=o(e+"CollectionConsumer",m);return w.useCallback(()=>{const b=g.collectionRef.current;if(!b)return[];const v=Array.from(b.querySelectorAll(`[${p}]`));return Array.from(g.itemMap.values()).sort((E,R)=>v.indexOf(E.ref.current)-v.indexOf(R.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},y,r]}var EA=J[" useId ".trim().toString()]||(()=>{}),NA=0;function Hh(e){const[t,n]=J.useState(EA());return bi(()=>{n(r=>r??String(NA++))},[e]),e||(t?`radix-${t}`:"")}function TA(e){const t=J.useRef(e);return J.useEffect(()=>{t.current=e}),J.useMemo(()=>(...n)=>t.current?.(...n),[])}var kA=J.createContext(void 0);function Jh(e){const t=J.useContext(kA);return e||t||"ltr"}var Ls="rovingFocusGroup.onEntryFocus",RA={bubbles:!1,cancelable:!0},Fi="RovingFocusGroup",[Ca,Wh,AA]=_A(Fi),[FA,Qh]=Lo(Fi,[AA]),[PA,jA]=FA(Fi),Gh=J.forwardRef((e,t)=>d.jsx(Ca.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Ca.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(MA,{...e,ref:t})})}));Gh.displayName=Fi;var MA=J.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...p}=e,h=J.useRef(null),f=kr(t,h),y=Jh(o),[m,g]=Ua({prop:s,defaultProp:a??null,onChange:l,caller:Fi}),[x,b]=J.useState(!1),v=TA(c),I=Wh(n),O=J.useRef(!1),[E,R]=J.useState(0);return J.useEffect(()=>{const T=h.current;if(T)return T.addEventListener(Ls,v),()=>T.removeEventListener(Ls,v)},[v]),d.jsx(PA,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:m,onItemFocus:J.useCallback(T=>g(T),[g]),onItemShiftTab:J.useCallback(()=>b(!0),[]),onFocusableItemAdd:J.useCallback(()=>R(T=>T+1),[]),onFocusableItemRemove:J.useCallback(()=>R(T=>T-1),[]),children:d.jsx(Rn.div,{tabIndex:x||E===0?-1:0,"data-orientation":r,...p,ref:f,style:{outline:"none",...e.style},onMouseDown:rn(e.onMouseDown,()=>{O.current=!0}),onFocus:rn(e.onFocus,T=>{const A=!O.current;if(T.target===T.currentTarget&&A&&!x){const F=new CustomEvent(Ls,RA);if(T.currentTarget.dispatchEvent(F),!F.defaultPrevented){const j=I().filter(X=>X.focusable),L=j.find(X=>X.active),H=j.find(X=>X.id===m),B=[L,H,...j].filter(Boolean).map(X=>X.ref.current);Zh(B,u)}}O.current=!1}),onBlur:rn(e.onBlur,()=>b(!1))})})}),Xh="RovingFocusGroupItem",Yh=J.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=e,l=Hh(),c=o||l,u=jA(Xh,n),p=u.currentTabStopId===c,h=Wh(n),{onFocusableItemAdd:f,onFocusableItemRemove:y,currentTabStopId:m}=u;return J.useEffect(()=>{if(r)return f(),()=>y()},[r,f,y]),d.jsx(Ca.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:d.jsx(Rn.span,{tabIndex:p?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:rn(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:rn(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:rn(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const x=BA(g,u.orientation,u.dir);if(x!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let v=h().filter(I=>I.focusable).map(I=>I.ref.current);if(x==="last")v.reverse();else if(x==="prev"||x==="next"){x==="prev"&&v.reverse();const I=v.indexOf(g.currentTarget);v=u.loop?qA(v,I+1):v.slice(I+1)}setTimeout(()=>Zh(v))}}),children:typeof s=="function"?s({isCurrentTabStop:p,hasTabStop:m!=null}):s})})});Yh.displayName=Xh;var DA={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function LA(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function BA(e,t,n){const r=LA(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return DA[r]}function Zh(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function qA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var $A=Gh,VA=Yh,Yo="Tabs",[UA]=Lo(Yo,[Qh]),em=Qh(),[zA,Kl]=UA(Yo),tm=J.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=Jh(a),[p,h]=Ua({prop:r,onChange:i,defaultProp:o??"",caller:Yo});return d.jsx(zA,{scope:n,baseId:Hh(),value:p,onValueChange:h,orientation:s,dir:u,activationMode:l,children:d.jsx(Rn.div,{dir:u,"data-orientation":s,...c,ref:t})})});tm.displayName=Yo;var nm="TabsList",rm=J.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=Kl(nm,n),s=em(n);return d.jsx($A,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:d.jsx(Rn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});rm.displayName=nm;var im="TabsTrigger",om=J.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=Kl(im,n),a=em(n),l=am(s.baseId,r),c=lm(s.baseId,r),u=r===s.value;return d.jsx(VA,{asChild:!0,...a,focusable:!i,active:u,children:d.jsx(Rn.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...o,ref:t,onMouseDown:rn(e.onMouseDown,p=>{!i&&p.button===0&&p.ctrlKey===!1?s.onValueChange(r):p.preventDefault()}),onKeyDown:rn(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&s.onValueChange(r)}),onFocus:rn(e.onFocus,()=>{const p=s.activationMode!=="manual";!u&&!i&&p&&s.onValueChange(r)})})})});om.displayName=im;var sm="TabsContent",KA=J.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=Kl(sm,n),l=am(a.baseId,r),c=lm(a.baseId,r),u=r===a.value,p=J.useRef(u);return J.useEffect(()=>{const h=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(h)},[]),d.jsx(za,{present:i||u,children:({present:h})=>d.jsx(Rn.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:h&&o})})});KA.displayName=sm;function am(e,t){return`${e}-trigger-${t}`}function lm(e,t){return`${e}-content-${t}`}var HA=tm,JA=rm,cm=om;const WA=d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[d.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),d.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function QA(e,t){return t?w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},w.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?WA:d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:d.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function GA(){return d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("path",{d:"M8 11C9.65685 11 11 9.65685 11 8C11 6.34315 9.65685 5 8 5C6.34315 5 5 6.34315 5 8C5 9.65685 6.34315 11 8 11Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M12.3378 5.04365C12.4882 5.25907 12.62 5.48699 12.7315 5.7249L14.3503 6.6249C14.5524 7.5302 14.5545 8.4687 14.3565 9.3749L12.7315 10.2749C12.62 10.5128 12.4882 10.7407 12.3378 10.9562L12.369 12.8124C11.683 13.4375 10.871 13.9085 9.98776 14.1937L8.39401 13.2374C8.13185 13.2562 7.86868 13.2562 7.60651 13.2374L6.01901 14.1874C5.13295 13.9075 4.31832 13.4383 3.63151 12.8124L3.66276 10.9624C3.51356 10.744 3.38189 10.5141 3.26901 10.2749L1.65026 9.3749C1.44814 8.46961 1.446 7.53111 1.64401 6.6249L3.26901 5.7249C3.38056 5.48699 3.5123 5.25907 3.66276 5.04365L3.63151 3.1874C4.31754 2.56226 5.1295 2.09128 6.01276 1.80615L7.60651 2.7624C7.86868 2.74365 8.13185 2.74365 8.39401 2.7624L9.98151 1.8124C10.8676 2.09234 11.6822 2.5615 12.369 3.1874L12.3378 5.04365Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const XA="_tabsRoot_ktpr0_1",YA="_tabsList_ktpr0_6",ZA="_tabTrigger_ktpr0_12",ko={tabsRoot:XA,tabsList:YA,tabTrigger:ZA};function eF(){return d.jsxs(d.Fragment,{children:[d.jsx(Qo,{style:{margin:"1rem 0"}}),d.jsx(cm,{value:To,className:ko.tabTrigger,children:d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[d.jsx(GA,{}),d.jsx("span",{children:"Manage"})]})})]})}function um({objectName:e,completed:t,pending:n,displayName:r,disabled:i}){return d.jsx(cm,{value:e,className:ko.tabTrigger,children:d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[QA(!i&&t,n),d.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[d.jsx("span",{children:r||e}),n&&d.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function tF({completed:e,pending:t,displayName:n}){return d.jsxs(d.Fragment,{children:[d.jsx(Qo,{style:{margin:"1rem 0"}}),d.jsx(um,{objectName:Dr,completed:e,pending:t,displayName:n},"other-write")]})}function nF({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i}){const{data:o}=Yd(),{installation:s}=ln(),a=s?.config,l=a?.content?.write?.objects,c=r?.other?.write?.selectedWriteObjects;return d.jsx(HA,{value:e,className:ko.tabsRoot,onValueChange:n,children:d.jsxs(JA,{className:ko.tabsList,children:[t.map(u=>{const p=a?.content?.read?.objects?.[u.name],h=r?.[u.name],f=Rh(a,u.name),y=h?.read?.selectedFieldMappings,m=!Ih(f,y),g=o?ql(a,o,u.name):void 0,x=h?.read?.selectedOptionalFields,b=!xh(g,x),v=p?.selectedValueMappings,I=h?.read?.selectedValueMappings,O=!Ch(v,I),E=b||m||O||!1;return d.jsx(um,{objectName:u.name,displayName:u.displayName,completed:u.completed,disabled:u.disabled,pending:E},u.name)}),i&&(()=>{const u=!Sh(l||{},c||{});return d.jsx(tF,{completed:i.completed,pending:u,displayName:"Write"})})(),d.jsx(eF,{})]})})}function rF(e,t){return t===To?{name:To,completed:!1}:e.find(n=>n.name===t)}function iF({children:e}){const{data:t}=an(),{installation:n}=st(),{providerName:r}=ut(),{hydratedRevision:i}=yr(),{objectConfigurationsState:o}=Ul(),[s,a]=w.useState(""),l=t?.appName||"",c=n?.config,u=i&&vh(c,i),p=u!==null,h=!!i?.content?.write,f=h?bh(c):void 0,y=w.useMemo(()=>{const x=[...u||[]];return f&&h&&x.push(f),x},[u,f,h]),m=rF(y,s),g=w.useCallback(()=>{const x=y.find(b=>m!==b&&!b.completed);x&&a(x.name)},[y,m]);return w.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,g]),d.jsx(Dh.Provider,{value:g,children:d.jsx(Mh.Provider,{value:m?.name,children:d.jsxs(qr,{style:{maxWidth:"55rem"},children:[d.jsxs(kn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[d.jsxs("div",{style:{width:"20rem"},children:[d.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),d.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:l}),p&&d.jsx(nF,{value:s,readNavObjects:u,onValueChange:x=>a(x),objectConfigurationsState:o,writeNavObject:f})]}),e]}),d.jsx(mf,{})]})})})}function oF({...e}){return d.jsx(iF,{...e})}const sF=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,variant:c})=>{const{installation:u,isPending:p}=ln(),{projectIdOrName:h,isLoading:f}=an(),{isLoading:y}=Ci(),{isError:m,errorState:g}=vn(),{seed:x,reset:b}=Va(),v=w.useRef(!1),[I,O]=w.useState(!1),E=w.useRef(x);return w.useEffect(()=>{E.current!==x&&(E.current=x,O(!1))},[x]),w.useEffect(()=>{c==="wizard"&&!u&&!p&&(v.current=!0)},[c,u,p]),f||y?d.jsx(mr,{}):m(Ie.PROJECT,h)?d.jsx(ot,{message:`Error loading project ${h}`}):m(Ie.INTEGRATION_LIST,h)?d.jsx(ot,{message:"Error retrieving integrations for the project, double check the API key"}):g[Ie.INTEGRATION_LIST]?.apiError?d.jsx(ot,{message:"Something went wrong, couldn't find integration information"}):v.current&&!I?d.jsx(aR,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,fieldMapping:l,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,onEditConfiguration:()=>O(!0)},x+1):d.jsx("div",{className:Ll.resetContainer,children:d.jsx(lp,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,resetComponent:b,children:d.jsx(qa,{children:d.jsx(Dl,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,resetComponent:b,children:d.jsx(bR,{resetComponent:b,children:d.jsx(OA,{children:d.jsx(IR,{children:d.jsx(oF,{children:d.jsx(IA,{})})})})})})})},x)})};function aF(e){const{integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o}=e;return d.jsx(Do,{fallback:d.jsx(ot,{message:"Something went wrong, couldn't find integration information"}),children:d.jsx(Mo,{integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:d.jsx(sF,{...e})})})}function lF(){return d.jsxs(qr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[d.jsx(vi,{}),d.jsx("p",{children:"Redirecting"})]})}function cF({redirectURL:e,children:t}){return w.useEffect(()=>{e&&window.location.replace(e)},[e]),e?d.jsx(lF,{}):t}function uF({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,module:s,onSuccess:a,onDisconnectSuccess:l,onConnectSuccess:c}){const{seed:u,reset:p}=Va(),h=w.useCallback(f=>{a?a(f.id):c&&c(f)},[a,c]);return d.jsx(Do,{fallback:d.jsx(ot,{message:"Something went wrong with the connection. Please try again."}),children:d.jsx("div",{className:Ll.resetContainer,children:d.jsx(Mo,{integration:"connect-provider-dummy-string",consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:d.jsx(qa,{groupRef:r,provider:e,children:d.jsx(Dl,{resetComponent:p,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,module:s,onSuccess:h,onDisconnectSuccess:l,children:d.jsx(cF,{redirectURL:o,children:d.jsx(Ia,{resetComponent:p,provider:e,onDisconnectSuccess:l})})})})})},u)})}const dF=(e,t,n)=>{const{data:r,isLoading:i,isError:o,error:s}=Pa(e,t,n),a=(r?.length||0)>0,l=!!r&&!i,u=r?.[0]?.config;return w.useEffect(()=>{o&&Ke(s)},[o,s]),{isLoaded:l,isIntegrationInstalled:a,isLoading:i,config:u,isError:o,error:s}};exports.AmpersandContext=Ra;exports.AmpersandErrorBoundary=Do;exports.AmpersandProvider=Ux;exports.ConnectProvider=uF;exports.FieldSettingWriteOnCreateEnum=Mg;exports.FieldSettingWriteOnUpdateEnum=Dg;exports.InstallIntegration=aF;exports.InstallationProvider=Mo;exports.useAmpersandProviderProps=He;exports.useConfig=aI;exports.useConnection=Ma;exports.useCreateInstallation=$a;exports.useDeleteInstallation=AI;exports.useInstallation=ln;exports.useIsIntegrationInstalled=dF;exports.useLocalConfig=jo;exports.useManifest=Tn;exports.useUpdateInstallation=pp;
22
22
  //# sourceMappingURL=amp-react.cjs.js.map