@amp-labs/react 2.4.10 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +1,32 @@
1
- "use strict";var Ra=e=>{throw TypeError(e)};var To=(e,t,n)=>t.has(e)||Ra("Cannot "+n);var C=(e,t,n)=>(To(e,t,"read from private field"),n?n.call(e):t.get(e)),ie=(e,t,n)=>t.has(e)?Ra("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),J=(e,t,n,r)=>(To(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(To(e,t,"access private method"),n);var Ri=(e,t,n,r)=>({set _(o){J(e,t,o,n)},get _(){return C(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),v=require("react");require("react-dom");function vf(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 D=vf(v);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(){}},nr=typeof window>"u"||"Deno"in globalThis;function Nt(){}function wf(e,t){return typeof e=="function"?e(t):e}function zo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Bc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function pr(e,t){return typeof e=="function"?e(t):e}function Kt(e,t){return typeof e=="function"?e(t):e}function Aa(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Ts(s,t.options))return!1}else if(!ei(t.queryKey,s))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function Pa(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(rr(t.options.mutationKey)!==rr(i))return!1}else if(!ei(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Ts(e,t){return((t==null?void 0:t.queryKeyHashFn)||rr)(e)}function rr(e){return JSON.stringify(e,(t,n)=>Qo(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function ei(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!ei(e[n],t[n])):!1}function Go(e,t){if(e===t)return e;const n=Da(e)&&Da(t);if(n||Qo(e)&&Qo(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let c=0;for(let u=0;u<s;u++){const d=n?u:i[u];(!n&&r.includes(d)||n)&&e[d]===void 0&&t[d]===void 0?(a[d]=void 0,c++):(a[d]=Go(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function Ji(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 Da(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Qo(e){if(!Fa(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Fa(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Fa(e){return Object.prototype.toString.call(e)==="[object Object]"}function If(e){return new Promise(t=>{setTimeout(t,e)})}function Xo(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 Go(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return Go(e,t)}return t}function bf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function _f(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var zi=Symbol();function Wc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===zi&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===zi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Jn,_n,gr,Mc,xf=(Mc=class extends Lr{constructor(){super();ie(this,Jn);ie(this,_n);ie(this,gr);J(this,gr,t=>{if(!nr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){C(this,_n)||this.setEventListener(C(this,gr))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,_n))==null||t.call(this),J(this,_n,void 0))}setEventListener(t){var n;J(this,gr,t),(n=C(this,_n))==null||n.call(this),J(this,_n,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){C(this,Jn)!==t&&(J(this,Jn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof C(this,Jn)=="boolean"?C(this,Jn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Jn=new WeakMap,_n=new WeakMap,gr=new WeakMap,Mc),Rs=new xf,yr,xn,vr,kc,Of=(kc=class extends Lr{constructor(){super();ie(this,yr,!0);ie(this,xn);ie(this,vr);J(this,vr,t=>{if(!nr&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){C(this,xn)||this.setEventListener(C(this,vr))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,xn))==null||t.call(this),J(this,xn,void 0))}setEventListener(t){var n;J(this,vr,t),(n=C(this,xn))==null||n.call(this),J(this,xn,t(this.setOnline.bind(this)))}setOnline(t){C(this,yr)!==t&&(J(this,yr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return C(this,yr)}},yr=new WeakMap,xn=new WeakMap,vr=new WeakMap,kc),Gi=new Of;function Yo(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function Cf(e){return Math.min(1e3*2**e,3e4)}function Jc(e){return(e??"online")==="online"?Gi.isOnline():!0}var zc=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ro(e){return e instanceof zc}function Gc(e){let t=!1,n=0,r=!1,o;const i=Yo(),s=I=>{var p;r||(m(new zc(I)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},c=()=>{t=!1},u=()=>Rs.isFocused()&&(e.networkMode==="always"||Gi.isOnline())&&e.canRun(),d=()=>Jc(e.networkMode)&&e.canRun(),f=I=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,I),o==null||o(),i.resolve(I))},m=I=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,I),o==null||o(),i.reject(I))},h=()=>new Promise(I=>{var p;o=x=>{(r||u())&&I(x)},(p=e.onPause)==null||p.call(e)}).then(()=>{var I;o=void 0,r||(I=e.onContinue)==null||I.call(e)}),y=()=>{if(r)return;let I;const p=n===0?e.initialPromise:void 0;try{I=p??e.fn()}catch(x){I=Promise.reject(x)}Promise.resolve(I).then(f).catch(x=>{var T;if(r)return;const g=e.retry??(nr?0:3),b=e.retryDelay??Cf,O=typeof b=="function"?b(n,x):b,_=g===!0||typeof g=="number"&&n<g||typeof g=="function"&&g(n,x);if(t||!_){m(x);return}n++,(T=e.onFail)==null||T.call(e,n,x),If(O).then(()=>u()?void 0:h()).then(()=>{t?m(x):y()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?y():h().then(y),i)}}function Ef(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||s()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Be=Ef(),zn,jc,Qc=(jc=class{constructor(){ie(this,zn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zo(this.gcTime)&&J(this,zn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(nr?1/0:5*60*1e3))}clearGcTimeout(){C(this,zn)&&(clearTimeout(C(this,zn)),J(this,zn,void 0))}},zn=new WeakMap,jc),wr,Ir,St,Gn,it,ci,Qn,Lt,an,Lc,Sf=(Lc=class extends Qc{constructor(t){super();ie(this,Lt);ie(this,wr);ie(this,Ir);ie(this,St);ie(this,Gn);ie(this,it);ie(this,ci);ie(this,Qn);J(this,Qn,!1),J(this,ci,t.defaultOptions),this.setOptions(t.options),this.observers=[],J(this,Gn,t.client),J(this,St,C(this,Gn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,J(this,wr,Nf(this.options)),this.state=t.state??C(this,wr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=C(this,it))==null?void 0:t.promise}setOptions(t){this.options={...C(this,ci),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,St).remove(this)}setData(t,n){const r=Xo(this.state.data,t,this.options);return pe(this,Lt,an).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){pe(this,Lt,an).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=C(this,it))==null?void 0:r.promise;return(o=C(this,it))==null||o.cancel(t),n?n.then(Nt).catch(Nt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(C(this,wr))}isActive(){return this.observers.some(t=>Kt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===zi||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Bc(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=C(this,it))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=C(this,it))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),C(this,St).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(C(this,it)&&(C(this,Qn)?C(this,it).cancel({revert:!0}):C(this,it).cancelRetry()),this.scheduleGc()),C(this,St).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,Lt,an).call(this,{type:"invalidate"})}fetch(t,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(C(this,it))return C(this,it).continueRetry(),C(this,it).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(m=>m.options.queryFn);f&&this.setOptions(f.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(J(this,Qn,!0),r.signal)})},i=()=>{const f=Wc(this.options,n),m={client:C(this,Gn),queryKey:this.queryKey,meta:this.meta};return o(m),J(this,Qn,!1),this.options.persister?this.options.persister(f,m,this):f(m)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:C(this,Gn),state:this.state,fetchFn:i};o(s),(c=this.options.behavior)==null||c.onFetch(s,this),J(this,Ir,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&pe(this,Lt,an).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const a=f=>{var m,h,y,I;Ro(f)&&f.silent||pe(this,Lt,an).call(this,{type:"error",error:f}),Ro(f)||((h=(m=C(this,St).config).onError)==null||h.call(m,f,this),(I=(y=C(this,St).config).onSettled)==null||I.call(y,this.state.data,f,this)),this.scheduleGc()};return J(this,it,Gc({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var m,h,y,I;if(f===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(p){a(p);return}(h=(m=C(this,St).config).onSuccess)==null||h.call(m,f,this),(I=(y=C(this,St).config).onSettled)==null||I.call(y,f,this.state.error,this),this.scheduleGc()},onError:a,onFail:(f,m)=>{pe(this,Lt,an).call(this,{type:"failed",failureCount:f,error:m})},onPause:()=>{pe(this,Lt,an).call(this,{type:"pause"})},onContinue:()=>{pe(this,Lt,an).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),C(this,it).start()}},wr=new WeakMap,Ir=new WeakMap,St=new WeakMap,Gn=new WeakMap,it=new WeakMap,ci=new WeakMap,Qn=new WeakMap,Lt=new WeakSet,an=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Xc(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Ro(o)&&o.revert&&C(this,Ir)?{...C(this,Ir),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Be.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),C(this,St).notify({query:this,type:"updated",action:t})})},Lc);function Xc(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Jc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Nf(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Bt,Vc,Tf=(Vc=class extends Lr{constructor(t={}){super();ie(this,Bt);this.config=t,J(this,Bt,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Ts(o,n);let s=this.get(i);return s||(s=new Sf({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){C(this,Bt).has(t.queryHash)||(C(this,Bt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=C(this,Bt).get(t.queryHash);n&&(t.destroy(),n===t&&C(this,Bt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Be.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return C(this,Bt).get(t)}getAll(){return[...C(this,Bt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Aa(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Aa(t,r)):n}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Be.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Be.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Bt=new WeakMap,Vc),Wt,ot,Xn,Jt,bn,Kc,Rf=(Kc=class extends Qc{constructor(t){super();ie(this,Jt);ie(this,Wt);ie(this,ot);ie(this,Xn);this.mutationId=t.mutationId,J(this,ot,t.mutationCache),J(this,Wt,[]),this.state=t.state||Yc(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){C(this,Wt).includes(t)||(C(this,Wt).push(t),this.clearGcTimeout(),C(this,ot).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){J(this,Wt,C(this,Wt).filter(n=>n!==t)),this.scheduleGc(),C(this,ot).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){C(this,Wt).length||(this.state.status==="pending"?this.scheduleGc():C(this,ot).remove(this))}continue(){var t;return((t=C(this,Xn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,c,u,d,f,m,h,y,I,p,x,g,b,O,_,T,S;J(this,Xn,Gc({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(N,F)=>{pe(this,Jt,bn).call(this,{type:"failed",failureCount:N,error:F})},onPause:()=>{pe(this,Jt,bn).call(this,{type:"pause"})},onContinue:()=>{pe(this,Jt,bn).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,ot).canRun(this)}));const n=this.state.status==="pending",r=!C(this,Xn).canStart();try{if(!n){pe(this,Jt,bn).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=C(this,ot).config).onMutate)==null?void 0:i.call(o,t,this));const F=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));F!==this.state.context&&pe(this,Jt,bn).call(this,{type:"pending",context:F,variables:t,isPaused:r})}const N=await C(this,Xn).start();return await((u=(c=C(this,ot).config).onSuccess)==null?void 0:u.call(c,N,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,N,t,this.state.context)),await((h=(m=C(this,ot).config).onSettled)==null?void 0:h.call(m,N,null,this.state.variables,this.state.context,this)),await((I=(y=this.options).onSettled)==null?void 0:I.call(y,N,null,t,this.state.context)),pe(this,Jt,bn).call(this,{type:"success",data:N}),N}catch(N){try{throw await((x=(p=C(this,ot).config).onError)==null?void 0:x.call(p,N,t,this.state.context,this)),await((b=(g=this.options).onError)==null?void 0:b.call(g,N,t,this.state.context)),await((_=(O=C(this,ot).config).onSettled)==null?void 0:_.call(O,void 0,N,this.state.variables,this.state.context,this)),await((S=(T=this.options).onSettled)==null?void 0:S.call(T,void 0,N,t,this.state.context)),N}finally{pe(this,Jt,bn).call(this,{type:"error",error:N})}}finally{C(this,ot).runNext(this)}}},Wt=new WeakMap,ot=new WeakMap,Xn=new WeakMap,Jt=new WeakSet,bn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Be.batch(()=>{C(this,Wt).forEach(r=>{r.onMutationUpdate(t)}),C(this,ot).notify({mutation:this,type:"updated",action:t})})},Kc);function Yc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var cn,Vt,li,$c,Af=($c=class extends Lr{constructor(t={}){super();ie(this,cn);ie(this,Vt);ie(this,li);this.config=t,J(this,cn,new Set),J(this,Vt,new Map),J(this,li,0)}build(t,n,r){const o=new Rf({mutationCache:this,mutationId:++Ri(this,li)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){C(this,cn).add(t);const n=Ai(t);if(typeof n=="string"){const r=C(this,Vt).get(n);r?r.push(t):C(this,Vt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(C(this,cn).delete(t)){const n=Ai(t);if(typeof n=="string"){const r=C(this,Vt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&C(this,Vt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ai(t);if(typeof n=="string"){const r=C(this,Vt).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=Ai(t);if(typeof n=="string"){const o=(r=C(this,Vt).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Be.batch(()=>{C(this,cn).forEach(t=>{this.notify({type:"removed",mutation:t})}),C(this,cn).clear(),C(this,Vt).clear()})}getAll(){return Array.from(C(this,cn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Pa(n,r))}findAll(t={}){return this.getAll().filter(n=>Pa(t,n))}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Be.batch(()=>Promise.all(t.map(n=>n.continue().catch(Nt))))}},cn=new WeakMap,Vt=new WeakMap,li=new WeakMap,$c);function Ai(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Ma(e){return{onFetch:(t,n)=>{var d,f,m,h,y;const r=t.options,o=(m=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((h=t.state.data)==null?void 0:h.pages)||[],s=((y=t.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let I=!1;const p=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(t.signal.aborted?I=!0:t.signal.addEventListener("abort",()=>{I=!0}),t.signal)})},x=Wc(t.options,t.fetchOptions),g=async(b,O,_)=>{if(I)return Promise.reject();if(O==null&&b.pages.length)return Promise.resolve(b);const T={client:t.client,queryKey:t.queryKey,pageParam:O,direction:_?"backward":"forward",meta:t.options.meta};p(T);const S=await x(T),{maxPages:N}=t.options,F=_?_f:bf;return{pages:F(b.pages,S,N),pageParams:F(b.pageParams,O,N)}};if(o&&i.length){const b=o==="backward",O=b?Pf:ka,_={pages:i,pageParams:s},T=O(r,_);a=await g(_,T,b)}else{const b=e??i.length;do{const O=c===0?s[0]??r.initialPageParam:ka(r,a);if(c>0&&O==null)break;a=await g(a,O),c++}while(c<b)}return a};t.options.persister?t.fetchFn=()=>{var I,p;return(p=(I=t.options).persister)==null?void 0:p.call(I,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function ka(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 Pf(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Me,On,Cn,br,_r,En,xr,Or,qc,Df=(qc=class{constructor(e={}){ie(this,Me);ie(this,On);ie(this,Cn);ie(this,br);ie(this,_r);ie(this,En);ie(this,xr);ie(this,Or);J(this,Me,e.queryCache||new Tf),J(this,On,e.mutationCache||new Af),J(this,Cn,e.defaultOptions||{}),J(this,br,new Map),J(this,_r,new Map),J(this,En,0)}mount(){Ri(this,En)._++,C(this,En)===1&&(J(this,xr,Rs.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Me).onFocus())})),J(this,Or,Gi.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Me).onOnline())})))}unmount(){var e,t;Ri(this,En)._--,C(this,En)===0&&((e=C(this,xr))==null||e.call(this),J(this,xr,void 0),(t=C(this,Or))==null||t.call(this),J(this,Or,void 0))}isFetching(e){return C(this,Me).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return C(this,On).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=C(this,Me).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=C(this,Me).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(pr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return C(this,Me).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=C(this,Me).get(r.queryHash),i=o==null?void 0:o.state.data,s=wf(t,i);if(s!==void 0)return C(this,Me).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Be.batch(()=>C(this,Me).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=C(this,Me).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=C(this,Me);Be.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=C(this,Me),r={type:"active",...e};return Be.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Be.batch(()=>C(this,Me).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Nt).catch(Nt)}invalidateQueries(e,t={}){return Be.batch(()=>{if(C(this,Me).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none")return Promise.resolve();const n={...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"};return this.refetchQueries(n,t)})}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Be.batch(()=>C(this,Me).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Nt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Nt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=C(this,Me).build(this,t);return n.isStaleByTime(pr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Nt).catch(Nt)}fetchInfiniteQuery(e){return e.behavior=Ma(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Nt).catch(Nt)}ensureInfiniteQueryData(e){return e.behavior=Ma(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Gi.isOnline()?C(this,On).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,Me)}getMutationCache(){return C(this,On)}getDefaultOptions(){return C(this,Cn)}setDefaultOptions(e){J(this,Cn,e)}setQueryDefaults(e,t){C(this,br).set(rr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...C(this,br).values()],n={};return t.forEach(r=>{ei(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){C(this,_r).set(rr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...C(this,_r).values()];let n={};return t.forEach(r=>{ei(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...C(this,Cn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ts(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===zi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...C(this,Cn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){C(this,Me).clear(),C(this,On).clear()}},Me=new WeakMap,On=new WeakMap,Cn=new WeakMap,br=new WeakMap,_r=new WeakMap,En=new WeakMap,xr=new WeakMap,Or=new WeakMap,qc),dt,ye,ui,st,Yn,Cr,Sn,zt,di,Er,Sr,Zn,er,Nn,Nr,Ce,Qr,Zo,es,ts,ns,rs,is,os,Zc,Uc,Ff=(Uc=class extends Lr{constructor(t,n){super();ie(this,Ce);ie(this,dt);ie(this,ye);ie(this,ui);ie(this,st);ie(this,Yn);ie(this,Cr);ie(this,Sn);ie(this,zt);ie(this,di);ie(this,Er);ie(this,Sr);ie(this,Zn);ie(this,er);ie(this,Nn);ie(this,Nr,new Set);this.options=n,J(this,dt,t),J(this,zt,null),J(this,Sn,Yo()),this.options.experimental_prefetchInRender||C(this,Sn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,ye).addObserver(this),ja(C(this,ye),this.options)?pe(this,Ce,Qr).call(this):this.updateResult(),pe(this,Ce,ns).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ss(C(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ss(C(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,Ce,rs).call(this),pe(this,Ce,is).call(this),C(this,ye).removeObserver(this)}setOptions(t,n){const r=this.options,o=C(this,ye);if(this.options=C(this,dt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Kt(this.options.enabled,C(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,Ce,os).call(this),C(this,ye).setOptions(this.options),r._defaulted&&!Ji(this.options,r)&&C(this,dt).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,ye),observer:this});const i=this.hasListeners();i&&La(C(this,ye),o,this.options,r)&&pe(this,Ce,Qr).call(this),this.updateResult(n),i&&(C(this,ye)!==o||Kt(this.options.enabled,C(this,ye))!==Kt(r.enabled,C(this,ye))||pr(this.options.staleTime,C(this,ye))!==pr(r.staleTime,C(this,ye)))&&pe(this,Ce,Zo).call(this);const s=pe(this,Ce,es).call(this);i&&(C(this,ye)!==o||Kt(this.options.enabled,C(this,ye))!==Kt(r.enabled,C(this,ye))||s!==C(this,Nn))&&pe(this,Ce,ts).call(this,s)}getOptimisticResult(t){const n=C(this,dt).getQueryCache().build(C(this,dt),t),r=this.createResult(n,t);return kf(this,r)&&(J(this,st,r),J(this,Cr,this.options),J(this,Yn,C(this,ye).state)),r}getCurrentResult(){return C(this,st)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){C(this,Nr).add(t)}getCurrentQuery(){return C(this,ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=C(this,dt).defaultQueryOptions(t),r=C(this,dt).getQueryCache().build(C(this,dt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,Ce,Qr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,st)))}createResult(t,n){var N;const r=C(this,ye),o=this.options,i=C(this,st),s=C(this,Yn),a=C(this,Cr),u=t!==r?t.state:C(this,ui),{state:d}=t;let f={...d},m=!1,h;if(n._optimisticResults){const F=this.hasListeners(),q=!F&&ja(t,n),G=F&&La(t,r,n,o);(q||G)&&(f={...f,...Xc(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:I,status:p}=f;if(n.select&&f.data!==void 0)if(i&&f.data===(s==null?void 0:s.data)&&n.select===C(this,di))h=C(this,Er);else try{J(this,di,n.select),h=n.select(f.data),h=Xo(i==null?void 0:i.data,h,n),J(this,Er,h),J(this,zt,null)}catch(F){J(this,zt,F)}else h=f.data;if(n.placeholderData!==void 0&&h===void 0&&p==="pending"){let F;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))F=i.data;else if(F=typeof n.placeholderData=="function"?n.placeholderData((N=C(this,Sr))==null?void 0:N.state.data,C(this,Sr)):n.placeholderData,n.select&&F!==void 0)try{F=n.select(F),J(this,zt,null)}catch(q){J(this,zt,q)}F!==void 0&&(p="success",h=Xo(i==null?void 0:i.data,F,n),m=!0)}C(this,zt)&&(y=C(this,zt),h=C(this,Er),I=Date.now(),p="error");const x=f.fetchStatus==="fetching",g=p==="pending",b=p==="error",O=g&&x,_=h!==void 0,S={status:p,fetchStatus:f.fetchStatus,isPending:g,isSuccess:p==="success",isError:b,isInitialLoading:O,isLoading:O,data:h,dataUpdatedAt:f.dataUpdatedAt,error:y,errorUpdatedAt:I,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:x,isRefetching:x&&!g,isLoadingError:b&&!_,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:b&&_,isStale:As(t,n),refetch:this.refetch,promise:C(this,Sn)};if(this.options.experimental_prefetchInRender){const F=z=>{S.status==="error"?z.reject(S.error):S.data!==void 0&&z.resolve(S.data)},q=()=>{const z=J(this,Sn,S.promise=Yo());F(z)},G=C(this,Sn);switch(G.status){case"pending":t.queryHash===r.queryHash&&F(G);break;case"fulfilled":(S.status==="error"||S.data!==G.value)&&q();break;case"rejected":(S.status!=="error"||S.error!==G.reason)&&q();break}}return S}updateResult(t){const n=C(this,st),r=this.createResult(C(this,ye),this.options);if(J(this,Yn,C(this,ye).state),J(this,Cr,this.options),C(this,Yn).data!==void 0&&J(this,Sr,C(this,ye)),Ji(r,n))return;J(this,st,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!C(this,Nr).size)return!0;const c=new Set(a??C(this,Nr));return this.options.throwOnError&&c.add("error"),Object.keys(C(this,st)).some(u=>{const d=u;return C(this,st)[d]!==n[d]&&c.has(d)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),pe(this,Ce,Zc).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,Ce,ns).call(this)}},dt=new WeakMap,ye=new WeakMap,ui=new WeakMap,st=new WeakMap,Yn=new WeakMap,Cr=new WeakMap,Sn=new WeakMap,zt=new WeakMap,di=new WeakMap,Er=new WeakMap,Sr=new WeakMap,Zn=new WeakMap,er=new WeakMap,Nn=new WeakMap,Nr=new WeakMap,Ce=new WeakSet,Qr=function(t){pe(this,Ce,os).call(this);let n=C(this,ye).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Nt)),n},Zo=function(){pe(this,Ce,rs).call(this);const t=pr(this.options.staleTime,C(this,ye));if(nr||C(this,st).isStale||!zo(t))return;const r=Bc(C(this,st).dataUpdatedAt,t)+1;J(this,Zn,setTimeout(()=>{C(this,st).isStale||this.updateResult()},r))},es=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,ye)):this.options.refetchInterval)??!1},ts=function(t){pe(this,Ce,is).call(this),J(this,Nn,t),!(nr||Kt(this.options.enabled,C(this,ye))===!1||!zo(C(this,Nn))||C(this,Nn)===0)&&J(this,er,setInterval(()=>{(this.options.refetchIntervalInBackground||Rs.isFocused())&&pe(this,Ce,Qr).call(this)},C(this,Nn)))},ns=function(){pe(this,Ce,Zo).call(this),pe(this,Ce,ts).call(this,pe(this,Ce,es).call(this))},rs=function(){C(this,Zn)&&(clearTimeout(C(this,Zn)),J(this,Zn,void 0))},is=function(){C(this,er)&&(clearInterval(C(this,er)),J(this,er,void 0))},os=function(){const t=C(this,dt).getQueryCache().build(C(this,dt),this.options);if(t===C(this,ye))return;const n=C(this,ye);J(this,ye,t),J(this,ui,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Zc=function(t){Be.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(C(this,st))}),C(this,dt).getQueryCache().notify({query:C(this,ye),type:"observerResultsUpdated"})})},Uc);function Mf(e,t){return Kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function ja(e,t){return Mf(e,t)||e.state.data!==void 0&&ss(e,t,t.refetchOnMount)}function ss(e,t,n){if(Kt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&As(e,t)}return!1}function La(e,t,n,r){return(e!==t||Kt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&As(e,n)}function As(e,t){return Kt(t.enabled,e)!==!1&&e.isStaleByTime(pr(t.staleTime,e))}function kf(e,t){return!Ji(e.getCurrentResult(),t)}var Tn,Rn,ft,ln,fn,$i,as,Hc,jf=(Hc=class extends Lr{constructor(n,r){super();ie(this,fn);ie(this,Tn);ie(this,Rn);ie(this,ft);ie(this,ln);J(this,Tn,n),this.setOptions(r),this.bindMethods(),pe(this,fn,$i).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=C(this,Tn).defaultMutationOptions(n),Ji(this.options,r)||C(this,Tn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,ft),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&rr(r.mutationKey)!==rr(this.options.mutationKey)?this.reset():((o=C(this,ft))==null?void 0:o.state.status)==="pending"&&C(this,ft).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=C(this,ft))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,fn,$i).call(this),pe(this,fn,as).call(this,n)}getCurrentResult(){return C(this,Rn)}reset(){var n;(n=C(this,ft))==null||n.removeObserver(this),J(this,ft,void 0),pe(this,fn,$i).call(this),pe(this,fn,as).call(this)}mutate(n,r){var o;return J(this,ln,r),(o=C(this,ft))==null||o.removeObserver(this),J(this,ft,C(this,Tn).getMutationCache().build(C(this,Tn),this.options)),C(this,ft).addObserver(this),C(this,ft).execute(n)}},Tn=new WeakMap,Rn=new WeakMap,ft=new WeakMap,ln=new WeakMap,fn=new WeakSet,$i=function(){var r;const n=((r=C(this,ft))==null?void 0:r.state)??Yc();J(this,Rn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},as=function(n){Be.batch(()=>{var r,o,i,s,a,c,u,d;if(C(this,ln)&&this.hasListeners()){const f=C(this,Rn).variables,m=C(this,Rn).context;(n==null?void 0:n.type)==="success"?((o=(r=C(this,ln)).onSuccess)==null||o.call(r,n.data,f,m),(s=(i=C(this,ln)).onSettled)==null||s.call(i,n.data,null,f,m)):(n==null?void 0:n.type)==="error"&&((c=(a=C(this,ln)).onError)==null||c.call(a,n.error,f,m),(d=(u=C(this,ln)).onSettled)==null||d.call(u,void 0,n.error,f,m))}this.listeners.forEach(f=>{f(C(this,Rn))})})},Hc),el=D.createContext(void 0),Yt=e=>{const t=D.useContext(el);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Lf=({client:e,children:t})=>(D.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(el.Provider,{value:e,children:t})),tl=D.createContext(!1),Vf=()=>D.useContext(tl);tl.Provider;function Kf(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var $f=D.createContext(Kf()),qf=()=>D.useContext($f);function nl(e,t){return typeof e=="function"?e(...t):!!e}function cs(){}var Uf=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Hf=e=>{D.useEffect(()=>{e.clearReset()},[e])},Bf=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||nl(n,[e.error,r])),Wf=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Jf=(e,t)=>e.isLoading&&e.isFetching&&!t,zf=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Va=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Gf(e,t,n){var f,m,h,y,I;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=Yt(),o=Vf(),i=qf(),s=r.defaultQueryOptions(e);(m=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||m.call(f,s),s._optimisticResults=o?"isRestoring":"optimistic",Wf(s),Uf(s,i),Hf(i);const a=!r.getQueryCache().get(s.queryHash),[c]=D.useState(()=>new t(r,s)),u=c.getOptimisticResult(s),d=!o&&e.subscribed!==!1;if(D.useSyncExternalStore(D.useCallback(p=>{const x=d?c.subscribe(Be.batchCalls(p)):cs;return c.updateResult(),x},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),D.useEffect(()=>{c.setOptions(s,{listeners:!1})},[s,c]),zf(s,u))throw Va(s,c,i);if(Bf({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw u.error;if((y=(h=r.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,s,u),s.experimental_prefetchInRender&&!nr&&Jf(u,o)){const p=a?Va(s,c,i):(I=r.getQueryCache().get(s.queryHash))==null?void 0:I.promise;p==null||p.catch(cs).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?u:c.trackResult(u)}function Vr(e,t){return Gf(e,Ff)}function Ps(e,t){const n=Yt(),[r]=D.useState(()=>new jf(n,e));D.useEffect(()=>{r.setOptions(e)},[r,e]);const o=D.useSyncExternalStore(D.useCallback(s=>r.subscribe(Be.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=D.useCallback((s,a)=>{r.mutate(s,a).catch(cs)},[r]);if(o.error&&nl(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const rl=v.createContext(null),Qf=rl.Provider,fi=()=>{const e=v.useContext(rl);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var ue=(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))(ue||{});const il=v.createContext(void 0);function Tt(){const e=v.useContext(il);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Xf=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function Yf({children:e}){const[t,n]=v.useState(Xf),r=v.useCallback((d,f,m=!0)=>{n(h=>{const y={...h};return y[d]=y[d]||{},y[d][f]=m,y})},[n]),o=v.useCallback((d,f)=>{var m;return!!((m=t[d])!=null&&m[f])},[t]),i=v.useCallback((d,f)=>{var m;return(m=t[d])==null?void 0:m[f]},[t]),s=v.useCallback((d,f)=>{n(m=>{var y;const h={...m};return(y=h[d])==null||delete y[f],h})},[n]),a=v.useCallback(d=>{n(f=>{const m={...f};return m[d]={},m})},[n]),c=v.useCallback((d,f)=>{n(m=>{const h={...m};return h[d]=h[d]||{},f.forEach(y=>{h[d][y]=!0}),h})},[n]),u=v.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:c,getError:i}),[t,n,r,o,s,a,c,i]);return l.jsx(il.Provider,{value:u,children:e})}const Zf="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ds{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Zf}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||sl}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 ep=new Ds,uo=class uo{constructor(t=ep){this.configuration=t,this.fetchApi=async(n,r)=>{let o={url:n,init:r};for(const s of this.middleware)s.pre&&(o=await s.pre({fetch:this.fetchApi,...o})||o);let i;try{i=await(this.configuration.fetchApi||fetch)(o.url,o.init)}catch(s){for(const a of this.middleware)a.onError&&(i=await a.onError({fetch:this.fetchApi,url:o.url,init:o.init,error:s,response:i?i.clone():void 0})||i);if(i===void 0)throw s instanceof Error?new rp(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(i=await s.post({fetch:this.fetchApi,url:o.url,init:o.init,response:i.clone()})||i);return i},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?uo.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:o}=await this.createFetchParams(t,n),i=await this.fetchApi(r,o);if(i&&i.status>=200&&i.status<300)return i;throw new ol(i,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const o=Object.assign({},this.configuration.headers,t.headers);Object.keys(o).forEach(u=>o[u]===void 0?delete o[u]:{});const i=typeof n=="function"?n:async()=>n,s={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},a={...s,...await i({init:s,context:t})},c={...a,body:np(a.body)||a.body instanceof URLSearchParams||tp(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};uo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Qt=uo;function tp(e){return typeof Blob<"u"&&e instanceof Blob}function np(e){return typeof FormData<"u"&&e instanceof FormData}class ol extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class rp extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class se extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function R(e,t){const n=e[t];return n!=null}function sl(e,t=""){return Object.keys(e).map(n=>al(n,e[n],t)).filter(n=>n.length>0).join("&")}function al(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const o=t.map(i=>encodeURIComponent(String(i))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${o}`}if(t instanceof Set){const o=Array.from(t);return al(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?sl(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function pi(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 ir{constructor(t){this.raw=t}async value(){}}class ip{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function op(e){return sp(e)}function sp(e,t){return e==null?e:{fieldUsed:R(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:R(e,"keyFormat")?e.keyFormat:void 0}}function ap(e){return cp(e)}function cp(e,t){return e==null?e:{name:e.name,valuePrefix:R(e,"valuePrefix")?e.valuePrefix:void 0}}function lp(e){return up(e)}function up(e,t){return e==null?e:{name:e.name}}function dp(e){return fp(e)}function fp(e,t){return e==null?e:{attachmentType:e.attachmentType,query:R(e,"query")?lp(e.query):void 0,header:R(e,"header")?ap(e.header):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function pp(e){return hp(e)}function hp(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0,includeFullRecords:R(e,"includeFullRecords")?e.includeFullRecords:void 0}}function mp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function gp(e){return yp(e)}function yp(e,t){return e}function vp(e){return wp(e)}function wp(e,t){return e==null?e:{days:R(e,"days")?e.days:void 0,fullHistory:R(e,"fullHistory")?e.fullHistory:void 0}}function Ip(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function cl(e){return bp(e)}function bp(e,t){return e==null?e:{defaultPeriod:vp(e.defaultPeriod)}}function _p(e){if(e!==void 0)return e===null?null:{defaultPeriod:Ip(e.defaultPeriod)}}function xp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Op(e){if(e!==void 0)return e===null?null:{defaultPeriod:xp(e.defaultPeriod)}}function Cp(e){return Ep(e)}function Ep(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function ll(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Sp(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Op(e.backfill)}}function Np(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:pi(e.objects,Sp)}}function Tp(e){let t=!0;return t=t&&"value"in e,t}function Rp(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Ap(e){let t=!0;return t=t&&"value"in e,t}function Pp(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Dp(e){let t=!0;return t=t&&"value"in e,t}function Fp(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Mp(e){if(e!==void 0)return e===null?null:Tp(e)?Rp(e):Ap(e)?Pp(e):Dp(e)?Fp(e):{}}function kp(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:pi(e.selectedValueDefaults,Mp)}}function jp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:pi(e.objects,kp)}}function Lp(e){return Vp(e)}function Vp(e,t){return e==null?e:{apiKeyAsBasic:R(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:R(e,"apiKeyAsBasicOpts")?op(e.apiKeyAsBasicOpts):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function Kp(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Pi(e){return $p(e)}function $p(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:R(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function qp(e){return Up(e)}function Up(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Hp(e){return Bp(e)}function Bp(e,t){return e==null?e:{provider:e.provider,read:R(e,"read")?e.read:void 0,write:R(e,"write")?e.write:void 0,proxy:R(e,"proxy")?Cp(e.proxy):void 0}}function Wp(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:ll(e.proxy)}}function Jp(e){return zp(e)}function zp(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Hp(e.content)}}function Gp(e){return Qp(e)}function Qp(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function ul(e){return Xp(e)}function Xp(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Yp(e){return Zp(e)}function Zp(e,t){return e==null?e:{token:e.token}}function eh(e){return th(e)}function th(e,t){return e==null?e:{token:e.token}}function nh(e){return rh(e)}function rh(e,t){return e==null?e:{accessToken:R(e,"accessToken")?Yp(e.accessToken):void 0,refreshToken:R(e,"refreshToken")?eh(e.refreshToken):void 0,scopes:R(e,"scopes")?e.scopes:void 0}}function qi(e){return ih(e)}function ih(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:R(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:R(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Ui(e){return oh(e)}function oh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:R(e,"providerApp")?qi(e.providerApp):void 0,group:ul(e.group),consumer:Gp(e.consumer),providerWorkspaceRef:R(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:R(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:R(e,"oauth2AuthorizationCode")?nh(e.oauth2AuthorizationCode):void 0,apiKey:R(e,"apiKey")?e.apiKey:void 0}}function sh(e){return ah(e)}function ah(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function ch(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function lh(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Wp(e.content)}}function uh(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:lh(e.config)}}function dh(e){return fh(e)}function fh(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function ph(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function hh(e){return mh(e)}function mh(e,t){return e==null?e:{mode:R(e,"mode")?e.mode:void 0,pageSize:R(e,"pageSize")?e.pageSize:void 0}}function gh(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function yh(e){let t=!0;return t=t&&"fieldName"in e,t}function vh(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function wh(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Ih(e){let t=!0;return t=t&&"mapToName"in e,t}function dl(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:R(e,"default")?e.default:void 0,prompt:R(e,"prompt")?e.prompt:void 0}}function bh(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ka(e){return _h(e)}function _h(e,t){return e==null?e:{...vh(e),...dl(e)}}function $a(e){if(e!==void 0)return e===null?null:yh(e)?wh(e):Ih(e)?bh(e):{}}function fl(e){return xh(e)}function xh(e,t){return e}function Oh(e){return Ch(e)}function Ch(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:R(e,"requiredFields")?e.requiredFields.map(Ka):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(Ka):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?fl(e.optionalFieldsAuto):void 0,backfill:R(e,"backfill")?cl(e.backfill):void 0,delivery:R(e,"delivery")?hh(e.delivery):void 0}}function Eh(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($a),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map($a),optionalFieldsAuto:e.optionalFieldsAuto,backfill:_p(e.backfill),delivery:gh(e.delivery)}}function Sh(e){return Nh(e)}function Nh(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Oh):void 0}}function Th(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Eh)}}function Rh(e){return Ah(e)}function Ah(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Ph(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Dh(e){return Fh(e)}function Fh(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0,requiredWatchFields:R(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function Mh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,requiredWatchFields:e.requiredWatchFields}}function kh(e){return jh(e)}function jh(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFields:R(e,"inheritFields")?e.inheritFields:void 0,createEvent:R(e,"CreateEvent")?sh(e.CreateEvent):void 0,updateEvent:R(e,"UpdateEvent")?Dh(e.UpdateEvent):void 0,deleteEvent:R(e,"DeleteEvent")?Rh(e.DeleteEvent):void 0,associationChangeEvent:R(e,"AssociationChangeEvent")?pp(e.AssociationChangeEvent):void 0,otherEvents:R(e,"OtherEvents")?e.OtherEvents:void 0}}function Lh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFields:e.inheritFields,CreateEvent:ch(e.createEvent),UpdateEvent:Mh(e.updateEvent),DeleteEvent:Ph(e.deleteEvent),AssociationChangeEvent:mp(e.associationChangeEvent),OtherEvents:e.otherEvents}}function Vh(e){return Kh(e)}function Kh(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(kh):void 0}}function $h(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Lh)}}function pl(e){return qh(e)}function qh(e,t){return e==null?e:{allowAnyFields:R(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Uh(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Hh(e){return Bh(e)}function Bh(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:R(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:R(e,"valueDefaults")?pl(e.valueDefaults):void 0}}function Wh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Uh(e.valueDefaults)}}function Jh(e){return zh(e)}function zh(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Hh):void 0}}function Gh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Wh)}}function Qh(e){return Xh(e)}function Xh(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?Sh(e.read):void 0,write:R(e,"write")?Jh(e.write):void 0,proxy:R(e,"proxy")?dh(e.proxy):void 0,subscribe:R(e,"subscribe")?Vh(e.subscribe):void 0}}function Yh(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:Th(e.read),write:Gh(e.write),proxy:ph(e.proxy),subscribe:$h(e.subscribe)}}function Zh(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Yh(e.content)}}function em(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Zh(e.latestRevision)}}function tm(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function nm(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 rm(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function im(e){return om(e)}function om(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function sm(e){return am(e)}function am(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:R(e,"valueType")?e.valueType:void 0,providerType:R(e,"providerType")?e.providerType:void 0,readOnly:R(e,"readOnly")?e.readOnly:void 0,values:R(e,"values")?e.values.map(im):void 0}}function cm(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function lm(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function um(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 dm(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 fm(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 pm(e){if(e!==void 0)return e===null?null:{accessToken:dm(e.accessToken),refreshToken:fm(e.refreshToken),scopes:e.scopes}}function hm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:cm(e.basicAuth),oauth2ClientCredentials:lm(e.oauth2ClientCredentials),oauth2Password:um(e.oauth2Password),oauth2AuthorizationCode:pm(e.oauth2AuthorizationCode)}}function mm(e){return gm(e)}function gm(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function ym(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Ao(e){return vm(e)}function vm(e,t){return e==null?e:{...ym(e),...dl(e)}}function wm(e){return Im(e)}function Im(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:R(e,"requiredFields")?e.requiredFields.map(Ao):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(Ao):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?fl(e.optionalFieldsAuto):void 0,allFields:R(e,"allFields")?e.allFields.map(Ao):void 0,allFieldsMetadata:R(e,"allFieldsMetadata")?pi(e.allFieldsMetadata,sm):void 0,backfill:R(e,"backfill")?cl(e.backfill):void 0}}function bm(e){return _m(e)}function _m(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(wm):void 0}}function xm(e){return Om(e)}function Om(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:R(e,"valueDefaults")?pl(e.valueDefaults):void 0}}function Cm(e){return Em(e)}function Em(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(xm):void 0}}function Sm(e){return Nm(e)}function Nm(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?bm(e.read):void 0,write:R(e,"write")?Cm(e.write):void 0,proxy:R(e,"proxy")?mm(e.proxy):void 0}}function Tm(e){return Rm(e)}function Rm(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Sm(e.content)}}function Di(e){return Am(e)}function Am(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:R(e,"group")?ul(e.group):void 0,healthStatus:e.healthStatus,connection:Ui(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,config:Jp(e.config)}}function Pm(e){return Dm(e)}function Dm(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Qh(e.content)}}function qa(e){return Fm(e)}function Fm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Pm(e.latestRevision)}}function Mm(e){return km(e)}function km(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function jm(e){return Lm(e)}function Lm(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function Vm(e){return Km(e)}function Km(e,t){return e==null?e:{regular:R(e,"regular")?jm(e.regular):void 0,darkMode:R(e,"darkMode")?Mm(e.darkMode):void 0}}function $m(e){return qm(e)}function qm(e,t){return e==null?e:{workspaceRefField:R(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:R(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:R(e,"scopesField")?e.scopesField:void 0}}function Um(e){return Hm(e)}function Hm(e,t){return e==null?e:{grantType:e.grantType,authURL:R(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:R(e,"audience")?e.audience:void 0,tokenMetadataFields:$m(e.tokenMetadataFields),docsURL:R(e,"docsURL")?e.docsURL:void 0,authURLParams:R(e,"authURLParams")?e.authURLParams:void 0}}function Bm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function Wm(e){return Jm(e)}function Jm(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function zm(e){return Gm(e)}function Gm(e,t){return e==null?e:{create:R(e,"create")?e.create:void 0,update:R(e,"update")?e.update:void 0,_delete:R(e,"delete")?e.delete:void 0,passThrough:R(e,"passThrough")?e.passThrough:void 0}}function Qm(e){return Xm(e)}function Xm(e,t){return e==null?e:{bulkWrite:qp(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:R(e,"subscribeSupport")?zm(e.subscribeSupport):void 0}}function Ua(e){return Ym(e)}function Ym(e,t){return e==null?e:{name:e.name,authType:gp(e.authType),baseURL:e.baseURL,oauth2Opts:R(e,"oauth2Opts")?Um(e.oauth2Opts):void 0,apiKeyOpts:R(e,"apiKeyOpts")?dp(e.apiKeyOpts):void 0,basicOpts:R(e,"basicOpts")?Lp(e.basicOpts):void 0,support:Qm(e.support),providerOpts:e.providerOpts,displayName:R(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:R(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:R(e,"media")?Vm(e.media):void 0,labels:R(e,"labels")?e.labels:void 0,subscribeOpts:R(e,"subscribeOpts")?Wm(e.subscribeOpts):void 0}}function Zm(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Np(e.read),write:jp(e.write),proxy:ll(e.proxy)}}function eg(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Zm(e.content)}}function tg(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:eg(e.config)}}function ng(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:tg(e.installation)}}function rg(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function ig(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:rg(e.project)}}function og(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 sg(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:og(e.providerApp)}}class ag extends Qt{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new se("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new ir(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");if(t.generateConnectionParams===null||t.generateConnectionParams===void 0)throw new se("generateConnectionParams","Required parameter requestParameters.generateConnectionParams was null or undefined when calling generateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:hm(t.generateConnectionParams)},n);return new Ve(i,s=>Ui(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new se("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>Ui(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>s.map(Ui))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class cg extends Qt{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new se("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:uh(t.installation)},n);return new Ve(i,s=>Di(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new se("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:o,query:r},n);return new ir(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new se("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>Di(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>s.map(Di))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new se("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new se("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:o,query:r,body:ng(t.installationUpdate)},n);return new Ve(i,s=>Di(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class lg extends Qt{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new se("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:Kp(t.batchUpsertIntegrationsRequest)},n);return new Ve(i,s=>s.map(qa))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new se("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:em(t.integration)},n);return new ir(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new ir(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>s.map(qa))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class ug extends Qt{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new se("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json";const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:Bm(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Ve(i):new ip(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class dg extends Qt{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new se("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:tm(t.project)},n);return new Ve(i,s=>Pi(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:o,query:r},n);return new ir(i)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>Pi(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Ve(o,i=>i.map(Pi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new se("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:ig(t.projectUpdate)},n);return new Ve(i,s=>Pi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class fg extends Qt{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new se("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>Ua(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Ve(o,i=>pi(i,Ua))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class pg extends Qt{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new se("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:nm(t.providerApp)},n);return new Ve(i,s=>qi(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new se("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new ir(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>s.map(qi))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new se("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new se("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:sg(t.providerAppUpdate)},n);return new Ve(i,s=>qi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class hg extends Qt{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new se("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:rm(t.revision)},n);return new ir(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new se("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new se("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>Tm(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class hl{constructor(t){this.connectionApi=new ag(t),this.installationApi=new cg(t),this.integrationApi=new lg(t),this.oAuthApi=new ug(t),this.projectApi=new dg(t),this.providerApi=new fg(t),this.providerAppApi=new pg(t),this.revisionApi=new hg(t)}}const ml="2.4.10",mg="v1",Fi="https://api.withampersand.com";function gl(){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 Fi;case"mock":return"http://127.0.0.1:4010";case"":return Fi;default:return e??Fi}}catch{return Fi}}const gg=(e,t)=>`${e}/${t}`;function yg(){return gg(gl(),mg)}const vg=gl(),yl=yg(),wg=new Ds({basePath:yl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":ml}});let Ig=new hl(wg);const hr=()=>Ig;function pn(){const e=fi();return v.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Ds({basePath:yl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":ml,"X-Api-Key":e}});return new hl(n)},[e])}const _t=async(e,t)=>{var n;if(e instanceof ol){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
2
- `))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s),t&&t(a+(s!=null&&s.remedy?`
1
+ "use strict";var Na=e=>{throw TypeError(e)};var To=(e,t,n)=>t.has(e)||Na("Cannot "+n);var C=(e,t,n)=>(To(e,t,"read from private field"),n?n.call(e):t.get(e)),ie=(e,t,n)=>t.has(e)?Na("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),J=(e,t,n,r)=>(To(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(To(e,t,"access private method"),n);var Ri=(e,t,n,r)=>({set _(o){J(e,t,o,n)},get _(){return C(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),w=require("react");require("react-dom");function yf(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const K=yf(w);var Kr=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(){}},rr=typeof window>"u"||"Deno"in globalThis;function Nt(){}function vf(e,t){return typeof e=="function"?e(t):e}function Jo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Uc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function hr(e,t){return typeof e=="function"?e(t):e}function Kt(e,t){return typeof e=="function"?e(t):e}function Ta(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Ns(s,t.options))return!1}else if(!ti(t.queryKey,s))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function Ra(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(ir(t.options.mutationKey)!==ir(i))return!1}else if(!ti(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Ns(e,t){return((t==null?void 0:t.queryKeyHashFn)||ir)(e)}function ir(e){return JSON.stringify(e,(t,n)=>Go(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function ti(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!ti(e[n],t[n])):!1}function zo(e,t){if(e===t)return e;const n=Aa(e)&&Aa(t);if(n||Go(e)&&Go(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let c=0;for(let u=0;u<s;u++){const d=n?u:i[u];(!n&&r.includes(d)||n)&&e[d]===void 0&&t[d]===void 0?(a[d]=void 0,c++):(a[d]=zo(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function Ji(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 Aa(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Go(e){if(!Pa(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Pa(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Pa(e){return Object.prototype.toString.call(e)==="[object Object]"}function wf(e){return new Promise(t=>{setTimeout(t,e)})}function Qo(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 zo(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return zo(e,t)}return t}function If(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function bf(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var zi=Symbol();function Hc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===zi&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===zi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var zn,_n,yr,Dc,_f=(Dc=class extends Kr{constructor(){super();ie(this,zn);ie(this,_n);ie(this,yr);J(this,yr,t=>{if(!rr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){C(this,_n)||this.setEventListener(C(this,yr))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,_n))==null||t.call(this),J(this,_n,void 0))}setEventListener(t){var n;J(this,yr,t),(n=C(this,_n))==null||n.call(this),J(this,_n,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){C(this,zn)!==t&&(J(this,zn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof C(this,zn)=="boolean"?C(this,zn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},zn=new WeakMap,_n=new WeakMap,yr=new WeakMap,Dc),Ts=new _f,vr,xn,wr,Fc,xf=(Fc=class extends Kr{constructor(){super();ie(this,vr,!0);ie(this,xn);ie(this,wr);J(this,wr,t=>{if(!rr&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){C(this,xn)||this.setEventListener(C(this,wr))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,xn))==null||t.call(this),J(this,xn,void 0))}setEventListener(t){var n;J(this,wr,t),(n=C(this,xn))==null||n.call(this),J(this,xn,t(this.setOnline.bind(this)))}setOnline(t){C(this,vr)!==t&&(J(this,vr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return C(this,vr)}},vr=new WeakMap,xn=new WeakMap,wr=new WeakMap,Fc),Gi=new xf;function Xo(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function Of(e){return Math.min(1e3*2**e,3e4)}function Bc(e){return(e??"online")==="online"?Gi.isOnline():!0}var Wc=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ro(e){return e instanceof Wc}function Jc(e){let t=!1,n=0,r=!1,o;const i=Xo(),s=v=>{var p;r||(h(new Wc(v)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},c=()=>{t=!1},u=()=>Ts.isFocused()&&(e.networkMode==="always"||Gi.isOnline())&&e.canRun(),d=()=>Bc(e.networkMode)&&e.canRun(),f=v=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,v),o==null||o(),i.resolve(v))},h=v=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,v),o==null||o(),i.reject(v))},m=()=>new Promise(v=>{var p;o=x=>{(r||u())&&v(x)},(p=e.onPause)==null||p.call(e)}).then(()=>{var v;o=void 0,r||(v=e.onContinue)==null||v.call(e)}),y=()=>{if(r)return;let v;const p=n===0?e.initialPromise:void 0;try{v=p??e.fn()}catch(x){v=Promise.reject(x)}Promise.resolve(v).then(f).catch(x=>{var T;if(r)return;const g=e.retry??(rr?0:3),b=e.retryDelay??Of,O=typeof b=="function"?b(n,x):b,_=g===!0||typeof g=="number"&&n<g||typeof g=="function"&&g(n,x);if(t||!_){h(x);return}n++,(T=e.onFail)==null||T.call(e,n,x),wf(O).then(()=>u()?void 0:m()).then(()=>{t?h(x):y()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?y():m().then(y),i)}}function Cf(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||s()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Be=Cf(),Gn,Mc,zc=(Mc=class{constructor(){ie(this,Gn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jo(this.gcTime)&&J(this,Gn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(rr?1/0:5*60*1e3))}clearGcTimeout(){C(this,Gn)&&(clearTimeout(C(this,Gn)),J(this,Gn,void 0))}},Gn=new WeakMap,Mc),Ir,br,St,Qn,it,li,Xn,Lt,an,kc,Ef=(kc=class extends zc{constructor(t){super();ie(this,Lt);ie(this,Ir);ie(this,br);ie(this,St);ie(this,Qn);ie(this,it);ie(this,li);ie(this,Xn);J(this,Xn,!1),J(this,li,t.defaultOptions),this.setOptions(t.options),this.observers=[],J(this,Qn,t.client),J(this,St,C(this,Qn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,J(this,Ir,Sf(this.options)),this.state=t.state??C(this,Ir),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=C(this,it))==null?void 0:t.promise}setOptions(t){this.options={...C(this,li),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,St).remove(this)}setData(t,n){const r=Qo(this.state.data,t,this.options);return pe(this,Lt,an).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){pe(this,Lt,an).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=C(this,it))==null?void 0:r.promise;return(o=C(this,it))==null||o.cancel(t),n?n.then(Nt).catch(Nt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(C(this,Ir))}isActive(){return this.observers.some(t=>Kt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===zi||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Uc(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=C(this,it))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=C(this,it))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),C(this,St).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(C(this,it)&&(C(this,Xn)?C(this,it).cancel({revert:!0}):C(this,it).cancelRetry()),this.scheduleGc()),C(this,St).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,Lt,an).call(this,{type:"invalidate"})}fetch(t,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(C(this,it))return C(this,it).continueRetry(),C(this,it).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(h=>h.options.queryFn);f&&this.setOptions(f.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(J(this,Xn,!0),r.signal)})},i=()=>{const f=Hc(this.options,n),h={client:C(this,Qn),queryKey:this.queryKey,meta:this.meta};return o(h),J(this,Xn,!1),this.options.persister?this.options.persister(f,h,this):f(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:C(this,Qn),state:this.state,fetchFn:i};o(s),(c=this.options.behavior)==null||c.onFetch(s,this),J(this,br,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&pe(this,Lt,an).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const a=f=>{var h,m,y,v;Ro(f)&&f.silent||pe(this,Lt,an).call(this,{type:"error",error:f}),Ro(f)||((m=(h=C(this,St).config).onError)==null||m.call(h,f,this),(v=(y=C(this,St).config).onSettled)==null||v.call(y,this.state.data,f,this)),this.scheduleGc()};return J(this,it,Jc({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,m,y,v;if(f===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(p){a(p);return}(m=(h=C(this,St).config).onSuccess)==null||m.call(h,f,this),(v=(y=C(this,St).config).onSettled)==null||v.call(y,f,this.state.error,this),this.scheduleGc()},onError:a,onFail:(f,h)=>{pe(this,Lt,an).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{pe(this,Lt,an).call(this,{type:"pause"})},onContinue:()=>{pe(this,Lt,an).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),C(this,it).start()}},Ir=new WeakMap,br=new WeakMap,St=new WeakMap,Qn=new WeakMap,it=new WeakMap,li=new WeakMap,Xn=new WeakMap,Lt=new WeakSet,an=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Gc(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Ro(o)&&o.revert&&C(this,br)?{...C(this,br),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Be.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),C(this,St).notify({query:this,type:"updated",action:t})})},kc);function Gc(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Bc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Sf(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Bt,jc,Nf=(jc=class extends Kr{constructor(t={}){super();ie(this,Bt);this.config=t,J(this,Bt,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Ns(o,n);let s=this.get(i);return s||(s=new Ef({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){C(this,Bt).has(t.queryHash)||(C(this,Bt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=C(this,Bt).get(t.queryHash);n&&(t.destroy(),n===t&&C(this,Bt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Be.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return C(this,Bt).get(t)}getAll(){return[...C(this,Bt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ta(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ta(t,r)):n}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Be.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Be.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Bt=new WeakMap,jc),Wt,ot,Yn,Jt,bn,Lc,Tf=(Lc=class extends zc{constructor(t){super();ie(this,Jt);ie(this,Wt);ie(this,ot);ie(this,Yn);this.mutationId=t.mutationId,J(this,ot,t.mutationCache),J(this,Wt,[]),this.state=t.state||Qc(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){C(this,Wt).includes(t)||(C(this,Wt).push(t),this.clearGcTimeout(),C(this,ot).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){J(this,Wt,C(this,Wt).filter(n=>n!==t)),this.scheduleGc(),C(this,ot).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){C(this,Wt).length||(this.state.status==="pending"?this.scheduleGc():C(this,ot).remove(this))}continue(){var t;return((t=C(this,Yn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,c,u,d,f,h,m,y,v,p,x,g,b,O,_,T,S;J(this,Yn,Jc({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(N,D)=>{pe(this,Jt,bn).call(this,{type:"failed",failureCount:N,error:D})},onPause:()=>{pe(this,Jt,bn).call(this,{type:"pause"})},onContinue:()=>{pe(this,Jt,bn).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,ot).canRun(this)}));const n=this.state.status==="pending",r=!C(this,Yn).canStart();try{if(!n){pe(this,Jt,bn).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=C(this,ot).config).onMutate)==null?void 0:i.call(o,t,this));const D=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));D!==this.state.context&&pe(this,Jt,bn).call(this,{type:"pending",context:D,variables:t,isPaused:r})}const N=await C(this,Yn).start();return await((u=(c=C(this,ot).config).onSuccess)==null?void 0:u.call(c,N,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,N,t,this.state.context)),await((m=(h=C(this,ot).config).onSettled)==null?void 0:m.call(h,N,null,this.state.variables,this.state.context,this)),await((v=(y=this.options).onSettled)==null?void 0:v.call(y,N,null,t,this.state.context)),pe(this,Jt,bn).call(this,{type:"success",data:N}),N}catch(N){try{throw await((x=(p=C(this,ot).config).onError)==null?void 0:x.call(p,N,t,this.state.context,this)),await((b=(g=this.options).onError)==null?void 0:b.call(g,N,t,this.state.context)),await((_=(O=C(this,ot).config).onSettled)==null?void 0:_.call(O,void 0,N,this.state.variables,this.state.context,this)),await((S=(T=this.options).onSettled)==null?void 0:S.call(T,void 0,N,t,this.state.context)),N}finally{pe(this,Jt,bn).call(this,{type:"error",error:N})}}finally{C(this,ot).runNext(this)}}},Wt=new WeakMap,ot=new WeakMap,Yn=new WeakMap,Jt=new WeakSet,bn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Be.batch(()=>{C(this,Wt).forEach(r=>{r.onMutationUpdate(t)}),C(this,ot).notify({mutation:this,type:"updated",action:t})})},Lc);function Qc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var cn,Vt,ui,Vc,Rf=(Vc=class extends Kr{constructor(t={}){super();ie(this,cn);ie(this,Vt);ie(this,ui);this.config=t,J(this,cn,new Set),J(this,Vt,new Map),J(this,ui,0)}build(t,n,r){const o=new Tf({mutationCache:this,mutationId:++Ri(this,ui)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){C(this,cn).add(t);const n=Ai(t);if(typeof n=="string"){const r=C(this,Vt).get(n);r?r.push(t):C(this,Vt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(C(this,cn).delete(t)){const n=Ai(t);if(typeof n=="string"){const r=C(this,Vt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&C(this,Vt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ai(t);if(typeof n=="string"){const r=C(this,Vt).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=Ai(t);if(typeof n=="string"){const o=(r=C(this,Vt).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Be.batch(()=>{C(this,cn).forEach(t=>{this.notify({type:"removed",mutation:t})}),C(this,cn).clear(),C(this,Vt).clear()})}getAll(){return Array.from(C(this,cn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ra(n,r))}findAll(t={}){return this.getAll().filter(n=>Ra(t,n))}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Be.batch(()=>Promise.all(t.map(n=>n.continue().catch(Nt))))}},cn=new WeakMap,Vt=new WeakMap,ui=new WeakMap,Vc);function Ai(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Da(e){return{onFetch:(t,n)=>{var d,f,h,m,y;const r=t.options,o=(h=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],s=((y=t.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let v=!1;const p=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(t.signal.aborted?v=!0:t.signal.addEventListener("abort",()=>{v=!0}),t.signal)})},x=Hc(t.options,t.fetchOptions),g=async(b,O,_)=>{if(v)return Promise.reject();if(O==null&&b.pages.length)return Promise.resolve(b);const T={client:t.client,queryKey:t.queryKey,pageParam:O,direction:_?"backward":"forward",meta:t.options.meta};p(T);const S=await x(T),{maxPages:N}=t.options,D=_?bf:If;return{pages:D(b.pages,S,N),pageParams:D(b.pageParams,O,N)}};if(o&&i.length){const b=o==="backward",O=b?Af:Fa,_={pages:i,pageParams:s},T=O(r,_);a=await g(_,T,b)}else{const b=e??i.length;do{const O=c===0?s[0]??r.initialPageParam:Fa(r,a);if(c>0&&O==null)break;a=await g(a,O),c++}while(c<b)}return a};t.options.persister?t.fetchFn=()=>{var v,p;return(p=(v=t.options).persister)==null?void 0:p.call(v,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function Fa(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 Af(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var ke,On,Cn,_r,xr,En,Or,Cr,Kc,Pf=(Kc=class{constructor(e={}){ie(this,ke);ie(this,On);ie(this,Cn);ie(this,_r);ie(this,xr);ie(this,En);ie(this,Or);ie(this,Cr);J(this,ke,e.queryCache||new Nf),J(this,On,e.mutationCache||new Rf),J(this,Cn,e.defaultOptions||{}),J(this,_r,new Map),J(this,xr,new Map),J(this,En,0)}mount(){Ri(this,En)._++,C(this,En)===1&&(J(this,Or,Ts.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,ke).onFocus())})),J(this,Cr,Gi.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,ke).onOnline())})))}unmount(){var e,t;Ri(this,En)._--,C(this,En)===0&&((e=C(this,Or))==null||e.call(this),J(this,Or,void 0),(t=C(this,Cr))==null||t.call(this),J(this,Cr,void 0))}isFetching(e){return C(this,ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return C(this,On).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=C(this,ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=C(this,ke).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(hr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return C(this,ke).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=C(this,ke).get(r.queryHash),i=o==null?void 0:o.state.data,s=vf(t,i);if(s!==void 0)return C(this,ke).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Be.batch(()=>C(this,ke).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=C(this,ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=C(this,ke);Be.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=C(this,ke),r={type:"active",...e};return Be.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Be.batch(()=>C(this,ke).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Nt).catch(Nt)}invalidateQueries(e,t={}){return Be.batch(()=>{if(C(this,ke).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none")return Promise.resolve();const n={...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"};return this.refetchQueries(n,t)})}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Be.batch(()=>C(this,ke).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Nt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Nt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=C(this,ke).build(this,t);return n.isStaleByTime(hr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Nt).catch(Nt)}fetchInfiniteQuery(e){return e.behavior=Da(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Nt).catch(Nt)}ensureInfiniteQueryData(e){return e.behavior=Da(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Gi.isOnline()?C(this,On).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,ke)}getMutationCache(){return C(this,On)}getDefaultOptions(){return C(this,Cn)}setDefaultOptions(e){J(this,Cn,e)}setQueryDefaults(e,t){C(this,_r).set(ir(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...C(this,_r).values()],n={};return t.forEach(r=>{ti(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){C(this,xr).set(ir(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...C(this,xr).values()];let n={};return t.forEach(r=>{ti(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...C(this,Cn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ns(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===zi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...C(this,Cn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){C(this,ke).clear(),C(this,On).clear()}},ke=new WeakMap,On=new WeakMap,Cn=new WeakMap,_r=new WeakMap,xr=new WeakMap,En=new WeakMap,Or=new WeakMap,Cr=new WeakMap,Kc),dt,ye,di,st,Zn,Er,Sn,zt,fi,Sr,Nr,er,tr,Nn,Tr,Ce,Xr,Yo,Zo,es,ts,ns,rs,is,Xc,$c,Df=($c=class extends Kr{constructor(t,n){super();ie(this,Ce);ie(this,dt);ie(this,ye);ie(this,di);ie(this,st);ie(this,Zn);ie(this,Er);ie(this,Sn);ie(this,zt);ie(this,fi);ie(this,Sr);ie(this,Nr);ie(this,er);ie(this,tr);ie(this,Nn);ie(this,Tr,new Set);this.options=n,J(this,dt,t),J(this,zt,null),J(this,Sn,Xo()),this.options.experimental_prefetchInRender||C(this,Sn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,ye).addObserver(this),Ma(C(this,ye),this.options)?pe(this,Ce,Xr).call(this):this.updateResult(),pe(this,Ce,ts).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return os(C(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return os(C(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,Ce,ns).call(this),pe(this,Ce,rs).call(this),C(this,ye).removeObserver(this)}setOptions(t,n){const r=this.options,o=C(this,ye);if(this.options=C(this,dt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Kt(this.options.enabled,C(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,Ce,is).call(this),C(this,ye).setOptions(this.options),r._defaulted&&!Ji(this.options,r)&&C(this,dt).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,ye),observer:this});const i=this.hasListeners();i&&ka(C(this,ye),o,this.options,r)&&pe(this,Ce,Xr).call(this),this.updateResult(n),i&&(C(this,ye)!==o||Kt(this.options.enabled,C(this,ye))!==Kt(r.enabled,C(this,ye))||hr(this.options.staleTime,C(this,ye))!==hr(r.staleTime,C(this,ye)))&&pe(this,Ce,Yo).call(this);const s=pe(this,Ce,Zo).call(this);i&&(C(this,ye)!==o||Kt(this.options.enabled,C(this,ye))!==Kt(r.enabled,C(this,ye))||s!==C(this,Nn))&&pe(this,Ce,es).call(this,s)}getOptimisticResult(t){const n=C(this,dt).getQueryCache().build(C(this,dt),t),r=this.createResult(n,t);return Mf(this,r)&&(J(this,st,r),J(this,Er,this.options),J(this,Zn,C(this,ye).state)),r}getCurrentResult(){return C(this,st)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){C(this,Tr).add(t)}getCurrentQuery(){return C(this,ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=C(this,dt).defaultQueryOptions(t),r=C(this,dt).getQueryCache().build(C(this,dt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,Ce,Xr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,st)))}createResult(t,n){var N;const r=C(this,ye),o=this.options,i=C(this,st),s=C(this,Zn),a=C(this,Er),u=t!==r?t.state:C(this,di),{state:d}=t;let f={...d},h=!1,m;if(n._optimisticResults){const D=this.hasListeners(),q=!D&&Ma(t,n),G=D&&ka(t,r,n,o);(q||G)&&(f={...f,...Gc(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:v,status:p}=f;if(n.select&&f.data!==void 0)if(i&&f.data===(s==null?void 0:s.data)&&n.select===C(this,fi))m=C(this,Sr);else try{J(this,fi,n.select),m=n.select(f.data),m=Qo(i==null?void 0:i.data,m,n),J(this,Sr,m),J(this,zt,null)}catch(D){J(this,zt,D)}else m=f.data;if(n.placeholderData!==void 0&&m===void 0&&p==="pending"){let D;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))D=i.data;else if(D=typeof n.placeholderData=="function"?n.placeholderData((N=C(this,Nr))==null?void 0:N.state.data,C(this,Nr)):n.placeholderData,n.select&&D!==void 0)try{D=n.select(D),J(this,zt,null)}catch(q){J(this,zt,q)}D!==void 0&&(p="success",m=Qo(i==null?void 0:i.data,D,n),h=!0)}C(this,zt)&&(y=C(this,zt),m=C(this,Sr),v=Date.now(),p="error");const x=f.fetchStatus==="fetching",g=p==="pending",b=p==="error",O=g&&x,_=m!==void 0,S={status:p,fetchStatus:f.fetchStatus,isPending:g,isSuccess:p==="success",isError:b,isInitialLoading:O,isLoading:O,data:m,dataUpdatedAt:f.dataUpdatedAt,error:y,errorUpdatedAt:v,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:x,isRefetching:x&&!g,isLoadingError:b&&!_,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:b&&_,isStale:Rs(t,n),refetch:this.refetch,promise:C(this,Sn)};if(this.options.experimental_prefetchInRender){const D=z=>{S.status==="error"?z.reject(S.error):S.data!==void 0&&z.resolve(S.data)},q=()=>{const z=J(this,Sn,S.promise=Xo());D(z)},G=C(this,Sn);switch(G.status){case"pending":t.queryHash===r.queryHash&&D(G);break;case"fulfilled":(S.status==="error"||S.data!==G.value)&&q();break;case"rejected":(S.status!=="error"||S.error!==G.reason)&&q();break}}return S}updateResult(t){const n=C(this,st),r=this.createResult(C(this,ye),this.options);if(J(this,Zn,C(this,ye).state),J(this,Er,this.options),C(this,Zn).data!==void 0&&J(this,Nr,C(this,ye)),Ji(r,n))return;J(this,st,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!C(this,Tr).size)return!0;const c=new Set(a??C(this,Tr));return this.options.throwOnError&&c.add("error"),Object.keys(C(this,st)).some(u=>{const d=u;return C(this,st)[d]!==n[d]&&c.has(d)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),pe(this,Ce,Xc).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,Ce,ts).call(this)}},dt=new WeakMap,ye=new WeakMap,di=new WeakMap,st=new WeakMap,Zn=new WeakMap,Er=new WeakMap,Sn=new WeakMap,zt=new WeakMap,fi=new WeakMap,Sr=new WeakMap,Nr=new WeakMap,er=new WeakMap,tr=new WeakMap,Nn=new WeakMap,Tr=new WeakMap,Ce=new WeakSet,Xr=function(t){pe(this,Ce,is).call(this);let n=C(this,ye).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Nt)),n},Yo=function(){pe(this,Ce,ns).call(this);const t=hr(this.options.staleTime,C(this,ye));if(rr||C(this,st).isStale||!Jo(t))return;const r=Uc(C(this,st).dataUpdatedAt,t)+1;J(this,er,setTimeout(()=>{C(this,st).isStale||this.updateResult()},r))},Zo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,ye)):this.options.refetchInterval)??!1},es=function(t){pe(this,Ce,rs).call(this),J(this,Nn,t),!(rr||Kt(this.options.enabled,C(this,ye))===!1||!Jo(C(this,Nn))||C(this,Nn)===0)&&J(this,tr,setInterval(()=>{(this.options.refetchIntervalInBackground||Ts.isFocused())&&pe(this,Ce,Xr).call(this)},C(this,Nn)))},ts=function(){pe(this,Ce,Yo).call(this),pe(this,Ce,es).call(this,pe(this,Ce,Zo).call(this))},ns=function(){C(this,er)&&(clearTimeout(C(this,er)),J(this,er,void 0))},rs=function(){C(this,tr)&&(clearInterval(C(this,tr)),J(this,tr,void 0))},is=function(){const t=C(this,dt).getQueryCache().build(C(this,dt),this.options);if(t===C(this,ye))return;const n=C(this,ye);J(this,ye,t),J(this,di,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Xc=function(t){Be.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(C(this,st))}),C(this,dt).getQueryCache().notify({query:C(this,ye),type:"observerResultsUpdated"})})},$c);function Ff(e,t){return Kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ma(e,t){return Ff(e,t)||e.state.data!==void 0&&os(e,t,t.refetchOnMount)}function os(e,t,n){if(Kt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Rs(e,t)}return!1}function ka(e,t,n,r){return(e!==t||Kt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Rs(e,n)}function Rs(e,t){return Kt(t.enabled,e)!==!1&&e.isStaleByTime(hr(t.staleTime,e))}function Mf(e,t){return!Ji(e.getCurrentResult(),t)}var Tn,Rn,ft,ln,fn,$i,ss,qc,kf=(qc=class extends Kr{constructor(n,r){super();ie(this,fn);ie(this,Tn);ie(this,Rn);ie(this,ft);ie(this,ln);J(this,Tn,n),this.setOptions(r),this.bindMethods(),pe(this,fn,$i).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=C(this,Tn).defaultMutationOptions(n),Ji(this.options,r)||C(this,Tn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,ft),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&ir(r.mutationKey)!==ir(this.options.mutationKey)?this.reset():((o=C(this,ft))==null?void 0:o.state.status)==="pending"&&C(this,ft).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=C(this,ft))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,fn,$i).call(this),pe(this,fn,ss).call(this,n)}getCurrentResult(){return C(this,Rn)}reset(){var n;(n=C(this,ft))==null||n.removeObserver(this),J(this,ft,void 0),pe(this,fn,$i).call(this),pe(this,fn,ss).call(this)}mutate(n,r){var o;return J(this,ln,r),(o=C(this,ft))==null||o.removeObserver(this),J(this,ft,C(this,Tn).getMutationCache().build(C(this,Tn),this.options)),C(this,ft).addObserver(this),C(this,ft).execute(n)}},Tn=new WeakMap,Rn=new WeakMap,ft=new WeakMap,ln=new WeakMap,fn=new WeakSet,$i=function(){var r;const n=((r=C(this,ft))==null?void 0:r.state)??Qc();J(this,Rn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ss=function(n){Be.batch(()=>{var r,o,i,s,a,c,u,d;if(C(this,ln)&&this.hasListeners()){const f=C(this,Rn).variables,h=C(this,Rn).context;(n==null?void 0:n.type)==="success"?((o=(r=C(this,ln)).onSuccess)==null||o.call(r,n.data,f,h),(s=(i=C(this,ln)).onSettled)==null||s.call(i,n.data,null,f,h)):(n==null?void 0:n.type)==="error"&&((c=(a=C(this,ln)).onError)==null||c.call(a,n.error,f,h),(d=(u=C(this,ln)).onSettled)==null||d.call(u,void 0,n.error,f,h))}this.listeners.forEach(f=>{f(C(this,Rn))})})},qc),Yc=K.createContext(void 0),Yt=e=>{const t=K.useContext(Yc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},jf=({client:e,children:t})=>(K.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Yc.Provider,{value:e,children:t})),Zc=K.createContext(!1),Lf=()=>K.useContext(Zc);Zc.Provider;function Vf(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Kf=K.createContext(Vf()),$f=()=>K.useContext(Kf);function el(e,t){return typeof e=="function"?e(...t):!!e}function as(){}var qf=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Uf=e=>{K.useEffect(()=>{e.clearReset()},[e])},Hf=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||el(n,[e.error,r])),Bf=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Wf=(e,t)=>e.isLoading&&e.isFetching&&!t,Jf=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,ja=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function zf(e,t,n){var f,h,m,y,v;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=Yt(),o=Lf(),i=$f(),s=r.defaultQueryOptions(e);(h=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||h.call(f,s),s._optimisticResults=o?"isRestoring":"optimistic",Bf(s),qf(s,i),Uf(i);const a=!r.getQueryCache().get(s.queryHash),[c]=K.useState(()=>new t(r,s)),u=c.getOptimisticResult(s),d=!o&&e.subscribed!==!1;if(K.useSyncExternalStore(K.useCallback(p=>{const x=d?c.subscribe(Be.batchCalls(p)):as;return c.updateResult(),x},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),K.useEffect(()=>{c.setOptions(s,{listeners:!1})},[s,c]),Jf(s,u))throw ja(s,c,i);if(Hf({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw u.error;if((y=(m=r.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||y.call(m,s,u),s.experimental_prefetchInRender&&!rr&&Wf(u,o)){const p=a?ja(s,c,i):(v=r.getQueryCache().get(s.queryHash))==null?void 0:v.promise;p==null||p.catch(as).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?u:c.trackResult(u)}function $r(e,t){return zf(e,Df)}function As(e,t){const n=Yt(),[r]=K.useState(()=>new kf(n,e));K.useEffect(()=>{r.setOptions(e)},[r,e]);const o=K.useSyncExternalStore(K.useCallback(s=>r.subscribe(Be.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=K.useCallback((s,a)=>{r.mutate(s,a).catch(as)},[r]);if(o.error&&el(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const tl=w.createContext(null),Gf=tl.Provider,pi=()=>{const e=w.useContext(tl);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var ue=(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))(ue||{});const nl=w.createContext(void 0);function Tt(){const e=w.useContext(nl);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Qf=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function Xf({children:e}){const[t,n]=w.useState(Qf),r=w.useCallback((d,f,h=!0)=>{n(m=>{const y={...m};return y[d]=y[d]||{},y[d][f]=h,y})},[n]),o=w.useCallback((d,f)=>{var h;return!!((h=t[d])!=null&&h[f])},[t]),i=w.useCallback((d,f)=>{var h;return(h=t[d])==null?void 0:h[f]},[t]),s=w.useCallback((d,f)=>{n(h=>{var y;const m={...h};return(y=m[d])==null||delete y[f],m})},[n]),a=w.useCallback(d=>{n(f=>{const h={...f};return h[d]={},h})},[n]),c=w.useCallback((d,f)=>{n(h=>{const m={...h};return m[d]=m[d]||{},f.forEach(y=>{m[d][y]=!0}),m})},[n]),u=w.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:c,getError:i}),[t,n,r,o,s,a,c,i]);return l.jsx(nl.Provider,{value:u,children:e})}const Yf="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ps{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Yf}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||il}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 Zf=new Ps,uo=class uo{constructor(t=Zf){this.configuration=t,this.fetchApi=async(n,r)=>{let o={url:n,init:r};for(const s of this.middleware)s.pre&&(o=await s.pre({fetch:this.fetchApi,...o})||o);let i;try{i=await(this.configuration.fetchApi||fetch)(o.url,o.init)}catch(s){for(const a of this.middleware)a.onError&&(i=await a.onError({fetch:this.fetchApi,url:o.url,init:o.init,error:s,response:i?i.clone():void 0})||i);if(i===void 0)throw s instanceof Error?new np(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(i=await s.post({fetch:this.fetchApi,url:o.url,init:o.init,response:i.clone()})||i);return i},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?uo.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:o}=await this.createFetchParams(t,n),i=await this.fetchApi(r,o);if(i&&i.status>=200&&i.status<300)return i;throw new rl(i,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const o=Object.assign({},this.configuration.headers,t.headers);Object.keys(o).forEach(u=>o[u]===void 0?delete o[u]:{});const i=typeof n=="function"?n:async()=>n,s={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},a={...s,...await i({init:s,context:t})},c={...a,body:tp(a.body)||a.body instanceof URLSearchParams||ep(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};uo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Qt=uo;function ep(e){return typeof Blob<"u"&&e instanceof Blob}function tp(e){return typeof FormData<"u"&&e instanceof FormData}class rl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class np extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class se extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function R(e,t){const n=e[t];return n!=null}function il(e,t=""){return Object.keys(e).map(n=>ol(n,e[n],t)).filter(n=>n.length>0).join("&")}function ol(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const o=t.map(i=>encodeURIComponent(String(i))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${o}`}if(t instanceof Set){const o=Array.from(t);return ol(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?il(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Rr(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 or{constructor(t){this.raw=t}async value(){}}class rp{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function ip(e){return op(e)}function op(e,t){return e==null?e:{fieldUsed:R(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:R(e,"keyFormat")?e.keyFormat:void 0}}function sp(e){return ap(e)}function ap(e,t){return e==null?e:{name:e.name,valuePrefix:R(e,"valuePrefix")?e.valuePrefix:void 0}}function cp(e){return lp(e)}function lp(e,t){return e==null?e:{name:e.name}}function up(e){return dp(e)}function dp(e,t){return e==null?e:{attachmentType:e.attachmentType,query:R(e,"query")?cp(e.query):void 0,header:R(e,"header")?sp(e.header):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function fp(e){return pp(e)}function pp(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0,includeFullRecords:R(e,"includeFullRecords")?e.includeFullRecords:void 0}}function hp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function mp(e){return gp(e)}function gp(e,t){return e}function yp(e){return vp(e)}function vp(e,t){return e==null?e:{days:R(e,"days")?e.days:void 0,fullHistory:R(e,"fullHistory")?e.fullHistory:void 0}}function wp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function sl(e){return Ip(e)}function Ip(e,t){return e==null?e:{defaultPeriod:yp(e.defaultPeriod)}}function bp(e){if(e!==void 0)return e===null?null:{defaultPeriod:wp(e.defaultPeriod)}}function _p(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function xp(e){if(e!==void 0)return e===null?null:{defaultPeriod:_p(e.defaultPeriod)}}function Op(e){return Cp(e)}function Cp(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function al(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Ep(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:xp(e.backfill)}}function Sp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Rr(e.objects,Ep)}}function Np(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}function Tp(e){if(e!==void 0)return e===null?null:{default:Np(e._default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function Rp(e){let t=!0;return t=t&&"value"in e,t}function Ap(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Pp(e){let t=!0;return t=t&&"value"in e,t}function Dp(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Fp(e){let t=!0;return t=t&&"value"in e,t}function Mp(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function kp(e){if(e!==void 0)return e===null?null:Rp(e)?Ap(e):Pp(e)?Dp(e):Fp(e)?Mp(e):{}}function jp(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Rr(e.selectedValueDefaults,kp),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Rr(e.selectedFieldSettings,Tp)}}function Lp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Rr(e.objects,jp)}}function Vp(e){return Kp(e)}function Kp(e,t){return e==null?e:{apiKeyAsBasic:R(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:R(e,"apiKeyAsBasicOpts")?ip(e.apiKeyAsBasicOpts):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function $p(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function qp(e){return Up(e)}function Up(e,t){return e==null?e:{value:e.value}}function Hp(e){return Bp(e)}function Bp(e,t){return e==null?e:{brandingRemoval:R(e,"brandingRemoval")?qp(e.brandingRemoval):void 0}}function Pi(e){return Wp(e)}function Wp(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:R(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:R(e,"entitlements")?Hp(e.entitlements):void 0}}function Jp(e){return zp(e)}function zp(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Gp(e){return Qp(e)}function Qp(e,t){return e==null?e:{provider:e.provider,read:R(e,"read")?e.read:void 0,write:R(e,"write")?e.write:void 0,proxy:R(e,"proxy")?Op(e.proxy):void 0}}function Xp(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:al(e.proxy)}}function Yp(e){return Zp(e)}function Zp(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Gp(e.content)}}function eh(e){return th(e)}function th(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function cl(e){return nh(e)}function nh(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function rh(e){return ih(e)}function ih(e,t){return e==null?e:{token:e.token,issuedAt:R(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:R(e,"expiresAt")?new Date(e.expiresAt):void 0}}function oh(e){return sh(e)}function sh(e,t){return e==null?e:{token:e.token,issuedAt:R(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:R(e,"expiresAt")?new Date(e.expiresAt):void 0}}function ah(e){return ch(e)}function ch(e,t){return e==null?e:{accessToken:R(e,"accessToken")?rh(e.accessToken):void 0,refreshToken:R(e,"refreshToken")?oh(e.refreshToken):void 0,scopes:R(e,"scopes")?e.scopes:void 0}}function qi(e){return lh(e)}function lh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:R(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:R(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Ui(e){return uh(e)}function uh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:R(e,"providerApp")?qi(e.providerApp):void 0,group:cl(e.group),consumer:eh(e.consumer),providerWorkspaceRef:R(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:R(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:R(e,"oauth2AuthorizationCode")?ah(e.oauth2AuthorizationCode):void 0,apiKey:R(e,"apiKey")?e.apiKey:void 0}}function dh(e){return fh(e)}function fh(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function ph(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function hh(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Xp(e.content)}}function mh(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:hh(e.config)}}function gh(e){return yh(e)}function yh(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function vh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function wh(e){return Ih(e)}function Ih(e,t){return e==null?e:{mode:R(e,"mode")?e.mode:void 0,pageSize:R(e,"pageSize")?e.pageSize:void 0}}function bh(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function _h(e){let t=!0;return t=t&&"fieldName"in e,t}function xh(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Oh(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Ch(e){let t=!0;return t=t&&"mapToName"in e,t}function ll(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:R(e,"default")?e.default:void 0,prompt:R(e,"prompt")?e.prompt:void 0}}function Eh(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function La(e){return Sh(e)}function Sh(e,t){return e==null?e:{...xh(e),...ll(e)}}function Va(e){if(e!==void 0)return e===null?null:_h(e)?Oh(e):Ch(e)?Eh(e):{}}function ul(e){return Nh(e)}function Nh(e,t){return e}function Th(e){return Rh(e)}function Rh(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:R(e,"requiredFields")?e.requiredFields.map(La):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(La):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?ul(e.optionalFieldsAuto):void 0,backfill:R(e,"backfill")?sl(e.backfill):void 0,delivery:R(e,"delivery")?wh(e.delivery):void 0}}function Ah(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(Va),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Va),optionalFieldsAuto:e.optionalFieldsAuto,backfill:bp(e.backfill),delivery:bh(e.delivery)}}function Ph(e){return Dh(e)}function Dh(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Th):void 0}}function Fh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Ah)}}function Mh(e){return kh(e)}function kh(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function jh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Lh(e){return Vh(e)}function Vh(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0,requiredWatchFields:R(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function Kh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,requiredWatchFields:e.requiredWatchFields}}function $h(e){return qh(e)}function qh(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,createEvent:R(e,"createEvent")?dh(e.createEvent):void 0,updateEvent:R(e,"updateEvent")?Lh(e.updateEvent):void 0,deleteEvent:R(e,"deleteEvent")?Mh(e.deleteEvent):void 0,associationChangeEvent:R(e,"associationChangeEvent")?fp(e.associationChangeEvent):void 0,otherEvents:R(e,"otherEvents")?e.otherEvents:void 0}}function Uh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,createEvent:ph(e.createEvent),updateEvent:Kh(e.updateEvent),deleteEvent:jh(e.deleteEvent),associationChangeEvent:hp(e.associationChangeEvent),otherEvents:e.otherEvents}}function Hh(e){return Bh(e)}function Bh(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map($h):void 0}}function Wh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Uh)}}function dl(e){return Jh(e)}function Jh(e,t){return e==null?e:{allowAnyFields:R(e,"allowAnyFields")?e.allowAnyFields:void 0}}function zh(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Gh(e){return Qh(e)}function Qh(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:R(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:R(e,"valueDefaults")?dl(e.valueDefaults):void 0}}function Xh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:zh(e.valueDefaults)}}function Yh(e){return Zh(e)}function Zh(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Gh):void 0}}function em(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Xh)}}function tm(e){return nm(e)}function nm(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?Ph(e.read):void 0,write:R(e,"write")?Yh(e.write):void 0,proxy:R(e,"proxy")?gh(e.proxy):void 0,subscribe:R(e,"subscribe")?Hh(e.subscribe):void 0}}function rm(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:Fh(e.read),write:em(e.write),proxy:vh(e.proxy),subscribe:Wh(e.subscribe)}}function im(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:rm(e.content)}}function om(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:im(e.latestRevision)}}function sm(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function am(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 cm(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function lm(e){return um(e)}function um(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function dm(e){return fm(e)}function fm(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:R(e,"valueType")?e.valueType:void 0,providerType:R(e,"providerType")?e.providerType:void 0,readOnly:R(e,"readOnly")?e.readOnly:void 0,values:R(e,"values")?e.values.map(lm):void 0}}function pm(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function hm(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function mm(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 gm(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 ym(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 vm(e){if(e!==void 0)return e===null?null:{accessToken:gm(e.accessToken),refreshToken:ym(e.refreshToken),scopes:e.scopes}}function wm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:pm(e.basicAuth),oauth2ClientCredentials:hm(e.oauth2ClientCredentials),oauth2Password:mm(e.oauth2Password),oauth2AuthorizationCode:vm(e.oauth2AuthorizationCode)}}function Im(e){return bm(e)}function bm(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function _m(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Ao(e){return xm(e)}function xm(e,t){return e==null?e:{..._m(e),...ll(e)}}function Om(e){return Cm(e)}function Cm(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:R(e,"requiredFields")?e.requiredFields.map(Ao):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(Ao):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?ul(e.optionalFieldsAuto):void 0,allFields:R(e,"allFields")?e.allFields.map(Ao):void 0,allFieldsMetadata:R(e,"allFieldsMetadata")?Rr(e.allFieldsMetadata,dm):void 0,backfill:R(e,"backfill")?sl(e.backfill):void 0}}function Em(e){return Sm(e)}function Sm(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Om):void 0}}function Nm(e){return Tm(e)}function Tm(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:R(e,"valueDefaults")?dl(e.valueDefaults):void 0}}function Rm(e){return Am(e)}function Am(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Nm):void 0}}function Pm(e){return Dm(e)}function Dm(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?Em(e.read):void 0,write:R(e,"write")?Rm(e.write):void 0,proxy:R(e,"proxy")?Im(e.proxy):void 0}}function Fm(e){return Mm(e)}function Mm(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Pm(e.content)}}function Di(e){return km(e)}function km(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:R(e,"group")?cl(e.group):void 0,healthStatus:e.healthStatus,connection:Ui(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,config:Yp(e.config)}}function jm(e){return Lm(e)}function Lm(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:tm(e.content)}}function Ka(e){return Vm(e)}function Vm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:jm(e.latestRevision)}}function Km(e){return $m(e)}function $m(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function qm(e){return Um(e)}function Um(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function Hm(e){return Bm(e)}function Bm(e,t){return e==null?e:{regular:R(e,"regular")?qm(e.regular):void 0,darkMode:R(e,"darkMode")?Km(e.darkMode):void 0}}function Wm(e){return Jm(e)}function Jm(e,t){return e==null?e:{workspaceRefField:R(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:R(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:R(e,"scopesField")?e.scopesField:void 0}}function zm(e){return Gm(e)}function Gm(e,t){return e==null?e:{grantType:e.grantType,authURL:R(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:R(e,"audience")?e.audience:void 0,tokenMetadataFields:Wm(e.tokenMetadataFields),docsURL:R(e,"docsURL")?e.docsURL:void 0,authURLParams:R(e,"authURLParams")?e.authURLParams:void 0}}function Qm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function Xm(e){return Ym(e)}function Ym(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Zm(e){return eg(e)}function eg(e,t){return e==null?e:{create:R(e,"create")?e.create:void 0,update:R(e,"update")?e.update:void 0,_delete:R(e,"delete")?e.delete:void 0,passThrough:R(e,"passThrough")?e.passThrough:void 0}}function tg(e){return ng(e)}function ng(e,t){return e==null?e:{bulkWrite:Jp(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:R(e,"subscribeSupport")?Zm(e.subscribeSupport):void 0}}function $a(e){return rg(e)}function rg(e,t){return e==null?e:{name:e.name,authType:mp(e.authType),baseURL:e.baseURL,oauth2Opts:R(e,"oauth2Opts")?zm(e.oauth2Opts):void 0,apiKeyOpts:R(e,"apiKeyOpts")?up(e.apiKeyOpts):void 0,basicOpts:R(e,"basicOpts")?Vp(e.basicOpts):void 0,support:tg(e.support),providerOpts:e.providerOpts,displayName:R(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:R(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:R(e,"media")?Hm(e.media):void 0,labels:R(e,"labels")?e.labels:void 0,subscribeOpts:R(e,"subscribeOpts")?Xm(e.subscribeOpts):void 0}}function ig(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Sp(e.read),write:Lp(e.write),proxy:al(e.proxy)}}function og(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:ig(e.content)}}function sg(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:og(e.config)}}function ag(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:sg(e.installation)}}function cg(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function lg(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:cg(e.project)}}function ug(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 dg(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:ug(e.providerApp)}}class fg extends Qt{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new se("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new or(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");if(t.generateConnectionParams===null||t.generateConnectionParams===void 0)throw new se("generateConnectionParams","Required parameter requestParameters.generateConnectionParams was null or undefined when calling generateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:wm(t.generateConnectionParams)},n);return new Ve(i,s=>Ui(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new se("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>Ui(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>s.map(Ui))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class pg extends Qt{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new se("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:mh(t.installation)},n);return new Ve(i,s=>Di(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new se("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:o,query:r},n);return new or(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new se("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>Di(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>s.map(Di))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new se("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new se("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:o,query:r,body:ag(t.installationUpdate)},n);return new Ve(i,s=>Di(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class hg extends Qt{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new se("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:$p(t.batchUpsertIntegrationsRequest)},n);return new Ve(i,s=>s.map(Ka))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new se("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:om(t.integration)},n);return new or(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new or(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>s.map(Ka))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class mg extends Qt{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new se("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json";const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:Qm(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Ve(i):new rp(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class gg extends Qt{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new se("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:sm(t.project)},n);return new Ve(i,s=>Pi(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:o,query:r},n);return new or(i)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>Pi(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Ve(o,i=>i.map(Pi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new se("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:lg(t.projectUpdate)},n);return new Ve(i,s=>Pi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class yg extends Qt{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new se("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>$a(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Ve(o,i=>Rr(i,$a))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class vg extends Qt{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new se("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:am(t.providerApp)},n);return new Ve(i,s=>qi(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new se("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new or(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>s.map(qi))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new se("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new se("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:dg(t.providerAppUpdate)},n);return new Ve(i,s=>qi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class wg extends Qt{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new se("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:cm(t.revision)},n);return new or(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new se("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new se("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:o,query:r},n);return new Ve(i,s=>Fm(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class fl{constructor(t){this.connectionApi=new fg(t),this.installationApi=new pg(t),this.integrationApi=new hg(t),this.oAuthApi=new mg(t),this.projectApi=new gg(t),this.providerApi=new yg(t),this.providerAppApi=new vg(t),this.revisionApi=new wg(t)}}const pl="2.5.0",Ig="v1",Fi="https://api.withampersand.com";function hl(){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 Fi;case"mock":return"http://127.0.0.1:4010";case"":return Fi;default:return e??Fi}}catch{return Fi}}const bg=(e,t)=>`${e}/${t}`;function _g(){return bg(hl(),Ig)}const xg=hl(),ml=_g(),Og=new Ps({basePath:ml,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":pl}});let Cg=new fl(Og);const mr=()=>Cg;function pn(){const e=pi();return w.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Ps({basePath:ml,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":pl,"X-Api-Key":e}});return new fl(n)},[e])}const _t=async(e,t)=>{var n;if(e instanceof rl){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
2
+ `))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const c=`${a} ${s!=null&&s.remedy?`
3
3
 
4
- ${s.remedy}`:""))}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)},bg=e=>{const t=pn();return Vr({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},vl=v.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),ke=()=>{const e=v.useContext(vl);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function _g({projectIdOrName:e,children:t}){const{setError:n}=Tt(),{data:r,isLoading:o,isError:i}=bg(e);v.useEffect(()=>{i&&n(ue.PROJECT,e)},[i,e,n]);const s=v.useMemo(()=>({projectId:(r==null?void 0:r.id)||"",projectIdOrName:e,project:r||null,appName:(r==null?void 0:r.appName)||"",isLoading:o}),[e,r,o]);return l.jsx(vl.Provider,{value:s,children:t})}const wl=v.createContext({integrations:null,isLoading:!0}),Fs=()=>{const e=v.useContext(wl);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function xg(){const e=pn(),{projectIdOrName:t}=ke();return Vr({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t})}function Og({children:e}){const{projectIdOrName:t}=ke(),{setError:n,removeError:r}=Tt(),{data:o,isLoading:i,isError:s}=xg();v.useEffect(()=>{s?(_t(s),n(ue.INTEGRATION_LIST,t)):r(ue.INTEGRATION_LIST,t)},[s,t,r,n]);const a=v.useMemo(()=>({integrations:o||null,isLoading:i}),[o,i]);return l.jsx(wl.Provider,{value:a,children:e})}const Cg=new Df;function Eg(e){const{options:{apiKey:t,projectId:n,project:r},children:o}=e,i=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!i)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return l.jsx(Lf,{client:Cg,children:l.jsx(Yf,{children:l.jsx(Qf,{value:t,children:l.jsx(_g,{projectIdOrName:i,children:l.jsx(Og,{children:o})})})})})}const Il=v.createContext(null);function Sg(){const e=v.useContext(Il);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
5
- component is wrapped with AmpersandProvider`);return e}function Ng(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Tg="_box_1p7c5_1",Ha={box:Tg};function kn({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Ha.box} ${t}`:Ha.box,style:n,children:e})}const Rg="_container_1wvzr_1",Ba={container:Rg};function Kr({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Ba.container} ${t}`:Ba.container,style:n,children:e})}const Ag="_errorBoxContainer_4sdb2_1",Pg="_errorBox_4sdb2_1",Dg="_errorText_4sdb2_20",Po={errorBoxContainer:Ag,errorBox:Pg,errorText:Dg};function bl({message:e}){return l.jsxs(Kr,{className:Po.errorBoxContainer,children:[l.jsx(Ng,{}),l.jsx(kn,{className:Po.errorBox,children:l.jsx("p",{className:Po.errorText,children:e})})]})}const Fg="_loader_6ubm6_1",Mg="_rotate_6ubm6_1",kg="_ball1_6ubm6_1",jg="_ball2_6ubm6_1",Lg={loader:Fg,rotate:Mg,ball1:kg,ball2:jg};function Vg(){return l.jsx("span",{className:Lg.loader})}function ti(){return l.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:l.jsx(Vg,{})})}function _l({children:e}){return l.jsx(Kr,{style:{maxWidth:"55rem"},children:l.jsx(kn,{children:e})})}function $r(){return l.jsx(_l,{children:l.jsx(ti,{})})}function Gt({message:e}){return l.jsx(_l,{children:l.jsx(bl,{message:e})})}const xl=(e,t)=>{var s;const n=pn(),{projectIdOrName:r}=ke(),{integrations:o}=Fs(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return Vr({queryKey:["amp","installations",r,i,t],queryFn:async()=>{if(!r)throw new Error("Project ID is required");if(!i)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await n()).installationApi.listInstallations({projectIdOrName:r,integrationId:i,groupRef:t})},enabled:!!r&&!!i&&!!t&&!!o&&o.length>0})};function Ms(e,t){try{return process.env[e]}catch{return t}}function Tr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ol(e,t){return(t==null?void 0:t.displayName)??Tr(e)}const Kg=e=>e.split(`
6
- `).filter(n=>n.trim()!==""),$g=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,qg=()=>{const[e,t]=v.useState(!1),n=v.useCallback(()=>{t(!0)},[t]),r=v.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},Cl=v.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function et(){const e=v.useContext(Cl);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Ug({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:u}){const{integrations:d}=Fs(),{setError:f,isError:m,removeError:h}=Tt(),{isIntegrationDeleted:y,setIntegrationDeleted:I,resetIntegrationDeleted:p}=qg(),x=v.useMemo(()=>$g(t,d||[]),[t,d]),{data:g,isLoading:b,isError:O,error:_}=xl(t,o),T=(g==null?void 0:g[0])||null;v.useEffect(()=>{p()},[t,n,r,o,i,u]),v.useEffect(()=>{x===null&&(d!=null&&d.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,x,d]),v.useEffect(()=>{O?(f(ue.INSTALLATION_LIST,(x==null?void 0:x.id)||""),_t(_)):h(ue.INSTALLATION_LIST,(x==null?void 0:x.id)||"")},[O,x,f,h,_]);const S=Yt(),N=v.useCallback(()=>{S.invalidateQueries({queryKey:["amp","installations"]})},[S]),F=v.useCallback(z=>{S.setQueryData(["amp","installations"],[z]),S.invalidateQueries({queryKey:["amp","installations"]})},[S]),q=(x==null?void 0:x.id)||"",G=v.useMemo(()=>({integrationId:(x==null?void 0:x.id)||"",provider:(x==null?void 0:x.provider)||"",integrationObj:x,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:T||void 0,setInstallation:F,resetInstallations:N,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:y,setIntegrationDeleted:I,fieldMapping:u}),[x,n,r,o,i,T,F,N,s,a,c,y,I,u]);if(b)return l.jsx($r,{});if(x===null)return l.jsx(Gt,{message:`Integration "${t}" not found`});if(m(ue.INSTALLATION_LIST,q)){const z=`Error retrieving installation information for integration "${(x==null?void 0:x.name)||"unknown"}"`;return l.jsx(Gt,{message:z})}return l.jsx(Cl.Provider,{value:G,children:e})}const El=v.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),qr=()=>{const e=v.useContext(El);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e},Hg=({groupRefParam:e,providerParam:t})=>{const{projectIdOrName:n}=ke(),{groupRef:r,provider:o}=et(),i=e||r,s=t||o,a=pn();return Vr({queryKey:["amp","connections",n,i,s],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!i)throw new Error("Group reference not found.");if(!s)throw new Error("Provider not found.");return(await a()).connectionApi.listConnections({projectIdOrName:n,groupRef:i,provider:s})},retry:3,enabled:!!n&&!!i&&!!s})};function Sl({groupRef:e,provider:t,children:n}){const r=Yt(),{setError:o,isError:i}=Tt(),{projectId:s,isLoading:a}=ke(),{data:c,isLoading:u,isError:d,error:f}=Hg({groupRefParam:e,providerParam:t}),m=c==null?void 0:c[0],h=v.useCallback(p=>{r.setQueryData(["amp","connections"],()=>p),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),y=v.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);v.useEffect(()=>{d?(o(ue.CONNECTION_LIST,s,!0),_t(f)):o(ue.CONNECTION_LIST,s,!1)},[d,o,s,f]);const I=v.useMemo(()=>({connections:c||null,isConnectionsLoading:u,selectedConnection:m||null,setConnections:h,setSelectedConnection:y}),[c,u,m,h,y]);if(u||a)return l.jsx($r,{});if(i(ue.PROJECT,s))return l.jsx(Gt,{message:`Error loading project ${s}`});if(i(ue.CONNECTION_LIST,s))return l.jsx(Gt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx(El.Provider,{value:I,children:n})}function Nl(){const[e,t]=v.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const Bg="_resetContainer_lkwv9_4",Tl={resetContainer:Bg};var Mi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ks(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qi={exports:{}};Qi.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",m="[object Error]",h="[object Function]",y="[object GeneratorFunction]",I="[object Map]",p="[object Number]",x="[object Null]",g="[object Object]",b="[object Promise]",O="[object Proxy]",_="[object RegExp]",T="[object Set]",S="[object String]",N="[object Symbol]",F="[object Undefined]",q="[object WeakMap]",G="[object ArrayBuffer]",z="[object DataView]",ne="[object Float32Array]",B="[object Float64Array]",ce="[object Int8Array]",oe="[object Int16Array]",te="[object Int32Array]",ge="[object Uint8Array]",we="[object Uint8ClampedArray]",A="[object Uint16Array]",j="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,V=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,M={};M[ne]=M[B]=M[ce]=M[oe]=M[te]=M[ge]=M[we]=M[A]=M[j]=!0,M[a]=M[c]=M[G]=M[d]=M[z]=M[f]=M[m]=M[h]=M[I]=M[p]=M[g]=M[_]=M[T]=M[S]=M[q]=!1;var Y=typeof Mi=="object"&&Mi&&Mi.Object===Object&&Mi,Z=typeof self=="object"&&self&&self.Object===Object&&self,U=Y||Z||Function("return this")(),ee=t&&!t.nodeType&&t,Q=ee&&!0&&e&&!e.nodeType&&e,de=Q&&Q.exports===ee,k=de&&Y.process,ve=function(){try{return k&&k.binding&&k.binding("util")}catch{}}(),H=ve&&ve.isTypedArray;function Ee(w,E){for(var P=-1,X=w==null?0:w.length,Te=0,fe=[];++P<X;){var Fe=w[P];E(Fe,P,w)&&(fe[Te++]=Fe)}return fe}function Le(w,E){for(var P=-1,X=E.length,Te=w.length;++P<X;)w[Te+P]=E[P];return w}function Ge(w,E){for(var P=-1,X=w==null?0:w.length;++P<X;)if(E(w[P],P,w))return!0;return!1}function Ke(w,E){for(var P=-1,X=Array(w);++P<w;)X[P]=E(P);return X}function Ie(w){return function(E){return w(E)}}function Rt(w,E){return w.has(E)}function Qe(w,E){return w==null?void 0:w[E]}function ht(w){var E=-1,P=Array(w.size);return w.forEach(function(X,Te){P[++E]=[Te,X]}),P}function At(w,E){return function(P){return w(E(P))}}function Pt(w){var E=-1,P=Array(w.size);return w.forEach(function(X){P[++E]=X}),P}var Xe=Array.prototype,We=Function.prototype,$e=Object.prototype,Ae=U["__core-js_shared__"],Dt=We.toString,tt=$e.hasOwnProperty,en=function(){var w=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||"");return w?"Symbol(src)_1."+w:""}(),hn=$e.toString,mt=RegExp("^"+Dt.call(tt).replace($,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pe=de?U.Buffer:void 0,tn=U.Symbol,mn=U.Uint8Array,nn=$e.propertyIsEnumerable,Ln=Xe.splice,ct=tn?tn.toStringTag:void 0,rn=Object.getOwnPropertySymbols,gn=Pe?Pe.isBuffer:void 0,Vn=At(Object.keys,Object),yn=ur(U,"DataView"),Re=ur(U,"Map"),nt=ur(U,"Promise"),re=ur(U,"Set"),me=ur(U,"WeakMap"),qe=ur(Object,"create"),on=qn(yn),W=qn(Re),ae=qn(nt),le=qn(re),je=qn(me),Ue=tn?tn.prototype:void 0,lt=Ue?Ue.valueOf:void 0;function Je(w){var E=-1,P=w==null?0:w.length;for(this.clear();++E<P;){var X=w[E];this.set(X[0],X[1])}}function Ye(){this.__data__=qe?qe(null):{},this.size=0}function ut(w){var E=this.has(w)&&delete this.__data__[w];return this.size-=E?1:0,E}function Ne(w){var E=this.__data__;if(qe){var P=E[w];return P===r?void 0:P}return tt.call(E,w)?E[w]:void 0}function Kn(w){var E=this.__data__;return qe?E[w]!==void 0:tt.call(E,w)}function Eo(w,E){var P=this.__data__;return this.size+=this.has(w)?0:1,P[w]=qe&&E===void 0?r:E,this}Je.prototype.clear=Ye,Je.prototype.delete=ut,Je.prototype.get=Ne,Je.prototype.has=Kn,Je.prototype.set=Eo;function xt(w){var E=-1,P=w==null?0:w.length;for(this.clear();++E<P;){var X=w[E];this.set(X[0],X[1])}}function bi(){this.__data__=[],this.size=0}function _i(w){var E=this.__data__,P=Ci(E,w);if(P<0)return!1;var X=E.length-1;return P==X?E.pop():Ln.call(E,P,1),--this.size,!0}function xi(w){var E=this.__data__,P=Ci(E,w);return P<0?void 0:E[P][1]}function Se(w){return Ci(this.__data__,w)>-1}function Ft(w,E){var P=this.__data__,X=Ci(P,w);return X<0?(++this.size,P.push([w,E])):P[X][1]=E,this}xt.prototype.clear=bi,xt.prototype.delete=_i,xt.prototype.get=xi,xt.prototype.has=Se,xt.prototype.set=Ft;function Mt(w){var E=-1,P=w==null?0:w.length;for(this.clear();++E<P;){var X=w[E];this.set(X[0],X[1])}}function $n(){this.size=0,this.__data__={hash:new Je,map:new(Re||xt),string:new Je}}function So(w){var E=Ei(this,w).delete(w);return this.size-=E?1:0,E}function Wr(w){return Ei(this,w).get(w)}function $d(w){return Ei(this,w).has(w)}function qd(w,E){var P=Ei(this,w),X=P.size;return P.set(w,E),this.size+=P.size==X?0:1,this}Mt.prototype.clear=$n,Mt.prototype.delete=So,Mt.prototype.get=Wr,Mt.prototype.has=$d,Mt.prototype.set=qd;function Oi(w){var E=-1,P=w==null?0:w.length;for(this.__data__=new Mt;++E<P;)this.add(w[E])}function Ud(w){return this.__data__.set(w,r),this}function Hd(w){return this.__data__.has(w)}Oi.prototype.add=Oi.prototype.push=Ud,Oi.prototype.has=Hd;function vn(w){var E=this.__data__=new xt(w);this.size=E.size}function Bd(){this.__data__=new xt,this.size=0}function Wd(w){var E=this.__data__,P=E.delete(w);return this.size=E.size,P}function Jd(w){return this.__data__.get(w)}function zd(w){return this.__data__.has(w)}function Gd(w,E){var P=this.__data__;if(P instanceof xt){var X=P.__data__;if(!Re||X.length<n-1)return X.push([w,E]),this.size=++P.size,this;P=this.__data__=new Mt(X)}return P.set(w,E),this.size=P.size,this}vn.prototype.clear=Bd,vn.prototype.delete=Wd,vn.prototype.get=Jd,vn.prototype.has=zd,vn.prototype.set=Gd;function Qd(w,E){var P=Si(w),X=!P&&ff(w),Te=!P&&!X&&No(w),fe=!P&&!X&&!Te&&Na(w),Fe=P||X||Te||fe,ze=Fe?Ke(w.length,String):[],Ze=ze.length;for(var De in w)tt.call(w,De)&&!(Fe&&(De=="length"||Te&&(De=="offset"||De=="parent")||fe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||af(De,Ze)))&&ze.push(De);return ze}function Ci(w,E){for(var P=w.length;P--;)if(Oa(w[P][0],E))return P;return-1}function Xd(w,E,P){var X=E(w);return Si(w)?X:Le(X,P(w))}function Jr(w){return w==null?w===void 0?F:x:ct&&ct in Object(w)?of(w):df(w)}function Ia(w){return zr(w)&&Jr(w)==a}function ba(w,E,P,X,Te){return w===E?!0:w==null||E==null||!zr(w)&&!zr(E)?w!==w&&E!==E:Yd(w,E,P,X,ba,Te)}function Yd(w,E,P,X,Te,fe){var Fe=Si(w),ze=Si(E),Ze=Fe?c:wn(w),De=ze?c:wn(E);Ze=Ze==a?g:Ze,De=De==a?g:De;var gt=Ze==g,kt=De==g,rt=Ze==De;if(rt&&No(w)){if(!No(E))return!1;Fe=!0,gt=!1}if(rt&&!gt)return fe||(fe=new vn),Fe||Na(w)?_a(w,E,P,X,Te,fe):nf(w,E,Ze,P,X,Te,fe);if(!(P&o)){var Ot=gt&&tt.call(w,"__wrapped__"),Ct=kt&&tt.call(E,"__wrapped__");if(Ot||Ct){var In=Ot?w.value():w,sn=Ct?E.value():E;return fe||(fe=new vn),Te(In,sn,P,X,fe)}}return rt?(fe||(fe=new vn),rf(w,E,P,X,Te,fe)):!1}function Zd(w){if(!Sa(w)||lf(w))return!1;var E=Ca(w)?mt:V;return E.test(qn(w))}function ef(w){return zr(w)&&Ea(w.length)&&!!M[Jr(w)]}function tf(w){if(!uf(w))return Vn(w);var E=[];for(var P in Object(w))tt.call(w,P)&&P!="constructor"&&E.push(P);return E}function _a(w,E,P,X,Te,fe){var Fe=P&o,ze=w.length,Ze=E.length;if(ze!=Ze&&!(Fe&&Ze>ze))return!1;var De=fe.get(w);if(De&&fe.get(E))return De==E;var gt=-1,kt=!0,rt=P&i?new Oi:void 0;for(fe.set(w,E),fe.set(E,w);++gt<ze;){var Ot=w[gt],Ct=E[gt];if(X)var In=Fe?X(Ct,Ot,gt,E,w,fe):X(Ot,Ct,gt,w,E,fe);if(In!==void 0){if(In)continue;kt=!1;break}if(rt){if(!Ge(E,function(sn,Un){if(!Rt(rt,Un)&&(Ot===sn||Te(Ot,sn,P,X,fe)))return rt.push(Un)})){kt=!1;break}}else if(!(Ot===Ct||Te(Ot,Ct,P,X,fe))){kt=!1;break}}return fe.delete(w),fe.delete(E),kt}function nf(w,E,P,X,Te,fe,Fe){switch(P){case z:if(w.byteLength!=E.byteLength||w.byteOffset!=E.byteOffset)return!1;w=w.buffer,E=E.buffer;case G:return!(w.byteLength!=E.byteLength||!fe(new mn(w),new mn(E)));case d:case f:case p:return Oa(+w,+E);case m:return w.name==E.name&&w.message==E.message;case _:case S:return w==E+"";case I:var ze=ht;case T:var Ze=X&o;if(ze||(ze=Pt),w.size!=E.size&&!Ze)return!1;var De=Fe.get(w);if(De)return De==E;X|=i,Fe.set(w,E);var gt=_a(ze(w),ze(E),X,Te,fe,Fe);return Fe.delete(w),gt;case N:if(lt)return lt.call(w)==lt.call(E)}return!1}function rf(w,E,P,X,Te,fe){var Fe=P&o,ze=xa(w),Ze=ze.length,De=xa(E),gt=De.length;if(Ze!=gt&&!Fe)return!1;for(var kt=Ze;kt--;){var rt=ze[kt];if(!(Fe?rt in E:tt.call(E,rt)))return!1}var Ot=fe.get(w);if(Ot&&fe.get(E))return Ot==E;var Ct=!0;fe.set(w,E),fe.set(E,w);for(var In=Fe;++kt<Ze;){rt=ze[kt];var sn=w[rt],Un=E[rt];if(X)var Ta=Fe?X(Un,sn,rt,E,w,fe):X(sn,Un,rt,w,E,fe);if(!(Ta===void 0?sn===Un||Te(sn,Un,P,X,fe):Ta)){Ct=!1;break}In||(In=rt=="constructor")}if(Ct&&!In){var Ni=w.constructor,Ti=E.constructor;Ni!=Ti&&"constructor"in w&&"constructor"in E&&!(typeof Ni=="function"&&Ni instanceof Ni&&typeof Ti=="function"&&Ti instanceof Ti)&&(Ct=!1)}return fe.delete(w),fe.delete(E),Ct}function xa(w){return Xd(w,mf,sf)}function Ei(w,E){var P=w.__data__;return cf(E)?P[typeof E=="string"?"string":"hash"]:P.map}function ur(w,E){var P=Qe(w,E);return Zd(P)?P:void 0}function of(w){var E=tt.call(w,ct),P=w[ct];try{w[ct]=void 0;var X=!0}catch{}var Te=hn.call(w);return X&&(E?w[ct]=P:delete w[ct]),Te}var sf=rn?function(w){return w==null?[]:(w=Object(w),Ee(rn(w),function(E){return nn.call(w,E)}))}:gf,wn=Jr;(yn&&wn(new yn(new ArrayBuffer(1)))!=z||Re&&wn(new Re)!=I||nt&&wn(nt.resolve())!=b||re&&wn(new re)!=T||me&&wn(new me)!=q)&&(wn=function(w){var E=Jr(w),P=E==g?w.constructor:void 0,X=P?qn(P):"";if(X)switch(X){case on:return z;case W:return I;case ae:return b;case le:return T;case je:return q}return E});function af(w,E){return E=E??s,!!E&&(typeof w=="number"||L.test(w))&&w>-1&&w%1==0&&w<E}function cf(w){var E=typeof w;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?w!=="__proto__":w===null}function lf(w){return!!en&&en in w}function uf(w){var E=w&&w.constructor,P=typeof E=="function"&&E.prototype||$e;return w===P}function df(w){return hn.call(w)}function qn(w){if(w!=null){try{return Dt.call(w)}catch{}try{return w+""}catch{}}return""}function Oa(w,E){return w===E||w!==w&&E!==E}var ff=Ia(function(){return arguments}())?Ia:function(w){return zr(w)&&tt.call(w,"callee")&&!nn.call(w,"callee")},Si=Array.isArray;function pf(w){return w!=null&&Ea(w.length)&&!Ca(w)}var No=gn||yf;function hf(w,E){return ba(w,E)}function Ca(w){if(!Sa(w))return!1;var E=Jr(w);return E==h||E==y||E==u||E==O}function Ea(w){return typeof w=="number"&&w>-1&&w%1==0&&w<=s}function Sa(w){var E=typeof w;return w!=null&&(E=="object"||E=="function")}function zr(w){return w!=null&&typeof w=="object"}var Na=H?Ie(H):ef;function mf(w){return pf(w)?Qd(w):tf(w)}function gf(){return[]}function yf(){return!1}e.exports=hf})(Qi,Qi.exports);var Wg=Qi.exports;const Rl=ks(Wg),or="other",Xi="uninstall-installation";function Dn(e){return!e.fieldName}function Jg(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function zg(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Dn(n)&&!!n.fieldName))||null}function Gg(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Dn(r)&&!!r.mapToName))||[]}function Qg(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Dn(r)&&!!r.mapToName))||[]}function Xg(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Dn(n)&&!!n.fieldName))||null}const Al=(e,t)=>{var n,r,o;return(o=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:o[t]};function Yg(e){return Dn(e)?e.mapToName:e.fieldName}const Pl=(e,t)=>{var r,o,i;const n=[];return(i=(o=(r=t.content)==null?void 0:r.read)==null?void 0:o.objects)==null||i.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Tr(s==null?void 0:s.objectName),completed:e?!!Al(e,s.objectName):!1})}),n},Dl=e=>{var n;return{name:or,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Zg(e,t){var i;const n=Pl(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?Dl(e):void 0;return o&&n.push(o),n}function Fl(e,t,n){const r=(e==null?void 0:e.filter(i=>!(t!=null&&t[i==null?void 0:i.mapToName])))||[],o=r.map(i=>i.mapToName);return n(ue.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function ey(e,t){return Rl(e,t)}function Ml(e,t){return Rl(e,t)}const ty=(e,t,n)=>{var p,x,g,b,O,_,T,S,N;if(!e)return null;const r=Jg(e,t),o=r&&zg(r),i=r&&Xg(r),s=r&&Gg(r),a=r&&Qg(r),c=(r==null?void 0:r.allFields)||[],u=(r==null?void 0:r.allFieldsMetadata)||{},d=n==null?void 0:n.content,f=((g=(x=(p=d==null?void 0:d.read)==null?void 0:p.objects)==null?void 0:x[t])==null?void 0:g.selectedFields)||{},m=((_=(O=(b=d==null?void 0:d.read)==null?void 0:b.objects)==null?void 0:O[t])==null?void 0:_.selectedValueMappings)||{},h=((N=(S=(T=d==null?void 0:d.read)==null?void 0:T.objects)==null?void 0:S[t])==null?void 0:N.selectedFieldMappings)||{},y={...f},I={...h};return{allFields:c,allFieldsMetadata:u,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:f,selectedFieldMappings:h,selectedValueMappings:m,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:y,requiredMapFields:I,selectedValueMappings:m}}},ny=(e,t)=>{var r,o;if(!e)return null;const n=(o=(r=t==null?void 0:t.content)==null?void 0:r.write)==null?void 0:o.objects;return{writeObjects:(e==null?void 0:e.objects)||[],selectedWriteObjects:n||{},isWriteModified:!1,savedConfig:{selectedWriteObjects:n||{}}}};function kl(e,t,n){var i,s;const r=(i=e==null?void 0:e.content)==null?void 0:i.read,o=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:ty(r,t,n),write:ny(o,n)}}const jl=(e,t,n,r)=>{const o=kl(e,n,t);r(n,o)},ry=(e,t,n)=>{const r=Zg(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=kl(e,i,t))}),n(o)},Ll=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(Yg(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},Vl=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n},Kl=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function $l(e,t){return t[e]||void 0}async function js({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:c}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const d=await hr().installationApi.createInstallation(u,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){_t(d,s)}}function fo(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const iy=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(o=>o.objectName===t)},oy=(e,t,n,r)=>{const o=Ll(e),i=Vl(e),s=Kl(e),a=iy(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:a.schedule,destination:a.destination,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return fo(n)&&(c.content.proxy={enabled:!0}),c},sy=(e,t,n,r,o,i,s,a,c,u,d,f)=>{const m=oy(c,i,a,r);return m?js({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:s,setError:u,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},ql=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},ay=e=>{const t=e.content.write;return t==null?void 0:t.objects},cy=(e,t,n)=>{if(!ay(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=ql(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return fo(t)&&(i.content.proxy={enabled:!0}),i},ly=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=cy(a,s,r);return f?js({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:c,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},uy={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 Ul({children:e,style:t}){return l.jsx(kn,{style:{...uy,...t},children:e})}var Hl={exports:{}};/*!
4
+ [Remedy] ${s.remedy}`:""}`;t&&t(c)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)},Eg=e=>{const t=pn();return $r({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e,includeEntitlements:!0})})},gl=w.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Fe=()=>{const e=w.useContext(gl);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Sg({projectIdOrName:e,children:t}){const{setError:n}=Tt(),{data:r,isLoading:o,isError:i}=Eg(e);w.useEffect(()=>{i&&n(ue.PROJECT,e)},[i,e,n]);const s=w.useMemo(()=>({projectId:(r==null?void 0:r.id)||"",projectIdOrName:e,project:r||null,appName:(r==null?void 0:r.appName)||"",isLoading:o}),[e,r,o]);return l.jsx(gl.Provider,{value:s,children:t})}const yl=w.createContext({integrations:null,isLoading:!0}),Ds=()=>{const e=w.useContext(yl);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Ng(){const e=pn(),{projectIdOrName:t}=Fe();return $r({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t})}function Tg({children:e}){const{projectIdOrName:t}=Fe(),{setError:n,removeError:r}=Tt(),{data:o,isLoading:i,isError:s}=Ng();w.useEffect(()=>{s?(_t(s),n(ue.INTEGRATION_LIST,t)):r(ue.INTEGRATION_LIST,t)},[s,t,r,n]);const a=w.useMemo(()=>({integrations:o||null,isLoading:i}),[o,i]);return l.jsx(yl.Provider,{value:a,children:e})}const Rg=new Pf;function Ag(e){const{options:{apiKey:t,projectId:n,project:r},children:o}=e,i=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!i)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return l.jsx(jf,{client:Rg,children:l.jsx(Xf,{children:l.jsx(Gf,{value:t,children:l.jsx(Sg,{projectIdOrName:i,children:l.jsx(Tg,{children:o})})})})})}const vl=w.createContext(null);function Pg(){const e=w.useContext(vl);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
5
+ component is wrapped with AmpersandProvider`);return e}function Dg(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Fg="_box_1p7c5_1",qa={box:Fg};function kn({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${qa.box} ${t}`:qa.box,style:n,children:e})}const Mg="_container_1wvzr_1",Ua={container:Mg};function qr({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Ua.container} ${t}`:Ua.container,style:n,children:e})}const kg="_errorBoxContainer_4sdb2_1",jg="_errorBox_4sdb2_1",Lg="_errorText_4sdb2_20",cs={errorBoxContainer:kg,errorBox:jg,errorText:Lg};function wl({message:e}){return l.jsx(kn,{className:cs.errorBox,children:l.jsx("p",{className:cs.errorText,children:e})})}function Il({message:e,children:t}){return l.jsxs(qr,{className:cs.errorBoxContainer,children:[l.jsx(Dg,{}),l.jsx(wl,{message:e}),t]})}const Vg="_loader_6ubm6_1",Kg="_rotate_6ubm6_1",$g="_ball1_6ubm6_1",qg="_ball2_6ubm6_1",Ug={loader:Vg,rotate:Kg,ball1:$g,ball2:qg};function Hg(){return l.jsx("span",{className:Ug.loader})}function ni(){return l.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:l.jsx(Hg,{})})}function bl({children:e}){return l.jsx(qr,{style:{maxWidth:"55rem"},children:l.jsx(kn,{children:e})})}function Ur(){return l.jsx(bl,{children:l.jsx(ni,{})})}function Gt({message:e,children:t}){return l.jsx(bl,{children:l.jsx(Il,{message:e,children:t})})}const _l=(e,t)=>{var s;const n=pn(),{projectIdOrName:r}=Fe(),{integrations:o}=Ds(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return $r({queryKey:["amp","installations",r,i,t],queryFn:async()=>{if(!r)throw new Error("Project ID is required");if(!i)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await n()).installationApi.listInstallations({projectIdOrName:r,integrationId:i,groupRef:t})},enabled:!!r&&!!i&&!!t&&!!o&&o.length>0})};function Fs(e,t){try{return process.env[e]}catch{return t}}function Ar(e){return e.charAt(0).toUpperCase()+e.slice(1)}function xl(e,t){return(t==null?void 0:t.displayName)??Ar(e)}const Bg=e=>e.split(`
6
+ `).filter(n=>n.trim()!==""),Wg=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Jg=()=>{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}},Ol=w.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function et(){const e=w.useContext(Ol);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function zg({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:u}){const{integrations:d}=Ds(),{setError:f,isError:h,removeError:m}=Tt(),{isIntegrationDeleted:y,setIntegrationDeleted:v,resetIntegrationDeleted:p}=Jg(),x=w.useMemo(()=>Wg(t,d||[]),[t,d]),{data:g,isLoading:b,isError:O,error:_}=_l(t,o),T=(g==null?void 0:g[0])||null;w.useEffect(()=>{p()},[t,n,r,o,i,u]),w.useEffect(()=>{x===null&&(d!=null&&d.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,x,d]),w.useEffect(()=>{O?(f(ue.INSTALLATION_LIST,(x==null?void 0:x.id)||""),_t(_)):m(ue.INSTALLATION_LIST,(x==null?void 0:x.id)||"")},[O,x,f,m,_]);const S=Yt(),N=w.useCallback(()=>{S.invalidateQueries({queryKey:["amp","installations"]})},[S]),D=w.useCallback(z=>{S.setQueryData(["amp","installations"],[z]),S.invalidateQueries({queryKey:["amp","installations"]})},[S]),q=(x==null?void 0:x.id)||"",G=w.useMemo(()=>({integrationId:(x==null?void 0:x.id)||"",provider:(x==null?void 0:x.provider)||"",integrationObj:x,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:T||void 0,setInstallation:D,resetInstallations:N,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:y,setIntegrationDeleted:v,fieldMapping:u}),[x,n,r,o,i,T,D,N,s,a,c,y,v,u]);if(b)return l.jsx(Ur,{});if(x===null)return l.jsx(Gt,{message:`Integration "${t}" not found`});if(h(ue.INSTALLATION_LIST,q)){const z=`Error retrieving installation information for integration "${(x==null?void 0:x.name)||"unknown"}"`;return l.jsx(Gt,{message:z})}return l.jsx(Ol.Provider,{value:G,children:e})}const Cl=w.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Hr=()=>{const e=w.useContext(Cl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e},Gg=({groupRefParam:e,providerParam:t})=>{const{projectIdOrName:n}=Fe(),{groupRef:r,provider:o}=et(),i=e||r,s=t||o,a=pn();return $r({queryKey:["amp","connections",n,i,s],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!i)throw new Error("Group reference not found.");if(!s)throw new Error("Provider not found.");return(await a()).connectionApi.listConnections({projectIdOrName:n,groupRef:i,provider:s})},retry:3,enabled:!!n&&!!i&&!!s})};function El({groupRef:e,provider:t,children:n}){const r=Yt(),{setError:o,isError:i}=Tt(),{projectId:s,isLoading:a}=Fe(),{data:c,isLoading:u,isError:d,error:f}=Gg({groupRefParam:e,providerParam:t}),h=c==null?void 0:c[0],m=w.useCallback(p=>{r.setQueryData(["amp","connections"],()=>p),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),y=w.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);w.useEffect(()=>{d?(o(ue.CONNECTION_LIST,s,!0),_t(f)):o(ue.CONNECTION_LIST,s,!1)},[d,o,s,f]);const v=w.useMemo(()=>({connections:c||null,isConnectionsLoading:u,selectedConnection:h||null,setConnections:m,setSelectedConnection:y}),[c,u,h,m,y]);if(u||a)return l.jsx(Ur,{});if(i(ue.PROJECT,s))return l.jsx(Gt,{message:`Error loading project ${s}`});if(i(ue.CONNECTION_LIST,s))return l.jsx(Gt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx(Cl.Provider,{value:v,children:n})}function Sl(){const[e,t]=w.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const Qg="_resetContainer_lkwv9_4",Nl={resetContainer:Qg};var Mi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ms(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qi={exports:{}};Qi.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",h="[object Error]",m="[object Function]",y="[object GeneratorFunction]",v="[object Map]",p="[object Number]",x="[object Null]",g="[object Object]",b="[object Promise]",O="[object Proxy]",_="[object RegExp]",T="[object Set]",S="[object String]",N="[object Symbol]",D="[object Undefined]",q="[object WeakMap]",G="[object ArrayBuffer]",z="[object DataView]",ne="[object Float32Array]",B="[object Float64Array]",ce="[object Int8Array]",oe="[object Int16Array]",te="[object Int32Array]",ge="[object Uint8Array]",we="[object Uint8ClampedArray]",A="[object Uint16Array]",k="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,L=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,F={};F[ne]=F[B]=F[ce]=F[oe]=F[te]=F[ge]=F[we]=F[A]=F[k]=!0,F[a]=F[c]=F[G]=F[d]=F[z]=F[f]=F[h]=F[m]=F[v]=F[p]=F[g]=F[_]=F[T]=F[S]=F[q]=!1;var Y=typeof Mi=="object"&&Mi&&Mi.Object===Object&&Mi,Z=typeof self=="object"&&self&&self.Object===Object&&self,U=Y||Z||Function("return this")(),ee=t&&!t.nodeType&&t,Q=ee&&!0&&e&&!e.nodeType&&e,de=Q&&Q.exports===ee,M=de&&Y.process,ve=function(){try{return M&&M.binding&&M.binding("util")}catch{}}(),H=ve&&ve.isTypedArray;function Ee(I,E){for(var P=-1,X=I==null?0:I.length,Te=0,fe=[];++P<X;){var Me=I[P];E(Me,P,I)&&(fe[Te++]=Me)}return fe}function Le(I,E){for(var P=-1,X=E.length,Te=I.length;++P<X;)I[Te+P]=E[P];return I}function Ge(I,E){for(var P=-1,X=I==null?0:I.length;++P<X;)if(E(I[P],P,I))return!0;return!1}function Ke(I,E){for(var P=-1,X=Array(I);++P<I;)X[P]=E(P);return X}function Ie(I){return function(E){return I(E)}}function Rt(I,E){return I.has(E)}function Qe(I,E){return I==null?void 0:I[E]}function ht(I){var E=-1,P=Array(I.size);return I.forEach(function(X,Te){P[++E]=[Te,X]}),P}function At(I,E){return function(P){return I(E(P))}}function Pt(I){var E=-1,P=Array(I.size);return I.forEach(function(X){P[++E]=X}),P}var Xe=Array.prototype,We=Function.prototype,$e=Object.prototype,Ae=U["__core-js_shared__"],Dt=We.toString,tt=$e.hasOwnProperty,en=function(){var I=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||"");return I?"Symbol(src)_1."+I:""}(),hn=$e.toString,mt=RegExp("^"+Dt.call(tt).replace($,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pe=de?U.Buffer:void 0,tn=U.Symbol,mn=U.Uint8Array,nn=$e.propertyIsEnumerable,Vn=Xe.splice,ct=tn?tn.toStringTag:void 0,rn=Object.getOwnPropertySymbols,gn=Pe?Pe.isBuffer:void 0,Kn=At(Object.keys,Object),yn=dr(U,"DataView"),Re=dr(U,"Map"),nt=dr(U,"Promise"),re=dr(U,"Set"),me=dr(U,"WeakMap"),qe=dr(Object,"create"),on=Un(yn),W=Un(Re),ae=Un(nt),le=Un(re),je=Un(me),Ue=tn?tn.prototype:void 0,lt=Ue?Ue.valueOf:void 0;function Je(I){var E=-1,P=I==null?0:I.length;for(this.clear();++E<P;){var X=I[E];this.set(X[0],X[1])}}function Ye(){this.__data__=qe?qe(null):{},this.size=0}function ut(I){var E=this.has(I)&&delete this.__data__[I];return this.size-=E?1:0,E}function Ne(I){var E=this.__data__;if(qe){var P=E[I];return P===r?void 0:P}return tt.call(E,I)?E[I]:void 0}function $n(I){var E=this.__data__;return qe?E[I]!==void 0:tt.call(E,I)}function Eo(I,E){var P=this.__data__;return this.size+=this.has(I)?0:1,P[I]=qe&&E===void 0?r:E,this}Je.prototype.clear=Ye,Je.prototype.delete=ut,Je.prototype.get=Ne,Je.prototype.has=$n,Je.prototype.set=Eo;function xt(I){var E=-1,P=I==null?0:I.length;for(this.clear();++E<P;){var X=I[E];this.set(X[0],X[1])}}function bi(){this.__data__=[],this.size=0}function _i(I){var E=this.__data__,P=Ci(E,I);if(P<0)return!1;var X=E.length-1;return P==X?E.pop():Vn.call(E,P,1),--this.size,!0}function xi(I){var E=this.__data__,P=Ci(E,I);return P<0?void 0:E[P][1]}function Se(I){return Ci(this.__data__,I)>-1}function Ft(I,E){var P=this.__data__,X=Ci(P,I);return X<0?(++this.size,P.push([I,E])):P[X][1]=E,this}xt.prototype.clear=bi,xt.prototype.delete=_i,xt.prototype.get=xi,xt.prototype.has=Se,xt.prototype.set=Ft;function Mt(I){var E=-1,P=I==null?0:I.length;for(this.clear();++E<P;){var X=I[E];this.set(X[0],X[1])}}function qn(){this.size=0,this.__data__={hash:new Je,map:new(Re||xt),string:new Je}}function So(I){var E=Ei(this,I).delete(I);return this.size-=E?1:0,E}function Jr(I){return Ei(this,I).get(I)}function Kd(I){return Ei(this,I).has(I)}function $d(I,E){var P=Ei(this,I),X=P.size;return P.set(I,E),this.size+=P.size==X?0:1,this}Mt.prototype.clear=qn,Mt.prototype.delete=So,Mt.prototype.get=Jr,Mt.prototype.has=Kd,Mt.prototype.set=$d;function Oi(I){var E=-1,P=I==null?0:I.length;for(this.__data__=new Mt;++E<P;)this.add(I[E])}function qd(I){return this.__data__.set(I,r),this}function Ud(I){return this.__data__.has(I)}Oi.prototype.add=Oi.prototype.push=qd,Oi.prototype.has=Ud;function vn(I){var E=this.__data__=new xt(I);this.size=E.size}function Hd(){this.__data__=new xt,this.size=0}function Bd(I){var E=this.__data__,P=E.delete(I);return this.size=E.size,P}function Wd(I){return this.__data__.get(I)}function Jd(I){return this.__data__.has(I)}function zd(I,E){var P=this.__data__;if(P instanceof xt){var X=P.__data__;if(!Re||X.length<n-1)return X.push([I,E]),this.size=++P.size,this;P=this.__data__=new Mt(X)}return P.set(I,E),this.size=P.size,this}vn.prototype.clear=Hd,vn.prototype.delete=Bd,vn.prototype.get=Wd,vn.prototype.has=Jd,vn.prototype.set=zd;function Gd(I,E){var P=Si(I),X=!P&&df(I),Te=!P&&!X&&No(I),fe=!P&&!X&&!Te&&Ea(I),Me=P||X||Te||fe,ze=Me?Ke(I.length,String):[],Ze=ze.length;for(var De in I)tt.call(I,De)&&!(Me&&(De=="length"||Te&&(De=="offset"||De=="parent")||fe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||sf(De,Ze)))&&ze.push(De);return ze}function Ci(I,E){for(var P=I.length;P--;)if(_a(I[P][0],E))return P;return-1}function Qd(I,E,P){var X=E(I);return Si(I)?X:Le(X,P(I))}function zr(I){return I==null?I===void 0?D:x:ct&&ct in Object(I)?rf(I):uf(I)}function va(I){return Gr(I)&&zr(I)==a}function wa(I,E,P,X,Te){return I===E?!0:I==null||E==null||!Gr(I)&&!Gr(E)?I!==I&&E!==E:Xd(I,E,P,X,wa,Te)}function Xd(I,E,P,X,Te,fe){var Me=Si(I),ze=Si(E),Ze=Me?c:wn(I),De=ze?c:wn(E);Ze=Ze==a?g:Ze,De=De==a?g:De;var gt=Ze==g,kt=De==g,rt=Ze==De;if(rt&&No(I)){if(!No(E))return!1;Me=!0,gt=!1}if(rt&&!gt)return fe||(fe=new vn),Me||Ea(I)?Ia(I,E,P,X,Te,fe):tf(I,E,Ze,P,X,Te,fe);if(!(P&o)){var Ot=gt&&tt.call(I,"__wrapped__"),Ct=kt&&tt.call(E,"__wrapped__");if(Ot||Ct){var In=Ot?I.value():I,sn=Ct?E.value():E;return fe||(fe=new vn),Te(In,sn,P,X,fe)}}return rt?(fe||(fe=new vn),nf(I,E,P,X,Te,fe)):!1}function Yd(I){if(!Ca(I)||cf(I))return!1;var E=xa(I)?mt:L;return E.test(Un(I))}function Zd(I){return Gr(I)&&Oa(I.length)&&!!F[zr(I)]}function ef(I){if(!lf(I))return Kn(I);var E=[];for(var P in Object(I))tt.call(I,P)&&P!="constructor"&&E.push(P);return E}function Ia(I,E,P,X,Te,fe){var Me=P&o,ze=I.length,Ze=E.length;if(ze!=Ze&&!(Me&&Ze>ze))return!1;var De=fe.get(I);if(De&&fe.get(E))return De==E;var gt=-1,kt=!0,rt=P&i?new Oi:void 0;for(fe.set(I,E),fe.set(E,I);++gt<ze;){var Ot=I[gt],Ct=E[gt];if(X)var In=Me?X(Ct,Ot,gt,E,I,fe):X(Ot,Ct,gt,I,E,fe);if(In!==void 0){if(In)continue;kt=!1;break}if(rt){if(!Ge(E,function(sn,Hn){if(!Rt(rt,Hn)&&(Ot===sn||Te(Ot,sn,P,X,fe)))return rt.push(Hn)})){kt=!1;break}}else if(!(Ot===Ct||Te(Ot,Ct,P,X,fe))){kt=!1;break}}return fe.delete(I),fe.delete(E),kt}function tf(I,E,P,X,Te,fe,Me){switch(P){case z:if(I.byteLength!=E.byteLength||I.byteOffset!=E.byteOffset)return!1;I=I.buffer,E=E.buffer;case G:return!(I.byteLength!=E.byteLength||!fe(new mn(I),new mn(E)));case d:case f:case p:return _a(+I,+E);case h:return I.name==E.name&&I.message==E.message;case _:case S:return I==E+"";case v:var ze=ht;case T:var Ze=X&o;if(ze||(ze=Pt),I.size!=E.size&&!Ze)return!1;var De=Me.get(I);if(De)return De==E;X|=i,Me.set(I,E);var gt=Ia(ze(I),ze(E),X,Te,fe,Me);return Me.delete(I),gt;case N:if(lt)return lt.call(I)==lt.call(E)}return!1}function nf(I,E,P,X,Te,fe){var Me=P&o,ze=ba(I),Ze=ze.length,De=ba(E),gt=De.length;if(Ze!=gt&&!Me)return!1;for(var kt=Ze;kt--;){var rt=ze[kt];if(!(Me?rt in E:tt.call(E,rt)))return!1}var Ot=fe.get(I);if(Ot&&fe.get(E))return Ot==E;var Ct=!0;fe.set(I,E),fe.set(E,I);for(var In=Me;++kt<Ze;){rt=ze[kt];var sn=I[rt],Hn=E[rt];if(X)var Sa=Me?X(Hn,sn,rt,E,I,fe):X(sn,Hn,rt,I,E,fe);if(!(Sa===void 0?sn===Hn||Te(sn,Hn,P,X,fe):Sa)){Ct=!1;break}In||(In=rt=="constructor")}if(Ct&&!In){var Ni=I.constructor,Ti=E.constructor;Ni!=Ti&&"constructor"in I&&"constructor"in E&&!(typeof Ni=="function"&&Ni instanceof Ni&&typeof Ti=="function"&&Ti instanceof Ti)&&(Ct=!1)}return fe.delete(I),fe.delete(E),Ct}function ba(I){return Qd(I,hf,of)}function Ei(I,E){var P=I.__data__;return af(E)?P[typeof E=="string"?"string":"hash"]:P.map}function dr(I,E){var P=Qe(I,E);return Yd(P)?P:void 0}function rf(I){var E=tt.call(I,ct),P=I[ct];try{I[ct]=void 0;var X=!0}catch{}var Te=hn.call(I);return X&&(E?I[ct]=P:delete I[ct]),Te}var of=rn?function(I){return I==null?[]:(I=Object(I),Ee(rn(I),function(E){return nn.call(I,E)}))}:mf,wn=zr;(yn&&wn(new yn(new ArrayBuffer(1)))!=z||Re&&wn(new Re)!=v||nt&&wn(nt.resolve())!=b||re&&wn(new re)!=T||me&&wn(new me)!=q)&&(wn=function(I){var E=zr(I),P=E==g?I.constructor:void 0,X=P?Un(P):"";if(X)switch(X){case on:return z;case W:return v;case ae:return b;case le:return T;case je:return q}return E});function sf(I,E){return E=E??s,!!E&&(typeof I=="number"||j.test(I))&&I>-1&&I%1==0&&I<E}function af(I){var E=typeof I;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?I!=="__proto__":I===null}function cf(I){return!!en&&en in I}function lf(I){var E=I&&I.constructor,P=typeof E=="function"&&E.prototype||$e;return I===P}function uf(I){return hn.call(I)}function Un(I){if(I!=null){try{return Dt.call(I)}catch{}try{return I+""}catch{}}return""}function _a(I,E){return I===E||I!==I&&E!==E}var df=va(function(){return arguments}())?va:function(I){return Gr(I)&&tt.call(I,"callee")&&!nn.call(I,"callee")},Si=Array.isArray;function ff(I){return I!=null&&Oa(I.length)&&!xa(I)}var No=gn||gf;function pf(I,E){return wa(I,E)}function xa(I){if(!Ca(I))return!1;var E=zr(I);return E==m||E==y||E==u||E==O}function Oa(I){return typeof I=="number"&&I>-1&&I%1==0&&I<=s}function Ca(I){var E=typeof I;return I!=null&&(E=="object"||E=="function")}function Gr(I){return I!=null&&typeof I=="object"}var Ea=H?Ie(H):Zd;function hf(I){return ff(I)?Gd(I):ef(I)}function mf(){return[]}function gf(){return!1}e.exports=pf})(Qi,Qi.exports);var Xg=Qi.exports;const Tl=Ms(Xg),sr="other",Xi="uninstall-installation";function Dn(e){return!e.fieldName}function Yg(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Zg(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Dn(n)&&!!n.fieldName))||null}function ey(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Dn(r)&&!!r.mapToName))||[]}function ty(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Dn(r)&&!!r.mapToName))||[]}function ny(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Dn(n)&&!!n.fieldName))||null}const Rl=(e,t)=>{var n,r,o;return(o=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:o[t]};function ry(e){return Dn(e)?e.mapToName:e.fieldName}const Al=(e,t)=>{var r,o,i;const n=[];return(i=(o=(r=t.content)==null?void 0:r.read)==null?void 0:o.objects)==null||i.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Ar(s==null?void 0:s.objectName),completed:e?!!Rl(e,s.objectName):!1})}),n},Pl=e=>{var n;return{name:sr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function iy(e,t){var i;const n=Al(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?Pl(e):void 0;return o&&n.push(o),n}function Dl(e,t,n){const r=(e==null?void 0:e.filter(i=>!(t!=null&&t[i==null?void 0:i.mapToName])))||[],o=r.map(i=>i.mapToName);return n(ue.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function oy(e,t){return Tl(e,t)}function Fl(e,t){return Tl(e,t)}const sy=(e,t,n)=>{var p,x,g,b,O,_,T,S,N;if(!e)return null;const r=Yg(e,t),o=r&&Zg(r),i=r&&ny(r),s=r&&ey(r),a=r&&ty(r),c=(r==null?void 0:r.allFields)||[],u=(r==null?void 0:r.allFieldsMetadata)||{},d=n==null?void 0:n.content,f=((g=(x=(p=d==null?void 0:d.read)==null?void 0:p.objects)==null?void 0:x[t])==null?void 0:g.selectedFields)||{},h=((_=(O=(b=d==null?void 0:d.read)==null?void 0:b.objects)==null?void 0:O[t])==null?void 0:_.selectedValueMappings)||{},m=((N=(S=(T=d==null?void 0:d.read)==null?void 0:T.objects)==null?void 0:S[t])==null?void 0:N.selectedFieldMappings)||{},y={...f},v={...m};return{allFields:c,allFieldsMetadata:u,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:f,selectedFieldMappings:m,selectedValueMappings:h,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:y,requiredMapFields:v,selectedValueMappings:h}}},ay=(e,t)=>{var r,o;if(!e)return null;const n=(o=(r=t==null?void 0:t.content)==null?void 0:r.write)==null?void 0:o.objects;return{writeObjects:(e==null?void 0:e.objects)||[],selectedWriteObjects:n||{},isWriteModified:!1,savedConfig:{selectedWriteObjects:n||{}}}};function Ml(e,t,n){var i,s;const r=(i=e==null?void 0:e.content)==null?void 0:i.read,o=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:sy(r,t,n),write:ay(o,n)}}const kl=(e,t,n,r)=>{const o=Ml(e,n,t);r(n,o)},cy=(e,t,n)=>{const r=iy(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=Ml(e,i,t))}),n(o)},jl=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(ry(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},Ll=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n},Vl=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function Kl(e,t){return t[e]||void 0}async function ks({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:c}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const d=await mr().installationApi.createInstallation(u,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){_t(d,s)}}function fo(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const ly=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(o=>o.objectName===t)},uy=(e,t,n,r)=>{const o=jl(e),i=Ll(e),s=Vl(e),a=ly(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:a.schedule,destination:a.destination,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return fo(n)&&(c.content.proxy={enabled:!0}),c},dy=(e,t,n,r,o,i,s,a,c,u,d,f)=>{const h=uy(c,i,a,r);return h?ks({createConfig:h,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:s,setError:u,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},$l=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},fy=e=>{const t=e.content.write;return t==null?void 0:t.objects},py=(e,t,n)=>{if(!fy(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=$l(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return fo(t)&&(i.content.proxy={enabled:!0}),i},hy=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=py(a,s,r);return f?ks({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:c,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},my={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 ql({children:e,style:t}){return l.jsx(kn,{style:{...my,...t},children:e})}var Ul={exports:{}};/*!
7
7
  Copyright (c) 2018 Jed Watson.
8
8
  Licensed under the MIT License (MIT), see
9
9
  http://jedwatson.github.io/classnames
10
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)t.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Hl);var dy=Hl.exports;const vt=ks(dy),fy="_button_gmp7p_1",py="_buttonError_gmp7p_20",hy="_danger_gmp7p_34",my="_ghost_gmp7p_39",Do={button:fy,buttonError:py,danger:hy,ghost:my};function at({className:e,style:t,type:n,children:r,variant:o,...i}){const s=vt(Do.button,{[Do.danger]:o==="danger",[Do.ghost]:o==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...i,children:r})}const Bl=v.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),Ur=()=>{const e=v.useContext(Bl);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},gy=()=>{var u;const e=Yt(),t=pn(),{selectedConnection:n,isConnectionsLoading:r}=qr(),{projectIdOrName:o}=ke(),{integrationId:i,integrationObj:s}=et(),a=n==null?void 0:n.id,c=(u=s==null?void 0:s.latestRevision)==null?void 0:u.id;return v.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),Vr({queryKey:["amp","hydratedRevision",o,i,c,a],queryFn:async()=>{if(!o)throw new Error("projectIdOrName is required");if(!i)throw new Error("integrationId is required");if(!c)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:o,integrationId:i,revisionId:c,connectionId:a})},retry:3,enabled:!!o&&!!i&&!!c&&!!a&&!r})};function yy({children:e}){const{integrationId:t,integrationObj:n}=et(),{isError:r,removeError:o,setError:i}=Tt(),s=(n==null?void 0:n.name)||t,{data:a,isLoading:c,isError:u,error:d}=gy();v.useEffect(()=>{u?(i(ue.HYDRATED_REVISION,s),_t(d)):o(ue.HYDRATED_REVISION,s)},[u,s,i,o,d]);const f=v.useMemo(()=>{var m,h,y;return{hydratedRevision:a||null,loading:c,readAction:(m=a==null?void 0:a.content)==null?void 0:m.read,writeObjects:((y=(h=a==null?void 0:a.content)==null?void 0:h.write)==null?void 0:y.objects)||[]}},[a,c]);if(c)return l.jsx($r,{});if(r(ue.HYDRATED_REVISION,s)){const h=`Error retrieving integration details for '${(n==null?void 0:n.name)||t||"unknown integration"}. This is sometimes caused by insufficient permissions with your credentials'`;return l.jsx(Gt,{message:h})}return l.jsx(Bl.Provider,{value:f,children:e})}const Wl=v.createContext(null);function Jl(){const e=v.useContext(Wl);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const zl=v.createContext(()=>{});function vy(){const e=v.useContext(zl);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var Gl=Symbol.for("immer-nothing"),Wa=Symbol.for("immer-draftable"),It=Symbol.for("immer-state"),wy=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 pt(e,...t){if(process.env.NODE_ENV!=="production"){const n=wy[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 Rr=Object.getPrototypeOf;function Ar(e){return!!e&&!!e[It]}function sr(e){var t;return e?Ql(e)||Array.isArray(e)||!!e[Wa]||!!((t=e.constructor)!=null&&t[Wa])||ho(e)||mo(e):!1}var Iy=Object.prototype.constructor.toString();function Ql(e){if(!e||typeof e!="object")return!1;const t=Rr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Iy}function Yi(e,t){po(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function po(e){const t=e[It];return t?t.type_:Array.isArray(e)?1:ho(e)?2:mo(e)?3:0}function ls(e,t){return po(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Xl(e,t,n){const r=po(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function by(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ho(e){return e instanceof Map}function mo(e){return e instanceof Set}function Bn(e){return e.copy_||e.base_}function us(e,t){if(ho(e))return new Map(e);if(mo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ql(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[It];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){const s=o[i],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Rr(e),r)}else{const r=Rr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function Ls(e,t=!1){return go(e)||Ar(e)||!sr(e)||(po(e)>1&&(e.set=e.add=e.clear=e.delete=_y),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ls(r,!0))),e}function _y(){pt(2)}function go(e){return Object.isFrozen(e)}var xy={};function ar(e){const t=xy[e];return t||pt(0,e),t}var ni;function Yl(){return ni}function Oy(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ja(e,t){t&&(ar("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ds(e){fs(e),e.drafts_.forEach(Cy),e.drafts_=null}function fs(e){e===ni&&(ni=e.parent_)}function za(e){return ni=Oy(ni,e)}function Cy(e){const t=e[It];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ga(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[It].modified_&&(ds(t),pt(4)),sr(e)&&(e=Zi(t,e),t.parent_||eo(t,e)),t.patches_&&ar("Patches").generateReplacementPatches_(n[It].base_,e,t.patches_,t.inversePatches_)):e=Zi(t,n,[]),ds(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Gl?e:void 0}function Zi(e,t,n){if(go(t))return t;const r=t[It];if(!r)return Yi(t,(o,i)=>Qa(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return eo(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let i=o,s=!1;r.type_===3&&(i=new Set(o),o.clear(),s=!0),Yi(i,(a,c)=>Qa(e,r,o,a,c,n,s)),eo(e,o,!1),n&&e.patches_&&ar("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Qa(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&pt(5),Ar(o)){const a=i&&t&&t.type_!==3&&!ls(t.assigned_,r)?i.concat(r):void 0,c=Zi(e,o,a);if(Xl(n,r,c),Ar(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(sr(o)&&!go(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Zi(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&eo(e,o)}}function eo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ls(t,n)}function Ey(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Yl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Vs;n&&(o=[r],i=ri);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var Vs={get(e,t){if(t===It)return e;const n=Bn(e);if(!ls(n,t))return Sy(e,n,t);const r=n[t];return e.finalized_||!sr(r)?r:r===Fo(e.base_,t)?(Mo(e),e.copy_[t]=hs(r,e)):r},has(e,t){return t in Bn(e)},ownKeys(e){return Reflect.ownKeys(Bn(e))},set(e,t,n){const r=Zl(Bn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Fo(Bn(e),t),i=o==null?void 0:o[It];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(by(n,o)&&(n!==void 0||ls(e.base_,t)))return!0;Mo(e),ps(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Fo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Mo(e),ps(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Bn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){pt(11)},getPrototypeOf(e){return Rr(e.base_)},setPrototypeOf(){pt(12)}},ri={};Yi(Vs,(e,t)=>{ri[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ri.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&pt(13),ri.set.call(this,e,t,void 0)};ri.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&pt(14),Vs.set.call(this,e[0],t,n,e[0])};function Fo(e,t){const n=e[It];return(n?Bn(n):e)[t]}function Sy(e,t,n){var o;const r=Zl(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Zl(e,t){if(!(t in e))return;let n=Rr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Rr(n)}}function ps(e){e.modified_||(e.modified_=!0,e.parent_&&ps(e.parent_))}function Mo(e){e.copy_||(e.copy_=us(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Ny=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(c=i,...u){return s.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&pt(6),r!==void 0&&typeof r!="function"&&pt(7);let o;if(sr(t)){const i=za(this),s=hs(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?ds(i):fs(i)}return Ja(i,r),Ga(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===Gl&&(o=void 0),this.autoFreeze_&&Ls(o,!0),r){const i=[],s=[];ar("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else pt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){sr(e)||pt(8),Ar(e)&&(e=Ty(e));const t=za(this),n=hs(e,void 0);return n[It].isManual_=!0,fs(t),n}finishDraft(e,t){const n=e&&e[It];(!n||!n.isManual_)&&pt(9);const{scope_:r}=n;return Ja(r,t),Ga(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=ar("Patches").applyPatches_;return Ar(e)?r(e,t):this.produce(e,o=>r(o,t))}};function hs(e,t){const n=ho(e)?ar("MapSet").proxyMap_(e,t):mo(e)?ar("MapSet").proxySet_(e,t):Ey(e,t);return(t?t.scope_:Yl()).drafts_.push(n),n}function Ty(e){return Ar(e)||pt(10,e),eu(e)}function eu(e){if(!sr(e)||go(e))return e;const t=e[It];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=us(e,t.scope_.immer_.useStrictShallowCopy_)}else n=us(e,!0);return Yi(n,(r,o)=>{Xl(n,r,eu(o))}),t&&(t.finalized_=!1),n}var bt=new Ny,Gr=bt.produce;bt.produceWithPatches.bind(bt);bt.setAutoFreeze.bind(bt);bt.setUseStrictShallowCopy.bind(bt);bt.applyPatches.bind(bt);bt.createDraft.bind(bt);bt.finishDraft.bind(bt);const tu=v.createContext(void 0),Ry={};function Ks(){const e=v.useContext(tu);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Ay({children:e}){const{installation:t}=et(),{hydratedRevision:n,loading:r}=Ur(),[o,i]=v.useState(Ry),s=t==null?void 0:t.config;v.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&ry(n,s,i)},[n,r,s,o]);const a=v.useCallback((h,y)=>{i(I=>Gr(I,p=>{p[h]=Gr(p[h],y)}))},[i]),c=v.useCallback((h,y)=>{i(I=>Gr(I,p=>{p[h]=y}))},[i]),u=v.useCallback(()=>{i(Gr(h=>{const y=h.other.write;y&&(y.isWriteModified=!1)}))},[i]),d=v.useCallback(h=>{i(Gr(y=>{var p;const I=(p=y[h])==null?void 0:p.read;I&&(I.isOptionalFieldsModified=!1,I.isRequiredMapFieldsModified=!1,I.isValueMappingsModified=!1)}))},[i]),f=v.useCallback(h=>{h===or?u():d(h)},[d,u]),m=v.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:f}),[o,c,f,a]);return l.jsx(tu.Provider,{value:m,children:e})}const Ht=()=>{const{appName:e}=ke(),{objectConfigurationsState:t,setConfigureState:n}=Ks(),{selectedObjectName:r}=Jl(),o=$l(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function Py(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};if(t.forEach(o=>{const{field:i,value:s}=o;s===null?delete n[i]:n[i]=s}),e!=null&&e.read){const o=e.read.savedConfig.requiredMapFields,s=!Ml(o,n);e.read.isRequiredMapFieldsModified=s}}function ii(e,t,n){t(e,r=>Py(r,n))}const Dy=(e,t)=>e.filter(n=>!t.has(n));function Fy(){var m,h,y;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Ht(),{fieldMapping:r}=et(),o=((m=t==null?void 0:t.read)==null?void 0:m.selectedFieldMappings)||{},i=Object.keys(o),s=((h=t==null?void 0:t.read)==null?void 0:h.requiredMapFields)||[],a=((y=t==null?void 0:t.read)==null?void 0:y.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(I=>!I.fieldName):[],u=s.concat(c,a).map(I=>I.mapToName),d=new Set(u),f=Dy(i,d);v.useEffect(()=>{e&&f.length&&ii(e,n,f.map(I=>({field:I,value:null})))},[e,n,f])}function un(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 he(){return he=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},he.apply(null,arguments)}function ms(e,t){return ms=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ms(e,t)}function My(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ms(e,t)}var gs={exports:{}},ki={exports:{}},be={};/** @license React v16.13.1
10
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)t.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Ul);var gy=Ul.exports;const vt=Ms(gy),yy="_button_gmp7p_1",vy="_buttonError_gmp7p_20",wy="_danger_gmp7p_34",Iy="_ghost_gmp7p_39",Po={button:yy,buttonError:vy,danger:wy,ghost:Iy};function at({className:e,style:t,type:n,children:r,variant:o,...i}){const s=vt(Po.button,{[Po.danger]:o==="danger",[Po.ghost]:o==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...i,children:r})}const by=()=>{const e=pn(),t=Yt();return As({mutationKey:["deleteConnection"],mutationFn:async({projectIdOrName:n,connectionId:r})=>(await e()).connectionApi.deleteConnection({projectIdOrName:n,connectionId:r}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error deleting connection.",{error:n})}})};function Hl({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectId:s}=Fe(),{selectedConnection:a}=Hr(),c=by(),[u,d]=w.useState(!1),f=!s||!a||!a.id||u,h=async()=>{f||(d(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id}),c.mutate({projectIdOrName:s,connectionId:a==null?void 0:a.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),o()},onError:v=>{_t(v,i)},onSettled:()=>d(!1)}))},m=u?"Disconnecting...":e;return l.jsx(at,{type:"button",onClick:h,disabled:f,variant:t,style:n,children:m})}const Bl=w.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),Br=()=>{const e=w.useContext(Bl);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},_y=()=>{var u;const e=Yt(),t=pn(),{selectedConnection:n,isConnectionsLoading:r}=Hr(),{projectIdOrName:o}=Fe(),{integrationId:i,integrationObj:s}=et(),a=n==null?void 0:n.id,c=(u=s==null?void 0:s.latestRevision)==null?void 0:u.id;return w.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),$r({queryKey:["amp","hydratedRevision",o,i,c,a],queryFn:async()=>{if(!o)throw new Error("projectIdOrName is required");if(!i)throw new Error("integrationId is required");if(!c)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:o,integrationId:i,revisionId:c,connectionId:a})},retry:3,enabled:!!o&&!!i&&!!c&&!!a&&!r})};function xy({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=et(),{isError:o,removeError:i,setError:s}=Tt(),a=(r==null?void 0:r.name)||n,[c,u]=w.useState(null),[d,f]=w.useState(null),{data:h,isLoading:m,isError:y,error:v}=_y();w.useEffect(()=>{y?(s(ue.HYDRATED_REVISION,a),_t(v,u)):(i(ue.HYDRATED_REVISION,a),u(null),f(null))},[y,a,s,i,v,u]);const p=w.useMemo(()=>{var g,b,O;return{hydratedRevision:h||null,loading:m,readAction:(g=h==null?void 0:h.content)==null?void 0:g.read,writeObjects:((O=(b=h==null?void 0:h.content)==null?void 0:b.write)==null?void 0:O.objects)||[]}},[h,m]);if(m)return l.jsx(Ur,{});const x=(r==null?void 0:r.provider)||"provider";if(o(ue.HYDRATED_REVISION,a)){const g=(r==null?void 0:r.name)||n||"unknown integration",b=`${c?`: ${c}`:`Error retrieving objects from ${x} or integration details for ${g}`}`;return l.jsx(Gt,{message:b,children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem"},children:[d&&l.jsx(wl,{message:d}),l.jsx(Hl,{buttonText:"Try again",resetComponent:t,buttonVariant:"danger",onDisconnectError:O=>f(O)})]})})}return l.jsx(Bl.Provider,{value:p,children:e})}const Wl=w.createContext(null);function Jl(){const e=w.useContext(Wl);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const zl=w.createContext(()=>{});function Oy(){const e=w.useContext(zl);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var Gl=Symbol.for("immer-nothing"),Ha=Symbol.for("immer-draftable"),It=Symbol.for("immer-state"),Cy=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 pt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Cy[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 Pr=Object.getPrototypeOf;function Dr(e){return!!e&&!!e[It]}function ar(e){var t;return e?Ql(e)||Array.isArray(e)||!!e[Ha]||!!((t=e.constructor)!=null&&t[Ha])||ho(e)||mo(e):!1}var Ey=Object.prototype.constructor.toString();function Ql(e){if(!e||typeof e!="object")return!1;const t=Pr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Ey}function Yi(e,t){po(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function po(e){const t=e[It];return t?t.type_:Array.isArray(e)?1:ho(e)?2:mo(e)?3:0}function ls(e,t){return po(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Xl(e,t,n){const r=po(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Sy(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ho(e){return e instanceof Map}function mo(e){return e instanceof Set}function Wn(e){return e.copy_||e.base_}function us(e,t){if(ho(e))return new Map(e);if(mo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ql(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[It];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){const s=o[i],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Pr(e),r)}else{const r=Pr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function js(e,t=!1){return go(e)||Dr(e)||!ar(e)||(po(e)>1&&(e.set=e.add=e.clear=e.delete=Ny),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>js(r,!0))),e}function Ny(){pt(2)}function go(e){return Object.isFrozen(e)}var Ty={};function cr(e){const t=Ty[e];return t||pt(0,e),t}var ri;function Yl(){return ri}function Ry(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ba(e,t){t&&(cr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ds(e){fs(e),e.drafts_.forEach(Ay),e.drafts_=null}function fs(e){e===ri&&(ri=e.parent_)}function Wa(e){return ri=Ry(ri,e)}function Ay(e){const t=e[It];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ja(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[It].modified_&&(ds(t),pt(4)),ar(e)&&(e=Zi(t,e),t.parent_||eo(t,e)),t.patches_&&cr("Patches").generateReplacementPatches_(n[It].base_,e,t.patches_,t.inversePatches_)):e=Zi(t,n,[]),ds(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Gl?e:void 0}function Zi(e,t,n){if(go(t))return t;const r=t[It];if(!r)return Yi(t,(o,i)=>za(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return eo(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let i=o,s=!1;r.type_===3&&(i=new Set(o),o.clear(),s=!0),Yi(i,(a,c)=>za(e,r,o,a,c,n,s)),eo(e,o,!1),n&&e.patches_&&cr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function za(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&pt(5),Dr(o)){const a=i&&t&&t.type_!==3&&!ls(t.assigned_,r)?i.concat(r):void 0,c=Zi(e,o,a);if(Xl(n,r,c),Dr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(ar(o)&&!go(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Zi(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&eo(e,o)}}function eo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&js(t,n)}function Py(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Yl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Ls;n&&(o=[r],i=ii);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var Ls={get(e,t){if(t===It)return e;const n=Wn(e);if(!ls(n,t))return Dy(e,n,t);const r=n[t];return e.finalized_||!ar(r)?r:r===Do(e.base_,t)?(Fo(e),e.copy_[t]=hs(r,e)):r},has(e,t){return t in Wn(e)},ownKeys(e){return Reflect.ownKeys(Wn(e))},set(e,t,n){const r=Zl(Wn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Do(Wn(e),t),i=o==null?void 0:o[It];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Sy(n,o)&&(n!==void 0||ls(e.base_,t)))return!0;Fo(e),ps(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 Do(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Fo(e),ps(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Wn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){pt(11)},getPrototypeOf(e){return Pr(e.base_)},setPrototypeOf(){pt(12)}},ii={};Yi(Ls,(e,t)=>{ii[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ii.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&pt(13),ii.set.call(this,e,t,void 0)};ii.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&pt(14),Ls.set.call(this,e[0],t,n,e[0])};function Do(e,t){const n=e[It];return(n?Wn(n):e)[t]}function Dy(e,t,n){var o;const r=Zl(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Zl(e,t){if(!(t in e))return;let n=Pr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Pr(n)}}function ps(e){e.modified_||(e.modified_=!0,e.parent_&&ps(e.parent_))}function Fo(e){e.copy_||(e.copy_=us(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Fy=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(c=i,...u){return s.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&pt(6),r!==void 0&&typeof r!="function"&&pt(7);let o;if(ar(t)){const i=Wa(this),s=hs(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?ds(i):fs(i)}return Ba(i,r),Ja(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===Gl&&(o=void 0),this.autoFreeze_&&js(o,!0),r){const i=[],s=[];cr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else pt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ar(e)||pt(8),Dr(e)&&(e=My(e));const t=Wa(this),n=hs(e,void 0);return n[It].isManual_=!0,fs(t),n}finishDraft(e,t){const n=e&&e[It];(!n||!n.isManual_)&&pt(9);const{scope_:r}=n;return Ba(r,t),Ja(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=cr("Patches").applyPatches_;return Dr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function hs(e,t){const n=ho(e)?cr("MapSet").proxyMap_(e,t):mo(e)?cr("MapSet").proxySet_(e,t):Py(e,t);return(t?t.scope_:Yl()).drafts_.push(n),n}function My(e){return Dr(e)||pt(10,e),eu(e)}function eu(e){if(!ar(e)||go(e))return e;const t=e[It];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=us(e,t.scope_.immer_.useStrictShallowCopy_)}else n=us(e,!0);return Yi(n,(r,o)=>{Xl(n,r,eu(o))}),t&&(t.finalized_=!1),n}var bt=new Fy,Qr=bt.produce;bt.produceWithPatches.bind(bt);bt.setAutoFreeze.bind(bt);bt.setUseStrictShallowCopy.bind(bt);bt.applyPatches.bind(bt);bt.createDraft.bind(bt);bt.finishDraft.bind(bt);const tu=w.createContext(void 0),ky={};function Vs(){const e=w.useContext(tu);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function jy({children:e}){const{installation:t}=et(),{hydratedRevision:n,loading:r}=Br(),[o,i]=w.useState(ky),s=t==null?void 0:t.config;w.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&cy(n,s,i)},[n,r,s,o]);const a=w.useCallback((m,y)=>{i(v=>Qr(v,p=>{p[m]=Qr(p[m],y)}))},[i]),c=w.useCallback((m,y)=>{i(v=>Qr(v,p=>{p[m]=y}))},[i]),u=w.useCallback(()=>{i(Qr(m=>{const y=m.other.write;y&&(y.isWriteModified=!1)}))},[i]),d=w.useCallback(m=>{i(Qr(y=>{var p;const v=(p=y[m])==null?void 0:p.read;v&&(v.isOptionalFieldsModified=!1,v.isRequiredMapFieldsModified=!1,v.isValueMappingsModified=!1)}))},[i]),f=w.useCallback(m=>{m===sr?u():d(m)},[d,u]),h=w.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:f}),[o,c,f,a]);return l.jsx(tu.Provider,{value:h,children:e})}const Ht=()=>{const{appName:e}=Fe(),{objectConfigurationsState:t,setConfigureState:n}=Vs(),{selectedObjectName:r}=Jl(),o=Kl(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function Ly(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};if(t.forEach(o=>{const{field:i,value:s}=o;s===null?delete n[i]:n[i]=s}),e!=null&&e.read){const o=e.read.savedConfig.requiredMapFields,s=!Fl(o,n);e.read.isRequiredMapFieldsModified=s}}function oi(e,t,n){t(e,r=>Ly(r,n))}const Vy=(e,t)=>e.filter(n=>!t.has(n));function Ky(){var h,m,y;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Ht(),{fieldMapping:r}=et(),o=((h=t==null?void 0:t.read)==null?void 0:h.selectedFieldMappings)||{},i=Object.keys(o),s=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],a=((y=t==null?void 0:t.read)==null?void 0:y.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(v=>!v.fieldName):[],u=s.concat(c,a).map(v=>v.mapToName),d=new Set(u),f=Vy(i,d);w.useEffect(()=>{e&&f.length&&oi(e,n,f.map(v=>({field:v,value:null})))},[e,n,f])}function un(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 he(){return he=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},he.apply(null,arguments)}function ms(e,t){return ms=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ms(e,t)}function $y(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ms(e,t)}var gs={exports:{}},ki={exports:{}},be={};/** @license React v16.13.1
11
11
  * react-is.production.min.js
12
12
  *
13
13
  * Copyright (c) Facebook, Inc. and its affiliates.
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Xa;function ky(){if(Xa)return be;Xa=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function b(_){if(typeof _=="object"&&_!==null){var T=_.$$typeof;switch(T){case t:switch(_=_.type,_){case c:case u:case r:case i:case o:case f:return _;default:switch(_=_&&_.$$typeof,_){case a:case d:case y:case h:case s:return _;default:return T}}case n:return T}}}function O(_){return b(_)===u}return be.AsyncMode=c,be.ConcurrentMode=u,be.ContextConsumer=a,be.ContextProvider=s,be.Element=t,be.ForwardRef=d,be.Fragment=r,be.Lazy=y,be.Memo=h,be.Portal=n,be.Profiler=i,be.StrictMode=o,be.Suspense=f,be.isAsyncMode=function(_){return O(_)||b(_)===c},be.isConcurrentMode=O,be.isContextConsumer=function(_){return b(_)===a},be.isContextProvider=function(_){return b(_)===s},be.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===t},be.isForwardRef=function(_){return b(_)===d},be.isFragment=function(_){return b(_)===r},be.isLazy=function(_){return b(_)===y},be.isMemo=function(_){return b(_)===h},be.isPortal=function(_){return b(_)===n},be.isProfiler=function(_){return b(_)===i},be.isStrictMode=function(_){return b(_)===o},be.isSuspense=function(_){return b(_)===f},be.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===u||_===i||_===o||_===f||_===m||typeof _=="object"&&_!==null&&(_.$$typeof===y||_.$$typeof===h||_.$$typeof===s||_.$$typeof===a||_.$$typeof===d||_.$$typeof===p||_.$$typeof===x||_.$$typeof===g||_.$$typeof===I)},be.typeOf=b,be}var _e={};/** @license React v16.13.1
17
+ */var Ga;function qy(){if(Ga)return be;Ga=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function b(_){if(typeof _=="object"&&_!==null){var T=_.$$typeof;switch(T){case t:switch(_=_.type,_){case c:case u:case r:case i:case o:case f:return _;default:switch(_=_&&_.$$typeof,_){case a:case d:case y:case m:case s:return _;default:return T}}case n:return T}}}function O(_){return b(_)===u}return be.AsyncMode=c,be.ConcurrentMode=u,be.ContextConsumer=a,be.ContextProvider=s,be.Element=t,be.ForwardRef=d,be.Fragment=r,be.Lazy=y,be.Memo=m,be.Portal=n,be.Profiler=i,be.StrictMode=o,be.Suspense=f,be.isAsyncMode=function(_){return O(_)||b(_)===c},be.isConcurrentMode=O,be.isContextConsumer=function(_){return b(_)===a},be.isContextProvider=function(_){return b(_)===s},be.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===t},be.isForwardRef=function(_){return b(_)===d},be.isFragment=function(_){return b(_)===r},be.isLazy=function(_){return b(_)===y},be.isMemo=function(_){return b(_)===m},be.isPortal=function(_){return b(_)===n},be.isProfiler=function(_){return b(_)===i},be.isStrictMode=function(_){return b(_)===o},be.isSuspense=function(_){return b(_)===f},be.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===u||_===i||_===o||_===f||_===h||typeof _=="object"&&_!==null&&(_.$$typeof===y||_.$$typeof===m||_.$$typeof===s||_.$$typeof===a||_.$$typeof===d||_.$$typeof===p||_.$$typeof===x||_.$$typeof===g||_.$$typeof===v)},be.typeOf=b,be}var _e={};/** @license React v16.13.1
18
18
  * react-is.development.js
19
19
  *
20
20
  * Copyright (c) Facebook, Inc. and its affiliates.
21
21
  *
22
22
  * This source code is licensed under the MIT license found in the
23
23
  * LICENSE file in the root directory of this source tree.
24
- */var Ya;function jy(){return Ya||(Ya=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function b(k){return typeof k=="string"||typeof k=="function"||k===r||k===u||k===i||k===o||k===f||k===m||typeof k=="object"&&k!==null&&(k.$$typeof===y||k.$$typeof===h||k.$$typeof===s||k.$$typeof===a||k.$$typeof===d||k.$$typeof===p||k.$$typeof===x||k.$$typeof===g||k.$$typeof===I)}function O(k){if(typeof k=="object"&&k!==null){var ve=k.$$typeof;switch(ve){case t:var H=k.type;switch(H){case c:case u:case r:case i:case o:case f:return H;default:var Ee=H&&H.$$typeof;switch(Ee){case a:case d:case y:case h:case s:return Ee;default:return ve}}case n:return ve}}}var _=c,T=u,S=a,N=s,F=t,q=d,G=r,z=y,ne=h,B=n,ce=i,oe=o,te=f,ge=!1;function we(k){return ge||(ge=!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.")),A(k)||O(k)===c}function A(k){return O(k)===u}function j(k){return O(k)===a}function $(k){return O(k)===s}function V(k){return typeof k=="object"&&k!==null&&k.$$typeof===t}function L(k){return O(k)===d}function M(k){return O(k)===r}function Y(k){return O(k)===y}function Z(k){return O(k)===h}function U(k){return O(k)===n}function ee(k){return O(k)===i}function Q(k){return O(k)===o}function de(k){return O(k)===f}_e.AsyncMode=_,_e.ConcurrentMode=T,_e.ContextConsumer=S,_e.ContextProvider=N,_e.Element=F,_e.ForwardRef=q,_e.Fragment=G,_e.Lazy=z,_e.Memo=ne,_e.Portal=B,_e.Profiler=ce,_e.StrictMode=oe,_e.Suspense=te,_e.isAsyncMode=we,_e.isConcurrentMode=A,_e.isContextConsumer=j,_e.isContextProvider=$,_e.isElement=V,_e.isForwardRef=L,_e.isFragment=M,_e.isLazy=Y,_e.isMemo=Z,_e.isPortal=U,_e.isProfiler=ee,_e.isStrictMode=Q,_e.isSuspense=de,_e.isValidElementType=b,_e.typeOf=O}()),_e}var Za;function nu(){return Za||(Za=1,process.env.NODE_ENV==="production"?ki.exports=ky():ki.exports=jy()),ki.exports}/*
24
+ */var Qa;function Uy(){return Qa||(Qa=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function b(M){return typeof M=="string"||typeof M=="function"||M===r||M===u||M===i||M===o||M===f||M===h||typeof M=="object"&&M!==null&&(M.$$typeof===y||M.$$typeof===m||M.$$typeof===s||M.$$typeof===a||M.$$typeof===d||M.$$typeof===p||M.$$typeof===x||M.$$typeof===g||M.$$typeof===v)}function O(M){if(typeof M=="object"&&M!==null){var ve=M.$$typeof;switch(ve){case t:var H=M.type;switch(H){case c:case u:case r:case i:case o:case f:return H;default:var Ee=H&&H.$$typeof;switch(Ee){case a:case d:case y:case m:case s:return Ee;default:return ve}}case n:return ve}}}var _=c,T=u,S=a,N=s,D=t,q=d,G=r,z=y,ne=m,B=n,ce=i,oe=o,te=f,ge=!1;function we(M){return ge||(ge=!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.")),A(M)||O(M)===c}function A(M){return O(M)===u}function k(M){return O(M)===a}function $(M){return O(M)===s}function L(M){return typeof M=="object"&&M!==null&&M.$$typeof===t}function j(M){return O(M)===d}function F(M){return O(M)===r}function Y(M){return O(M)===y}function Z(M){return O(M)===m}function U(M){return O(M)===n}function ee(M){return O(M)===i}function Q(M){return O(M)===o}function de(M){return O(M)===f}_e.AsyncMode=_,_e.ConcurrentMode=T,_e.ContextConsumer=S,_e.ContextProvider=N,_e.Element=D,_e.ForwardRef=q,_e.Fragment=G,_e.Lazy=z,_e.Memo=ne,_e.Portal=B,_e.Profiler=ce,_e.StrictMode=oe,_e.Suspense=te,_e.isAsyncMode=we,_e.isConcurrentMode=A,_e.isContextConsumer=k,_e.isContextProvider=$,_e.isElement=L,_e.isForwardRef=j,_e.isFragment=F,_e.isLazy=Y,_e.isMemo=Z,_e.isPortal=U,_e.isProfiler=ee,_e.isStrictMode=Q,_e.isSuspense=de,_e.isValidElementType=b,_e.typeOf=O}()),_e}var Xa;function nu(){return Xa||(Xa=1,process.env.NODE_ENV==="production"?ki.exports=qy():ki.exports=Uy()),ki.exports}/*
25
25
  object-assign
26
26
  (c) Sindre Sorhus
27
27
  @license MIT
28
- */var ko,ec;function Ly(){if(ec)return ko;ec=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(c.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ko=o()?Object.assign:function(i,s){for(var a,c=r(i),u,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var f in a)t.call(a,f)&&(c[f]=a[f]);if(e){u=e(a);for(var m=0;m<u.length;m++)n.call(a,u[m])&&(c[u[m]]=a[u[m]])}}return c},ko}var jo,tc;function $s(){if(tc)return jo;tc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return jo=e,jo}var Lo,nc;function ru(){return nc||(nc=1,Lo=Function.call.bind(Object.prototype.hasOwnProperty)),Lo}var Vo,rc;function Vy(){if(rc)return Vo;rc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=$s(),n={},r=ru();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function o(i,s,a,c,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var f;try{if(typeof i[d]!="function"){var m=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}f=i[d](s,d,c,a,null,t)}catch(y){f=y}if(f&&!(f instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var h=u?u():"";e("Failed "+a+" type: "+f.message+(h??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Vo=o,Vo}var Ko,ic;function Ky(){if(ic)return Ko;ic=1;var e=nu(),t=Ly(),n=$s(),r=ru(),o=Vy(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function s(){return null}return Ko=function(a,c){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(A){var j=A&&(u&&A[u]||A[d]);if(typeof j=="function")return j}var m="<<anonymous>>",h={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:O(),elementType:_(),instanceOf:T,node:q(),objectOf:N,oneOf:S,oneOfType:F,shape:z,exact:ne};function y(A,j){return A===j?A!==0||1/A===1/j:A!==A&&j!==j}function I(A,j){this.message=A,this.data=j&&typeof j=="object"?j:{},this.stack=""}I.prototype=Error.prototype;function p(A){if(process.env.NODE_ENV!=="production")var j={},$=0;function V(M,Y,Z,U,ee,Q,de){if(U=U||m,Q=Q||Z,de!==n){if(c){var k=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 k.name="Invariant Violation",k}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=U+":"+Z;!j[ve]&&$<3&&(i("You are manually calling a React.PropTypes validation function for the `"+Q+"` prop on `"+U+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),j[ve]=!0,$++)}}return Y[Z]==null?M?Y[Z]===null?new I("The "+ee+" `"+Q+"` is marked as required "+("in `"+U+"`, but its value is `null`.")):new I("The "+ee+" `"+Q+"` is marked as required in "+("`"+U+"`, but its value is `undefined`.")):null:A(Y,Z,U,ee,Q)}var L=V.bind(null,!1);return L.isRequired=V.bind(null,!0),L}function x(A){function j($,V,L,M,Y,Z){var U=$[V],ee=oe(U);if(ee!==A){var Q=te(U);return new I("Invalid "+M+" `"+Y+"` of type "+("`"+Q+"` supplied to `"+L+"`, expected ")+("`"+A+"`."),{expectedType:A})}return null}return p(j)}function g(){return p(s)}function b(A){function j($,V,L,M,Y){if(typeof A!="function")return new I("Property `"+Y+"` of component `"+L+"` has invalid PropType notation inside arrayOf.");var Z=$[V];if(!Array.isArray(Z)){var U=oe(Z);return new I("Invalid "+M+" `"+Y+"` of type "+("`"+U+"` supplied to `"+L+"`, expected an array."))}for(var ee=0;ee<Z.length;ee++){var Q=A(Z,ee,L,M,Y+"["+ee+"]",n);if(Q instanceof Error)return Q}return null}return p(j)}function O(){function A(j,$,V,L,M){var Y=j[$];if(!a(Y)){var Z=oe(Y);return new I("Invalid "+L+" `"+M+"` of type "+("`"+Z+"` supplied to `"+V+"`, expected a single ReactElement."))}return null}return p(A)}function _(){function A(j,$,V,L,M){var Y=j[$];if(!e.isValidElementType(Y)){var Z=oe(Y);return new I("Invalid "+L+" `"+M+"` of type "+("`"+Z+"` supplied to `"+V+"`, expected a single ReactElement type."))}return null}return p(A)}function T(A){function j($,V,L,M,Y){if(!($[V]instanceof A)){var Z=A.name||m,U=we($[V]);return new I("Invalid "+M+" `"+Y+"` of type "+("`"+U+"` supplied to `"+L+"`, expected ")+("instance of `"+Z+"`."))}return null}return p(j)}function S(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function j($,V,L,M,Y){for(var Z=$[V],U=0;U<A.length;U++)if(y(Z,A[U]))return null;var ee=JSON.stringify(A,function(de,k){var ve=te(k);return ve==="symbol"?String(k):k});return new I("Invalid "+M+" `"+Y+"` of value `"+String(Z)+"` "+("supplied to `"+L+"`, expected one of "+ee+"."))}return p(j)}function N(A){function j($,V,L,M,Y){if(typeof A!="function")return new I("Property `"+Y+"` of component `"+L+"` has invalid PropType notation inside objectOf.");var Z=$[V],U=oe(Z);if(U!=="object")return new I("Invalid "+M+" `"+Y+"` of type "+("`"+U+"` supplied to `"+L+"`, expected an object."));for(var ee in Z)if(r(Z,ee)){var Q=A(Z,ee,L,M,Y+"."+ee,n);if(Q instanceof Error)return Q}return null}return p(j)}function F(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var j=0;j<A.length;j++){var $=A[j];if(typeof $!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ge($)+" at index "+j+"."),s}function V(L,M,Y,Z,U){for(var ee=[],Q=0;Q<A.length;Q++){var de=A[Q],k=de(L,M,Y,Z,U,n);if(k==null)return null;k.data&&r(k.data,"expectedType")&&ee.push(k.data.expectedType)}var ve=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new I("Invalid "+Z+" `"+U+"` supplied to "+("`"+Y+"`"+ve+"."))}return p(V)}function q(){function A(j,$,V,L,M){return B(j[$])?null:new I("Invalid "+L+" `"+M+"` supplied to "+("`"+V+"`, expected a ReactNode."))}return p(A)}function G(A,j,$,V,L){return new I((A||"React class")+": "+j+" type `"+$+"."+V+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+L+"`.")}function z(A){function j($,V,L,M,Y){var Z=$[V],U=oe(Z);if(U!=="object")return new I("Invalid "+M+" `"+Y+"` of type `"+U+"` "+("supplied to `"+L+"`, expected `object`."));for(var ee in A){var Q=A[ee];if(typeof Q!="function")return G(L,M,Y,ee,te(Q));var de=Q(Z,ee,L,M,Y+"."+ee,n);if(de)return de}return null}return p(j)}function ne(A){function j($,V,L,M,Y){var Z=$[V],U=oe(Z);if(U!=="object")return new I("Invalid "+M+" `"+Y+"` of type `"+U+"` "+("supplied to `"+L+"`, expected `object`."));var ee=t({},$[V],A);for(var Q in ee){var de=A[Q];if(r(A,Q)&&typeof de!="function")return G(L,M,Y,Q,te(de));if(!de)return new I("Invalid "+M+" `"+Y+"` key `"+Q+"` supplied to `"+L+"`.\nBad object: "+JSON.stringify($[V],null," ")+`
29
- Valid keys: `+JSON.stringify(Object.keys(A),null," "));var k=de(Z,Q,L,M,Y+"."+Q,n);if(k)return k}return null}return p(j)}function B(A){switch(typeof A){case"number":case"string":case"undefined":return!0;case"boolean":return!A;case"object":if(Array.isArray(A))return A.every(B);if(A===null||a(A))return!0;var j=f(A);if(j){var $=j.call(A),V;if(j!==A.entries){for(;!(V=$.next()).done;)if(!B(V.value))return!1}else for(;!(V=$.next()).done;){var L=V.value;if(L&&!B(L[1]))return!1}}else return!1;return!0;default:return!1}}function ce(A,j){return A==="symbol"?!0:j?j["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&j instanceof Symbol:!1}function oe(A){var j=typeof A;return Array.isArray(A)?"array":A instanceof RegExp?"object":ce(j,A)?"symbol":j}function te(A){if(typeof A>"u"||A===null)return""+A;var j=oe(A);if(j==="object"){if(A instanceof Date)return"date";if(A instanceof RegExp)return"regexp"}return j}function ge(A){var j=te(A);switch(j){case"array":case"object":return"an "+j;case"boolean":case"date":case"regexp":return"a "+j;default:return j}}function we(A){return!A.constructor||!A.constructor.name?m:A.constructor.name}return h.checkPropTypes=o,h.resetWarningCache=o.resetWarningCache,h.PropTypes=h,h},Ko}var $o,oc;function $y(){if(oc)return $o;oc=1;var e=$s();function t(){}function n(){}return n.resetWarningCache=t,$o=function(){function r(s,a,c,u,d,f){if(f!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},$o}if(process.env.NODE_ENV!=="production"){var qy=nu(),Uy=!0;gs.exports=Ky()(qy.isElement,Uy)}else gs.exports=$y()();var Hy=gs.exports;const K=ks(Hy);var ys={exports:{}},xe={};/**
28
+ */var Mo,Ya;function Hy(){if(Ya)return Mo;Ya=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(c.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Mo=o()?Object.assign:function(i,s){for(var a,c=r(i),u,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var f in a)t.call(a,f)&&(c[f]=a[f]);if(e){u=e(a);for(var h=0;h<u.length;h++)n.call(a,u[h])&&(c[u[h]]=a[u[h]])}}return c},Mo}var ko,Za;function Ks(){if(Za)return ko;Za=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ko=e,ko}var jo,ec;function ru(){return ec||(ec=1,jo=Function.call.bind(Object.prototype.hasOwnProperty)),jo}var Lo,tc;function By(){if(tc)return Lo;tc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Ks(),n={},r=ru();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function o(i,s,a,c,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var f;try{if(typeof i[d]!="function"){var h=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}f=i[d](s,d,c,a,null,t)}catch(y){f=y}if(f&&!(f instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var m=u?u():"";e("Failed "+a+" type: "+f.message+(m??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Lo=o,Lo}var Vo,nc;function Wy(){if(nc)return Vo;nc=1;var e=nu(),t=Hy(),n=Ks(),r=ru(),o=By(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function s(){return null}return Vo=function(a,c){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(A){var k=A&&(u&&A[u]||A[d]);if(typeof k=="function")return k}var h="<<anonymous>>",m={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:O(),elementType:_(),instanceOf:T,node:q(),objectOf:N,oneOf:S,oneOfType:D,shape:z,exact:ne};function y(A,k){return A===k?A!==0||1/A===1/k:A!==A&&k!==k}function v(A,k){this.message=A,this.data=k&&typeof k=="object"?k:{},this.stack=""}v.prototype=Error.prototype;function p(A){if(process.env.NODE_ENV!=="production")var k={},$=0;function L(F,Y,Z,U,ee,Q,de){if(U=U||h,Q=Q||Z,de!==n){if(c){var M=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw M.name="Invariant Violation",M}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=U+":"+Z;!k[ve]&&$<3&&(i("You are manually calling a React.PropTypes validation function for the `"+Q+"` prop on `"+U+"`. 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."),k[ve]=!0,$++)}}return Y[Z]==null?F?Y[Z]===null?new v("The "+ee+" `"+Q+"` is marked as required "+("in `"+U+"`, but its value is `null`.")):new v("The "+ee+" `"+Q+"` is marked as required in "+("`"+U+"`, but its value is `undefined`.")):null:A(Y,Z,U,ee,Q)}var j=L.bind(null,!1);return j.isRequired=L.bind(null,!0),j}function x(A){function k($,L,j,F,Y,Z){var U=$[L],ee=oe(U);if(ee!==A){var Q=te(U);return new v("Invalid "+F+" `"+Y+"` of type "+("`"+Q+"` supplied to `"+j+"`, expected ")+("`"+A+"`."),{expectedType:A})}return null}return p(k)}function g(){return p(s)}function b(A){function k($,L,j,F,Y){if(typeof A!="function")return new v("Property `"+Y+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var Z=$[L];if(!Array.isArray(Z)){var U=oe(Z);return new v("Invalid "+F+" `"+Y+"` of type "+("`"+U+"` supplied to `"+j+"`, expected an array."))}for(var ee=0;ee<Z.length;ee++){var Q=A(Z,ee,j,F,Y+"["+ee+"]",n);if(Q instanceof Error)return Q}return null}return p(k)}function O(){function A(k,$,L,j,F){var Y=k[$];if(!a(Y)){var Z=oe(Y);return new v("Invalid "+j+" `"+F+"` of type "+("`"+Z+"` supplied to `"+L+"`, expected a single ReactElement."))}return null}return p(A)}function _(){function A(k,$,L,j,F){var Y=k[$];if(!e.isValidElementType(Y)){var Z=oe(Y);return new v("Invalid "+j+" `"+F+"` of type "+("`"+Z+"` supplied to `"+L+"`, expected a single ReactElement type."))}return null}return p(A)}function T(A){function k($,L,j,F,Y){if(!($[L]instanceof A)){var Z=A.name||h,U=we($[L]);return new v("Invalid "+F+" `"+Y+"` of type "+("`"+U+"` supplied to `"+j+"`, expected ")+("instance of `"+Z+"`."))}return null}return p(k)}function S(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function k($,L,j,F,Y){for(var Z=$[L],U=0;U<A.length;U++)if(y(Z,A[U]))return null;var ee=JSON.stringify(A,function(de,M){var ve=te(M);return ve==="symbol"?String(M):M});return new v("Invalid "+F+" `"+Y+"` of value `"+String(Z)+"` "+("supplied to `"+j+"`, expected one of "+ee+"."))}return p(k)}function N(A){function k($,L,j,F,Y){if(typeof A!="function")return new v("Property `"+Y+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var Z=$[L],U=oe(Z);if(U!=="object")return new v("Invalid "+F+" `"+Y+"` of type "+("`"+U+"` supplied to `"+j+"`, expected an object."));for(var ee in Z)if(r(Z,ee)){var Q=A(Z,ee,j,F,Y+"."+ee,n);if(Q instanceof Error)return Q}return null}return p(k)}function D(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var k=0;k<A.length;k++){var $=A[k];if(typeof $!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ge($)+" at index "+k+"."),s}function L(j,F,Y,Z,U){for(var ee=[],Q=0;Q<A.length;Q++){var de=A[Q],M=de(j,F,Y,Z,U,n);if(M==null)return null;M.data&&r(M.data,"expectedType")&&ee.push(M.data.expectedType)}var ve=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new v("Invalid "+Z+" `"+U+"` supplied to "+("`"+Y+"`"+ve+"."))}return p(L)}function q(){function A(k,$,L,j,F){return B(k[$])?null:new v("Invalid "+j+" `"+F+"` supplied to "+("`"+L+"`, expected a ReactNode."))}return p(A)}function G(A,k,$,L,j){return new v((A||"React class")+": "+k+" type `"+$+"."+L+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function z(A){function k($,L,j,F,Y){var Z=$[L],U=oe(Z);if(U!=="object")return new v("Invalid "+F+" `"+Y+"` of type `"+U+"` "+("supplied to `"+j+"`, expected `object`."));for(var ee in A){var Q=A[ee];if(typeof Q!="function")return G(j,F,Y,ee,te(Q));var de=Q(Z,ee,j,F,Y+"."+ee,n);if(de)return de}return null}return p(k)}function ne(A){function k($,L,j,F,Y){var Z=$[L],U=oe(Z);if(U!=="object")return new v("Invalid "+F+" `"+Y+"` of type `"+U+"` "+("supplied to `"+j+"`, expected `object`."));var ee=t({},$[L],A);for(var Q in ee){var de=A[Q];if(r(A,Q)&&typeof de!="function")return G(j,F,Y,Q,te(de));if(!de)return new v("Invalid "+F+" `"+Y+"` key `"+Q+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify($[L],null," ")+`
29
+ Valid keys: `+JSON.stringify(Object.keys(A),null," "));var M=de(Z,Q,j,F,Y+"."+Q,n);if(M)return M}return null}return p(k)}function B(A){switch(typeof A){case"number":case"string":case"undefined":return!0;case"boolean":return!A;case"object":if(Array.isArray(A))return A.every(B);if(A===null||a(A))return!0;var k=f(A);if(k){var $=k.call(A),L;if(k!==A.entries){for(;!(L=$.next()).done;)if(!B(L.value))return!1}else for(;!(L=$.next()).done;){var j=L.value;if(j&&!B(j[1]))return!1}}else return!1;return!0;default:return!1}}function ce(A,k){return A==="symbol"?!0:k?k["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&k instanceof Symbol:!1}function oe(A){var k=typeof A;return Array.isArray(A)?"array":A instanceof RegExp?"object":ce(k,A)?"symbol":k}function te(A){if(typeof A>"u"||A===null)return""+A;var k=oe(A);if(k==="object"){if(A instanceof Date)return"date";if(A instanceof RegExp)return"regexp"}return k}function ge(A){var k=te(A);switch(k){case"array":case"object":return"an "+k;case"boolean":case"date":case"regexp":return"a "+k;default:return k}}function we(A){return!A.constructor||!A.constructor.name?h:A.constructor.name}return m.checkPropTypes=o,m.resetWarningCache=o.resetWarningCache,m.PropTypes=m,m},Vo}var Ko,rc;function Jy(){if(rc)return Ko;rc=1;var e=Ks();function t(){}function n(){}return n.resetWarningCache=t,Ko=function(){function r(s,a,c,u,d,f){if(f!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Ko}if(process.env.NODE_ENV!=="production"){var zy=nu(),Gy=!0;gs.exports=Wy()(zy.isElement,Gy)}else gs.exports=Jy()();var Qy=gs.exports;const V=Ms(Qy);var ys={exports:{}},xe={};/**
30
30
  * @license React
31
31
  * react-is.production.min.js
32
32
  *
@@ -34,7 +34,7 @@ Valid keys: `+JSON.stringify(Object.keys(A),null," "));var k=de(Z,Q,L,M,Y+"."+Q
34
34
  *
35
35
  * This source code is licensed under the MIT license found in the
36
36
  * LICENSE file in the root directory of this source tree.
37
- */var sc;function By(){if(sc)return xe;sc=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function I(p){if(typeof p=="object"&&p!==null){var x=p.$$typeof;switch(x){case e:switch(p=p.type,p){case n:case o:case r:case u:case d:return p;default:switch(p=p&&p.$$typeof,p){case a:case s:case c:case m:case f:case i:return p;default:return x}}case t:return x}}}return xe.ContextConsumer=s,xe.ContextProvider=i,xe.Element=e,xe.ForwardRef=c,xe.Fragment=n,xe.Lazy=m,xe.Memo=f,xe.Portal=t,xe.Profiler=o,xe.StrictMode=r,xe.Suspense=u,xe.SuspenseList=d,xe.isAsyncMode=function(){return!1},xe.isConcurrentMode=function(){return!1},xe.isContextConsumer=function(p){return I(p)===s},xe.isContextProvider=function(p){return I(p)===i},xe.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===e},xe.isForwardRef=function(p){return I(p)===c},xe.isFragment=function(p){return I(p)===n},xe.isLazy=function(p){return I(p)===m},xe.isMemo=function(p){return I(p)===f},xe.isPortal=function(p){return I(p)===t},xe.isProfiler=function(p){return I(p)===o},xe.isStrictMode=function(p){return I(p)===r},xe.isSuspense=function(p){return I(p)===u},xe.isSuspenseList=function(p){return I(p)===d},xe.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===o||p===r||p===u||p===d||p===h||typeof p=="object"&&p!==null&&(p.$$typeof===m||p.$$typeof===f||p.$$typeof===i||p.$$typeof===s||p.$$typeof===c||p.$$typeof===y||p.getModuleId!==void 0)},xe.typeOf=I,xe}var Oe={};/**
37
+ */var ic;function Xy(){if(ic)return xe;ic=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function v(p){if(typeof p=="object"&&p!==null){var x=p.$$typeof;switch(x){case e:switch(p=p.type,p){case n:case o:case r:case u:case d:return p;default:switch(p=p&&p.$$typeof,p){case a:case s:case c:case h:case f:case i:return p;default:return x}}case t:return x}}}return xe.ContextConsumer=s,xe.ContextProvider=i,xe.Element=e,xe.ForwardRef=c,xe.Fragment=n,xe.Lazy=h,xe.Memo=f,xe.Portal=t,xe.Profiler=o,xe.StrictMode=r,xe.Suspense=u,xe.SuspenseList=d,xe.isAsyncMode=function(){return!1},xe.isConcurrentMode=function(){return!1},xe.isContextConsumer=function(p){return v(p)===s},xe.isContextProvider=function(p){return v(p)===i},xe.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===e},xe.isForwardRef=function(p){return v(p)===c},xe.isFragment=function(p){return v(p)===n},xe.isLazy=function(p){return v(p)===h},xe.isMemo=function(p){return v(p)===f},xe.isPortal=function(p){return v(p)===t},xe.isProfiler=function(p){return v(p)===o},xe.isStrictMode=function(p){return v(p)===r},xe.isSuspense=function(p){return v(p)===u},xe.isSuspenseList=function(p){return v(p)===d},xe.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===o||p===r||p===u||p===d||p===m||typeof p=="object"&&p!==null&&(p.$$typeof===h||p.$$typeof===f||p.$$typeof===i||p.$$typeof===s||p.$$typeof===c||p.$$typeof===y||p.getModuleId!==void 0)},xe.typeOf=v,xe}var Oe={};/**
38
38
  * @license React
39
39
  * react-is.development.js
40
40
  *
@@ -42,10 +42,10 @@ Valid keys: `+JSON.stringify(Object.keys(A),null," "));var k=de(Z,Q,L,M,Y+"."+Q
42
42
  *
43
43
  * This source code is licensed under the MIT license found in the
44
44
  * LICENSE file in the root directory of this source tree.
45
- */var ac;function Wy(){return ac||(ac=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),y=!1,I=!1,p=!1,x=!1,g=!1,b;b=Symbol.for("react.module.reference");function O(H){return!!(typeof H=="string"||typeof H=="function"||H===n||H===o||g||H===r||H===u||H===d||x||H===h||y||I||p||typeof H=="object"&&H!==null&&(H.$$typeof===m||H.$$typeof===f||H.$$typeof===i||H.$$typeof===s||H.$$typeof===c||H.$$typeof===b||H.getModuleId!==void 0))}function _(H){if(typeof H=="object"&&H!==null){var Ee=H.$$typeof;switch(Ee){case e:var Le=H.type;switch(Le){case n:case o:case r:case u:case d:return Le;default:var Ge=Le&&Le.$$typeof;switch(Ge){case a:case s:case c:case m:case f:case i:return Ge;default:return Ee}}case t:return Ee}}}var T=s,S=i,N=e,F=c,q=n,G=m,z=f,ne=t,B=o,ce=r,oe=u,te=d,ge=!1,we=!1;function A(H){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function j(H){return we||(we=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function $(H){return _(H)===s}function V(H){return _(H)===i}function L(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function M(H){return _(H)===c}function Y(H){return _(H)===n}function Z(H){return _(H)===m}function U(H){return _(H)===f}function ee(H){return _(H)===t}function Q(H){return _(H)===o}function de(H){return _(H)===r}function k(H){return _(H)===u}function ve(H){return _(H)===d}Oe.ContextConsumer=T,Oe.ContextProvider=S,Oe.Element=N,Oe.ForwardRef=F,Oe.Fragment=q,Oe.Lazy=G,Oe.Memo=z,Oe.Portal=ne,Oe.Profiler=B,Oe.StrictMode=ce,Oe.Suspense=oe,Oe.SuspenseList=te,Oe.isAsyncMode=A,Oe.isConcurrentMode=j,Oe.isContextConsumer=$,Oe.isContextProvider=V,Oe.isElement=L,Oe.isForwardRef=M,Oe.isFragment=Y,Oe.isLazy=Z,Oe.isMemo=U,Oe.isPortal=ee,Oe.isProfiler=Q,Oe.isStrictMode=de,Oe.isSuspense=k,Oe.isSuspenseList=ve,Oe.isValidElementType=O,Oe.typeOf=_}()),Oe}process.env.NODE_ENV==="production"?ys.exports=By():ys.exports=Wy();var cc=ys.exports;const lc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,uc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",qo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return uc(n.overflowY,t)||uc(n.overflowX,t)||(r=>{const o=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!o&&(o.clientHeight<r.scrollHeight||o.clientWidth<r.scrollWidth)})(e)}return!1},ji=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,Jy=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},zy=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:u,skipOverflowHiddenElements:d}=t,f=typeof u=="function"?u:oe=>oe!==u;if(!lc(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,h=[];let y=e;for(;lc(y)&&f(y);){if(y=Jy(y),y===m){h.push(y);break}y!=null&&y===document.body&&qo(y)&&!qo(document.documentElement)||y!=null&&qo(y,d)&&h.push(y)}const I=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,p=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:x,scrollY:g}=window,{height:b,width:O,top:_,right:T,bottom:S,left:N}=e.getBoundingClientRect(),{top:F,right:q,bottom:G,left:z}=(oe=>{const te=window.getComputedStyle(oe);return{top:parseFloat(te.scrollMarginTop)||0,right:parseFloat(te.scrollMarginRight)||0,bottom:parseFloat(te.scrollMarginBottom)||0,left:parseFloat(te.scrollMarginLeft)||0}})(e);let ne=a==="start"||a==="nearest"?_-F:a==="end"?S+G:_+b/2-F+G,B=c==="center"?N+O/2-z+q:c==="end"?T+q:N-z;const ce=[];for(let oe=0;oe<h.length;oe++){const te=h[oe],{height:ge,width:we,top:A,right:j,bottom:$,left:V}=te.getBoundingClientRect();if(s==="if-needed"&&_>=0&&N>=0&&S<=p&&T<=I&&_>=A&&S<=$&&N>=V&&T<=j)return ce;const L=getComputedStyle(te),M=parseInt(L.borderLeftWidth,10),Y=parseInt(L.borderTopWidth,10),Z=parseInt(L.borderRightWidth,10),U=parseInt(L.borderBottomWidth,10);let ee=0,Q=0;const de="offsetWidth"in te?te.offsetWidth-te.clientWidth-M-Z:0,k="offsetHeight"in te?te.offsetHeight-te.clientHeight-Y-U:0,ve="offsetWidth"in te?te.offsetWidth===0?0:we/te.offsetWidth:0,H="offsetHeight"in te?te.offsetHeight===0?0:ge/te.offsetHeight:0;if(m===te)ee=a==="start"?ne:a==="end"?ne-p:a==="nearest"?ji(g,g+p,p,Y,U,g+ne,g+ne+b,b):ne-p/2,Q=c==="start"?B:c==="center"?B-I/2:c==="end"?B-I:ji(x,x+I,I,M,Z,x+B,x+B+O,O),ee=Math.max(0,ee+g),Q=Math.max(0,Q+x);else{ee=a==="start"?ne-A-Y:a==="end"?ne-$+U+k:a==="nearest"?ji(A,$,ge,Y,U+k,ne,ne+b,b):ne-(A+ge/2)+k/2,Q=c==="start"?B-V-M:c==="center"?B-(V+we/2)+de/2:c==="end"?B-j+Z+de:ji(V,j,we,M,Z+de,B,B+O,O);const{scrollLeft:Ee,scrollTop:Le}=te;ee=H===0?0:Math.max(0,Math.min(Le+ee/H,te.scrollHeight-ge/H+k)),Q=ve===0?0:Math.max(0,Math.min(Ee+Q/ve,te.scrollWidth-we/ve+de)),ne+=Le-ee,B+=Ee-Q}ce.push({el:te,top:ee,left:Q})}return ce};var Pr=function(){return Pr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Pr.apply(this,arguments)};var Gy=0;function dc(e){return typeof e=="function"?e:yt}function yt(){}function iu(e,t){if(e){var n=zy(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function fc(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function qs(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return o.cancel=r,o}function He(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(i)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function fr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(o){typeof o=="function"?o(r):o&&(o.current=r)})}}function ou(){return String(Gy++)}function Qy(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 pc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function su(e){return typeof e.type=="string"}function au(e){return e.props}function Xy(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Yy=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Li(e){e===void 0&&(e={});var t={};return Yy.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function to(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 vs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Zy(e){return Object.prototype.toString.call(e)==="[object Object]"}function Wn(e,t,n,r,o){var i=n.length;if(i===0)return-1;var s=i-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var c=Dr(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function Dr(e,t,n,r,o){o===void 0&&(o=!1);var i=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<i;a++)if(!r(n[a],a))return a;return o?Dr(t?i-1:0,t,n,r):-1}function ro(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(fc(o,e,n)||r&&fc(o,n.document.activeElement,n))})}var Us=yt;process.env.NODE_ENV!=="production"&&(Us=function(t,n,r){var o="This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props";Object.keys(t).forEach(function(i){n[i]!==void 0&&r[i]===void 0?console.error('downshift: A component has changed the controlled prop "'+i+'" to be uncontrolled. '+o):n[i]===void 0&&r[i]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+i+'" to be controlled. '+o)})});var ev=qs(function(e){cu(e).textContent=""},500);function cu(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 lu(e,t){if(!(!e||!t)){var n=cu(t);n.textContent=e,ev(t)}}function tv(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var uu=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,du=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,fu=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Hi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Bi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,pu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,hu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,mu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,gu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,yu=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,vu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,wu=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Iu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,ws=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,bu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,_u=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,xu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,nv=Object.freeze({__proto__:null,blurButton:bu,blurInput:vu,changeInput:wu,clickButton:ws,clickItem:yu,controlledPropUpdatedSelectedItem:_u,itemMouseEnter:fu,keyDownArrowDown:Bi,keyDownArrowUp:Hi,keyDownEnd:gu,keyDownEnter:hu,keyDownEscape:pu,keyDownHome:mu,keyDownSpaceButton:Iu,mouseUp:du,touchEnd:xu,unknown:uu}),rv=["refKey","ref"],iv=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],ov=["onKeyDown","onBlur","onChange","onInput","onChangeText"],sv=["refKey","ref"],av=["onMouseMove","onMouseDown","onClick","onPress","index","item"],cv=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+ou(),i.menuId=i.props.menuId||i.id+"-menu",i.labelId=i.props.labelId||i.id+"-label",i.inputId=i.props.inputId||i.id+"-input",i.getItemId=i.props.getItemId||function(g){return i.id+"-item-"+g},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(g,b){var O=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(_){return _!==O}),g()},b);i.timeoutIds.push(O)},i.setItemCount=function(g){i.itemCount=g},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(g,b){var O=i.getItemNodeFromIndex(b);return O&&O.hasAttribute("disabled")},i.setHighlightedIndex=function(g,b){g===void 0&&(g=i.props.defaultHighlightedIndex),b===void 0&&(b={}),b=Li(b),i.internalSetState(he({highlightedIndex:g},b))},i.clearSelection=function(g){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},g)},i.selectItem=function(g,b,O){b=Li(b),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:g,inputValue:i.props.itemToString(g)},b),O)},i.selectItemAtIndex=function(g,b,O){var _=i.items[g];_!=null&&i.selectItem(_,b,O)},i.selectHighlightedItem=function(g,b){return i.selectItemAtIndex(i.getState().highlightedIndex,g,b)},i.internalSetState=function(g,b){var O,_,T={},S=typeof g=="function";return!S&&g.hasOwnProperty("inputValue")&&i.props.onInputValueChange(g.inputValue,he({},i.getStateAndHelpers(),g)),i.setState(function(N){var F;N=i.getState(N);var q=S?g(N):g;q=i.props.stateReducer(N,q),O=q.hasOwnProperty("selectedItem");var G={};return O&&q.selectedItem!==N.selectedItem&&(_=q.selectedItem),(F=q).type||(F.type=uu),Object.keys(q).forEach(function(z){N[z]!==q[z]&&(T[z]=q[z]),z!=="type"&&(q[z],no(i.props,z)||(G[z]=q[z]))}),S&&q.hasOwnProperty("inputValue")&&i.props.onInputValueChange(q.inputValue,he({},i.getStateAndHelpers(),q)),G},function(){dc(b)();var N=Object.keys(T).length>1;N&&i.props.onStateChange(T,i.getStateAndHelpers()),O&&i.props.onSelect(g.selectedItem,i.getStateAndHelpers()),_!==void 0&&i.props.onChange(_,i.getStateAndHelpers()),i.props.onUserAction(T,i.getStateAndHelpers())})},i.rootRef=function(g){return i._rootNode=g},i.getRootProps=function(g,b){var O,_=g===void 0?{}:g,T=_.refKey,S=T===void 0?"ref":T,N=_.ref,F=un(_,rv),q=b===void 0?{}:b,G=q.suppressRefError,z=G===void 0?!1:G;i.getRootProps.called=!0,i.getRootProps.refKey=S,i.getRootProps.suppressRefError=z;var ne=i.getState(),B=ne.isOpen;return he((O={},O[S]=fr(N,i.rootRef),O.role="combobox",O["aria-expanded"]=B,O["aria-haspopup"]="listbox",O["aria-owns"]=B?i.menuId:void 0,O["aria-labelledby"]=i.labelId,O),F)},i.keyDownHandlers={ArrowDown:function(b){var O=this;if(b.preventDefault(),this.getState().isOpen){var _=b.shiftKey?5:1;this.moveHighlightedIndex(_,{type:Bi})}else this.internalSetState({isOpen:!0,type:Bi},function(){var T=O.getItemCount();if(T>0){var S=O.getState(),N=S.highlightedIndex,F=Wn(N,1,{length:T},O.isItemDisabled,!0);O.setHighlightedIndex(F,{type:Bi})}})},ArrowUp:function(b){var O=this;if(b.preventDefault(),this.getState().isOpen){var _=b.shiftKey?-5:-1;this.moveHighlightedIndex(_,{type:Hi})}else this.internalSetState({isOpen:!0,type:Hi},function(){var T=O.getItemCount();if(T>0){var S=O.getState(),N=S.highlightedIndex,F=Wn(N,-1,{length:T},O.isItemDisabled,!0);O.setHighlightedIndex(F,{type:Hi})}})},Enter:function(b){if(b.which!==229){var O=this.getState(),_=O.isOpen,T=O.highlightedIndex;if(_&&T!=null){b.preventDefault();var S=this.items[T],N=this.getItemNodeFromIndex(T);if(S==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:hu})}}},Escape:function(b){b.preventDefault(),this.reset(he({type:pu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(b){b.preventDefault(),this.toggleMenu({type:Iu})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(b){var O=this.getState(),_=O.isOpen;if(_){b.preventDefault();var T=this.getItemCount();if(!(T<=0||!_)){var S=Dr(0,!1,{length:T},this.isItemDisabled);this.setHighlightedIndex(S,{type:mu})}}},End:function(b){var O=this.getState(),_=O.isOpen;if(_){b.preventDefault();var T=this.getItemCount();if(!(T<=0||!_)){var S=Dr(T-1,!0,{length:T},this.isItemDisabled);this.setHighlightedIndex(S,{type:gu})}}}}),i.getToggleButtonProps=function(g){var b=g===void 0?{}:g,O=b.onClick;b.onPress;var _=b.onKeyDown,T=b.onKeyUp,S=b.onBlur,N=un(b,iv),F=i.getState(),q=F.isOpen,G={onClick:He(O,i.buttonHandleClick),onKeyDown:He(_,i.buttonHandleKeyDown),onKeyUp:He(T,i.buttonHandleKeyUp),onBlur:He(S,i.buttonHandleBlur)},z=N.disabled?{}:G;return he({type:"button",role:"button","aria-label":q?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},z,N)},i.buttonHandleKeyUp=function(g){g.preventDefault()},i.buttonHandleKeyDown=function(g){var b=vs(g);i.buttonKeyDownHandlers[b]&&i.buttonKeyDownHandlers[b].call(i,g)},i.buttonHandleClick=function(g){if(g.preventDefault(),i.props.environment){var b=i.props.environment.document,O=b.body,_=b.activeElement;O&&O===_&&g.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:ws}):i.internalSetTimeout(function(){return i.toggleMenu({type:ws})})},i.buttonHandleBlur=function(g){var b=g.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var O=i.props.environment.document.activeElement;(O==null||O.id!==i.inputId)&&O!==b&&i.reset({type:bu})}})},i.getLabelProps=function(g){return he({htmlFor:i.inputId,id:i.labelId},g)},i.getInputProps=function(g){var b=g===void 0?{}:g,O=b.onKeyDown,_=b.onBlur,T=b.onChange,S=b.onInput;b.onChangeText;var N=un(b,ov),F,q={};F="onChange";var G=i.getState(),z=G.inputValue,ne=G.isOpen,B=G.highlightedIndex;if(!N.disabled){var ce;q=(ce={},ce[F]=He(T,S,i.inputHandleChange),ce.onKeyDown=He(O,i.inputHandleKeyDown),ce.onBlur=He(_,i.inputHandleBlur),ce)}return he({"aria-autocomplete":"list","aria-activedescendant":ne&&typeof B=="number"&&B>=0?i.getItemId(B):void 0,"aria-controls":ne?i.menuId:void 0,"aria-labelledby":N&&N["aria-label"]?void 0:i.labelId,autoComplete:"off",value:z,id:i.inputId},q,N)},i.inputHandleKeyDown=function(g){var b=vs(g);b&&i.inputKeyDownHandlers[b]&&i.inputKeyDownHandlers[b].call(i,g)},i.inputHandleChange=function(g){i.internalSetState({type:wu,isOpen:!0,inputValue:g.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var g;if(!(i.isMouseDown||!i.props.environment)){var b=i.props.environment.document.activeElement,O=(b==null||(g=b.dataset)==null?void 0:g.toggle)&&i._rootNode&&i._rootNode.contains(b);O||i.reset({type:vu})}})},i.menuRef=function(g){i._menuNode=g},i.getMenuProps=function(g,b){var O,_=g===void 0?{}:g,T=_.refKey,S=T===void 0?"ref":T,N=_.ref,F=un(_,sv),q=b===void 0?{}:b,G=q.suppressRefError,z=G===void 0?!1:G;return i.getMenuProps.called=!0,i.getMenuProps.refKey=S,i.getMenuProps.suppressRefError=z,he((O={},O[S]=fr(N,i.menuRef),O.role="listbox",O["aria-labelledby"]=F&&F["aria-label"]?void 0:i.labelId,O.id=i.menuId,O),F)},i.getItemProps=function(g){var b,O=g===void 0?{}:g,_=O.onMouseMove,T=O.onMouseDown,S=O.onClick;O.onPress;var N=O.index,F=O.item,q=F===void 0?process.env.NODE_ENV==="production"?void 0:Xy("getItemProps","item"):F,G=un(O,av);N===void 0?(i.items.push(q),N=i.items.indexOf(q)):i.items[N]=q;var z="onClick",ne=S,B=(b={onMouseMove:He(_,function(){N!==i.getState().highlightedIndex&&(i.setHighlightedIndex(N,{type:fu}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:He(T,function(oe){oe.preventDefault()})},b[z]=He(ne,function(){i.selectItemAtIndex(N,{type:yu})}),b),ce=G.disabled?{onMouseDown:B.onMouseDown}:B;return he({id:i.getItemId(N),role:"option","aria-selected":i.getState().highlightedIndex===N},ce,G)},i.clearItems=function(){i.items=[]},i.reset=function(g,b){g===void 0&&(g={}),g=Li(g),i.internalSetState(function(O){var _=O.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(_)},g)},b)},i.toggleMenu=function(g,b){g===void 0&&(g={}),g=Li(g),i.internalSetState(function(O){var _=O.isOpen;return he({isOpen:!_},_&&{highlightedIndex:i.props.defaultHighlightedIndex},g)},function(){var O=i.getState(),_=O.isOpen,T=O.highlightedIndex;_&&i.getItemCount()>0&&typeof T=="number"&&i.setHighlightedIndex(T,g),dc(b)()})},i.openMenu=function(g){i.internalSetState({isOpen:!0},g)},i.closeMenu=function(g){i.internalSetState({isOpen:!1},g)},i.updateStatus=qs(function(){var g;if((g=i.props)!=null&&(g=g.environment)!=null&&g.document){var b=i.getState(),O=i.items[b.highlightedIndex],_=i.getItemCount(),T=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:_,highlightedItem:O},b));i.previousResultCount=_,lu(T,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,u=c===void 0?a:c,d=s.defaultIsOpen,f=s.initialIsOpen,m=f===void 0?d:f,h=s.initialInputValue,y=h===void 0?"":h,I=s.initialSelectedItem,p=I===void 0?null:I,x=i.getState({highlightedIndex:u,isOpen:m,inputValue:y,selectedItem:p});return x.selectedItem!=null&&i.props.initialInputValue===void 0&&(x.inputValue=i.props.itemToString(x.selectedItem)),i.state=x,i}My(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(i){clearTimeout(i)}),this.timeoutIds=[]},r.getState=function(i){return i===void 0&&(i=this.state),to(i,this.props)},r.getItemCount=function(){var i=this.items.length;return this.itemCount!=null?i=this.itemCount:this.props.itemCount!==void 0&&(i=this.props.itemCount),i},r.getItemNodeFromIndex=function(i){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(i)):null},r.scrollHighlightedItemIntoView=function(){{var i=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(i,this._menuNode)}},r.moveHighlightedIndex=function(i,s){var a=this.getItemCount(),c=this.getState(),u=c.highlightedIndex;if(a>0){var d=Wn(u,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,u=i.isOpen,d=this.props.itemToString,f=this.id,m=this.getRootProps,h=this.getToggleButtonProps,y=this.getLabelProps,I=this.getMenuProps,p=this.getInputProps,x=this.getItemProps,g=this.openMenu,b=this.closeMenu,O=this.toggleMenu,_=this.selectItem,T=this.selectItemAtIndex,S=this.selectHighlightedItem,N=this.setHighlightedIndex,F=this.clearSelection,q=this.clearItems,G=this.reset,z=this.setItemCount,ne=this.unsetItemCount,B=this.internalSetState;return{getRootProps:m,getToggleButtonProps:h,getLabelProps:y,getMenuProps:I,getInputProps:p,getItemProps:x,reset:G,openMenu:g,closeMenu:b,toggleMenu:O,selectItem:_,selectItemAtIndex:T,selectHighlightedItem:S,setHighlightedIndex:N,clearSelection:F,clearItems:q,setItemCount:z,unsetItemCount:ne,setState:B,itemToString:d,id:f,highlightedIndex:s,inputValue:a,isOpen:u,selectedItem:c}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&hc(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(h){i.isMouseDown=!1;var y=ro(h.target,[i._rootNode,i._menuNode],i.props.environment);!y&&i.getState().isOpen&&i.reset({type:du},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},u=function(){i.isTouchMove=!0},d=function(h){var y=ro(h.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!y&&i.getState().isOpen&&i.reset({type:xu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},f=this.props.environment;f.addEventListener("mousedown",s),f.addEventListener("mouseup",a),f.addEventListener("touchstart",c),f.addEventListener("touchmove",u),f.addEventListener("touchend",d),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),f.removeEventListener("mousedown",s),f.removeEventListener("mouseup",a),f.removeEventListener("touchstart",c),f.removeEventListener("touchmove",u),f.removeEventListener("touchend",d)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,u=s.highlightedIndex===void 0?i:s,d=u.highlightedIndex,f=c&&this.getState().isOpen&&!i.isOpen,m=c!==d;return f||m},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(Us(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&hc(this._menuNode,this.getMenuProps)),no(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:_u,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,i)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var i=pc(this.props.children,yt);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=pc(i(this.getStateAndHelpers()));if(!s)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&lv(s,this.getRootProps),s;if(su(s))return v.cloneElement(s,this.getRootProps(au(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}(v.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Qy,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Zy(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:yt,onInputValueChange:yt,onUserAction:yt,onChange:yt,onSelect:yt,onOuterClick:yt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:iu},e.stateChangeTypes=nv,e}();process.env.NODE_ENV!=="production"&&(cv.propTypes={children:K.func,defaultHighlightedIndex:K.number,defaultIsOpen:K.bool,initialHighlightedIndex:K.number,initialSelectedItem:K.any,initialInputValue:K.string,initialIsOpen:K.bool,getA11yStatusMessage:K.func,itemToString:K.func,onChange:K.func,onSelect:K.func,onStateChange:K.func,onInputValueChange:K.func,onUserAction:K.func,onOuterClick:K.func,selectedItemChanged:K.func,stateReducer:K.func,itemCount:K.number,id:K.string,environment:K.shape({addEventListener:K.func.isRequired,removeEventListener:K.func.isRequired,document:K.shape({createElement:K.func.isRequired,getElementById:K.func.isRequired,activeElement:K.any.isRequired,body:K.any.isRequired}).isRequired,Node:K.func.isRequired}),suppressRefError:K.bool,scrollIntoView:K.func,selectedItem:K.any,isOpen:K.bool,inputValue:K.string,highlightedIndex:K.number,labelId:K.string,inputId:K.string,menuId:K.string,getItemId:K.func});function hc(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 lv(e,t){var n=t.refKey,r=n!=="ref",o=!su(e);o&&!r&&!cc.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!o&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!cc.isForwardRef(e)&&!au(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Ou={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function uv(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){dv(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(he({type:o},i))}function dv(e,t,n,r){var o=t.props,i=t.type,s="on"+Hs(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function fv(e,t){return t.changes}var mc=qs(function(e,t){lu(e,t)},200),pv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?v.useLayoutEffect:v.useEffect,hv="useId"in v?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+v.useId();n||(n=c);var u=v.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(d){return n+"-item-"+d},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return u.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+ou():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,u=v.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return u.current};function mv(e,t,n,r){var o,i;if(e===void 0){if(t===void 0)throw new Error(r);o=n[t],i=t}else i=t===void 0?n.indexOf(e):t,o=e;return[o,i]}function Hs(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Cu(e){var t=v.useRef(e);return t.current=e,t}function gv(e,t,n,r){var o=v.useRef(),i=v.useRef(),s=v.useCallback(function(h,y){i.current=y,h=to(h,y.props);var I=e(h,y),p=y.props.stateReducer(h,he({},y,{changes:I}));return p},[e]),a=v.useReducer(s,t,n),c=a[0],u=a[1],d=Cu(t),f=v.useCallback(function(h){return u(he({props:d.current},h))},[d]),m=i.current;return v.useEffect(function(){var h=to(o.current,m==null?void 0:m.props),y=m&&o.current&&!r(h,c);y&&uv(m,h,c),o.current=c},[c,m,r]),[c,f]}var Xr={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:fv,scrollIntoView:iu,environment:typeof window>"u"?void 0:window};function An(e,t,n){n===void 0&&(n=Ou);var r=e["default"+Hs(t)];return r!==void 0?r:n[t]}function Yr(e,t,n){n===void 0&&(n=Ou);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Hs(t)];return o!==void 0?o:An(e,t,n)}function yv(e){var t=Yr(e,"selectedItem"),n=Yr(e,"isOpen"),r=_v(e),o=Yr(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(i){return e.itemToKey(i)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:o}}function Zr(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,u=t.highlightedIndex;return r.length===0?-1:o!==void 0&&u===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:c?r.findIndex(function(d){return a(c)===a(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function vv(e,t,n){var r=v.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return v.useEffect(function(){if(!e)return yt;var o=n.map(function(d){return d.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,ro(d.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function u(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!ro(d.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",u),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",u)}},[n,e,t]),r.current}var Eu=function(){return yt};process.env.NODE_ENV!=="production"&&(Eu=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=v.useRef(n.reduce(function(s,a){return s[a]={},s},{}));v.useEffect(function(){Object.keys(o.current).forEach(function(s){var a=o.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var c=a.suppressRefError,u=a.refKey,d=a.elementRef;c||d!=null&&d.current||console.error('downshift: The ref prop "'+u+'" from '+s+" was not applied correctly on your element.")})},[]);var i=v.useCallback(function(s,a,c,u){o.current[s]={suppressRefError:a,refKey:c,elementRef:u}},[]);return i});function wv(e,t,n,r){r===void 0&&(r={});var o=r.document,i=yo();v.useEffect(function(){if(!(!e||i||!o)){var s=e(t);mc(s,o)}},n),v.useEffect(function(){return function(){mc.cancel(),tv(o)}},[o])}function Iv(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=v.useRef(!0);return pv(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Su=yt;process.env.NODE_ENV!=="production"&&(Su=function(t){var n=t.props,r=t.state,o=v.useRef(n),i=yo();v.useEffect(function(){i||(Us(r,o.current,n),o.current=n)},[r,n,i])});function gc(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return he({isOpen:!1,highlightedIndex:-1},o&&he({selectedItem:e.items[t],isOpen:An(e,"isOpen"),highlightedIndex:An(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function bv(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function yo(){var e=v.useRef(!0);return v.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Is(e){var t=An(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function _v(e){var t=Yr(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Wi={environment:K.shape({addEventListener:K.func.isRequired,removeEventListener:K.func.isRequired,document:K.shape({createElement:K.func.isRequired,getElementById:K.func.isRequired,activeElement:K.any.isRequired,body:K.any.isRequired}).isRequired,Node:K.func.isRequired}),itemToString:K.func,itemToKey:K.func,stateReducer:K.func},Nu=he({},Wi,{getA11yStatusMessage:K.func,highlightedIndex:K.number,defaultHighlightedIndex:K.number,initialHighlightedIndex:K.number,isOpen:K.bool,defaultIsOpen:K.bool,initialIsOpen:K.bool,selectedItem:K.any,initialSelectedItem:K.any,defaultSelectedItem:K.any,id:K.string,labelId:K.string,menuId:K.string,getItemId:K.func,toggleButtonId:K.string,onSelectedItemChange:K.func,onHighlightedIndexChange:K.func,onStateChange:K.func,onIsOpenChange:K.func,scrollIntoView:K.func});function xv(e,t,n){var r=t.type,o=t.props,i;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Zr(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:Zr(o,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:o.isItemDisabled(o.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:Is(o),isOpen:An(o,"isOpen"),selectedItem:An(o,"selectedItem"),inputValue:An(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}Pr(Pr({},Nu),{items:K.array.isRequired,isItemDisabled:K.func});Pr(Pr({},Xr),{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 Bs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Ws=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Js=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,zs=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Gs=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Qs=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Xs=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Ys=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Zs=process.env.NODE_ENV!=="production"?"__input_change__":8,io=process.env.NODE_ENV!=="production"?"__input_blur__":9,ea=process.env.NODE_ENV!=="production"?"__input_click__":10,Tu=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Ru=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ta=process.env.NODE_ENV!=="production"?"__item_click__":13,Au=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Pu=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Du=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Fu=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Mu=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,na=process.env.NODE_ENV!=="production"?"__function_select_item__":19,ku=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,ju=process.env.NODE_ENV!=="production"?"__function_reset__":21,ra=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Lu=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ra,FunctionCloseMenu:Fu,FunctionOpenMenu:Du,FunctionReset:ju,FunctionSelectItem:na,FunctionSetHighlightedIndex:Mu,FunctionSetInputValue:ku,FunctionToggleMenu:Pu,InputBlur:io,InputChange:Zs,InputClick:ea,InputKeyDownArrowDown:Bs,InputKeyDownArrowUp:Ws,InputKeyDownEnd:Gs,InputKeyDownEnter:Ys,InputKeyDownEscape:Js,InputKeyDownHome:zs,InputKeyDownPageDown:Xs,InputKeyDownPageUp:Qs,ItemClick:ta,ItemMouseMove:Ru,MenuMouseLeave:Tu,ToggleButtonClick:Au});function Ov(e){var t=yv(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)),he({},t,{inputValue:r})}var Cv=he({},Nu,{items:K.array.isRequired,isItemDisabled:K.func,inputValue:K.string,defaultInputValue:K.string,initialInputValue:K.string,inputId:K.string,onInputValueChange:K.func});function Ev(e,t,n,r){var o=v.useRef(),i=gv(e,t,n,r),s=i[0],a=i[1],c=yo();return v.useEffect(function(){if(no(t,"selectedItem")){if(!c){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);u&&a({type:ra,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[to(s,t),a]}var Vu=yt;process.env.NODE_ENV!=="production"&&(Vu=function(t,n){K.checkPropTypes(Cv,t,"prop",n.name)});var Sv=he({},Xr,{isItemDisabled:function(){return!1}});function Nv(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case ta:s={isOpen:An(o,"isOpen"),highlightedIndex:Is(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Bs:e.isOpen?s={highlightedIndex:Wn(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:Zr(o,e,1),isOpen:o.items.length>=0};break;case Ws:e.isOpen?i?s=gc(o,e.highlightedIndex):s={highlightedIndex:Wn(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:Zr(o,e,-1),isOpen:o.items.length>=0};break;case Ys:s=gc(o,e.highlightedIndex);break;case Js:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Qs:s={highlightedIndex:Wn(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Xs:s={highlightedIndex:Wn(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case zs:s={highlightedIndex:Dr(0,!1,o.items,o.isItemDisabled)};break;case Gs:s={highlightedIndex:Dr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case io:s=he({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=o.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case Zs:s={isOpen:!0,highlightedIndex:Is(o),inputValue:t.inputValue};break;case ea:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Zr(o,e,0)};break;case na:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case ra:s={inputValue:t.inputValue};break;default:return xv(e,t,Lu)}return he({},e,s)}var Tv=["onMouseLeave","refKey","ref"],Rv=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],Av=["onClick","onPress","refKey","ref"],Pv=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];ia.stateChangeTypes=Lu;function ia(e){e===void 0&&(e={}),Vu(e,ia);var t=he({},Sv,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=Ev(Nv,t,Ov,bv),a=s[0],c=s[1],u=a.isOpen,d=a.highlightedIndex,f=a.selectedItem,m=a.inputValue,h=v.useRef(null),y=v.useRef({}),I=v.useRef(null),p=v.useRef(null),x=yo(),g=hv(t),b=v.useRef(),O=Cu({state:a,props:t}),_=v.useCallback(function($){return y.current[g.getItemId($)]},[g]);wv(i,a,[u,d,f,m],o);var T=Iv({menuElement:h.current,highlightedIndex:d,isOpen:u,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:_});Su({props:t,state:a}),v.useEffect(function(){var $=Yr(t,"isOpen");$&&I.current&&I.current.focus()},[]),v.useEffect(function(){x||(b.current=n.length)});var S=vv(o,v.useCallback(function(){O.current.state.isOpen&&c({type:io,selectItem:!1})},[c,O]),v.useMemo(function(){return[h,p,I]},[h.current,p.current,I.current])),N=Eu("getInputProps","getMenuProps");v.useEffect(function(){u||(y.current={})},[u]),v.useEffect(function(){var $;!u||!(o!=null&&o.document)||!(I!=null&&($=I.current)!=null&&$.focus)||o.document.activeElement!==I.current&&I.current.focus()},[u,o]);var F=v.useMemo(function(){return{ArrowDown:function(V){V.preventDefault(),c({type:Bs,altKey:V.altKey})},ArrowUp:function(V){V.preventDefault(),c({type:Ws,altKey:V.altKey})},Home:function(V){O.current.state.isOpen&&(V.preventDefault(),c({type:zs}))},End:function(V){O.current.state.isOpen&&(V.preventDefault(),c({type:Gs}))},Escape:function(V){var L=O.current.state;(L.isOpen||L.inputValue||L.selectedItem||L.highlightedIndex>-1)&&(V.preventDefault(),c({type:Js}))},Enter:function(V){var L=O.current.state;!L.isOpen||V.which===229||(V.preventDefault(),c({type:Ys}))},PageUp:function(V){O.current.state.isOpen&&(V.preventDefault(),c({type:Qs}))},PageDown:function(V){O.current.state.isOpen&&(V.preventDefault(),c({type:Xs}))}}},[c,O]),q=v.useCallback(function($){return he({id:g.labelId,htmlFor:g.inputId},$)},[g]),G=v.useCallback(function($,V){var L,M=$===void 0?{}:$,Y=M.onMouseLeave,Z=M.refKey,U=Z===void 0?"ref":Z,ee=M.ref,Q=un(M,Tv),de=V===void 0?{}:V,k=de.suppressRefError,ve=k===void 0?!1:k;return N("getMenuProps",ve,U,h),he((L={},L[U]=fr(ee,function(H){h.current=H}),L.id=g.menuId,L.role="listbox",L["aria-labelledby"]=Q&&Q["aria-label"]?void 0:""+g.labelId,L.onMouseLeave=He(Y,function(){c({type:Tu})}),L),Q)},[c,N,g]),z=v.useCallback(function($){var V,L,M=$===void 0?{}:$,Y=M.item,Z=M.index,U=M.refKey,ee=U===void 0?"ref":U,Q=M.ref,de=M.onMouseMove,k=M.onMouseDown,ve=M.onClick;M.onPress;var H=M.disabled,Ee=un(M,Rv);H!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Le=O.current,Ge=Le.props,Ke=Le.state,Ie=mv(Y,Z,Ge.items,"Pass either item or index to getItemProps!"),Rt=Ie[0],Qe=Ie[1],ht=Ge.isItemDisabled(Rt,Qe),At="onClick",Pt=ve,Xe=function(){S.isTouchEnd||Qe===Ke.highlightedIndex||(T.current=!1,c({type:Ru,index:Qe,disabled:ht}))},We=function(){c({type:ta,index:Qe})},$e=function(Dt){return Dt.preventDefault()};return he((V={},V[ee]=fr(Q,function(Ae){Ae&&(y.current[g.getItemId(Qe)]=Ae)}),V["aria-disabled"]=ht,V["aria-selected"]=Qe===Ke.highlightedIndex,V.id=g.getItemId(Qe),V.role="option",V),!ht&&(L={},L[At]=He(Pt,We),L),{onMouseMove:He(de,Xe),onMouseDown:He(k,$e)},Ee)},[c,g,O,S,T]),ne=v.useCallback(function($){var V,L=$===void 0?{}:$,M=L.onClick;L.onPress;var Y=L.refKey,Z=Y===void 0?"ref":Y,U=L.ref,ee=un(L,Av),Q=O.current.state,de=function(){c({type:Au})};return he((V={},V[Z]=fr(U,function(k){p.current=k}),V["aria-controls"]=g.menuId,V["aria-expanded"]=Q.isOpen,V.id=g.toggleButtonId,V.tabIndex=-1,V),!ee.disabled&&he({},{onClick:He(M,de)}),ee)},[c,O,g]),B=v.useCallback(function($,V){var L,M=$===void 0?{}:$,Y=M.onKeyDown,Z=M.onChange,U=M.onInput,ee=M.onBlur;M.onChangeText;var Q=M.onClick,de=M.refKey,k=de===void 0?"ref":de,ve=M.ref,H=un(M,Pv),Ee=V===void 0?{}:V,Le=Ee.suppressRefError,Ge=Le===void 0?!1:Le;N("getInputProps",Ge,k,I);var Ke=O.current.state,Ie=function($e){var Ae=vs($e);Ae&&F[Ae]&&F[Ae]($e)},Rt=function($e){c({type:Zs,inputValue:$e.target.value})},Qe=function($e){if(o!=null&&o.document&&Ke.isOpen&&!S.isMouseDown){var Ae=$e.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:io,selectItem:!Ae})}},ht=function(){c({type:ea})},At="onChange",Pt={};if(!H.disabled){var Xe;Pt=(Xe={},Xe[At]=He(Z,U,Rt),Xe.onKeyDown=He(Y,Ie),Xe.onBlur=He(ee,Qe),Xe.onClick=He(Q,ht),Xe)}return he((L={},L[k]=fr(ve,function(We){I.current=We}),L["aria-activedescendant"]=Ke.isOpen&&Ke.highlightedIndex>-1?g.getItemId(Ke.highlightedIndex):"",L["aria-autocomplete"]="list",L["aria-controls"]=g.menuId,L["aria-expanded"]=Ke.isOpen,L["aria-labelledby"]=H&&H["aria-label"]?void 0:g.labelId,L.autoComplete="off",L.id=g.inputId,L.role="combobox",L.value=Ke.inputValue,L),Pt,H)},[c,g,o,F,O,S,N]),ce=v.useCallback(function(){c({type:Pu})},[c]),oe=v.useCallback(function(){c({type:Fu})},[c]),te=v.useCallback(function(){c({type:Du})},[c]),ge=v.useCallback(function($){c({type:Mu,highlightedIndex:$})},[c]),we=v.useCallback(function($){c({type:na,selectedItem:$})},[c]),A=v.useCallback(function($){c({type:ku,inputValue:$})},[c]),j=v.useCallback(function(){c({type:ju})},[c]);return{getItemProps:z,getLabelProps:q,getMenuProps:G,getInputProps:B,getToggleButtonProps:ne,toggleMenu:ce,openMenu:te,closeMenu:oe,setHighlightedIndex:ge,setInputValue:A,selectItem:we,reset:j,highlightedIndex:d,isOpen:u,selectedItem:f,inputValue:m}}Wi.stateReducer,Wi.itemToKey,Wi.environment,K.array,K.array,K.array,K.func,K.number,K.number,K.number,K.func,K.func,K.string,K.string;Xr.itemToKey,Xr.stateReducer,Xr.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 Dv="_comboboxContainer_1lcc8_1",Fv="_label_1lcc8_8",Mv="_inputContainer_1lcc8_12",kv="_input_1lcc8_12",jv="_toggleButton_1lcc8_33",Lv="_menu_1lcc8_39",Vv="_menuBottom_1lcc8_55",Kv="_menuTop_1lcc8_61",$v="_menuItem_1lcc8_66",qv="_highlighted_1lcc8_73",Uv="_selected_1lcc8_77",Hv="_hidden_1lcc8_81",jt={comboboxContainer:Dv,label:Fv,inputContainer:Mv,input:kv,toggleButton:jv,menu:Lv,menuBottom:Vv,menuTop:Kv,menuItem:$v,highlighted:qv,selected:Uv,hidden:Hv};function Bv(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function Ku({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,c]=v.useState(e),u=v.useRef(null);v.useEffect(()=>c(e),[e]);const d=v.useCallback(S=>{(S==null?void 0:S.length)>0?c(e.filter(Bv(S))):c(e)},[e]),{isOpen:f,getToggleButtonProps:m,getMenuProps:h,getInputProps:y,highlightedIndex:I,getItemProps:p,setInputValue:x,selectedItem:g}=ia({items:a,selectedItem:t?e.find(S=>S.value===t):null,itemToString:S=>(S==null?void 0:S.label)||"",onInputValueChange:({inputValue:S})=>d(S),onSelectedItemChange:({selectedItem:S})=>{var N;n(S),(N=u.current)==null||N.blur()}}),b=()=>{x(""),c(e)},O=()=>b(),_=v.useMemo(()=>{var S;return(S=e.find(N=>N.value===t))==null?void 0:S.label},[e,t]),T=()=>{t&&_&&t!==(g==null?void 0:g.value)&&x(_||"")};return l.jsxs("div",{style:{position:"relative",...i},children:[l.jsx("div",{className:jt.comboboxContainer,children:l.jsxs("div",{className:jt.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:jt.input,...y({onFocus:O,onBlur:T,ref:u})}),l.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:jt.toggleButton,type:"button",...m(),children:f?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${jt.menu} ${f&&e.length?"":jt.hidden} ${s==="top"?jt.menuTop:jt.menuBottom}`,...h(),children:f&&a.map((S,N)=>l.jsx("li",{className:`${jt.menuItem} ${I===N?jt.highlighted:""} ${t===(S==null?void 0:S.value)?jt.selected:""}`,...p({item:S,index:N}),children:l.jsx("span",{children:S.label})},S.id))})]})}const Fr=Math.min,tr=Math.max,oo=Math.round,Vi=Math.floor,Fn=e=>({x:e,y:e}),Wv={left:"right",right:"left",bottom:"top",top:"bottom"},Jv={start:"end",end:"start"};function bs(e,t,n){return tr(e,Fr(t,n))}function hi(e,t){return typeof e=="function"?e(t):e}function cr(e){return e.split("-")[0]}function mi(e){return e.split("-")[1]}function $u(e){return e==="x"?"y":"x"}function oa(e){return e==="y"?"height":"width"}function Mr(e){return["top","bottom"].includes(cr(e))?"y":"x"}function sa(e){return $u(Mr(e))}function zv(e,t,n){n===void 0&&(n=!1);const r=mi(e),o=sa(e),i=oa(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=so(s)),[s,so(s)]}function Gv(e){const t=so(e);return[_s(e),t,_s(t)]}function _s(e){return e.replace(/start|end/g,t=>Jv[t])}function Qv(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function Xv(e,t,n,r){const o=mi(e);let i=Qv(cr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(_s)))),i}function so(e){return e.replace(/left|right|bottom|top/g,t=>Wv[t])}function Yv(e){return{top:0,right:0,bottom:0,left:0,...e}}function qu(e){return typeof e!="number"?Yv(e):{top:e,right:e,bottom:e,left:e}}function ao(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function yc(e,t,n){let{reference:r,floating:o}=e;const i=Mr(t),s=sa(t),a=oa(s),c=cr(t),u=i==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let h;switch(c){case"top":h={x:d,y:r.y-o.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-o.width,y:f};break;default:h={x:r.x,y:r.y}}switch(mi(t)){case"start":h[s]-=m*(n&&u?-1:1);break;case"end":h[s]+=m*(n&&u?-1:1);break}return h}const Zv=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=yc(u,r,c),m=r,h={},y=0;for(let I=0;I<a.length;I++){const{name:p,fn:x}=a[I],{x:g,y:b,data:O,reset:_}=await x({x:d,y:f,initialPlacement:r,placement:m,strategy:o,middlewareData:h,rects:u,platform:s,elements:{reference:e,floating:t}});d=g??d,f=b??f,h={...h,[p]:{...h[p],...O}},_&&y<=50&&(y++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(u=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):_.rects),{x:d,y:f}=yc(u,m,c)),I=-1)}return{x:d,y:f,placement:m,strategy:o,middlewareData:h}};async function Uu(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:h=0}=hi(t,e),y=qu(h),p=a[m?f==="floating"?"reference":"floating":f],x=ao(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),g=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),O=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},_=ao(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:b,strategy:c}):g);return{top:(x.top-_.top+y.top)/O.y,bottom:(_.bottom-x.bottom+y.bottom)/O.y,left:(x.left-_.left+y.left)/O.x,right:(_.right-x.right+y.right)/O.x}}const ew=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=hi(e,t)||{};if(u==null)return{};const f=qu(d),m={x:n,y:r},h=sa(o),y=oa(h),I=await s.getDimensions(u),p=h==="y",x=p?"top":"left",g=p?"bottom":"right",b=p?"clientHeight":"clientWidth",O=i.reference[y]+i.reference[h]-m[h]-i.floating[y],_=m[h]-i.reference[h],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let S=T?T[b]:0;(!S||!await(s.isElement==null?void 0:s.isElement(T)))&&(S=a.floating[b]||i.floating[y]);const N=O/2-_/2,F=S/2-I[y]/2-1,q=Fr(f[x],F),G=Fr(f[g],F),z=q,ne=S-I[y]-G,B=S/2-I[y]/2+N,ce=bs(z,B,ne),oe=!c.arrow&&mi(o)!=null&&B!==ce&&i.reference[y]/2-(B<z?q:G)-I[y]/2<0,te=oe?B<z?B-z:B-ne:0;return{[h]:m[h]+te,data:{[h]:ce,centerOffset:B-ce-te,...oe&&{alignmentOffset:te}},reset:oe}}}),tw=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:I=!0,...p}=hi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=cr(o),g=Mr(a),b=cr(a)===a,O=await(c.isRTL==null?void 0:c.isRTL(u.floating)),_=m||(b||!I?[so(a)]:Gv(a)),T=y!=="none";!m&&T&&_.push(...Xv(a,I,y,O));const S=[a,..._],N=await Uu(t,p),F=[];let q=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&F.push(N[x]),f){const B=zv(o,s,O);F.push(N[B[0]],N[B[1]])}if(q=[...q,{placement:o,overflows:F}],!F.every(B=>B<=0)){var G,z;const B=(((G=i.flip)==null?void 0:G.index)||0)+1,ce=S[B];if(ce)return{data:{index:B,overflows:q},reset:{placement:ce}};let oe=(z=q.filter(te=>te.overflows[0]<=0).sort((te,ge)=>te.overflows[1]-ge.overflows[1])[0])==null?void 0:z.placement;if(!oe)switch(h){case"bestFit":{var ne;const te=(ne=q.filter(ge=>{if(T){const we=Mr(ge.placement);return we===g||we==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(we=>we>0).reduce((we,A)=>we+A,0)]).sort((ge,we)=>ge[1]-we[1])[0])==null?void 0:ne[0];te&&(oe=te);break}case"initialPlacement":oe=a;break}if(o!==oe)return{reset:{placement:oe}}}return{}}}};async function nw(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=cr(n),a=mi(n),c=Mr(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,f=hi(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof y=="number"&&(h=a==="end"?y*-1:y),c?{x:h*d,y:m*u}:{x:m*u,y:h*d}}const rw=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,c=await nw(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:s}}}}},iw=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:p=>{let{x,y:g}=p;return{x,y:g}}},...c}=hi(e,t),u={x:n,y:r},d=await Uu(t,c),f=Mr(cr(o)),m=$u(f);let h=u[m],y=u[f];if(i){const p=m==="y"?"top":"left",x=m==="y"?"bottom":"right",g=h+d[p],b=h-d[x];h=bs(g,h,b)}if(s){const p=f==="y"?"top":"left",x=f==="y"?"bottom":"right",g=y+d[p],b=y-d[x];y=bs(g,y,b)}const I=a.fn({...t,[m]:h,[f]:y});return{...I,data:{x:I.x-n,y:I.y-r,enabled:{[m]:i,[f]:s}}}}}};function vo(){return typeof window<"u"}function Hr(e){return Hu(e)?(e.nodeName||"").toLowerCase():"#document"}function wt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zt(e){var t;return(t=(Hu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Hu(e){return vo()?e instanceof Node||e instanceof wt(e).Node:!1}function qt(e){return vo()?e instanceof Element||e instanceof wt(e).Element:!1}function Xt(e){return vo()?e instanceof HTMLElement||e instanceof wt(e).HTMLElement:!1}function vc(e){return!vo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof wt(e).ShadowRoot}function gi(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ut(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function ow(e){return["table","td","th"].includes(Hr(e))}function wo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function aa(e){const t=ca(),n=qt(e)?Ut(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 sw(e){let t=Mn(e);for(;Xt(t)&&!kr(t);){if(aa(t))return t;if(wo(t))return null;t=Mn(t)}return null}function ca(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function kr(e){return["html","body","#document"].includes(Hr(e))}function Ut(e){return wt(e).getComputedStyle(e)}function Io(e){return qt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Mn(e){if(Hr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vc(e)&&e.host||Zt(e);return vc(t)?t.host:t}function Bu(e){const t=Mn(e);return kr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xt(t)&&gi(t)?t:Bu(t)}function oi(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Bu(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=wt(o);if(i){const a=xs(s);return t.concat(s,s.visualViewport||[],gi(o)?o:[],a&&n?oi(a):[])}return t.concat(o,oi(o,[],n))}function xs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Wu(e){const t=Ut(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Xt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=oo(n)!==i||oo(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function la(e){return qt(e)?e:e.contextElement}function mr(e){const t=la(e);if(!Xt(t))return Fn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Wu(t);let s=(i?oo(n.width):n.width)/r,a=(i?oo(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const aw=Fn(0);function Ju(e){const t=wt(e);return!ca()||!t.visualViewport?aw:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cw(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==wt(e)?!1:t}function lr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=la(e);let s=Fn(1);t&&(r?qt(r)&&(s=mr(r)):s=mr(e));const a=cw(i,n,r)?Ju(i):Fn(0);let c=(o.left+a.x)/s.x,u=(o.top+a.y)/s.y,d=o.width/s.x,f=o.height/s.y;if(i){const m=wt(i),h=r&&qt(r)?wt(r):r;let y=m,I=xs(y);for(;I&&r&&h!==y;){const p=mr(I),x=I.getBoundingClientRect(),g=Ut(I),b=x.left+(I.clientLeft+parseFloat(g.paddingLeft))*p.x,O=x.top+(I.clientTop+parseFloat(g.paddingTop))*p.y;c*=p.x,u*=p.y,d*=p.x,f*=p.y,c+=b,u+=O,y=wt(I),I=xs(y)}}return ao({width:d,height:f,x:c,y:u})}function lw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Zt(r),a=t?wo(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Fn(1);const d=Fn(0),f=Xt(r);if((f||!f&&!i)&&((Hr(r)!=="body"||gi(s))&&(c=Io(r)),Xt(r))){const m=lr(r);u=mr(r),d.x=m.x+r.clientLeft,d.y=m.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function uw(e){return Array.from(e.getClientRects())}function Os(e,t){const n=Io(e).scrollLeft;return t?t.left+n:lr(Zt(e)).left+n}function dw(e){const t=Zt(e),n=Io(e),r=e.ownerDocument.body,o=tr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=tr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Os(e);const a=-n.scrollTop;return Ut(r).direction==="rtl"&&(s+=tr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function fw(e,t){const n=wt(e),r=Zt(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const u=ca();(!u||u&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function pw(e,t){const n=lr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Xt(e)?mr(e):Fn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,u=r*i.y;return{width:s,height:a,x:c,y:u}}function wc(e,t,n){let r;if(t==="viewport")r=fw(e,n);else if(t==="document")r=dw(Zt(e));else if(qt(t))r=pw(t,n);else{const o=Ju(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return ao(r)}function zu(e,t){const n=Mn(e);return n===t||!qt(n)||kr(n)?!1:Ut(n).position==="fixed"||zu(n,t)}function hw(e,t){const n=t.get(e);if(n)return n;let r=oi(e,[],!1).filter(a=>qt(a)&&Hr(a)!=="body"),o=null;const i=Ut(e).position==="fixed";let s=i?Mn(e):e;for(;qt(s)&&!kr(s);){const a=Ut(s),c=aa(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||gi(s)&&!c&&zu(e,s))?r=r.filter(d=>d!==s):o=a,s=Mn(s)}return t.set(e,r),r}function mw(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?wo(t)?[]:hw(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,d)=>{const f=wc(t,d,o);return u.top=tr(f.top,u.top),u.right=Fr(f.right,u.right),u.bottom=Fr(f.bottom,u.bottom),u.left=tr(f.left,u.left),u},wc(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function gw(e){const{width:t,height:n}=Wu(e);return{width:t,height:n}}function yw(e,t,n){const r=Xt(t),o=Zt(t),i=n==="fixed",s=lr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Fn(0);if(r||!r&&!i)if((Hr(t)!=="body"||gi(o))&&(a=Io(t)),r){const h=lr(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else o&&(c.x=Os(o));let u=0,d=0;if(o&&!r&&!i){const h=o.getBoundingClientRect();d=h.top+a.scrollTop,u=h.left+a.scrollLeft-Os(o,h)}const f=s.left+a.scrollLeft-c.x-u,m=s.top+a.scrollTop-c.y-d;return{x:f,y:m,width:s.width,height:s.height}}function Uo(e){return Ut(e).position==="static"}function Ic(e,t){if(!Xt(e)||Ut(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Zt(e)===n&&(n=n.ownerDocument.body),n}function Gu(e,t){const n=wt(e);if(wo(e))return n;if(!Xt(e)){let o=Mn(e);for(;o&&!kr(o);){if(qt(o)&&!Uo(o))return o;o=Mn(o)}return n}let r=Ic(e,t);for(;r&&ow(r)&&Uo(r);)r=Ic(r,t);return r&&kr(r)&&Uo(r)&&!aa(r)?n:r||sw(e)||n}const vw=async function(e){const t=this.getOffsetParent||Gu,n=this.getDimensions,r=await n(e.floating);return{reference:yw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ww(e){return Ut(e).direction==="rtl"}const Iw={convertOffsetParentRelativeRectToViewportRelativeRect:lw,getDocumentElement:Zt,getClippingRect:mw,getOffsetParent:Gu,getElementRects:vw,getClientRects:uw,getDimensions:gw,getScale:mr,isElement:qt,isRTL:ww};function bw(e,t){let n=null,r;const o=Zt(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const{left:u,top:d,width:f,height:m}=e.getBoundingClientRect();if(a||t(),!f||!m)return;const h=Vi(d),y=Vi(o.clientWidth-(u+f)),I=Vi(o.clientHeight-(d+m)),p=Vi(u),g={rootMargin:-h+"px "+-y+"px "+-I+"px "+-p+"px",threshold:tr(0,Fr(1,c))||1};let b=!0;function O(_){const T=_[0].intersectionRatio;if(T!==c){if(!b)return s();T?s(!1,T):r=setTimeout(()=>{s(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(O,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(O,g)}n.observe(e)}return s(!0),i}function _w(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=la(e),d=o||i?[...u?oi(u):[],...oi(t)]:[];d.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const f=u&&a?bw(u,n):null;let m=-1,h=null;s&&(h=new ResizeObserver(x=>{let[g]=x;g&&g.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(t)})),n()}),u&&!c&&h.observe(u),h.observe(t));let y,I=c?lr(e):null;c&&p();function p(){const x=lr(e);I&&(x.x!==I.x||x.y!==I.y||x.width!==I.width||x.height!==I.height)&&n(),I=x,y=requestAnimationFrame(p)}return n(),()=>{var x;d.forEach(g=>{o&&g.removeEventListener("scroll",n),i&&g.removeEventListener("resize",n)}),f==null||f(),(x=h)==null||x.disconnect(),h=null,c&&cancelAnimationFrame(y)}}const xw=rw,Ow=iw,Cw=tw,Ew=ew,bc=(e,t,n)=>{const r=new Map,o={platform:Iw,...n},i={...o.platform,_c:r};return Zv(e,t,{...o,platform:i})};/*
45
+ */var oc;function Yy(){return oc||(oc=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),y=!1,v=!1,p=!1,x=!1,g=!1,b;b=Symbol.for("react.module.reference");function O(H){return!!(typeof H=="string"||typeof H=="function"||H===n||H===o||g||H===r||H===u||H===d||x||H===m||y||v||p||typeof H=="object"&&H!==null&&(H.$$typeof===h||H.$$typeof===f||H.$$typeof===i||H.$$typeof===s||H.$$typeof===c||H.$$typeof===b||H.getModuleId!==void 0))}function _(H){if(typeof H=="object"&&H!==null){var Ee=H.$$typeof;switch(Ee){case e:var Le=H.type;switch(Le){case n:case o:case r:case u:case d:return Le;default:var Ge=Le&&Le.$$typeof;switch(Ge){case a:case s:case c:case h:case f:case i:return Ge;default:return Ee}}case t:return Ee}}}var T=s,S=i,N=e,D=c,q=n,G=h,z=f,ne=t,B=o,ce=r,oe=u,te=d,ge=!1,we=!1;function A(H){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function k(H){return we||(we=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function $(H){return _(H)===s}function L(H){return _(H)===i}function j(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function F(H){return _(H)===c}function Y(H){return _(H)===n}function Z(H){return _(H)===h}function U(H){return _(H)===f}function ee(H){return _(H)===t}function Q(H){return _(H)===o}function de(H){return _(H)===r}function M(H){return _(H)===u}function ve(H){return _(H)===d}Oe.ContextConsumer=T,Oe.ContextProvider=S,Oe.Element=N,Oe.ForwardRef=D,Oe.Fragment=q,Oe.Lazy=G,Oe.Memo=z,Oe.Portal=ne,Oe.Profiler=B,Oe.StrictMode=ce,Oe.Suspense=oe,Oe.SuspenseList=te,Oe.isAsyncMode=A,Oe.isConcurrentMode=k,Oe.isContextConsumer=$,Oe.isContextProvider=L,Oe.isElement=j,Oe.isForwardRef=F,Oe.isFragment=Y,Oe.isLazy=Z,Oe.isMemo=U,Oe.isPortal=ee,Oe.isProfiler=Q,Oe.isStrictMode=de,Oe.isSuspense=M,Oe.isSuspenseList=ve,Oe.isValidElementType=O,Oe.typeOf=_}()),Oe}process.env.NODE_ENV==="production"?ys.exports=Xy():ys.exports=Yy();var sc=ys.exports;const ac=e=>typeof e=="object"&&e!=null&&e.nodeType===1,cc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",$o=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return cc(n.overflowY,t)||cc(n.overflowX,t)||(r=>{const o=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!o&&(o.clientHeight<r.scrollHeight||o.clientWidth<r.scrollWidth)})(e)}return!1},ji=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,Zy=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},ev=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:u,skipOverflowHiddenElements:d}=t,f=typeof u=="function"?u:oe=>oe!==u;if(!ac(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,m=[];let y=e;for(;ac(y)&&f(y);){if(y=Zy(y),y===h){m.push(y);break}y!=null&&y===document.body&&$o(y)&&!$o(document.documentElement)||y!=null&&$o(y,d)&&m.push(y)}const v=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,p=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:x,scrollY:g}=window,{height:b,width:O,top:_,right:T,bottom:S,left:N}=e.getBoundingClientRect(),{top:D,right:q,bottom:G,left:z}=(oe=>{const te=window.getComputedStyle(oe);return{top:parseFloat(te.scrollMarginTop)||0,right:parseFloat(te.scrollMarginRight)||0,bottom:parseFloat(te.scrollMarginBottom)||0,left:parseFloat(te.scrollMarginLeft)||0}})(e);let ne=a==="start"||a==="nearest"?_-D:a==="end"?S+G:_+b/2-D+G,B=c==="center"?N+O/2-z+q:c==="end"?T+q:N-z;const ce=[];for(let oe=0;oe<m.length;oe++){const te=m[oe],{height:ge,width:we,top:A,right:k,bottom:$,left:L}=te.getBoundingClientRect();if(s==="if-needed"&&_>=0&&N>=0&&S<=p&&T<=v&&_>=A&&S<=$&&N>=L&&T<=k)return ce;const j=getComputedStyle(te),F=parseInt(j.borderLeftWidth,10),Y=parseInt(j.borderTopWidth,10),Z=parseInt(j.borderRightWidth,10),U=parseInt(j.borderBottomWidth,10);let ee=0,Q=0;const de="offsetWidth"in te?te.offsetWidth-te.clientWidth-F-Z:0,M="offsetHeight"in te?te.offsetHeight-te.clientHeight-Y-U:0,ve="offsetWidth"in te?te.offsetWidth===0?0:we/te.offsetWidth:0,H="offsetHeight"in te?te.offsetHeight===0?0:ge/te.offsetHeight:0;if(h===te)ee=a==="start"?ne:a==="end"?ne-p:a==="nearest"?ji(g,g+p,p,Y,U,g+ne,g+ne+b,b):ne-p/2,Q=c==="start"?B:c==="center"?B-v/2:c==="end"?B-v:ji(x,x+v,v,F,Z,x+B,x+B+O,O),ee=Math.max(0,ee+g),Q=Math.max(0,Q+x);else{ee=a==="start"?ne-A-Y:a==="end"?ne-$+U+M:a==="nearest"?ji(A,$,ge,Y,U+M,ne,ne+b,b):ne-(A+ge/2)+M/2,Q=c==="start"?B-L-F:c==="center"?B-(L+we/2)+de/2:c==="end"?B-k+Z+de:ji(L,k,we,F,Z+de,B,B+O,O);const{scrollLeft:Ee,scrollTop:Le}=te;ee=H===0?0:Math.max(0,Math.min(Le+ee/H,te.scrollHeight-ge/H+M)),Q=ve===0?0:Math.max(0,Math.min(Ee+Q/ve,te.scrollWidth-we/ve+de)),ne+=Le-ee,B+=Ee-Q}ce.push({el:te,top:ee,left:Q})}return ce};var Fr=function(){return Fr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Fr.apply(this,arguments)};var tv=0;function lc(e){return typeof e=="function"?e:yt}function yt(){}function iu(e,t){if(e){var n=ev(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function uc(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function $s(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return o.cancel=r,o}function He(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(i)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function pr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(o){typeof o=="function"?o(r):o&&(o.current=r)})}}function ou(){return String(tv++)}function nv(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 dc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function su(e){return typeof e.type=="string"}function au(e){return e.props}function rv(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var iv=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Li(e){e===void 0&&(e={});var t={};return iv.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function to(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 vs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function ov(e){return Object.prototype.toString.call(e)==="[object Object]"}function Jn(e,t,n,r,o){var i=n.length;if(i===0)return-1;var s=i-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var c=Mr(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function Mr(e,t,n,r,o){o===void 0&&(o=!1);var i=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<i;a++)if(!r(n[a],a))return a;return o?Mr(t?i-1:0,t,n,r):-1}function ro(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(uc(o,e,n)||r&&uc(o,n.document.activeElement,n))})}var qs=yt;process.env.NODE_ENV!=="production"&&(qs=function(t,n,r){var o="This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props";Object.keys(t).forEach(function(i){n[i]!==void 0&&r[i]===void 0?console.error('downshift: A component has changed the controlled prop "'+i+'" to be uncontrolled. '+o):n[i]===void 0&&r[i]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+i+'" to be controlled. '+o)})});var sv=$s(function(e){cu(e).textContent=""},500);function cu(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 lu(e,t){if(!(!e||!t)){var n=cu(t);n.textContent=e,sv(t)}}function av(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var uu=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,du=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,fu=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Hi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Bi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,pu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,hu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,mu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,gu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,yu=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,vu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,wu=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Iu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,ws=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,bu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,_u=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,xu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,cv=Object.freeze({__proto__:null,blurButton:bu,blurInput:vu,changeInput:wu,clickButton:ws,clickItem:yu,controlledPropUpdatedSelectedItem:_u,itemMouseEnter:fu,keyDownArrowDown:Bi,keyDownArrowUp:Hi,keyDownEnd:gu,keyDownEnter:hu,keyDownEscape:pu,keyDownHome:mu,keyDownSpaceButton:Iu,mouseUp:du,touchEnd:xu,unknown:uu}),lv=["refKey","ref"],uv=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],dv=["onKeyDown","onBlur","onChange","onInput","onChangeText"],fv=["refKey","ref"],pv=["onMouseMove","onMouseDown","onClick","onPress","index","item"],hv=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+ou(),i.menuId=i.props.menuId||i.id+"-menu",i.labelId=i.props.labelId||i.id+"-label",i.inputId=i.props.inputId||i.id+"-input",i.getItemId=i.props.getItemId||function(g){return i.id+"-item-"+g},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(g,b){var O=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(_){return _!==O}),g()},b);i.timeoutIds.push(O)},i.setItemCount=function(g){i.itemCount=g},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(g,b){var O=i.getItemNodeFromIndex(b);return O&&O.hasAttribute("disabled")},i.setHighlightedIndex=function(g,b){g===void 0&&(g=i.props.defaultHighlightedIndex),b===void 0&&(b={}),b=Li(b),i.internalSetState(he({highlightedIndex:g},b))},i.clearSelection=function(g){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},g)},i.selectItem=function(g,b,O){b=Li(b),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:g,inputValue:i.props.itemToString(g)},b),O)},i.selectItemAtIndex=function(g,b,O){var _=i.items[g];_!=null&&i.selectItem(_,b,O)},i.selectHighlightedItem=function(g,b){return i.selectItemAtIndex(i.getState().highlightedIndex,g,b)},i.internalSetState=function(g,b){var O,_,T={},S=typeof g=="function";return!S&&g.hasOwnProperty("inputValue")&&i.props.onInputValueChange(g.inputValue,he({},i.getStateAndHelpers(),g)),i.setState(function(N){var D;N=i.getState(N);var q=S?g(N):g;q=i.props.stateReducer(N,q),O=q.hasOwnProperty("selectedItem");var G={};return O&&q.selectedItem!==N.selectedItem&&(_=q.selectedItem),(D=q).type||(D.type=uu),Object.keys(q).forEach(function(z){N[z]!==q[z]&&(T[z]=q[z]),z!=="type"&&(q[z],no(i.props,z)||(G[z]=q[z]))}),S&&q.hasOwnProperty("inputValue")&&i.props.onInputValueChange(q.inputValue,he({},i.getStateAndHelpers(),q)),G},function(){lc(b)();var N=Object.keys(T).length>1;N&&i.props.onStateChange(T,i.getStateAndHelpers()),O&&i.props.onSelect(g.selectedItem,i.getStateAndHelpers()),_!==void 0&&i.props.onChange(_,i.getStateAndHelpers()),i.props.onUserAction(T,i.getStateAndHelpers())})},i.rootRef=function(g){return i._rootNode=g},i.getRootProps=function(g,b){var O,_=g===void 0?{}:g,T=_.refKey,S=T===void 0?"ref":T,N=_.ref,D=un(_,lv),q=b===void 0?{}:b,G=q.suppressRefError,z=G===void 0?!1:G;i.getRootProps.called=!0,i.getRootProps.refKey=S,i.getRootProps.suppressRefError=z;var ne=i.getState(),B=ne.isOpen;return he((O={},O[S]=pr(N,i.rootRef),O.role="combobox",O["aria-expanded"]=B,O["aria-haspopup"]="listbox",O["aria-owns"]=B?i.menuId:void 0,O["aria-labelledby"]=i.labelId,O),D)},i.keyDownHandlers={ArrowDown:function(b){var O=this;if(b.preventDefault(),this.getState().isOpen){var _=b.shiftKey?5:1;this.moveHighlightedIndex(_,{type:Bi})}else this.internalSetState({isOpen:!0,type:Bi},function(){var T=O.getItemCount();if(T>0){var S=O.getState(),N=S.highlightedIndex,D=Jn(N,1,{length:T},O.isItemDisabled,!0);O.setHighlightedIndex(D,{type:Bi})}})},ArrowUp:function(b){var O=this;if(b.preventDefault(),this.getState().isOpen){var _=b.shiftKey?-5:-1;this.moveHighlightedIndex(_,{type:Hi})}else this.internalSetState({isOpen:!0,type:Hi},function(){var T=O.getItemCount();if(T>0){var S=O.getState(),N=S.highlightedIndex,D=Jn(N,-1,{length:T},O.isItemDisabled,!0);O.setHighlightedIndex(D,{type:Hi})}})},Enter:function(b){if(b.which!==229){var O=this.getState(),_=O.isOpen,T=O.highlightedIndex;if(_&&T!=null){b.preventDefault();var S=this.items[T],N=this.getItemNodeFromIndex(T);if(S==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:hu})}}},Escape:function(b){b.preventDefault(),this.reset(he({type:pu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(b){b.preventDefault(),this.toggleMenu({type:Iu})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(b){var O=this.getState(),_=O.isOpen;if(_){b.preventDefault();var T=this.getItemCount();if(!(T<=0||!_)){var S=Mr(0,!1,{length:T},this.isItemDisabled);this.setHighlightedIndex(S,{type:mu})}}},End:function(b){var O=this.getState(),_=O.isOpen;if(_){b.preventDefault();var T=this.getItemCount();if(!(T<=0||!_)){var S=Mr(T-1,!0,{length:T},this.isItemDisabled);this.setHighlightedIndex(S,{type:gu})}}}}),i.getToggleButtonProps=function(g){var b=g===void 0?{}:g,O=b.onClick;b.onPress;var _=b.onKeyDown,T=b.onKeyUp,S=b.onBlur,N=un(b,uv),D=i.getState(),q=D.isOpen,G={onClick:He(O,i.buttonHandleClick),onKeyDown:He(_,i.buttonHandleKeyDown),onKeyUp:He(T,i.buttonHandleKeyUp),onBlur:He(S,i.buttonHandleBlur)},z=N.disabled?{}:G;return he({type:"button",role:"button","aria-label":q?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},z,N)},i.buttonHandleKeyUp=function(g){g.preventDefault()},i.buttonHandleKeyDown=function(g){var b=vs(g);i.buttonKeyDownHandlers[b]&&i.buttonKeyDownHandlers[b].call(i,g)},i.buttonHandleClick=function(g){if(g.preventDefault(),i.props.environment){var b=i.props.environment.document,O=b.body,_=b.activeElement;O&&O===_&&g.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:ws}):i.internalSetTimeout(function(){return i.toggleMenu({type:ws})})},i.buttonHandleBlur=function(g){var b=g.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var O=i.props.environment.document.activeElement;(O==null||O.id!==i.inputId)&&O!==b&&i.reset({type:bu})}})},i.getLabelProps=function(g){return he({htmlFor:i.inputId,id:i.labelId},g)},i.getInputProps=function(g){var b=g===void 0?{}:g,O=b.onKeyDown,_=b.onBlur,T=b.onChange,S=b.onInput;b.onChangeText;var N=un(b,dv),D,q={};D="onChange";var G=i.getState(),z=G.inputValue,ne=G.isOpen,B=G.highlightedIndex;if(!N.disabled){var ce;q=(ce={},ce[D]=He(T,S,i.inputHandleChange),ce.onKeyDown=He(O,i.inputHandleKeyDown),ce.onBlur=He(_,i.inputHandleBlur),ce)}return he({"aria-autocomplete":"list","aria-activedescendant":ne&&typeof B=="number"&&B>=0?i.getItemId(B):void 0,"aria-controls":ne?i.menuId:void 0,"aria-labelledby":N&&N["aria-label"]?void 0:i.labelId,autoComplete:"off",value:z,id:i.inputId},q,N)},i.inputHandleKeyDown=function(g){var b=vs(g);b&&i.inputKeyDownHandlers[b]&&i.inputKeyDownHandlers[b].call(i,g)},i.inputHandleChange=function(g){i.internalSetState({type:wu,isOpen:!0,inputValue:g.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var g;if(!(i.isMouseDown||!i.props.environment)){var b=i.props.environment.document.activeElement,O=(b==null||(g=b.dataset)==null?void 0:g.toggle)&&i._rootNode&&i._rootNode.contains(b);O||i.reset({type:vu})}})},i.menuRef=function(g){i._menuNode=g},i.getMenuProps=function(g,b){var O,_=g===void 0?{}:g,T=_.refKey,S=T===void 0?"ref":T,N=_.ref,D=un(_,fv),q=b===void 0?{}:b,G=q.suppressRefError,z=G===void 0?!1:G;return i.getMenuProps.called=!0,i.getMenuProps.refKey=S,i.getMenuProps.suppressRefError=z,he((O={},O[S]=pr(N,i.menuRef),O.role="listbox",O["aria-labelledby"]=D&&D["aria-label"]?void 0:i.labelId,O.id=i.menuId,O),D)},i.getItemProps=function(g){var b,O=g===void 0?{}:g,_=O.onMouseMove,T=O.onMouseDown,S=O.onClick;O.onPress;var N=O.index,D=O.item,q=D===void 0?process.env.NODE_ENV==="production"?void 0:rv("getItemProps","item"):D,G=un(O,pv);N===void 0?(i.items.push(q),N=i.items.indexOf(q)):i.items[N]=q;var z="onClick",ne=S,B=(b={onMouseMove:He(_,function(){N!==i.getState().highlightedIndex&&(i.setHighlightedIndex(N,{type:fu}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:He(T,function(oe){oe.preventDefault()})},b[z]=He(ne,function(){i.selectItemAtIndex(N,{type:yu})}),b),ce=G.disabled?{onMouseDown:B.onMouseDown}:B;return he({id:i.getItemId(N),role:"option","aria-selected":i.getState().highlightedIndex===N},ce,G)},i.clearItems=function(){i.items=[]},i.reset=function(g,b){g===void 0&&(g={}),g=Li(g),i.internalSetState(function(O){var _=O.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(_)},g)},b)},i.toggleMenu=function(g,b){g===void 0&&(g={}),g=Li(g),i.internalSetState(function(O){var _=O.isOpen;return he({isOpen:!_},_&&{highlightedIndex:i.props.defaultHighlightedIndex},g)},function(){var O=i.getState(),_=O.isOpen,T=O.highlightedIndex;_&&i.getItemCount()>0&&typeof T=="number"&&i.setHighlightedIndex(T,g),lc(b)()})},i.openMenu=function(g){i.internalSetState({isOpen:!0},g)},i.closeMenu=function(g){i.internalSetState({isOpen:!1},g)},i.updateStatus=$s(function(){var g;if((g=i.props)!=null&&(g=g.environment)!=null&&g.document){var b=i.getState(),O=i.items[b.highlightedIndex],_=i.getItemCount(),T=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:_,highlightedItem:O},b));i.previousResultCount=_,lu(T,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,u=c===void 0?a:c,d=s.defaultIsOpen,f=s.initialIsOpen,h=f===void 0?d:f,m=s.initialInputValue,y=m===void 0?"":m,v=s.initialSelectedItem,p=v===void 0?null:v,x=i.getState({highlightedIndex:u,isOpen:h,inputValue:y,selectedItem:p});return x.selectedItem!=null&&i.props.initialInputValue===void 0&&(x.inputValue=i.props.itemToString(x.selectedItem)),i.state=x,i}$y(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(i){clearTimeout(i)}),this.timeoutIds=[]},r.getState=function(i){return i===void 0&&(i=this.state),to(i,this.props)},r.getItemCount=function(){var i=this.items.length;return this.itemCount!=null?i=this.itemCount:this.props.itemCount!==void 0&&(i=this.props.itemCount),i},r.getItemNodeFromIndex=function(i){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(i)):null},r.scrollHighlightedItemIntoView=function(){{var i=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(i,this._menuNode)}},r.moveHighlightedIndex=function(i,s){var a=this.getItemCount(),c=this.getState(),u=c.highlightedIndex;if(a>0){var d=Jn(u,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,u=i.isOpen,d=this.props.itemToString,f=this.id,h=this.getRootProps,m=this.getToggleButtonProps,y=this.getLabelProps,v=this.getMenuProps,p=this.getInputProps,x=this.getItemProps,g=this.openMenu,b=this.closeMenu,O=this.toggleMenu,_=this.selectItem,T=this.selectItemAtIndex,S=this.selectHighlightedItem,N=this.setHighlightedIndex,D=this.clearSelection,q=this.clearItems,G=this.reset,z=this.setItemCount,ne=this.unsetItemCount,B=this.internalSetState;return{getRootProps:h,getToggleButtonProps:m,getLabelProps:y,getMenuProps:v,getInputProps:p,getItemProps:x,reset:G,openMenu:g,closeMenu:b,toggleMenu:O,selectItem:_,selectItemAtIndex:T,selectHighlightedItem:S,setHighlightedIndex:N,clearSelection:D,clearItems:q,setItemCount:z,unsetItemCount:ne,setState:B,itemToString:d,id:f,highlightedIndex:s,inputValue:a,isOpen:u,selectedItem:c}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&fc(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(m){i.isMouseDown=!1;var y=ro(m.target,[i._rootNode,i._menuNode],i.props.environment);!y&&i.getState().isOpen&&i.reset({type:du},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},u=function(){i.isTouchMove=!0},d=function(m){var y=ro(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!y&&i.getState().isOpen&&i.reset({type:xu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},f=this.props.environment;f.addEventListener("mousedown",s),f.addEventListener("mouseup",a),f.addEventListener("touchstart",c),f.addEventListener("touchmove",u),f.addEventListener("touchend",d),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),f.removeEventListener("mousedown",s),f.removeEventListener("mouseup",a),f.removeEventListener("touchstart",c),f.removeEventListener("touchmove",u),f.removeEventListener("touchend",d)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,u=s.highlightedIndex===void 0?i:s,d=u.highlightedIndex,f=c&&this.getState().isOpen&&!i.isOpen,h=c!==d;return f||h},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(qs(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&fc(this._menuNode,this.getMenuProps)),no(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:_u,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,i)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var i=dc(this.props.children,yt);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=dc(i(this.getStateAndHelpers()));if(!s)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&mv(s,this.getRootProps),s;if(su(s))return w.cloneElement(s,this.getRootProps(au(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:nv,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&ov(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:yt,onInputValueChange:yt,onUserAction:yt,onChange:yt,onSelect:yt,onOuterClick:yt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:iu},e.stateChangeTypes=cv,e}();process.env.NODE_ENV!=="production"&&(hv.propTypes={children:V.func,defaultHighlightedIndex:V.number,defaultIsOpen:V.bool,initialHighlightedIndex:V.number,initialSelectedItem:V.any,initialInputValue:V.string,initialIsOpen:V.bool,getA11yStatusMessage:V.func,itemToString:V.func,onChange:V.func,onSelect:V.func,onStateChange:V.func,onInputValueChange:V.func,onUserAction:V.func,onOuterClick:V.func,selectedItemChanged:V.func,stateReducer:V.func,itemCount:V.number,id:V.string,environment:V.shape({addEventListener:V.func.isRequired,removeEventListener:V.func.isRequired,document:V.shape({createElement:V.func.isRequired,getElementById:V.func.isRequired,activeElement:V.any.isRequired,body:V.any.isRequired}).isRequired,Node:V.func.isRequired}),suppressRefError:V.bool,scrollIntoView:V.func,selectedItem:V.any,isOpen:V.bool,inputValue:V.string,highlightedIndex:V.number,labelId:V.string,inputId:V.string,menuId:V.string,getItemId:V.func});function fc(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 mv(e,t){var n=t.refKey,r=n!=="ref",o=!su(e);o&&!r&&!sc.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!o&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!sc.isForwardRef(e)&&!au(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Ou={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function gv(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){yv(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(he({type:o},i))}function yv(e,t,n,r){var o=t.props,i=t.type,s="on"+Us(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function vv(e,t){return t.changes}var pc=$s(function(e,t){lu(e,t)},200),wv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,Iv="useId"in w?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+w.useId();n||(n=c);var u=w.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(d){return n+"-item-"+d},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return u.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+ou():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,u=w.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return u.current};function bv(e,t,n,r){var o,i;if(e===void 0){if(t===void 0)throw new Error(r);o=n[t],i=t}else i=t===void 0?n.indexOf(e):t,o=e;return[o,i]}function Us(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Cu(e){var t=w.useRef(e);return t.current=e,t}function _v(e,t,n,r){var o=w.useRef(),i=w.useRef(),s=w.useCallback(function(m,y){i.current=y,m=to(m,y.props);var v=e(m,y),p=y.props.stateReducer(m,he({},y,{changes:v}));return p},[e]),a=w.useReducer(s,t,n),c=a[0],u=a[1],d=Cu(t),f=w.useCallback(function(m){return u(he({props:d.current},m))},[d]),h=i.current;return w.useEffect(function(){var m=to(o.current,h==null?void 0:h.props),y=h&&o.current&&!r(m,c);y&&gv(h,m,c),o.current=c},[c,h,r]),[c,f]}var Yr={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:vv,scrollIntoView:iu,environment:typeof window>"u"?void 0:window};function An(e,t,n){n===void 0&&(n=Ou);var r=e["default"+Us(t)];return r!==void 0?r:n[t]}function Zr(e,t,n){n===void 0&&(n=Ou);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Us(t)];return o!==void 0?o:An(e,t,n)}function xv(e){var t=Zr(e,"selectedItem"),n=Zr(e,"isOpen"),r=Nv(e),o=Zr(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(i){return e.itemToKey(i)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:o}}function ei(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,u=t.highlightedIndex;return r.length===0?-1:o!==void 0&&u===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:c?r.findIndex(function(d){return a(c)===a(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function Ov(e,t,n){var r=w.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return w.useEffect(function(){if(!e)return yt;var o=n.map(function(d){return d.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,ro(d.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function u(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!ro(d.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",u),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",u)}},[n,e,t]),r.current}var Eu=function(){return yt};process.env.NODE_ENV!=="production"&&(Eu=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=w.useRef(n.reduce(function(s,a){return s[a]={},s},{}));w.useEffect(function(){Object.keys(o.current).forEach(function(s){var a=o.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var c=a.suppressRefError,u=a.refKey,d=a.elementRef;c||d!=null&&d.current||console.error('downshift: The ref prop "'+u+'" from '+s+" was not applied correctly on your element.")})},[]);var i=w.useCallback(function(s,a,c,u){o.current[s]={suppressRefError:a,refKey:c,elementRef:u}},[]);return i});function Cv(e,t,n,r){r===void 0&&(r={});var o=r.document,i=yo();w.useEffect(function(){if(!(!e||i||!o)){var s=e(t);pc(s,o)}},n),w.useEffect(function(){return function(){pc.cancel(),av(o)}},[o])}function Ev(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=w.useRef(!0);return wv(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Su=yt;process.env.NODE_ENV!=="production"&&(Su=function(t){var n=t.props,r=t.state,o=w.useRef(n),i=yo();w.useEffect(function(){i||(qs(r,o.current,n),o.current=n)},[r,n,i])});function hc(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return he({isOpen:!1,highlightedIndex:-1},o&&he({selectedItem:e.items[t],isOpen:An(e,"isOpen"),highlightedIndex:An(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Sv(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function yo(){var e=w.useRef(!0);return w.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Is(e){var t=An(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function Nv(e){var t=Zr(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Wi={environment:V.shape({addEventListener:V.func.isRequired,removeEventListener:V.func.isRequired,document:V.shape({createElement:V.func.isRequired,getElementById:V.func.isRequired,activeElement:V.any.isRequired,body:V.any.isRequired}).isRequired,Node:V.func.isRequired}),itemToString:V.func,itemToKey:V.func,stateReducer:V.func},Nu=he({},Wi,{getA11yStatusMessage:V.func,highlightedIndex:V.number,defaultHighlightedIndex:V.number,initialHighlightedIndex:V.number,isOpen:V.bool,defaultIsOpen:V.bool,initialIsOpen:V.bool,selectedItem:V.any,initialSelectedItem:V.any,defaultSelectedItem:V.any,id:V.string,labelId:V.string,menuId:V.string,getItemId:V.func,toggleButtonId:V.string,onSelectedItemChange:V.func,onHighlightedIndexChange:V.func,onStateChange:V.func,onIsOpenChange:V.func,scrollIntoView:V.func});function Tv(e,t,n){var r=t.type,o=t.props,i;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ei(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:ei(o,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:o.isItemDisabled(o.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:Is(o),isOpen:An(o,"isOpen"),selectedItem:An(o,"selectedItem"),inputValue:An(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}Fr(Fr({},Nu),{items:V.array.isRequired,isItemDisabled:V.func});Fr(Fr({},Yr),{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 Hs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Bs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ws=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Js=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,zs=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Gs=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Qs=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Xs=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Ys=process.env.NODE_ENV!=="production"?"__input_change__":8,io=process.env.NODE_ENV!=="production"?"__input_blur__":9,Zs=process.env.NODE_ENV!=="production"?"__input_click__":10,Tu=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Ru=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ea=process.env.NODE_ENV!=="production"?"__item_click__":13,Au=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Pu=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Du=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Fu=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Mu=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,ta=process.env.NODE_ENV!=="production"?"__function_select_item__":19,ku=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,ju=process.env.NODE_ENV!=="production"?"__function_reset__":21,na=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Lu=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:na,FunctionCloseMenu:Fu,FunctionOpenMenu:Du,FunctionReset:ju,FunctionSelectItem:ta,FunctionSetHighlightedIndex:Mu,FunctionSetInputValue:ku,FunctionToggleMenu:Pu,InputBlur:io,InputChange:Ys,InputClick:Zs,InputKeyDownArrowDown:Hs,InputKeyDownArrowUp:Bs,InputKeyDownEnd:zs,InputKeyDownEnter:Xs,InputKeyDownEscape:Ws,InputKeyDownHome:Js,InputKeyDownPageDown:Qs,InputKeyDownPageUp:Gs,ItemClick:ea,ItemMouseMove:Ru,MenuMouseLeave:Tu,ToggleButtonClick:Au});function Rv(e){var t=xv(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)),he({},t,{inputValue:r})}var Av=he({},Nu,{items:V.array.isRequired,isItemDisabled:V.func,inputValue:V.string,defaultInputValue:V.string,initialInputValue:V.string,inputId:V.string,onInputValueChange:V.func});function Pv(e,t,n,r){var o=w.useRef(),i=_v(e,t,n,r),s=i[0],a=i[1],c=yo();return w.useEffect(function(){if(no(t,"selectedItem")){if(!c){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);u&&a({type:na,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[to(s,t),a]}var Vu=yt;process.env.NODE_ENV!=="production"&&(Vu=function(t,n){V.checkPropTypes(Av,t,"prop",n.name)});var Dv=he({},Yr,{isItemDisabled:function(){return!1}});function Fv(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case ea:s={isOpen:An(o,"isOpen"),highlightedIndex:Is(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Hs:e.isOpen?s={highlightedIndex:Jn(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:ei(o,e,1),isOpen:o.items.length>=0};break;case Bs:e.isOpen?i?s=hc(o,e.highlightedIndex):s={highlightedIndex:Jn(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:ei(o,e,-1),isOpen:o.items.length>=0};break;case Xs:s=hc(o,e.highlightedIndex);break;case Ws:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Gs:s={highlightedIndex:Jn(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Qs:s={highlightedIndex:Jn(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case Js:s={highlightedIndex:Mr(0,!1,o.items,o.isItemDisabled)};break;case zs:s={highlightedIndex:Mr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case io:s=he({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=o.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case Ys:s={isOpen:!0,highlightedIndex:Is(o),inputValue:t.inputValue};break;case Zs:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ei(o,e,0)};break;case ta:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case na:s={inputValue:t.inputValue};break;default:return Tv(e,t,Lu)}return he({},e,s)}var Mv=["onMouseLeave","refKey","ref"],kv=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],jv=["onClick","onPress","refKey","ref"],Lv=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];ra.stateChangeTypes=Lu;function ra(e){e===void 0&&(e={}),Vu(e,ra);var t=he({},Dv,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=Pv(Fv,t,Rv,Sv),a=s[0],c=s[1],u=a.isOpen,d=a.highlightedIndex,f=a.selectedItem,h=a.inputValue,m=w.useRef(null),y=w.useRef({}),v=w.useRef(null),p=w.useRef(null),x=yo(),g=Iv(t),b=w.useRef(),O=Cu({state:a,props:t}),_=w.useCallback(function($){return y.current[g.getItemId($)]},[g]);Cv(i,a,[u,d,f,h],o);var T=Ev({menuElement:m.current,highlightedIndex:d,isOpen:u,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:_});Su({props:t,state:a}),w.useEffect(function(){var $=Zr(t,"isOpen");$&&v.current&&v.current.focus()},[]),w.useEffect(function(){x||(b.current=n.length)});var S=Ov(o,w.useCallback(function(){O.current.state.isOpen&&c({type:io,selectItem:!1})},[c,O]),w.useMemo(function(){return[m,p,v]},[m.current,p.current,v.current])),N=Eu("getInputProps","getMenuProps");w.useEffect(function(){u||(y.current={})},[u]),w.useEffect(function(){var $;!u||!(o!=null&&o.document)||!(v!=null&&($=v.current)!=null&&$.focus)||o.document.activeElement!==v.current&&v.current.focus()},[u,o]);var D=w.useMemo(function(){return{ArrowDown:function(L){L.preventDefault(),c({type:Hs,altKey:L.altKey})},ArrowUp:function(L){L.preventDefault(),c({type:Bs,altKey:L.altKey})},Home:function(L){O.current.state.isOpen&&(L.preventDefault(),c({type:Js}))},End:function(L){O.current.state.isOpen&&(L.preventDefault(),c({type:zs}))},Escape:function(L){var j=O.current.state;(j.isOpen||j.inputValue||j.selectedItem||j.highlightedIndex>-1)&&(L.preventDefault(),c({type:Ws}))},Enter:function(L){var j=O.current.state;!j.isOpen||L.which===229||(L.preventDefault(),c({type:Xs}))},PageUp:function(L){O.current.state.isOpen&&(L.preventDefault(),c({type:Gs}))},PageDown:function(L){O.current.state.isOpen&&(L.preventDefault(),c({type:Qs}))}}},[c,O]),q=w.useCallback(function($){return he({id:g.labelId,htmlFor:g.inputId},$)},[g]),G=w.useCallback(function($,L){var j,F=$===void 0?{}:$,Y=F.onMouseLeave,Z=F.refKey,U=Z===void 0?"ref":Z,ee=F.ref,Q=un(F,Mv),de=L===void 0?{}:L,M=de.suppressRefError,ve=M===void 0?!1:M;return N("getMenuProps",ve,U,m),he((j={},j[U]=pr(ee,function(H){m.current=H}),j.id=g.menuId,j.role="listbox",j["aria-labelledby"]=Q&&Q["aria-label"]?void 0:""+g.labelId,j.onMouseLeave=He(Y,function(){c({type:Tu})}),j),Q)},[c,N,g]),z=w.useCallback(function($){var L,j,F=$===void 0?{}:$,Y=F.item,Z=F.index,U=F.refKey,ee=U===void 0?"ref":U,Q=F.ref,de=F.onMouseMove,M=F.onMouseDown,ve=F.onClick;F.onPress;var H=F.disabled,Ee=un(F,kv);H!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Le=O.current,Ge=Le.props,Ke=Le.state,Ie=bv(Y,Z,Ge.items,"Pass either item or index to getItemProps!"),Rt=Ie[0],Qe=Ie[1],ht=Ge.isItemDisabled(Rt,Qe),At="onClick",Pt=ve,Xe=function(){S.isTouchEnd||Qe===Ke.highlightedIndex||(T.current=!1,c({type:Ru,index:Qe,disabled:ht}))},We=function(){c({type:ea,index:Qe})},$e=function(Dt){return Dt.preventDefault()};return he((L={},L[ee]=pr(Q,function(Ae){Ae&&(y.current[g.getItemId(Qe)]=Ae)}),L["aria-disabled"]=ht,L["aria-selected"]=Qe===Ke.highlightedIndex,L.id=g.getItemId(Qe),L.role="option",L),!ht&&(j={},j[At]=He(Pt,We),j),{onMouseMove:He(de,Xe),onMouseDown:He(M,$e)},Ee)},[c,g,O,S,T]),ne=w.useCallback(function($){var L,j=$===void 0?{}:$,F=j.onClick;j.onPress;var Y=j.refKey,Z=Y===void 0?"ref":Y,U=j.ref,ee=un(j,jv),Q=O.current.state,de=function(){c({type:Au})};return he((L={},L[Z]=pr(U,function(M){p.current=M}),L["aria-controls"]=g.menuId,L["aria-expanded"]=Q.isOpen,L.id=g.toggleButtonId,L.tabIndex=-1,L),!ee.disabled&&he({},{onClick:He(F,de)}),ee)},[c,O,g]),B=w.useCallback(function($,L){var j,F=$===void 0?{}:$,Y=F.onKeyDown,Z=F.onChange,U=F.onInput,ee=F.onBlur;F.onChangeText;var Q=F.onClick,de=F.refKey,M=de===void 0?"ref":de,ve=F.ref,H=un(F,Lv),Ee=L===void 0?{}:L,Le=Ee.suppressRefError,Ge=Le===void 0?!1:Le;N("getInputProps",Ge,M,v);var Ke=O.current.state,Ie=function($e){var Ae=vs($e);Ae&&D[Ae]&&D[Ae]($e)},Rt=function($e){c({type:Ys,inputValue:$e.target.value})},Qe=function($e){if(o!=null&&o.document&&Ke.isOpen&&!S.isMouseDown){var Ae=$e.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:io,selectItem:!Ae})}},ht=function(){c({type:Zs})},At="onChange",Pt={};if(!H.disabled){var Xe;Pt=(Xe={},Xe[At]=He(Z,U,Rt),Xe.onKeyDown=He(Y,Ie),Xe.onBlur=He(ee,Qe),Xe.onClick=He(Q,ht),Xe)}return he((j={},j[M]=pr(ve,function(We){v.current=We}),j["aria-activedescendant"]=Ke.isOpen&&Ke.highlightedIndex>-1?g.getItemId(Ke.highlightedIndex):"",j["aria-autocomplete"]="list",j["aria-controls"]=g.menuId,j["aria-expanded"]=Ke.isOpen,j["aria-labelledby"]=H&&H["aria-label"]?void 0:g.labelId,j.autoComplete="off",j.id=g.inputId,j.role="combobox",j.value=Ke.inputValue,j),Pt,H)},[c,g,o,D,O,S,N]),ce=w.useCallback(function(){c({type:Pu})},[c]),oe=w.useCallback(function(){c({type:Fu})},[c]),te=w.useCallback(function(){c({type:Du})},[c]),ge=w.useCallback(function($){c({type:Mu,highlightedIndex:$})},[c]),we=w.useCallback(function($){c({type:ta,selectedItem:$})},[c]),A=w.useCallback(function($){c({type:ku,inputValue:$})},[c]),k=w.useCallback(function(){c({type:ju})},[c]);return{getItemProps:z,getLabelProps:q,getMenuProps:G,getInputProps:B,getToggleButtonProps:ne,toggleMenu:ce,openMenu:te,closeMenu:oe,setHighlightedIndex:ge,setInputValue:A,selectItem:we,reset:k,highlightedIndex:d,isOpen:u,selectedItem:f,inputValue:h}}Wi.stateReducer,Wi.itemToKey,Wi.environment,V.array,V.array,V.array,V.func,V.number,V.number,V.number,V.func,V.func,V.string,V.string;Yr.itemToKey,Yr.stateReducer,Yr.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 Vv="_comboboxContainer_1lcc8_1",Kv="_label_1lcc8_8",$v="_inputContainer_1lcc8_12",qv="_input_1lcc8_12",Uv="_toggleButton_1lcc8_33",Hv="_menu_1lcc8_39",Bv="_menuBottom_1lcc8_55",Wv="_menuTop_1lcc8_61",Jv="_menuItem_1lcc8_66",zv="_highlighted_1lcc8_73",Gv="_selected_1lcc8_77",Qv="_hidden_1lcc8_81",jt={comboboxContainer:Vv,label:Kv,inputContainer:$v,input:qv,toggleButton:Uv,menu:Hv,menuBottom:Bv,menuTop:Wv,menuItem:Jv,highlighted:zv,selected:Gv,hidden:Qv};function Xv(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function Ku({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,c]=w.useState(e),u=w.useRef(null);w.useEffect(()=>c(e),[e]);const d=w.useCallback(S=>{(S==null?void 0:S.length)>0?c(e.filter(Xv(S))):c(e)},[e]),{isOpen:f,getToggleButtonProps:h,getMenuProps:m,getInputProps:y,highlightedIndex:v,getItemProps:p,setInputValue:x,selectedItem:g}=ra({items:a,selectedItem:t?e.find(S=>S.value===t):null,itemToString:S=>(S==null?void 0:S.label)||"",onInputValueChange:({inputValue:S})=>d(S),onSelectedItemChange:({selectedItem:S})=>{var N;n(S),(N=u.current)==null||N.blur()}}),b=()=>{x(""),c(e)},O=()=>b(),_=w.useMemo(()=>{var S;return(S=e.find(N=>N.value===t))==null?void 0:S.label},[e,t]),T=()=>{t&&_&&t!==(g==null?void 0:g.value)&&x(_||"")};return l.jsxs("div",{style:{position:"relative",...i},children:[l.jsx("div",{className:jt.comboboxContainer,children:l.jsxs("div",{className:jt.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:jt.input,...y({onFocus:O,onBlur:T,ref:u})}),l.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:jt.toggleButton,type:"button",...h(),children:f?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${jt.menu} ${f&&e.length?"":jt.hidden} ${s==="top"?jt.menuTop:jt.menuBottom}`,...m(),children:f&&a.map((S,N)=>l.jsx("li",{className:`${jt.menuItem} ${v===N?jt.highlighted:""} ${t===(S==null?void 0:S.value)?jt.selected:""}`,...p({item:S,index:N}),children:l.jsx("span",{children:S.label})},S.id))})]})}const kr=Math.min,nr=Math.max,oo=Math.round,Vi=Math.floor,Fn=e=>({x:e,y:e}),Yv={left:"right",right:"left",bottom:"top",top:"bottom"},Zv={start:"end",end:"start"};function bs(e,t,n){return nr(e,kr(t,n))}function hi(e,t){return typeof e=="function"?e(t):e}function lr(e){return e.split("-")[0]}function mi(e){return e.split("-")[1]}function $u(e){return e==="x"?"y":"x"}function ia(e){return e==="y"?"height":"width"}function jr(e){return["top","bottom"].includes(lr(e))?"y":"x"}function oa(e){return $u(jr(e))}function ew(e,t,n){n===void 0&&(n=!1);const r=mi(e),o=oa(e),i=ia(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=so(s)),[s,so(s)]}function tw(e){const t=so(e);return[_s(e),t,_s(t)]}function _s(e){return e.replace(/start|end/g,t=>Zv[t])}function nw(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function rw(e,t,n,r){const o=mi(e);let i=nw(lr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(_s)))),i}function so(e){return e.replace(/left|right|bottom|top/g,t=>Yv[t])}function iw(e){return{top:0,right:0,bottom:0,left:0,...e}}function qu(e){return typeof e!="number"?iw(e):{top:e,right:e,bottom:e,left:e}}function ao(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function mc(e,t,n){let{reference:r,floating:o}=e;const i=jr(t),s=oa(t),a=ia(s),c=lr(t),u=i==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let m;switch(c){case"top":m={x:d,y:r.y-o.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-o.width,y:f};break;default:m={x:r.x,y:r.y}}switch(mi(t)){case"start":m[s]-=h*(n&&u?-1:1);break;case"end":m[s]+=h*(n&&u?-1:1);break}return m}const ow=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=mc(u,r,c),h=r,m={},y=0;for(let v=0;v<a.length;v++){const{name:p,fn:x}=a[v],{x:g,y:b,data:O,reset:_}=await x({x:d,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:t}});d=g??d,f=b??f,m={...m,[p]:{...m[p],...O}},_&&y<=50&&(y++,typeof _=="object"&&(_.placement&&(h=_.placement),_.rects&&(u=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):_.rects),{x:d,y:f}=mc(u,h,c)),v=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:m}};async function Uu(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=hi(t,e),y=qu(m),p=a[h?f==="floating"?"reference":"floating":f],x=ao(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),g=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),O=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},_=ao(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:b,strategy:c}):g);return{top:(x.top-_.top+y.top)/O.y,bottom:(_.bottom-x.bottom+y.bottom)/O.y,left:(x.left-_.left+y.left)/O.x,right:(_.right-x.right+y.right)/O.x}}const sw=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=hi(e,t)||{};if(u==null)return{};const f=qu(d),h={x:n,y:r},m=oa(o),y=ia(m),v=await s.getDimensions(u),p=m==="y",x=p?"top":"left",g=p?"bottom":"right",b=p?"clientHeight":"clientWidth",O=i.reference[y]+i.reference[m]-h[m]-i.floating[y],_=h[m]-i.reference[m],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let S=T?T[b]:0;(!S||!await(s.isElement==null?void 0:s.isElement(T)))&&(S=a.floating[b]||i.floating[y]);const N=O/2-_/2,D=S/2-v[y]/2-1,q=kr(f[x],D),G=kr(f[g],D),z=q,ne=S-v[y]-G,B=S/2-v[y]/2+N,ce=bs(z,B,ne),oe=!c.arrow&&mi(o)!=null&&B!==ce&&i.reference[y]/2-(B<z?q:G)-v[y]/2<0,te=oe?B<z?B-z:B-ne:0;return{[m]:h[m]+te,data:{[m]:ce,centerOffset:B-ce-te,...oe&&{alignmentOffset:te}},reset:oe}}}),aw=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...p}=hi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=lr(o),g=jr(a),b=lr(a)===a,O=await(c.isRTL==null?void 0:c.isRTL(u.floating)),_=h||(b||!v?[so(a)]:tw(a)),T=y!=="none";!h&&T&&_.push(...rw(a,v,y,O));const S=[a,..._],N=await Uu(t,p),D=[];let q=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&D.push(N[x]),f){const B=ew(o,s,O);D.push(N[B[0]],N[B[1]])}if(q=[...q,{placement:o,overflows:D}],!D.every(B=>B<=0)){var G,z;const B=(((G=i.flip)==null?void 0:G.index)||0)+1,ce=S[B];if(ce)return{data:{index:B,overflows:q},reset:{placement:ce}};let oe=(z=q.filter(te=>te.overflows[0]<=0).sort((te,ge)=>te.overflows[1]-ge.overflows[1])[0])==null?void 0:z.placement;if(!oe)switch(m){case"bestFit":{var ne;const te=(ne=q.filter(ge=>{if(T){const we=jr(ge.placement);return we===g||we==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(we=>we>0).reduce((we,A)=>we+A,0)]).sort((ge,we)=>ge[1]-we[1])[0])==null?void 0:ne[0];te&&(oe=te);break}case"initialPlacement":oe=a;break}if(o!==oe)return{reset:{placement:oe}}}return{}}}};async function cw(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=lr(n),a=mi(n),c=jr(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,f=hi(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof y=="number"&&(m=a==="end"?y*-1:y),c?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const lw=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,c=await cw(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:s}}}}},uw=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:p=>{let{x,y:g}=p;return{x,y:g}}},...c}=hi(e,t),u={x:n,y:r},d=await Uu(t,c),f=jr(lr(o)),h=$u(f);let m=u[h],y=u[f];if(i){const p=h==="y"?"top":"left",x=h==="y"?"bottom":"right",g=m+d[p],b=m-d[x];m=bs(g,m,b)}if(s){const p=f==="y"?"top":"left",x=f==="y"?"bottom":"right",g=y+d[p],b=y-d[x];y=bs(g,y,b)}const v=a.fn({...t,[h]:m,[f]:y});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[f]:s}}}}}};function vo(){return typeof window<"u"}function Wr(e){return Hu(e)?(e.nodeName||"").toLowerCase():"#document"}function wt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zt(e){var t;return(t=(Hu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Hu(e){return vo()?e instanceof Node||e instanceof wt(e).Node:!1}function qt(e){return vo()?e instanceof Element||e instanceof wt(e).Element:!1}function Xt(e){return vo()?e instanceof HTMLElement||e instanceof wt(e).HTMLElement:!1}function gc(e){return!vo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof wt(e).ShadowRoot}function gi(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ut(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function dw(e){return["table","td","th"].includes(Wr(e))}function wo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function sa(e){const t=aa(),n=qt(e)?Ut(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 fw(e){let t=Mn(e);for(;Xt(t)&&!Lr(t);){if(sa(t))return t;if(wo(t))return null;t=Mn(t)}return null}function aa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Lr(e){return["html","body","#document"].includes(Wr(e))}function Ut(e){return wt(e).getComputedStyle(e)}function Io(e){return qt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Mn(e){if(Wr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gc(e)&&e.host||Zt(e);return gc(t)?t.host:t}function Bu(e){const t=Mn(e);return Lr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xt(t)&&gi(t)?t:Bu(t)}function si(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Bu(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=wt(o);if(i){const a=xs(s);return t.concat(s,s.visualViewport||[],gi(o)?o:[],a&&n?si(a):[])}return t.concat(o,si(o,[],n))}function xs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Wu(e){const t=Ut(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Xt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=oo(n)!==i||oo(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function ca(e){return qt(e)?e:e.contextElement}function gr(e){const t=ca(e);if(!Xt(t))return Fn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Wu(t);let s=(i?oo(n.width):n.width)/r,a=(i?oo(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const pw=Fn(0);function Ju(e){const t=wt(e);return!aa()||!t.visualViewport?pw:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function hw(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==wt(e)?!1:t}function ur(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=ca(e);let s=Fn(1);t&&(r?qt(r)&&(s=gr(r)):s=gr(e));const a=hw(i,n,r)?Ju(i):Fn(0);let c=(o.left+a.x)/s.x,u=(o.top+a.y)/s.y,d=o.width/s.x,f=o.height/s.y;if(i){const h=wt(i),m=r&&qt(r)?wt(r):r;let y=h,v=xs(y);for(;v&&r&&m!==y;){const p=gr(v),x=v.getBoundingClientRect(),g=Ut(v),b=x.left+(v.clientLeft+parseFloat(g.paddingLeft))*p.x,O=x.top+(v.clientTop+parseFloat(g.paddingTop))*p.y;c*=p.x,u*=p.y,d*=p.x,f*=p.y,c+=b,u+=O,y=wt(v),v=xs(y)}}return ao({width:d,height:f,x:c,y:u})}function mw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Zt(r),a=t?wo(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Fn(1);const d=Fn(0),f=Xt(r);if((f||!f&&!i)&&((Wr(r)!=="body"||gi(s))&&(c=Io(r)),Xt(r))){const h=ur(r);u=gr(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function gw(e){return Array.from(e.getClientRects())}function Os(e,t){const n=Io(e).scrollLeft;return t?t.left+n:ur(Zt(e)).left+n}function yw(e){const t=Zt(e),n=Io(e),r=e.ownerDocument.body,o=nr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=nr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Os(e);const a=-n.scrollTop;return Ut(r).direction==="rtl"&&(s+=nr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function vw(e,t){const n=wt(e),r=Zt(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const u=aa();(!u||u&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function ww(e,t){const n=ur(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Xt(e)?gr(e):Fn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,u=r*i.y;return{width:s,height:a,x:c,y:u}}function yc(e,t,n){let r;if(t==="viewport")r=vw(e,n);else if(t==="document")r=yw(Zt(e));else if(qt(t))r=ww(t,n);else{const o=Ju(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return ao(r)}function zu(e,t){const n=Mn(e);return n===t||!qt(n)||Lr(n)?!1:Ut(n).position==="fixed"||zu(n,t)}function Iw(e,t){const n=t.get(e);if(n)return n;let r=si(e,[],!1).filter(a=>qt(a)&&Wr(a)!=="body"),o=null;const i=Ut(e).position==="fixed";let s=i?Mn(e):e;for(;qt(s)&&!Lr(s);){const a=Ut(s),c=sa(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||gi(s)&&!c&&zu(e,s))?r=r.filter(d=>d!==s):o=a,s=Mn(s)}return t.set(e,r),r}function bw(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?wo(t)?[]:Iw(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,d)=>{const f=yc(t,d,o);return u.top=nr(f.top,u.top),u.right=kr(f.right,u.right),u.bottom=kr(f.bottom,u.bottom),u.left=nr(f.left,u.left),u},yc(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function _w(e){const{width:t,height:n}=Wu(e);return{width:t,height:n}}function xw(e,t,n){const r=Xt(t),o=Zt(t),i=n==="fixed",s=ur(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Fn(0);if(r||!r&&!i)if((Wr(t)!=="body"||gi(o))&&(a=Io(t)),r){const m=ur(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&(c.x=Os(o));let u=0,d=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();d=m.top+a.scrollTop,u=m.left+a.scrollLeft-Os(o,m)}const f=s.left+a.scrollLeft-c.x-u,h=s.top+a.scrollTop-c.y-d;return{x:f,y:h,width:s.width,height:s.height}}function qo(e){return Ut(e).position==="static"}function vc(e,t){if(!Xt(e)||Ut(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Zt(e)===n&&(n=n.ownerDocument.body),n}function Gu(e,t){const n=wt(e);if(wo(e))return n;if(!Xt(e)){let o=Mn(e);for(;o&&!Lr(o);){if(qt(o)&&!qo(o))return o;o=Mn(o)}return n}let r=vc(e,t);for(;r&&dw(r)&&qo(r);)r=vc(r,t);return r&&Lr(r)&&qo(r)&&!sa(r)?n:r||fw(e)||n}const Ow=async function(e){const t=this.getOffsetParent||Gu,n=this.getDimensions,r=await n(e.floating);return{reference:xw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Cw(e){return Ut(e).direction==="rtl"}const Ew={convertOffsetParentRelativeRectToViewportRelativeRect:mw,getDocumentElement:Zt,getClippingRect:bw,getOffsetParent:Gu,getElementRects:Ow,getClientRects:gw,getDimensions:_w,getScale:gr,isElement:qt,isRTL:Cw};function Sw(e,t){let n=null,r;const o=Zt(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const{left:u,top:d,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const m=Vi(d),y=Vi(o.clientWidth-(u+f)),v=Vi(o.clientHeight-(d+h)),p=Vi(u),g={rootMargin:-m+"px "+-y+"px "+-v+"px "+-p+"px",threshold:nr(0,kr(1,c))||1};let b=!0;function O(_){const T=_[0].intersectionRatio;if(T!==c){if(!b)return s();T?s(!1,T):r=setTimeout(()=>{s(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(O,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(O,g)}n.observe(e)}return s(!0),i}function Nw(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=ca(e),d=o||i?[...u?si(u):[],...si(t)]:[];d.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const f=u&&a?Sw(u,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(x=>{let[g]=x;g&&g.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var b;(b=m)==null||b.observe(t)})),n()}),u&&!c&&m.observe(u),m.observe(t));let y,v=c?ur(e):null;c&&p();function p(){const x=ur(e);v&&(x.x!==v.x||x.y!==v.y||x.width!==v.width||x.height!==v.height)&&n(),v=x,y=requestAnimationFrame(p)}return n(),()=>{var x;d.forEach(g=>{o&&g.removeEventListener("scroll",n),i&&g.removeEventListener("resize",n)}),f==null||f(),(x=m)==null||x.disconnect(),m=null,c&&cancelAnimationFrame(y)}}const Tw=lw,Rw=uw,Aw=aw,Pw=sw,wc=(e,t,n)=>{const r=new Map,o={platform:Ew,...n},i={...o.platform,_c:r};return ow(e,t,{...o,platform:i})};/*
46
46
  * React Tooltip
47
47
  * {@link https://github.com/ReactTooltip/react-tooltip}
48
48
  * @copyright ReactTooltip Team
49
49
  * @license MIT
50
- */const Sw="react-tooltip-core-styles",Nw="react-tooltip-base-styles",_c={core:!1,base:!1};function xc({css:e,id:t=Nw,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||_c[n]||n==="core"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=Sw),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css",s==="top"&&a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),_c[n]=!0}const Oc=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[xw(Number(o)),Cw({fallbackAxisSideDirection:"start"}),Ow({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(Ew({element:n,padding:5})),bc(e,t,{placement:r,strategy:i,middleware:c}).then(({x:u,y:d,placement:f,middlewareData:m})=>{var h,y;const I={left:`${u}px`,top:`${d}px`,border:a},{x:p,y:x}=(h=m.arrow)!==null&&h!==void 0?h:{x:0,y:0},g=(y={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&y!==void 0?y:"bottom",b=a&&{borderBottom:a,borderRight:a};let O=0;if(a){const _=`${a}`.match(/(\d+)px/);O=_!=null&&_[1]?Number(_[1]):1}return{tooltipStyles:I,tooltipArrowStyles:{left:p!=null?`${p}px`:"",top:x!=null?`${x}px`:"",right:"",bottom:"",...b,[g]:`-${4+O}px`},place:f}})):bc(e,t,{placement:"bottom",strategy:i,middleware:c}).then(({x:u,y:d,placement:f})=>({tooltipStyles:{left:`${u}px`,top:`${d}px`},tooltipArrowStyles:{},place:f}))},Cc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Ec=(e,t,n)=>{let r=null;const o=function(...i){const s=()=>{r=null};!r&&(e.apply(this,i),r=setTimeout(s,t))};return o.cancel=()=>{r&&(clearTimeout(r),r=null)},o},Sc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Cs=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>Cs(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Sc(e)||!Sc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Cs(e[o],t[o]))},Tw=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"})},Nc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Tw(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Rw=typeof window<"u"?v.useLayoutEffect:v.useEffect,Et=e=>{e.current&&(clearTimeout(e.current),e.current=null)},Aw="DEFAULT_TOOLTIP_ID",Pw={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Dw=v.createContext({getTooltipData:()=>Pw});function Qu(e=Aw){return v.useContext(Dw).getTooltipData(e)}var dr={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"},Ho={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 Fw=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:c=10,events:u=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:m,wrapper:h,delayShow:y=0,delayHide:I=0,float:p=!1,hidden:x=!1,noArrow:g=!1,clickable:b=!1,closeOnEsc:O=!1,closeOnScroll:_=!1,closeOnResize:T=!1,openEvents:S,closeEvents:N,globalCloseEvents:F,imperativeModeOnly:q,style:G,position:z,afterShow:ne,afterHide:B,disableTooltip:ce,content:oe,contentWrapperRef:te,isOpen:ge,defaultIsOpen:we=!1,setIsOpen:A,activeAnchor:j,setActiveAnchor:$,border:V,opacity:L,arrowColor:M,role:Y="tooltip"})=>{var Z;const U=v.useRef(null),ee=v.useRef(null),Q=v.useRef(null),de=v.useRef(null),k=v.useRef(null),[ve,H]=v.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ee,Le]=v.useState(!1),[Ge,Ke]=v.useState(!1),[Ie,Rt]=v.useState(null),Qe=v.useRef(!1),ht=v.useRef(null),{anchorRefs:At,setActiveAnchor:Pt}=Qu(t),Xe=v.useRef(!1),[We,$e]=v.useState([]),Ae=v.useRef(!1),Dt=d||u.includes("click"),tt=Dt||(S==null?void 0:S.click)||(S==null?void 0:S.dblclick)||(S==null?void 0:S.mousedown),en=S?{...S}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!S&&Dt&&Object.assign(en,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const hn=N?{...N}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!N&&Dt&&Object.assign(hn,{mouseleave:!1,blur:!1,mouseout:!1});const mt=F?{...F}:{escape:O||!1,scroll:_||!1,resize:T||!1,clickOutsideAnchor:tt||!1};q&&(Object.assign(en,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(hn,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(mt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),Rw(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]);const Pe=W=>{Ae.current&&(W&&Ke(!0),setTimeout(()=>{Ae.current&&(A==null||A(W),ge===void 0&&Le(W))},10))};v.useEffect(()=>{if(ge===void 0)return()=>null;ge&&Ke(!0);const W=setTimeout(()=>{Le(ge)},10);return()=>{clearTimeout(W)}},[ge]),v.useEffect(()=>{if(Ee!==Qe.current)if(Et(k),Qe.current=Ee,Ee)ne==null||ne();else{const W=(ae=>{const le=ae.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,je,Ue]=le;return Number(je)*(Ue==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));k.current=setTimeout(()=>{Ke(!1),Rt(null),B==null||B()},W+25)}},[Ee]);const tn=W=>{H(ae=>Cs(ae,W)?ae:W)},mn=(W=y)=>{Et(Q),Ge?Pe(!0):Q.current=setTimeout(()=>{Pe(!0)},W)},nn=(W=I)=>{Et(de),de.current=setTimeout(()=>{Xe.current||Pe(!1)},W)},Ln=W=>{var ae;if(!W)return;const le=(ae=W.currentTarget)!==null&&ae!==void 0?ae:W.target;if(!(le!=null&&le.isConnected))return $(null),void Pt({current:null});y?mn():Pe(!0),$(le),Pt({current:le}),Et(de)},ct=()=>{b?nn(I||100):I?nn():Pe(!1),Et(Q)},rn=({x:W,y:ae})=>{var le;const je={getBoundingClientRect:()=>({x:W,y:ae,width:0,height:0,top:ae,left:W,right:W,bottom:ae})};Oc({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:c,elementReference:je,tooltipReference:U.current,tooltipArrowReference:ee.current,strategy:f,middlewares:m,border:V}).then(Ue=>{tn(Ue)})},gn=W=>{if(!W)return;const ae=W,le={x:ae.clientX,y:ae.clientY};rn(le),ht.current=le},Vn=W=>{var ae;if(!Ee)return;const le=W.target;le.isConnected&&(!((ae=U.current)===null||ae===void 0)&&ae.contains(le)||[document.querySelector(`[id='${i}']`),...We].some(je=>je==null?void 0:je.contains(le))||(Pe(!1),Et(Q)))},yn=Ec(Ln,50),Re=Ec(ct,50),nt=W=>{Re.cancel(),yn(W)},re=()=>{yn.cancel(),Re()},me=v.useCallback(()=>{var W,ae;const le=(W=Ie==null?void 0:Ie.position)!==null&&W!==void 0?W:z;le?rn(le):p?ht.current&&rn(ht.current):j!=null&&j.isConnected&&Oc({place:(ae=Ie==null?void 0:Ie.place)!==null&&ae!==void 0?ae:a,offset:c,elementReference:j,tooltipReference:U.current,tooltipArrowReference:ee.current,strategy:f,middlewares:m,border:V}).then(je=>{Ae.current&&tn(je)})},[Ee,j,oe,G,a,Ie==null?void 0:Ie.place,c,f,z,Ie==null?void 0:Ie.position,p]);v.useEffect(()=>{var W,ae;const le=new Set(At);We.forEach(Se=>{ce!=null&&ce(Se)||le.add({current:Se})});const je=document.querySelector(`[id='${i}']`);je&&!(ce!=null&&ce(je))&&le.add({current:je});const Ue=()=>{Pe(!1)},lt=Nc(j),Je=Nc(U.current);mt.scroll&&(window.addEventListener("scroll",Ue),lt==null||lt.addEventListener("scroll",Ue),Je==null||Je.addEventListener("scroll",Ue));let Ye=null;mt.resize?window.addEventListener("resize",Ue):j&&U.current&&(Ye=_w(j,U.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const ut=Se=>{Se.key==="Escape"&&Pe(!1)};mt.escape&&window.addEventListener("keydown",ut),mt.clickOutsideAnchor&&window.addEventListener("click",Vn);const Ne=[],Kn=Se=>{Ee&&(Se==null?void 0:Se.target)===j||Ln(Se)},Eo=Se=>{Ee&&(Se==null?void 0:Se.target)===j&&ct()},xt=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],bi=["click","dblclick","mousedown","mouseup"];Object.entries(en).forEach(([Se,Ft])=>{Ft&&(xt.includes(Se)?Ne.push({event:Se,listener:nt}):bi.includes(Se)&&Ne.push({event:Se,listener:Kn}))}),Object.entries(hn).forEach(([Se,Ft])=>{Ft&&(xt.includes(Se)?Ne.push({event:Se,listener:re}):bi.includes(Se)&&Ne.push({event:Se,listener:Eo}))}),p&&Ne.push({event:"pointermove",listener:gn});const _i=()=>{Xe.current=!0},xi=()=>{Xe.current=!1,ct()};return b&&!tt&&((W=U.current)===null||W===void 0||W.addEventListener("mouseenter",_i),(ae=U.current)===null||ae===void 0||ae.addEventListener("mouseleave",xi)),Ne.forEach(({event:Se,listener:Ft})=>{le.forEach(Mt=>{var $n;($n=Mt.current)===null||$n===void 0||$n.addEventListener(Se,Ft)})}),()=>{var Se,Ft;mt.scroll&&(window.removeEventListener("scroll",Ue),lt==null||lt.removeEventListener("scroll",Ue),Je==null||Je.removeEventListener("scroll",Ue)),mt.resize?window.removeEventListener("resize",Ue):Ye==null||Ye(),mt.clickOutsideAnchor&&window.removeEventListener("click",Vn),mt.escape&&window.removeEventListener("keydown",ut),b&&!tt&&((Se=U.current)===null||Se===void 0||Se.removeEventListener("mouseenter",_i),(Ft=U.current)===null||Ft===void 0||Ft.removeEventListener("mouseleave",xi)),Ne.forEach(({event:Mt,listener:$n})=>{le.forEach(So=>{var Wr;(Wr=So.current)===null||Wr===void 0||Wr.removeEventListener(Mt,$n)})})}},[j,me,Ge,At,We,S,N,F,Dt,y,I]),v.useEffect(()=>{var W,ae;let le=(ae=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s)!==null&&ae!==void 0?ae:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const je=new MutationObserver(Ue=>{const lt=[],Je=[];Ue.forEach(Ye=>{if(Ye.type==="attributes"&&Ye.attributeName==="data-tooltip-id"&&(Ye.target.getAttribute("data-tooltip-id")===t?lt.push(Ye.target):Ye.oldValue===t&&Je.push(Ye.target)),Ye.type==="childList"){if(j){const ut=[...Ye.removedNodes].filter(Ne=>Ne.nodeType===1);if(le)try{Je.push(...ut.filter(Ne=>Ne.matches(le))),Je.push(...ut.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}ut.some(Ne=>{var Kn;return!!(!((Kn=Ne==null?void 0:Ne.contains)===null||Kn===void 0)&&Kn.call(Ne,j))&&(Ke(!1),Pe(!1),$(null),Et(Q),Et(de),!0)})}if(le)try{const ut=[...Ye.addedNodes].filter(Ne=>Ne.nodeType===1);lt.push(...ut.filter(Ne=>Ne.matches(le))),lt.push(...ut.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}}}),(lt.length||Je.length)&&$e(Ye=>[...Ye.filter(ut=>!Je.includes(ut)),...lt])});return je.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{je.disconnect()}},[t,s,Ie==null?void 0:Ie.anchorSelect,j]),v.useEffect(()=>{me()},[me]),v.useEffect(()=>{if(!(te!=null&&te.current))return()=>null;const W=new ResizeObserver(()=>{setTimeout(()=>me())});return W.observe(te.current),()=>{W.disconnect()}},[oe,te==null?void 0:te.current]),v.useEffect(()=>{var W;const ae=document.querySelector(`[id='${i}']`),le=[...We,ae];j&&le.includes(j)||$((W=We[0])!==null&&W!==void 0?W:ae)},[i,We,j]),v.useEffect(()=>(we&&Pe(!0),()=>{Et(Q),Et(de)}),[]),v.useEffect(()=>{var W;let ae=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s;if(!ae&&t&&(ae=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ae)try{const le=Array.from(document.querySelectorAll(ae));$e(le)}catch{$e([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),v.useEffect(()=>{Q.current&&(Et(Q),mn(y))},[y]);const qe=(Z=Ie==null?void 0:Ie.content)!==null&&Z!==void 0?Z:oe,on=Ee&&Object.keys(ve.tooltipStyles).length>0;return v.useImperativeHandle(e,()=>({open:W=>{if(W!=null&&W.anchorSelect)try{document.querySelector(W.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${W.anchorSelect}" is not a valid CSS selector`)}Rt(W??null),W!=null&&W.delay?mn(W.delay):Pe(!0)},close:W=>{W!=null&&W.delay?nn(W.delay):Pe(!1)},activeAnchor:j,place:ve.place,isOpen:!!(Ge&&!x&&qe&&on)})),Ge&&!x&&qe?v.createElement(h,{id:t,role:Y,className:vt("react-tooltip",dr.tooltip,Ho.tooltip,Ho[o],n,`react-tooltip__place-${ve.place}`,dr[on?"show":"closing"],on?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&dr.fixed,b&&dr.clickable),onTransitionEnd:W=>{Et(k),Ee||W.propertyName!=="opacity"||(Ke(!1),Rt(null),B==null||B())},style:{...G,...ve.tooltipStyles,opacity:L!==void 0&&on?L:void 0},ref:U},qe,v.createElement(h,{className:vt("react-tooltip-arrow",dr.arrow,Ho.arrow,r,g&&dr.noArrow),style:{...ve.tooltipArrowStyles,background:M?`linear-gradient(to right bottom, transparent 50%, ${M} 50%)`:void 0},ref:ee})):null},Mw=({content:e})=>v.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),kw=v.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:u="top",offset:d=10,wrapper:f="div",children:m=null,events:h=["hover"],openOnClick:y=!1,positionStrategy:I="absolute",middlewares:p,delayShow:x=0,delayHide:g=0,float:b=!1,hidden:O=!1,noArrow:_=!1,clickable:T=!1,closeOnEsc:S=!1,closeOnScroll:N=!1,closeOnResize:F=!1,openEvents:q,closeEvents:G,globalCloseEvents:z,imperativeModeOnly:ne=!1,style:B,position:ce,isOpen:oe,defaultIsOpen:te=!1,disableStyleInjection:ge=!1,border:we,opacity:A,arrowColor:j,setIsOpen:$,afterShow:V,afterHide:L,disableTooltip:M,role:Y="tooltip"},Z)=>{const[U,ee]=v.useState(r),[Q,de]=v.useState(o),[k,ve]=v.useState(u),[H,Ee]=v.useState(c),[Le,Ge]=v.useState(d),[Ke,Ie]=v.useState(x),[Rt,Qe]=v.useState(g),[ht,At]=v.useState(b),[Pt,Xe]=v.useState(O),[We,$e]=v.useState(f),[Ae,Dt]=v.useState(h),[tt,en]=v.useState(I),[hn,mt]=v.useState(null),[Pe,tn]=v.useState(null),mn=v.useRef(ge),{anchorRefs:nn,activeAnchor:Ln}=Qu(e),ct=Re=>Re==null?void 0:Re.getAttributeNames().reduce((nt,re)=>{var me;return re.startsWith("data-tooltip-")&&(nt[re.replace(/^data-tooltip-/,"")]=(me=Re==null?void 0:Re.getAttribute(re))!==null&&me!==void 0?me:null),nt},{}),rn=Re=>{const nt={place:re=>{var me;ve((me=re)!==null&&me!==void 0?me:u)},content:re=>{ee(re??r)},html:re=>{de(re??o)},variant:re=>{var me;Ee((me=re)!==null&&me!==void 0?me:c)},offset:re=>{Ge(re===null?d:Number(re))},wrapper:re=>{var me;$e((me=re)!==null&&me!==void 0?me:f)},events:re=>{const me=re==null?void 0:re.split(" ");Dt(me??h)},"position-strategy":re=>{var me;en((me=re)!==null&&me!==void 0?me:I)},"delay-show":re=>{Ie(re===null?x:Number(re))},"delay-hide":re=>{Qe(re===null?g:Number(re))},float:re=>{At(re===null?b:re==="true")},hidden:re=>{Xe(re===null?O:re==="true")},"class-name":re=>{mt(re)}};Object.values(nt).forEach(re=>re(null)),Object.entries(Re).forEach(([re,me])=>{var qe;(qe=nt[re])===null||qe===void 0||qe.call(nt,me)})};v.useEffect(()=>{ee(r)},[r]),v.useEffect(()=>{de(o)},[o]),v.useEffect(()=>{ve(u)},[u]),v.useEffect(()=>{Ee(c)},[c]),v.useEffect(()=>{Ge(d)},[d]),v.useEffect(()=>{Ie(x)},[x]),v.useEffect(()=>{Qe(g)},[g]),v.useEffect(()=>{At(b)},[b]),v.useEffect(()=>{Xe(O)},[O]),v.useEffect(()=>{en(I)},[I]),v.useEffect(()=>{mn.current!==ge&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[ge]),v.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:ge==="core",disableBase:ge}}))},[]),v.useEffect(()=>{var Re;const nt=new Set(nn);let re=n;if(!re&&e&&(re=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),re)try{document.querySelectorAll(re).forEach(ae=>{nt.add({current:ae})})}catch{console.warn(`[react-tooltip] "${re}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&nt.add({current:me}),!nt.size)return()=>null;const qe=(Re=Pe??me)!==null&&Re!==void 0?Re:Ln.current,on=new MutationObserver(ae=>{ae.forEach(le=>{var je;if(!qe||le.type!=="attributes"||!(!((je=le.attributeName)===null||je===void 0)&&je.startsWith("data-tooltip-")))return;const Ue=ct(qe);rn(Ue)})}),W={attributes:!0,childList:!1,subtree:!1};if(qe){const ae=ct(qe);rn(ae),on.observe(qe,W)}return()=>{on.disconnect()}},[nn,Ln,Pe,t,n]),v.useEffect(()=>{B!=null&&B.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),we&&!Cc("border",`${we}`)&&console.warn(`[react-tooltip] "${we}" is not a valid \`border\`.`),B!=null&&B.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),A&&!Cc("opacity",`${A}`)&&console.warn(`[react-tooltip] "${A}" is not a valid \`opacity\`.`)},[]);let gn=m;const Vn=v.useRef(null);if(i){const Re=i({content:(Pe==null?void 0:Pe.getAttribute("data-tooltip-content"))||U||null,activeAnchor:Pe});gn=Re?v.createElement("div",{ref:Vn,className:"react-tooltip-content-wrapper"},Re):null}else U&&(gn=U);Q&&(gn=v.createElement(Mw,{content:Q}));const yn={forwardRef:Z,id:e,anchorId:t,anchorSelect:n,className:vt(s,hn),classNameArrow:a,content:gn,contentWrapperRef:Vn,place:k,variant:H,offset:Le,wrapper:We,events:Ae,openOnClick:y,positionStrategy:tt,middlewares:p,delayShow:Ke,delayHide:Rt,float:ht,hidden:Pt,noArrow:_,clickable:T,closeOnEsc:S,closeOnScroll:N,closeOnResize:F,openEvents:q,closeEvents:G,globalCloseEvents:z,imperativeModeOnly:ne,style:B,position:ce,isOpen:oe,defaultIsOpen:te,border:we,opacity:A,arrowColor:j,setIsOpen:$,afterShow:V,afterHide:L,disableTooltip:M,activeAnchor:Pe,setActiveAnchor:Re=>tn(Re),role:Y};return v.createElement(Fw,{...yn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||xc({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||xc({css:`
51
- .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function jw(){return l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[l.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[l.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_2896_16290",children:l.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function Lw({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:jw()}),l.jsx(kw,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const Vw="Each field must be mapped to a unique value";function ua({field:e,onSelectChange:t,allFields:n}){var g;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Ht(),[s,a]=v.useState(!0),{isError:c,removeError:u,getError:d}=Tt(),f=(g=r==null?void 0:r.read)==null?void 0:g.selectedFieldMappings,m=f==null?void 0:f[e.mapToName];v.useEffect(()=>{e._default&&!m&&o&&r&&ii(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,m,r]);const h=v.useMemo(()=>n.map(b=>({id:b.fieldName,label:b.displayName,value:b.fieldName})),[n]),y=l.jsx(Ku,{disabled:s,items:h,selectedValue:m||null,onSelectedItemChange:b=>{t({target:{name:e.mapToName,value:b==null?void 0:b.value}})},placeholder:"Please select one",style:{width:"100%"}}),I=v.useCallback(()=>{o&&(ii(o,i,[{field:e.mapToName,value:null}]),c(ue.MAPPING,o)&&u(ue.MAPPING,o))},[e.mapToName,o,i,c,u]),{hasDuplicationError:p,errorMessage:x}=v.useMemo(()=>{const b=d(ue.MAPPING,o),O=Array.isArray(b)&&b.length>0&&b.includes(e.mapToName);return{hasDuplicationError:O,errorMessage:O?Vw:""}},[o,d,e.mapToName]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[l.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName}),l.jsx("span",{children:(e==null?void 0:e.prompt)&&l.jsx(Lw,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[y,l.jsx(at,{type:"button",variant:"ghost",onClick:I,children:"Clear"})]})]},e.mapToName),p&&l.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",x," "]},e.mapToName)]})}const Kw="_formControl_9qd8d_1",$w="_formLabel_9qd8d_5",qw="_formLabelRequired_9qd8d_11",Uw="_formInput_9qd8d_16",Hw="_formInputInvalid_9qd8d_20",Bw="_formError_9qd8d_24",Ww="_disabled_9qd8d_30",Hn={formControl:Kw,formLabel:$w,formLabelRequired:qw,formInput:Uw,formInputInvalid:Hw,formError:Bw,disabled:Ww};function bo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return l.jsxs("div",{className:vt(Hn.formControl,{[Hn.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:vt(Hn.formLabel,{[Hn.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:vt(Hn.formInput,{[Hn.formInputInvalid]:o}),children:s}),o&&i&&l.jsx("div",{className:Hn.formError,role:"alert",children:i})]})}const Jw="_divider_1kmoj_1",Tc={divider:Jw};function _o({className:e,style:t}){return l.jsx("hr",{className:e?`${Tc.divider} ${e}`:Tc.divider,style:t})}function yi({string:e}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(_o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Xu({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:o}){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(c=>e[c]===r),a=[n,...s];return o(ue.MAPPING,t,a),!0}return!1}function zw({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>l.jsx(bo,{id:r.mapToName,children:l.jsx(ua,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function Gw(){var y,I;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Ht(),{isError:r,removeError:o,setError:i}=Tt(),s=((y=t==null?void 0:t.read)==null?void 0:y.allFields)||[],{fieldMapping:a}=et(),c=(I=t==null?void 0:t.read)==null?void 0:I.selectedFieldMappings,u=p=>{const{value:x,name:g}=p.target;!x||Xu({selectedFieldMappings:c,selectedObjectName:e,fieldName:g,fieldValue:x,setError:i})||(e&&ii(e,n,[{field:g,value:x}]),r(ue.MAPPING,g)&&o(ue.MAPPING,g),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},d=v.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(p=>!p.fieldName),[a,e]),f=v.useMemo(()=>{var g;return(((g=t==null?void 0:t.read)==null?void 0:g.optionalMapFields)||[]).filter(b=>!d.some(O=>O.mapToName===b.mapToName))},[t,d]),m=d.length>0;return f.length>0||m?l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:"Map the following optional fields"}),l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[f==null?void 0:f.map(p=>l.jsx(bo,{id:p.mapToName,children:l.jsx(ua,{allFields:s,field:p,onSelectChange:u})},p.mapToName)),m&&l.jsx(zw,{dynamicFieldMappings:d,onSelectChange:u,allFields:s})]})]}):null}function Qw(){var u;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Ht(),{isError:r,removeError:o,setError:i}=Tt(),s=(u=t==null?void 0:t.read)==null?void 0:u.selectedFieldMappings,a=d=>{const{value:f,name:m}=d.target;!f||Xu({selectedFieldMappings:s,selectedObjectName:e,fieldName:m,fieldValue:f,setError:i})||(e&&ii(e,n,[{field:m,value:f}]),r(ue.MAPPING,m)&&o(ue.MAPPING,m),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},c=v.useMemo(()=>{var d;return((d=t==null?void 0:t.read)==null?void 0:d.requiredMapFields)||[]},[t]);return c!=null&&c.length?l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(d=>{var f;return l.jsx(bo,{id:d.mapToName,isInvalid:r(ue.MAPPING,d.mapToName),errorMessage:"* required",children:l.jsx(ua,{allFields:((f=t==null?void 0:t.read)==null?void 0:f.allFields)||[],field:d,onSelectChange:a})},d.mapToName)})})]}):null}const Xw={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function Yw({children:e,style:t}){return l.jsx(kn,{style:{...Xw,...t},children:e})}const Zw=e=>{const t=pn(),{provider:n}=et(),r=e||n;return Vr({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},jn=e=>{const t=Zw(e),{data:n}=t,{provider:r}=et(),o=n&&Ol(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function eI(){var u,d,f;const{project:e}=ke(),{hydratedRevision:t}=Ur(),{selectedObjectName:n}=Ht(),{providerName:r}=jn(),o=e==null?void 0:e.appName,i=(f=(d=(u=t==null?void 0:t.content)==null?void 0:u.read)==null?void 0:d.objects)==null?void 0:f.find(m=>m.objectName===n),s=(i==null?void 0:i.displayName)||n&&Tr(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&Tr(a);return c&&o&&r?l.jsx(Yw,{style:{marginTop:"1rem"},children:l.jsxs("p",{style:{margin:"1rem 0"},children:[l.jsx("b",{children:c})," in ",o," is mapped to ",l.jsx("b",{children:s})," in ",r,"."]})}):null}function Rc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function da(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Rc(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():Rc(e[o],null)}}}}function si(...e){return D.useCallback(da(...e),e)}function xo(e,t=[]){let n=[];function r(i,s){const a=D.createContext(s),c=n.length;n=[...n,s];const u=f=>{var x;const{scope:m,children:h,...y}=f,I=((x=m==null?void 0:m[e])==null?void 0:x[c])||a,p=D.useMemo(()=>y,Object.values(y));return l.jsx(I.Provider,{value:p,children:h})};u.displayName=i+"Provider";function d(f,m){var I;const h=((I=m==null?void 0:m[e])==null?void 0:I[c])||a,y=D.useContext(h);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const o=()=>{const i=n.map(s=>D.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return D.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,tI(o,...t)]}function tI(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...a,...f}},{});return D.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function $t(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function fa(e){const t=D.useRef(e);return D.useEffect(()=>{t.current=e}),D.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function pa({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=nI({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=fa(n),c=D.useCallback(u=>{if(i){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else o(u)},[i,e,o,a]);return[s,c]}function nI({defaultProp:e,onChange:t}){const n=D.useState(e),[r]=n,o=D.useRef(r),i=fa(t);return D.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function rI(e){const t=D.useRef({value:e,previous:e});return D.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var co=globalThis!=null&&globalThis.document?D.useLayoutEffect:()=>{};function iI(e){const[t,n]=D.useState(void 0);return co(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function oI(e,t){return D.useReducer((n,r)=>t[n][r]??n,e)}var ha=e=>{const{present:t,children:n}=e,r=sI(t),o=typeof n=="function"?n({present:r.isPresent}):D.Children.only(n),i=si(r.ref,aI(o));return typeof n=="function"||r.isPresent?D.cloneElement(o,{ref:i}):null};ha.displayName="Presence";function sI(e){const[t,n]=D.useState(),r=D.useRef({}),o=D.useRef(e),i=D.useRef("none"),s=e?"mounted":"unmounted",[a,c]=oI(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return D.useEffect(()=>{const u=Ki(r.current);i.current=a==="mounted"?u:"none"},[a]),co(()=>{const u=r.current,d=o.current;if(d!==e){const m=i.current,h=Ki(u);e?c("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),co(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=h=>{const I=Ki(r.current).includes(h.animationName);if(h.target===t&&I&&(c("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},m=h=>{h.target===t&&(i.current=Ki(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:D.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Ki(e){return(e==null?void 0:e.animationName)||"none"}function aI(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Yu=D.forwardRef((e,t)=>{const{children:n,...r}=e,o=D.Children.toArray(n),i=o.find(lI);if(i){const s=i.props.children,a=o.map(c=>c===i?D.Children.count(s)>1?D.Children.only(null):D.isValidElement(s)?s.props.children:null:c);return l.jsx(Es,{...r,ref:t,children:D.isValidElement(s)?D.cloneElement(s,void 0,a):null})}return l.jsx(Es,{...r,ref:t,children:n})});Yu.displayName="Slot";var Es=D.forwardRef((e,t)=>{const{children:n,...r}=e;if(D.isValidElement(n)){const o=dI(n);return D.cloneElement(n,{...uI(r,n.props),ref:t?da(t,o):o})}return D.Children.count(n)>1?D.Children.only(null):null});Es.displayName="SlotClone";var cI=({children:e})=>l.jsx(l.Fragment,{children:e});function lI(e){return D.isValidElement(e)&&e.type===cI}function uI(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function dI(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Zu=fI.reduce((e,t)=>{const n=D.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?Yu:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),ma="Checkbox",[pI,$_]=xo(ma),[hI,mI]=pI(ma),ed=D.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c="on",onCheckedChange:u,form:d,...f}=e,[m,h]=D.useState(null),y=si(t,O=>h(O)),I=D.useRef(!1),p=m?d||!!m.closest("form"):!0,[x=!1,g]=pa({prop:o,defaultProp:i,onChange:u}),b=D.useRef(x);return D.useEffect(()=>{const O=m==null?void 0:m.form;if(O){const _=()=>g(b.current);return O.addEventListener("reset",_),()=>O.removeEventListener("reset",_)}},[m,g]),l.jsxs(hI,{scope:n,state:x,disabled:a,children:[l.jsx(Zu.button,{type:"button",role:"checkbox","aria-checked":Pn(x)?"mixed":x,"aria-required":s,"data-state":rd(x),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:y,onKeyDown:$t(e.onKeyDown,O=>{O.key==="Enter"&&O.preventDefault()}),onClick:$t(e.onClick,O=>{g(_=>Pn(_)?!0:!_),p&&(I.current=O.isPropagationStopped(),I.current||O.stopPropagation())})}),p&&l.jsx(gI,{control:m,bubbles:!I.current,name:r,value:c,checked:x,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Pn(i)?!1:i})]})});ed.displayName=ma;var td="CheckboxIndicator",nd=D.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=mI(td,n);return l.jsx(ha,{present:r||Pn(i.state)||i.state===!0,children:l.jsx(Zu.span,{"data-state":rd(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});nd.displayName=td;var gI=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=D.useRef(null),a=rI(n),c=iI(t);D.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&h){const y=new Event("click",{bubbles:r});d.indeterminate=Pn(n),h.call(d,Pn(n)?!1:n),d.dispatchEvent(y)}},[a,n,r]);const u=D.useRef(Pn(n)?!1:n);return l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??u.current,...i,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Pn(e){return e==="indeterminate"}function rd(e){return Pn(e)?"indeterminate":e?"checked":"unchecked"}var id=ed,od=nd;function sd(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var yI=["color"],ad=v.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=sd(e,yI);return v.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v.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"}))}),vI=["color"],wI=v.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=sd(e,vI);return v.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const II="_checkboxGroupContainer_1ya1t_1",bI="_stack_1ya1t_6",_I="_selectAllContainer_1ya1t_11",xI="_fieldContainer_1ya1t_18",OI="_checkbox_1ya1t_1",jr={checkboxGroupContainer:II,stack:bI,selectAllContainer:_I,fieldContainer:xI,checkbox:OI};function cd({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:jr.fieldContainer,children:[l.jsx(id,{className:jr.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(od,{children:l.jsx(ad,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function ld({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:jr.selectAllContainer,children:[l.jsx(id,{className:jr.checkbox,id:e,onCheckedChange:r,children:l.jsxs(od,{children:[o&&l.jsx(wI,{}),t===!0&&l.jsx(ad,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function ud({children:e}){return l.jsx("div",{className:jr.checkboxGroupContainer,children:e})}function dd({children:e}){return l.jsx("div",{className:jr.stack,children:e})}function CI(e,t,n){var o,i;const r=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(i=e.read)!=null&&i.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,c=!Ml(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function Ac(e,t,n,r){t(e,o=>CI(o,n,r))}function EI(){var f,m;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Ht(),o=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,i=(h,y)=>{h!=="indeterminate"&&r&&t&&Ac(r,n,y,h)},s=(m=t==null?void 0:t.read)==null?void 0:m.optionalFields,a=h=>{r&&s&&s.forEach(y=>{Dn(y)||Ac(r,n,y.fieldName,h)})},c=!!(s&&s.length>0),u=Object.keys(o||{}).length===(s==null?void 0:s.length),d=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:`${e} reads the following optional fields`}),l.jsxs(ud,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(ld,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:a,isIndeterminate:d}),l.jsx(dd,{children:s.map(h=>Dn(h)?null:l.jsx(cd,{id:h.fieldName,isChecked:!!(o!=null&&o[h==null?void 0:h.fieldName]),label:h.displayName,onCheckedChange:y=>i(y,h.fieldName)},h.fieldName))})]})]})}function SI(){return l.jsx(EI,{})}const NI={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 TI({children:e,style:t,...n}){return l.jsx("span",{style:{...NI,...t},...n,children:e})}function RI(){var r,o,i;const{configureState:e,selectedObjectName:t}=Ht(),{appName:n}=ke();return l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:`${n} reads the following ${t} fields`}),l.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(o=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&o.length?(i=e.read)==null?void 0:i.requiredFields.map(s=>Dn(s)?null:l.jsx(TI,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function AI(e,t,n,r,o){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[o]||(e.read.selectedValueMappings[o]={}),r===""&&e.read.selectedValueMappings[o][n]?delete e.read.selectedValueMappings[o][n]:e.read.selectedValueMappings[o][n]=r)}function fd(e,t,n,r,o){t(e,i=>AI(i,e,n,r,o))}function PI(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function DI({string:e,fieldName:t}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,l.jsx("b",{children:t})]}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(_o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function FI({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var _;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Ht(),[c,u]=v.useState(!0),{getError:d,setError:f,resetBoundary:m,isError:h,removeError:y}=Tt(),I=v.useMemo(()=>{var T,S;return((S=(T=i==null?void 0:i.read)==null?void 0:T.selectedValueMappings)==null?void 0:S[n])||{}},[(_=i==null?void 0:i.read)==null?void 0:_.selectedValueMappings,n]),p=v.useMemo(()=>I==null?void 0:I[e.mappedValue],[I,e.mappedValue]);v.useEffect(()=>{u(!1)},[e,a,s,p,i]);const x=v.useMemo(()=>r.map(T=>({id:T.value,label:T.displayValue,value:T.value})),[r]),g=v.useCallback(T=>{if(T){if(Object.values(I).some(S=>S===T.value&&S!==p)){const S=[...Object.entries(I).filter(([N,F])=>F===T.value&&F!==p).map(([N])=>N),e.mappedValue];f(ue.VALUE_MAPPING,n,S);return}d(ue.VALUE_MAPPING,n)&&m(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:T.value,fieldName:n}})}},[t,I,p,n,e.mappedValue,m,f,d]),b=v.useMemo(()=>l.jsx(Ku,{disabled:c,items:x,selectedValue:p||null,onSelectedItemChange:g,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,c,x,g,o]),O=v.useCallback(()=>{s&&(fd(s,a,e.mappedValue,"",n),h(ue.VALUE_MAPPING,n)&&y(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,h,y]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[l.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:l.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[b,l.jsx(at,{type:"button",variant:"ghost",onClick:O,children:"Clear"})]})]},e.mappedValue)}function MI(){var h,y,I;const{fieldMapping:e}=et(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Ht(),{isError:o,removeError:i,getError:s}=Tt(),a=(h=n==null?void 0:n.read)==null?void 0:h.selectedFieldMappings,c=(y=n==null?void 0:n.read)==null?void 0:y.selectedValueMappings,u=(I=n==null?void 0:n.read)==null?void 0:I.isValueMappingsModified,d=v.useRef(!1),f=v.useMemo(()=>{const p=t&&e?Object.values(e[t]||{}).flat().filter(x=>x.mappedValues).map(x=>({...x})):[];if(a)for(let x=0;x<p.length;x+=1){const{mapToName:g}=p[x];a!=null&&a[g]&&(p[x].fieldName=a[g])}return p},[t,e,a]),m=v.useCallback(p=>{const{value:x,name:g,fieldName:b}=p.target;x&&(t&&fd(t,r,g,x,b),o(ue.VALUE_MAPPING,g)&&i(ue.VALUE_MAPPING,g))},[t,r,o,i]);return v.useEffect(()=>{var p;if(t&&c){const x=((p=e==null?void 0:e[t])==null?void 0:p.filter(b=>b.fieldName&&b.mappedValues.length>0))||[];x.every(b=>{const O=c[b.fieldName]||{};return Object.keys(O).length===Object.keys(b.mappedValues).length})&&x.length>0?!u&&!d.current&&(PI(t,r,!0),d.current=!0):d.current=!1}},[c,f,t,r,e,u]),f!=null&&f.length?l.jsx(l.Fragment,{children:f.map(p=>{var T,S,N;if(!p.fieldName)return null;const x=(S=(T=n==null?void 0:n.read)==null?void 0:T.allFieldsMetadata)==null?void 0:S[p.fieldName],g=x==null?void 0:x.valueType;if(!["singleSelect","multiSelect"].includes(g))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const b=x==null?void 0:x.values;if(!b)return null;const O=Object.keys(b).length,_=Object.keys((p==null?void 0:p.mappedValues)||[]).length;return O!==_?(console.error("field values and the values to be mapped are not of the same length",p,b),null):l.jsxs(l.Fragment,{children:[l.jsx(DI,{string:"Map the values for ",fieldName:p.mapToDisplayName||p.mapToName||p.fieldName}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(bo,{id:p.mapToName||p.fieldName,children:(N=p==null?void 0:p.mappedValues)==null?void 0:N.map(F=>{var ne,B,ce;const q=s(ue.VALUE_MAPPING,p.fieldName),G=Array.isArray(q)&&q.includes(F.mappedValue),z=((ce=(B=(ne=n==null?void 0:n.read)==null?void 0:ne.allFieldsMetadata)==null?void 0:B[p.fieldName])==null?void 0:ce.values)||[];return l.jsxs(l.Fragment,{children:[l.jsx(FI,{allValueOptions:z,mappedValue:F,onSelectChange:m,fieldName:(p==null?void 0:p.fieldName)||"",hasError:G},`${F.mappedValue}-${p.fieldName}`),G&&l.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${p.mapToName||p.fieldName} must be mapped to a unique value`},F.mappedValue)]})})},p.mapToName||p.fieldName)})]})})}):null}function kI(){return Fy(),l.jsxs(l.Fragment,{children:[l.jsx(eI,{}),l.jsx(RI,{}),l.jsx(Qw,{}),l.jsx(Gw,{}),l.jsx(MI,{}),l.jsx(SI,{})]})}function jI(e,t,n){var r,o,i;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const s=e.write.selectedWriteObjects;if(n&&(s[t]={objectName:t}),n||delete s[t],(i=(o=e==null?void 0:e.write)==null?void 0:o.savedConfig)!=null&&i.selectedWriteObjects){const a=e.write.savedConfig.selectedWriteObjects,u=!ey(a,s);e.write.isWriteModified=u}}}function Pc(e,t,n,r){t(e,o=>{jI(o,n,r)})}function LI(){var f,m,h,y;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Ht(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects,s=(I,p)=>{I!=="indeterminate"&&t&&n&&Pc(t,r,p,I)},a=I=>{var p,x;t&&n&&((x=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null||x.forEach(g=>{Pc(t,r,g.objectName,I)}))},c=!!i,u=Object.keys(o||{}).length===((y=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects)==null?void 0:y.length),d=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:`Allow ${e} to write to these objects`}),l.jsxs(ud,{children:[((i==null?void 0:i.length)||0)>=2&&l.jsx(ld,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:u,label:"Select all"}),l.jsx(dd,{children:i.map(I=>l.jsx(cd,{id:I.objectName,onCheckedChange:p=>s(p,I.objectName),isChecked:!!(o!=null&&o[I.objectName]),label:I.displayName},I.objectName))})]})]})}function VI(){return l.jsx(l.Fragment,{children:l.jsx(LI,{})})}const KI=()=>{const e=pn(),t=Yt();return Ps({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:o})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:o}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),_t(n)}})};function pd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=ke(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=et(),[c,u]=v.useState(!1),d=!r||!o||!(i!=null&&i.id)||c,f=KI(),m=async()=>{d||(u(!0),console.warn("uninstalling installation",{projectId:r,integrationId:o,installationId:i.id}),f.mutate({projectIdOrName:r,integrationId:o,installationId:i.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",i.id),a==null||a(i==null?void 0:i.id),s()},onSettled:()=>u(!1)}))},h=c?"Uninstalling...":e,y=l.jsx(at,{type:"button",onClick:m,disabled:d,variant:t,style:n,children:h});return i!=null&&i.id?y:null}function $I(){const{installation:e}=et();return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e!=null&&e.id?l.jsx("p",{children:"Once you uninstall this integration, its configuration will be lost."}):l.jsx("p",{children:"You've successfully uninstalled the integration."}),l.jsx(pd,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function hd({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var T,S,N,F;const{installation:i}=et(),{hydratedRevision:s,loading:a}=Ur(),{configureState:c,selectedObjectName:u}=Ht(),d=i==null?void 0:i.config,f=d&&u&&!!Al(d,u)||!1,m=((T=c==null?void 0:c.read)==null?void 0:T.isOptionalFieldsModified)||((S=c==null?void 0:c.read)==null?void 0:S.isRequiredMapFieldsModified)||((N=c==null?void 0:c.read)==null?void 0:N.isValueMappingsModified),h=(F=c==null?void 0:c.write)==null?void 0:F.isWriteModified,x=a||n||!c||!u||!(m||h||r||u!==or&&!f),g=u===or,b=u===Xi,O=l.jsx(at,{type:"submit",disabled:x,children:r?"Install":"Save"}),_=l.jsx(at,{type:"button",onClick:t,disabled:x,variant:"ghost",children:"Reset"});return n?l.jsx(ti,{}):l.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px"},children:[O,_]}),l.jsxs(kn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&l.jsx(Ul,{children:typeof o=="string"?o:"Installation Failed."}),a&&l.jsx(ti,{}),s&&!b&&!g&&l.jsx(kI,{}),s&&!b&&g&&l.jsx(VI,{}),!a&&b&&l.jsx($I,{})]})]})}const md=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=et(),{hydratedRevision:s,loading:a}=Ur(),{selectedObjectName:c}=Jl(),{selectedConnection:u}=qr(),d=fi(),{projectId:f}=ke(),{resetBoundary:m,setErrors:h,setError:y,getError:I}=Tt(),{resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:g}=Ks(),b=$l(c||"",x),{onNextIncompleteTab:O}=vy(),_=v.useCallback(()=>{m(ue.INSTALLATION_MUTATION)},[m]),T=v.useCallback(N=>N?F=>{y(ue.INSTALLATION_MUTATION,N,F)}:F=>{console.error("objectName is required to set installation error: ",F)},[y]),S=v.useCallback(N=>N?I(ue.INSTALLATION_MUTATION,N):"",[I]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:u,apiKey:d,projectId:f,resetBoundary:m,setErrors:h,setMutateInstallationError:T,getMutateInstallationError:S,resetMutateInstallationErrorState:_,resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:g,configureState:b,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:O}},qI=void 0;function UI(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:u,resetBoundary:d,setErrors:f,setMutateInstallationError:m,getMutateInstallationError:h,resetMutateInstallationErrorState:y,resetConfigureState:I,objectConfigurationsState:p,resetPendingConfigurationState:x,configureState:g,onInstallSuccess:b,onNextIncompleteTab:O}=md(),[_,T]=v.useState(!1),S=s===or,N=h(s),F=v.useCallback(()=>{d(ue.MAPPING),o!=null&&o.content&&!i&&s&&jl(o,qI,s,I)},[d,o,i,s,I]);v.useEffect(()=>{!g&&(o!=null&&o.content)&&!i&&F()},[g,p,o,i,F]);const q=()=>{y();const{requiredMapFields:ne,selectedFieldMappings:B}=(g==null?void 0:g.read)||{},{errorList:ce}=Fl(ne,B,f);ce.length>0||(s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(T(!0),sy(u,e,t,n,a.id,s,c,o,g,m(s),r,b).finally(()=>{T(!1),x(s),O()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},G=()=>{y(),s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(T(!0),ly(u,e,t,n,a.id,c,o,g,m(s),r,b).finally(()=>{T(!1),x(s),O()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},z=ne=>{ne.preventDefault(),S?G():q()};return l.jsx(hd,{errorMsg:N,isCreateMode:!0,isLoading:_,onSave:z,onReset:F})}function HI({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:c}){const u={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${i}`],installation:{config:e}}};return hr().installationApi.updateInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(d=>{s(d),a==null||a(d.id,d.config)}).catch(d=>{_t(d,c)})}const BI=(e,t,n,r,o,i)=>{const s=Ll(e),a=Vl(e),c=Kl(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:c||{},backfill:i}}}}};return fo(o)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},WI=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=BI(i,r||"",a,a.schedule,c,a.backfill);return f?HI({updateConfig:f,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:u,setInstallation:s,onUpdateSuccess:d}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},JI=(e,t)=>{const r={content:{write:{objects:ql(e)}}};return fo(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},zI=(e,t,n,r,o,i,s,a,c)=>{const u=JI(o,i);if(!u)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const d={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:u}}};return hr().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(f=>{a(f),c==null||c(f.id,f.config)}).catch(f=>{_t(f,s)})};function GI({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:c,setErrors:u,setMutateInstallationError:d,getMutateInstallationError:f,resetConfigureState:m,resetPendingConfigurationState:h,configureState:y,onUpdateSuccess:I,onNextIncompleteTab:p}=md(),[x,g]=v.useState(!1),b=i===or,O=f(i),{config:_}=e,T=v.useCallback(()=>{c(ue.MAPPING),r!=null&&r.content&&!o&&i&&jl(r,_,i,m)},[c,r,o,i,_,m]);v.useEffect(()=>{y||T()},[y,T]);const S=v.useMemo(()=>{var z,ne,B;return(B=(ne=(z=r==null?void 0:r.content)==null?void 0:z.read)==null?void 0:ne.objects)==null?void 0:B.find(ce=>(ce==null?void 0:ce.objectName)===i)},[r,i]),N=()=>{const{requiredMapFields:G,selectedFieldMappings:z}=(y==null?void 0:y.read)||{},{errorList:ne}=Fl(G,z,u);ne.length>0||(r&&e&&i&&s&&a&&S?(g(!0),WI(a,t.id,e.id,i,s,y,n,S,r,d(i),I).finally(()=>{g(!1),h(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},F=()=>{e&&i&&s&&a&&r?(g(!0),zI(a,t.id,e.id,s,y,r,d(i),n,I).finally(()=>{g(!1),h(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},q=G=>{G.preventDefault(),b?F():N()};return l.jsx(hd,{errorMsg:O,onSave:q,onReset:T,isLoading:x})}function QI(){const{integrationObj:e,installation:t}=et();return e?t&&e?l.jsx(GI,{installation:t,integrationObj:e}):l.jsx(UI,{}):l.jsx(bl,{message:"We can't load the integration"})}const XI=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function YI({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:o,apiKey:i,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:u}){const d=XI(s,r);return d?js({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:a,setInstallation:c,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function ZI(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),l.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function ga({text:e,children:t}){return l.jsx(Kr,{children:l.jsxs(kn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(ZI,{}),l.jsx("p",{children:e}),t]})})}function eb({provider:e}){const{providerName:t}=jn(e),n=`You have successfully installed your ${t} integration.`;return l.jsx(ga,{text:n,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(pd,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const tb=e=>{const{read:t,write:n,proxy:r}=(e==null?void 0:e.content)??{};return!t&&!n&&(r==null?void 0:r.enabled)||!1};function nb({children:e}){var O;const{projectId:t}=ke(),n=fi(),{hydratedRevision:r,loading:o}=Ur(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,setInstallation:u,onInstallSuccess:d,isIntegrationDeleted:f}=et(),{selectedConnection:m,isConnectionsLoading:h}=qr(),[y,I]=v.useState(!1),p=o||y,x=(O=r==null?void 0:r.content)==null?void 0:O.provider,g=tb(r),b=_=>{console.error("Error when creating proxy installation:",_)};return v.useEffect(()=>{!p&&!h&&r&&g&&!s&&m&&n&&(i!=null&&i.id)&&!f&&(I(!0),YI({apiKey:n,projectId:t,integrationId:i==null?void 0:i.id,groupRef:a,consumerRef:c,connectionId:m==null?void 0:m.id,hydratedRevision:r,setError:b,setInstallation:u,onInstallSuccess:d}).then(()=>{I(!1)}).catch(_=>{I(!1),console.error("Error when creating proxy installation:",_)}))},[r,g,s,m,n,t,i==null?void 0:i.id,a,c,u,p,d,f,h]),i?p?l.jsx($r,{}):g&&x&&s?l.jsx(eb,{provider:x}):l.jsx("div",{children:e}):l.jsx(Gt,{message:"We can't load the integration"})}function Oo(){const e=pn(),t=Yt();return Ps({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"),_t(n)}})}function gd(){return l.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[l.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),l.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:l.jsxs("picture",{children:[l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),l.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function vi({children:e}){return l.jsx(Kr,{children:l.jsxs(kn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(gd,{})]})})}function wi({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function rb({children:e}){return l.jsx("p",{style:{padding:".5em 0"},children:e})}function Ii({error:e}){return e?l.jsx(Ul,{style:{marginTop:"2em"},children:e}):null}function ya({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:o,title:i}){if(!i&&!r)throw new Error("Either title or providerName is required");return l.jsxs(vi,{children:[l.jsx(wi,{children:i||`Set up ${r} integration`}),l.jsx(Ii,{error:t}),o,l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const ib="_link_oo2kv_1",ob={link:ib};function yd({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:vt(ob.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function vd({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(yd,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const sb="_input_10rzg_1",ab="_inputError_10rzg_27",cb="_error_10rzg_43",Bo={input:sb,inputError:ab,error:cb};function lb({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?vt(Bo.inputError,Bo.input):Bo.input;return l.jsx("input",{id:e,type:t,className:vt(i,n),...o})}const ub="_textarea_18zl4_1",db="_textareaError_18zl4_14",fb="_error_18zl4_29",Wo={textarea:ub,textareaError:db,error:fb};function pb({className:e,isError:t=!1,...n}){const r=t?vt(Wo.textareaError,Wo.textarea):Wo.textarea;return l.jsx("textarea",{className:vt(e,r),...n})}const dn={Input:lb,Textarea:pb};function hb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){var I;const[i,s]=v.useState(!1),a=()=>s(p=>!p),[c,u]=v.useState(""),d=p=>u(p.currentTarget.value),{providerName:f}=jn(e),m=c.length>0,h=o||!m,y=(I=t.apiKeyOpts)==null?void 0:I.docsURL;return l.jsx(ya,{providerName:f,handleSubmit:()=>{n({apiKey:c})},error:r,isButtonDisabled:h,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[y&&l.jsx(vd,{url:y,providerDisplayName:f||Tr(e),credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(dn.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"API Key",onChange:p=>d(p)}),l.jsx(at,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:i?"Hide":"Show"})]})]})})}function mb({...e}){return l.jsx(hb,{...e})}function gb({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=ke(),u=Oo(),d=v.useCallback(f=>{const{apiKey:m}=f,h={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:m}};u.mutate(h)},[c,i,o,r,n,e,u]);return a===null?l.jsx(mb,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function yb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){var g;const[i,s]=v.useState(!1),a=()=>s(b=>!b),[c,u]=v.useState({username:"",password:""}),{username:d,password:f}=c,{providerName:m}=jn(e),h=m||Tr(e),y=(g=t.basicOpts)==null?void 0:g.docsURL,I=d.length>0,p=o||!I,x=b=>{const{name:O,value:_}=b.currentTarget;u(T=>({...T,[O]:_}))};return l.jsx(ya,{providerName:m,handleSubmit:()=>{n({user:d,pass:f})},error:r,isButtonDisabled:p,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[y&&l.jsx(vd,{url:y,providerDisplayName:h,credentialName:"credentials"}),l.jsx(dn.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:b=>x(b)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(dn.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:b=>x(b)}),l.jsx(at,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:i?"Hide":"Show"})]})]})})}function vb({...e}){return l.jsx(yb,{...e})}function wb({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=ke(),u=Oo(),d=v.useCallback(f=>{const{user:m,pass:h}=f,y={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m,password:h}}};u.mutate(y)},[c,i,o,r,n,e,u]);return a===null?l.jsx(vb,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function Ib({...e}){return l.jsx(ya,{...e})}function bb({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=ke(),u=Oo(),d=v.useCallback(()=>{const f={projectIdOrName:c,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};u.mutate(f)},[c,o,r,n,t,e,u]);return s===null?l.jsx(Ib,{handleSubmit:d,error:null,providerName:a}):i}const _b=Ms("VITE_AMP_ENABLE_CSRF",!1),xb=Ms("NEXT_AMP_ENABLE_CSRF",!1),Ob=Ms("REACT_APP_AMP_ENABLE_CSRF",!1),Cb=!!_b||!!xb||!!Ob,wd=async(e,t,n,r,o,i,s,a)=>{var u,d;const c=await hr().providerApi.getProvider({provider:o},{headers:{"X-Api-Key":r??""}});if(!c)throw new Error(`Provider ${o} not found`);if(c.authType==="oauth2"&&(((u=c.oauth2Opts)==null?void 0:u.grantType)==="authorizationCode"||((d=c.oauth2Opts)==null?void 0:d.grantType)==="authorizationCodePKCE")){const m=(await hr().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(p=>p.provider===o),h=Ol(o,c);if(!m)throw new Error(`You must first set up a ${h} Provider App using the Ampersand Console.`);const y={connectOAuthParams:{providerWorkspaceRef:i,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:m.id,provider:o,enableCSRFProtection:Cb}};return await hr().oAuthApi.oauthConnect(y,{credentials:"include",headers:{"X-Api-Key":r??"","Content-Type":"application/json"}})}throw new Error(`Provider ${o} does not support an OAuth2 web flow.`)},Dc=600,Fc=600,Eb="AUTHORIZATION_SUCCEEDED",Sb="AUTHORIZATION_FAILED";function Nb(e,t,n,r){return v.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Dc)/2,i=window.screenY+(window.outerHeight-Fc)/2.5,s=`width=${Dc},height=${Fc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Tb(e,t,n){const r=Yt();return v.useCallback(o=>{var i,s;if(o.origin===vg){if(o.data.eventType===Eb){const a=(i=o.data.data)==null?void 0:i.connection;a?(e(a),t==null||t.close(),r.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:o})}o.data.eventType===Sb&&(console.error("OAuth failed: ",{event:o}),n==null||n(((s=o==null?void 0:o.data)==null?void 0:s.message)??"Something went wrong. Please try again."))}},[t,n,r,e])}function Id({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o}){const[i,s]=v.useState(null),[a,c]=v.useState(null),u=Tb(s,a,r),d=Nb(n,c,u,t);return v.useEffect(()=>{t&&!a&&d()},[t,a,d,u,n]),v.useEffect(()=>{if(!a)return;const f=setInterval(()=>{a.closed&&(clearInterval(f),window.removeEventListener("message",u),c(null),!i&&!o?(console.error("OAuth failed. Please try again."),r==null||r("Something went wrong. Please try again.")):i&&(r==null||r(null)))},500);return()=>{clearInterval(f),window.removeEventListener("message",u)}},[a,i,o,u,r]),l.jsx("div",{children:e})}function Rb({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(vi,{children:[l.jsx(wi,{children:`Set up ${r} integration`}),l.jsx(rb,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),l.jsx(Ii,{error:t}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Ab({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const{projectId:s}=ke(),a=fi(),[c,u]=v.useState(null),[d,f]=v.useState(null),m=async()=>{f(null);try{const y=await wd(s,t,r,a,e,void 0,n,o);u(y)}catch(y){console.error("Could not fetch OAuth popup URL."),_t(y),f(y.message??"Unexpected error")}},h=v.useCallback(y=>{f(y),u(null)},[]);return l.jsx(Id,{windowTitle:`Connect to ${i}`,oauthUrl:c,onError:h,children:l.jsx(Rb,{handleSubmit:m,error:d,providerName:i})})}const Pb="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Db({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(vi,{children:[l.jsx(wi,{children:"Enter your Salesforce subdomain"}),l.jsx(yd,{href:Pb,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(Ii,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(dn.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),l.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function Fb({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:o}){return l.jsxs(vi,{children:[l.jsxs(wi,{children:["Enter your ",o," workspace"]}),l.jsx(Ii,{error:n}),l.jsx("br",{}),l.jsx(dn.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:i=>t(i.currentTarget.value)}),l.jsx("br",{}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Mb="salesforce";function kb({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const{projectId:s}=ke(),a=fi(),[c,u]=v.useState(""),[d,f]=v.useState(null),[m,h]=v.useState(null),y=async()=>{if(h(null),!c){h("Workspace is required");return}try{const x=await wd(s,t,r,a,e,c,n,o);f(x)}catch(x){console.error(x),h((x==null?void 0:x.message)??"Unexpected error")}},I=v.useCallback(x=>{h(x),f(null)},[]),p=e===Mb?l.jsx(Db,{handleSubmit:y,setWorkspace:u,error:m,isButtonDisabled:c.length===0}):l.jsx(Fb,{handleSubmit:y,setWorkspace:u,error:m,isButtonDisabled:c.length===0,providerName:i});return l.jsx(Id,{windowTitle:`Connect to ${i}`,oauthUrl:d,onError:I,children:p})}function jb({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:o,explicitWorkspaceRequired:i}){const[s,a]=v.useState(!1),[c,u]=v.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),d=()=>a(_=>!_),f=_=>{const{name:T,value:S}=_.currentTarget;u(N=>({...N,[T]:S}))},{clientSecret:m,clientId:h,workspace:y,scopes:I}=c,p=m.length>0,x=h.length>0,g=i?y.length>0:!0,b=n||!p||!x||!g,O=()=>{const _={clientId:h,clientSecret:m};i&&(_.workspace=y),o&&I.length>0&&(_.scopes=Kg(I)),e(_)};return l.jsxs(vi,{children:[l.jsx(wi,{children:`Set up ${r} integration`}),l.jsx(Ii,{error:t}),l.jsx("br",{}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[i&&l.jsx(dn.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:_=>f(_)}),l.jsx(dn.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:_=>f(_)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(dn.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:_=>f(_)}),l.jsx(at,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:d,children:s?"Hide":"Show"})]}),o&&l.jsx(dn.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:_=>f(_)})]}),l.jsx("br",{}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:b,type:"submit",onClick:O,children:"Next"})]})}function Lb({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c}){const{projectIdOrName:u}=ke(),d=Oo(),[f,m]=v.useState(null),h=v.useCallback(y=>{m(null);const I={projectIdOrName:u,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:y.workspace,oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret,scopes:y.scopes}}};d.mutate(I,{onError:()=>m("Error loading provider info")})},[u,i,o,r,n,e,d]);return c===null?l.jsx(jb,{providerName:t,handleSubmit:h,error:f,explicitScopesRequired:s,explicitWorkspaceRequired:a}):l.jsx(ti,{})}function Vb({...e}){return l.jsx(Lb,{...e})}const Kb="authorizationCode",$b="authorizationCodePKCE",qb="clientCredentials";function Ub({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=jn(e);if(t.oauth2Opts===void 0)return l.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:u,explicitScopesRequired:d,explicitWorkspaceRequired:f}=t.oauth2Opts,m={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return u===Kb||u===$b?f?l.jsx(kb,{...m}):l.jsx(Ab,{...m}):u===qb?l.jsx(Vb,{...m,explicitWorkspaceRequired:f,explicitScopesRequired:d,selectedConnection:s,setSelectedConnection:a}):u==="password"?l.jsx("em",{children:"Password flow not supported yet"}):l.jsxs("em",{children:["Unsupported grant type: ",u]})}function Hb(e){const{selectedConnection:t}=qr();v.useEffect(()=>{e&&t&&e(t)},[e,t])}function Bb({onSuccess:e}){Hb(e)}function bd({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:u,isLoading:d,isError:f,error:m,providerName:h,selectedProvider:y}=jn(e),{provider:I,isIntegrationDeleted:p}=et(),{selectedConnection:x,setSelectedConnection:g}=qr();Bb({onSuccess:s});const b=Yt();v.useEffect(()=>{f&&(console.error("Error loading provider info."),_t(m))},[f,m]);const O=v.useCallback(()=>{b.clear(),c()},[c,b]);if(!e&&!I)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return l.jsx(ga,{text:"Integration successfully uninstalled.",children:l.jsx(at,{type:"button",onClick:O,style:{width:"100%"},children:"Reinstall Integration"})});if(x)return i;if(d)return l.jsx($r,{});if(u==null)return l.jsx(Gt,{message:"Provider info was not found."});const _={provider:y,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:x,setSelectedConnection:g,providerName:h,providerInfo:u,onDisconnectSuccess:a};return u.authType==="none"?l.jsx(bb,{..._,children:i}):u.authType==="basic"?l.jsx(wb,{..._,children:i}):u.authType==="apiKey"?l.jsx(gb,{..._,children:i}):l.jsx(Ub,{..._})}var lo=D.forwardRef((e,t)=>{const{children:n,...r}=e,o=D.Children.toArray(n),i=o.find(Jb);if(i){const s=i.props.children,a=o.map(c=>c===i?D.Children.count(s)>1?D.Children.only(null):D.isValidElement(s)?s.props.children:null:c);return l.jsx(Ss,{...r,ref:t,children:D.isValidElement(s)?D.cloneElement(s,void 0,a):null})}return l.jsx(Ss,{...r,ref:t,children:n})});lo.displayName="Slot";var Ss=D.forwardRef((e,t)=>{const{children:n,...r}=e;if(D.isValidElement(n)){const o=Gb(n),i=zb(r,n.props);return n.type!==D.Fragment&&(i.ref=t?da(t,o):o),D.cloneElement(n,i)}return D.Children.count(n)>1?D.Children.only(null):null});Ss.displayName="SlotClone";var Wb=({children:e})=>l.jsx(l.Fragment,{children:e});function Jb(e){return D.isValidElement(e)&&e.type===Wb}function zb(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Gb(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Qb(e){const t=e+"CollectionProvider",[n,r]=xo(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=h=>{const{scope:y,children:I}=h,p=v.useRef(null),x=v.useRef(new Map).current;return l.jsx(o,{scope:y,itemMap:x,collectionRef:p,children:I})};s.displayName=t;const a=e+"CollectionSlot",c=v.forwardRef((h,y)=>{const{scope:I,children:p}=h,x=i(a,I),g=si(y,x.collectionRef);return l.jsx(lo,{ref:g,children:p})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=v.forwardRef((h,y)=>{const{scope:I,children:p,...x}=h,g=v.useRef(null),b=si(y,g),O=i(u,I);return v.useEffect(()=>(O.itemMap.set(g,{ref:g,...x}),()=>void O.itemMap.delete(g))),l.jsx(lo,{[d]:"",ref:b,children:p})});f.displayName=u;function m(h){const y=i(e+"CollectionConsumer",h);return v.useCallback(()=>{const p=y.collectionRef.current;if(!p)return[];const x=Array.from(p.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((O,_)=>x.indexOf(O.ref.current)-x.indexOf(_.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},m,r]}var Xb=D.useId||(()=>{}),Yb=0;function _d(e){const[t,n]=D.useState(Xb());return co(()=>{e||n(r=>r??String(Yb++))},[e]),e||(t?`radix-${t}`:"")}var Zb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Br=Zb.reduce((e,t)=>{const n=D.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?lo:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),e_=D.createContext(void 0);function xd(e){const t=D.useContext(e_);return e||t||"ltr"}var Jo="rovingFocusGroup.onEntryFocus",t_={bubbles:!1,cancelable:!0},Co="RovingFocusGroup",[Ns,Od,n_]=Qb(Co),[r_,Cd]=xo(Co,[n_]),[i_,o_]=r_(Co),Ed=D.forwardRef((e,t)=>l.jsx(Ns.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Ns.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(s_,{...e,ref:t})})}));Ed.displayName=Co;var s_=D.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,m=D.useRef(null),h=si(t,m),y=xd(i),[I=null,p]=pa({prop:s,defaultProp:a,onChange:c}),[x,g]=D.useState(!1),b=fa(u),O=Od(n),_=D.useRef(!1),[T,S]=D.useState(0);return D.useEffect(()=>{const N=m.current;if(N)return N.addEventListener(Jo,b),()=>N.removeEventListener(Jo,b)},[b]),l.jsx(i_,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:I,onItemFocus:D.useCallback(N=>p(N),[p]),onItemShiftTab:D.useCallback(()=>g(!0),[]),onFocusableItemAdd:D.useCallback(()=>S(N=>N+1),[]),onFocusableItemRemove:D.useCallback(()=>S(N=>N-1),[]),children:l.jsx(Br.div,{tabIndex:x||T===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:$t(e.onMouseDown,()=>{_.current=!0}),onFocus:$t(e.onFocus,N=>{const F=!_.current;if(N.target===N.currentTarget&&F&&!x){const q=new CustomEvent(Jo,t_);if(N.currentTarget.dispatchEvent(q),!q.defaultPrevented){const G=O().filter(oe=>oe.focusable),z=G.find(oe=>oe.active),ne=G.find(oe=>oe.id===I),ce=[z,ne,...G].filter(Boolean).map(oe=>oe.ref.current);Td(ce,d)}}_.current=!1}),onBlur:$t(e.onBlur,()=>g(!1))})})}),Sd="RovingFocusGroupItem",Nd=D.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=_d(),c=i||a,u=o_(Sd,n),d=u.currentTabStopId===c,f=Od(n),{onFocusableItemAdd:m,onFocusableItemRemove:h}=u;return D.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),l.jsx(Ns.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:l.jsx(Br.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:$t(e.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:$t(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:$t(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const I=l_(y,u.orientation,u.dir);if(I!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let x=f().filter(g=>g.focusable).map(g=>g.ref.current);if(I==="last")x.reverse();else if(I==="prev"||I==="next"){I==="prev"&&x.reverse();const g=x.indexOf(y.currentTarget);x=u.loop?u_(x,g+1):x.slice(g+1)}setTimeout(()=>Td(x))}})})})});Nd.displayName=Sd;var a_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function c_(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function l_(e,t,n){const r=c_(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return a_[r]}function Td(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function u_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var d_=Ed,f_=Nd,va="Tabs",[p_,q_]=xo(va,[Cd]),Rd=Cd(),[h_,wa]=p_(va),Ad=D.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=xd(a),[f,m]=pa({prop:r,onChange:o,defaultProp:i});return l.jsx(h_,{scope:n,baseId:_d(),value:f,onValueChange:m,orientation:s,dir:d,activationMode:c,children:l.jsx(Br.div,{dir:d,"data-orientation":s,...u,ref:t})})});Ad.displayName=va;var Pd="TabsList",Dd=D.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=wa(Pd,n),s=Rd(n);return l.jsx(d_,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(Br.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Dd.displayName=Pd;var Fd="TabsTrigger",Md=D.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=wa(Fd,n),a=Rd(n),c=jd(s.baseId,r),u=Ld(s.baseId,r),d=r===s.value;return l.jsx(f_,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(Br.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:$t(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:$t(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:$t(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!o&&f&&s.onValueChange(r)})})})});Md.displayName=Fd;var kd="TabsContent",m_=D.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=wa(kd,n),c=jd(a.baseId,r),u=Ld(a.baseId,r),d=r===a.value,f=D.useRef(d);return D.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(ha,{present:o||d,children:({present:m})=>l.jsx(Br.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&i})})});m_.displayName=kd;function jd(e,t){return`${e}-trigger-${t}`}function Ld(e,t){return`${e}-content-${t}`}var g_=Ad,y_=Dd,Vd=Md;const v_=l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[l.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),l.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function w_(e,t){return t?v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},v.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?v_:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:l.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function I_(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const b_="_tabsRoot_ktpr0_1",__="_tabsList_ktpr0_6",x_="_tabTrigger_ktpr0_12",O_="_danger_ktpr0_29",ai={tabsRoot:b_,tabsList:__,tabTrigger:x_,danger:O_};function Kd({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(Vd,{value:e,className:ai.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[w_(t,n),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsx("span",{children:r||e}),n&&l.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function C_({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(_o,{style:{margin:"1rem 0"}}),l.jsx(Kd,{objectName:or,completed:e,pending:t,displayName:n},"other-write")]})}function E_(){return l.jsxs(l.Fragment,{children:[l.jsx(_o,{style:{margin:"3rem 0 1rem 0"}}),l.jsx(Vd,{value:Xi,className:vt(ai.tabTrigger,ai.danger),children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[I_(),l.jsx("span",{children:"Uninstall"})]})})]})}function S_({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o,showUninstallButton:i}){var s,a;return l.jsx(g_,{value:e,className:ai.tabsRoot,onValueChange:n,children:l.jsxs(y_,{className:ai.tabsList,children:[t.map(c=>{var u,d,f,m,h,y;return l.jsx(Kd,{objectName:c.name,displayName:c.displayName,completed:c.completed,pending:((d=(u=r==null?void 0:r[c.name])==null?void 0:u.read)==null?void 0:d.isOptionalFieldsModified)||((m=(f=r==null?void 0:r[c.name])==null?void 0:f.read)==null?void 0:m.isRequiredMapFieldsModified)||((y=(h=r==null?void 0:r[c.name])==null?void 0:h.read)==null?void 0:y.isValueMappingsModified)||!1},c.name)}),o&&l.jsx(C_,{completed:o.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),i&&l.jsx(E_,{})]})})}function N_(e,t){return t===Xi?{name:Xi,completed:!1}:e.find(n=>n.name===t)}function T_({children:e}){var x;const{project:t}=ke(),{installation:n}=et(),{providerName:r}=jn(),{hydratedRevision:o}=Ur(),{objectConfigurationsState:i}=Ks(),[s,a]=v.useState(""),c=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=o&&Pl(u,o),f=d!==null,m=!!((x=o==null?void 0:o.content)!=null&&x.write),h=m?Dl(u):void 0,y=v.useMemo(()=>{const g=[...d||[]];return h&&m&&g.push(h),g},[d,h,m]),I=N_(y,s),p=v.useCallback(()=>{const g=y.find(b=>I!==b&&!b.completed);g&&a(g.name)},[y,I]);return v.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,p]),l.jsx(zl.Provider,{value:p,children:l.jsx(Wl.Provider,{value:I==null?void 0:I.name,children:l.jsxs(Kr,{style:{maxWidth:"55rem"},children:[l.jsxs(kn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[l.jsxs("div",{style:{width:"20rem"},children:[l.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),l.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),f&&l.jsx(S_,{value:s,readNavObjects:d,onValueChange:g=>a(g),objectConfigurationsState:i,writeNavObject:h,showUninstallButton:!!n})]}),e]}),l.jsx(gd,{})]})})})}function R_({...e}){return l.jsx(T_,{...e})}function A_({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var p;const{projectIdOrName:u,isLoading:d}=ke(),{isLoading:f}=Fs(),{isError:m,errorState:h}=Tt(),{seed:y,reset:I}=Nl();return d||f?l.jsx($r,{}):m(ue.PROJECT,u)?l.jsx(Gt,{message:`Error loading project ${u}`}):m(ue.INTEGRATION_LIST,u)?l.jsx(Gt,{message:"Error retrieving integrations for the project, double check the API key"}):(p=h[ue.INTEGRATION_LIST])!=null&&p.apiError?l.jsx(Gt,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:Tl.resetContainer,children:l.jsx(Ug,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(Sl,{children:l.jsx(bd,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:I,children:l.jsx(yy,{children:l.jsx(nb,{children:l.jsx(Ay,{children:l.jsx(R_,{children:l.jsx(QI,{})})})})})})})},y)})}function P_(){return l.jsxs(Kr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(ti,{}),l.jsx("p",{children:"Redirecting"})]})}function D_({redirectURL:e,children:t}){return v.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(P_,{}):t}const F_=()=>{const e=pn(),t=Yt();return Ps({mutationKey:["deleteConnection"],mutationFn:async({projectIdOrName:n,connectionId:r})=>(await e()).connectionApi.deleteConnection({projectIdOrName:n,connectionId:r}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error deleting connection."),_t(n)}})};function M_({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o}){const{projectId:i}=ke(),{selectedConnection:s}=qr(),a=F_(),[c,u]=v.useState(!1),d=!i||!s||!s.id||c,f=async()=>{d||(u(!0),console.warn("deleting connection",{projectId:i,connectionId:s==null?void 0:s.id}),a.mutate({projectIdOrName:i,connectionId:s==null?void 0:s.id},{onSuccess:()=>{console.warn("successfully deleted connection:",s==null?void 0:s.id),r==null||r(s),o()},onSettled:()=>u(!1)}))},m=c?"Disconnecting...":e;return l.jsx(at,{type:"button",onClick:f,disabled:d,variant:t,style:n,children:m})}function k_({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=ke(),{providerName:o}=jn(e),i=`You have successfully connected your ${o} account to ${r}.`;return l.jsx(ga,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(M_,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function j_({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:u,reset:d}=Nl(),f=v.useCallback(m=>{s?s(m.id):c&&c(m)},[s,c]);return l.jsx("div",{className:Tl.resetContainer,children:l.jsx(Sl,{groupRef:r,provider:e,children:l.jsx(bd,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:f,onDisconnectSuccess:a,children:l.jsx(D_,{redirectURL:i,children:l.jsx(k_,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},u)}const L_=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=xl(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r;return v.useEffect(()=>{o&&_t(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r}};exports.AmpersandContext=Il;exports.AmpersandProvider=Eg;exports.ConnectProvider=j_;exports.InstallIntegration=A_;exports.useAmpersandProvider=Sg;exports.useIsIntegrationInstalled=L_;
50
+ */const Dw="react-tooltip-core-styles",Fw="react-tooltip-base-styles",Ic={core:!1,base:!1};function bc({css:e,id:t=Fw,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||Ic[n]||n==="core"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=Dw),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css",s==="top"&&a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),Ic[n]=!0}const _c=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[Tw(Number(o)),Aw({fallbackAxisSideDirection:"start"}),Rw({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(Pw({element:n,padding:5})),wc(e,t,{placement:r,strategy:i,middleware:c}).then(({x:u,y:d,placement:f,middlewareData:h})=>{var m,y;const v={left:`${u}px`,top:`${d}px`,border:a},{x:p,y:x}=(m=h.arrow)!==null&&m!==void 0?m:{x:0,y:0},g=(y={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&y!==void 0?y:"bottom",b=a&&{borderBottom:a,borderRight:a};let O=0;if(a){const _=`${a}`.match(/(\d+)px/);O=_!=null&&_[1]?Number(_[1]):1}return{tooltipStyles:v,tooltipArrowStyles:{left:p!=null?`${p}px`:"",top:x!=null?`${x}px`:"",right:"",bottom:"",...b,[g]:`-${4+O}px`},place:f}})):wc(e,t,{placement:"bottom",strategy:i,middleware:c}).then(({x:u,y:d,placement:f})=>({tooltipStyles:{left:`${u}px`,top:`${d}px`},tooltipArrowStyles:{},place:f}))},xc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Oc=(e,t,n)=>{let r=null;const o=function(...i){const s=()=>{r=null};!r&&(e.apply(this,i),r=setTimeout(s,t))};return o.cancel=()=>{r&&(clearTimeout(r),r=null)},o},Cc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Cs=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>Cs(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Cc(e)||!Cc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Cs(e[o],t[o]))},Mw=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"})},Ec=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Mw(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},kw=typeof window<"u"?w.useLayoutEffect:w.useEffect,Et=e=>{e.current&&(clearTimeout(e.current),e.current=null)},jw="DEFAULT_TOOLTIP_ID",Lw={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Vw=w.createContext({getTooltipData:()=>Lw});function Qu(e=jw){return w.useContext(Vw).getTooltipData(e)}var fr={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},Uo={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const Kw=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:c=10,events:u=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:h,wrapper:m,delayShow:y=0,delayHide:v=0,float:p=!1,hidden:x=!1,noArrow:g=!1,clickable:b=!1,closeOnEsc:O=!1,closeOnScroll:_=!1,closeOnResize:T=!1,openEvents:S,closeEvents:N,globalCloseEvents:D,imperativeModeOnly:q,style:G,position:z,afterShow:ne,afterHide:B,disableTooltip:ce,content:oe,contentWrapperRef:te,isOpen:ge,defaultIsOpen:we=!1,setIsOpen:A,activeAnchor:k,setActiveAnchor:$,border:L,opacity:j,arrowColor:F,role:Y="tooltip"})=>{var Z;const U=w.useRef(null),ee=w.useRef(null),Q=w.useRef(null),de=w.useRef(null),M=w.useRef(null),[ve,H]=w.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ee,Le]=w.useState(!1),[Ge,Ke]=w.useState(!1),[Ie,Rt]=w.useState(null),Qe=w.useRef(!1),ht=w.useRef(null),{anchorRefs:At,setActiveAnchor:Pt}=Qu(t),Xe=w.useRef(!1),[We,$e]=w.useState([]),Ae=w.useRef(!1),Dt=d||u.includes("click"),tt=Dt||(S==null?void 0:S.click)||(S==null?void 0:S.dblclick)||(S==null?void 0:S.mousedown),en=S?{...S}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!S&&Dt&&Object.assign(en,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const hn=N?{...N}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!N&&Dt&&Object.assign(hn,{mouseleave:!1,blur:!1,mouseout:!1});const mt=D?{...D}:{escape:O||!1,scroll:_||!1,resize:T||!1,clickOutsideAnchor:tt||!1};q&&(Object.assign(en,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(hn,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(mt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),kw(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]);const Pe=W=>{Ae.current&&(W&&Ke(!0),setTimeout(()=>{Ae.current&&(A==null||A(W),ge===void 0&&Le(W))},10))};w.useEffect(()=>{if(ge===void 0)return()=>null;ge&&Ke(!0);const W=setTimeout(()=>{Le(ge)},10);return()=>{clearTimeout(W)}},[ge]),w.useEffect(()=>{if(Ee!==Qe.current)if(Et(M),Qe.current=Ee,Ee)ne==null||ne();else{const W=(ae=>{const le=ae.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,je,Ue]=le;return Number(je)*(Ue==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));M.current=setTimeout(()=>{Ke(!1),Rt(null),B==null||B()},W+25)}},[Ee]);const tn=W=>{H(ae=>Cs(ae,W)?ae:W)},mn=(W=y)=>{Et(Q),Ge?Pe(!0):Q.current=setTimeout(()=>{Pe(!0)},W)},nn=(W=v)=>{Et(de),de.current=setTimeout(()=>{Xe.current||Pe(!1)},W)},Vn=W=>{var ae;if(!W)return;const le=(ae=W.currentTarget)!==null&&ae!==void 0?ae:W.target;if(!(le!=null&&le.isConnected))return $(null),void Pt({current:null});y?mn():Pe(!0),$(le),Pt({current:le}),Et(de)},ct=()=>{b?nn(v||100):v?nn():Pe(!1),Et(Q)},rn=({x:W,y:ae})=>{var le;const je={getBoundingClientRect:()=>({x:W,y:ae,width:0,height:0,top:ae,left:W,right:W,bottom:ae})};_c({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:c,elementReference:je,tooltipReference:U.current,tooltipArrowReference:ee.current,strategy:f,middlewares:h,border:L}).then(Ue=>{tn(Ue)})},gn=W=>{if(!W)return;const ae=W,le={x:ae.clientX,y:ae.clientY};rn(le),ht.current=le},Kn=W=>{var ae;if(!Ee)return;const le=W.target;le.isConnected&&(!((ae=U.current)===null||ae===void 0)&&ae.contains(le)||[document.querySelector(`[id='${i}']`),...We].some(je=>je==null?void 0:je.contains(le))||(Pe(!1),Et(Q)))},yn=Oc(Vn,50),Re=Oc(ct,50),nt=W=>{Re.cancel(),yn(W)},re=()=>{yn.cancel(),Re()},me=w.useCallback(()=>{var W,ae;const le=(W=Ie==null?void 0:Ie.position)!==null&&W!==void 0?W:z;le?rn(le):p?ht.current&&rn(ht.current):k!=null&&k.isConnected&&_c({place:(ae=Ie==null?void 0:Ie.place)!==null&&ae!==void 0?ae:a,offset:c,elementReference:k,tooltipReference:U.current,tooltipArrowReference:ee.current,strategy:f,middlewares:h,border:L}).then(je=>{Ae.current&&tn(je)})},[Ee,k,oe,G,a,Ie==null?void 0:Ie.place,c,f,z,Ie==null?void 0:Ie.position,p]);w.useEffect(()=>{var W,ae;const le=new Set(At);We.forEach(Se=>{ce!=null&&ce(Se)||le.add({current:Se})});const je=document.querySelector(`[id='${i}']`);je&&!(ce!=null&&ce(je))&&le.add({current:je});const Ue=()=>{Pe(!1)},lt=Ec(k),Je=Ec(U.current);mt.scroll&&(window.addEventListener("scroll",Ue),lt==null||lt.addEventListener("scroll",Ue),Je==null||Je.addEventListener("scroll",Ue));let Ye=null;mt.resize?window.addEventListener("resize",Ue):k&&U.current&&(Ye=Nw(k,U.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const ut=Se=>{Se.key==="Escape"&&Pe(!1)};mt.escape&&window.addEventListener("keydown",ut),mt.clickOutsideAnchor&&window.addEventListener("click",Kn);const Ne=[],$n=Se=>{Ee&&(Se==null?void 0:Se.target)===k||Vn(Se)},Eo=Se=>{Ee&&(Se==null?void 0:Se.target)===k&&ct()},xt=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],bi=["click","dblclick","mousedown","mouseup"];Object.entries(en).forEach(([Se,Ft])=>{Ft&&(xt.includes(Se)?Ne.push({event:Se,listener:nt}):bi.includes(Se)&&Ne.push({event:Se,listener:$n}))}),Object.entries(hn).forEach(([Se,Ft])=>{Ft&&(xt.includes(Se)?Ne.push({event:Se,listener:re}):bi.includes(Se)&&Ne.push({event:Se,listener:Eo}))}),p&&Ne.push({event:"pointermove",listener:gn});const _i=()=>{Xe.current=!0},xi=()=>{Xe.current=!1,ct()};return b&&!tt&&((W=U.current)===null||W===void 0||W.addEventListener("mouseenter",_i),(ae=U.current)===null||ae===void 0||ae.addEventListener("mouseleave",xi)),Ne.forEach(({event:Se,listener:Ft})=>{le.forEach(Mt=>{var qn;(qn=Mt.current)===null||qn===void 0||qn.addEventListener(Se,Ft)})}),()=>{var Se,Ft;mt.scroll&&(window.removeEventListener("scroll",Ue),lt==null||lt.removeEventListener("scroll",Ue),Je==null||Je.removeEventListener("scroll",Ue)),mt.resize?window.removeEventListener("resize",Ue):Ye==null||Ye(),mt.clickOutsideAnchor&&window.removeEventListener("click",Kn),mt.escape&&window.removeEventListener("keydown",ut),b&&!tt&&((Se=U.current)===null||Se===void 0||Se.removeEventListener("mouseenter",_i),(Ft=U.current)===null||Ft===void 0||Ft.removeEventListener("mouseleave",xi)),Ne.forEach(({event:Mt,listener:qn})=>{le.forEach(So=>{var Jr;(Jr=So.current)===null||Jr===void 0||Jr.removeEventListener(Mt,qn)})})}},[k,me,Ge,At,We,S,N,D,Dt,y,v]),w.useEffect(()=>{var W,ae;let le=(ae=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s)!==null&&ae!==void 0?ae:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const je=new MutationObserver(Ue=>{const lt=[],Je=[];Ue.forEach(Ye=>{if(Ye.type==="attributes"&&Ye.attributeName==="data-tooltip-id"&&(Ye.target.getAttribute("data-tooltip-id")===t?lt.push(Ye.target):Ye.oldValue===t&&Je.push(Ye.target)),Ye.type==="childList"){if(k){const ut=[...Ye.removedNodes].filter(Ne=>Ne.nodeType===1);if(le)try{Je.push(...ut.filter(Ne=>Ne.matches(le))),Je.push(...ut.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}ut.some(Ne=>{var $n;return!!(!(($n=Ne==null?void 0:Ne.contains)===null||$n===void 0)&&$n.call(Ne,k))&&(Ke(!1),Pe(!1),$(null),Et(Q),Et(de),!0)})}if(le)try{const ut=[...Ye.addedNodes].filter(Ne=>Ne.nodeType===1);lt.push(...ut.filter(Ne=>Ne.matches(le))),lt.push(...ut.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}}}),(lt.length||Je.length)&&$e(Ye=>[...Ye.filter(ut=>!Je.includes(ut)),...lt])});return je.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{je.disconnect()}},[t,s,Ie==null?void 0:Ie.anchorSelect,k]),w.useEffect(()=>{me()},[me]),w.useEffect(()=>{if(!(te!=null&&te.current))return()=>null;const W=new ResizeObserver(()=>{setTimeout(()=>me())});return W.observe(te.current),()=>{W.disconnect()}},[oe,te==null?void 0:te.current]),w.useEffect(()=>{var W;const ae=document.querySelector(`[id='${i}']`),le=[...We,ae];k&&le.includes(k)||$((W=We[0])!==null&&W!==void 0?W:ae)},[i,We,k]),w.useEffect(()=>(we&&Pe(!0),()=>{Et(Q),Et(de)}),[]),w.useEffect(()=>{var W;let ae=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s;if(!ae&&t&&(ae=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ae)try{const le=Array.from(document.querySelectorAll(ae));$e(le)}catch{$e([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),w.useEffect(()=>{Q.current&&(Et(Q),mn(y))},[y]);const qe=(Z=Ie==null?void 0:Ie.content)!==null&&Z!==void 0?Z:oe,on=Ee&&Object.keys(ve.tooltipStyles).length>0;return w.useImperativeHandle(e,()=>({open:W=>{if(W!=null&&W.anchorSelect)try{document.querySelector(W.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${W.anchorSelect}" is not a valid CSS selector`)}Rt(W??null),W!=null&&W.delay?mn(W.delay):Pe(!0)},close:W=>{W!=null&&W.delay?nn(W.delay):Pe(!1)},activeAnchor:k,place:ve.place,isOpen:!!(Ge&&!x&&qe&&on)})),Ge&&!x&&qe?w.createElement(m,{id:t,role:Y,className:vt("react-tooltip",fr.tooltip,Uo.tooltip,Uo[o],n,`react-tooltip__place-${ve.place}`,fr[on?"show":"closing"],on?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&fr.fixed,b&&fr.clickable),onTransitionEnd:W=>{Et(M),Ee||W.propertyName!=="opacity"||(Ke(!1),Rt(null),B==null||B())},style:{...G,...ve.tooltipStyles,opacity:j!==void 0&&on?j:void 0},ref:U},qe,w.createElement(m,{className:vt("react-tooltip-arrow",fr.arrow,Uo.arrow,r,g&&fr.noArrow),style:{...ve.tooltipArrowStyles,background:F?`linear-gradient(to right bottom, transparent 50%, ${F} 50%)`:void 0},ref:ee})):null},$w=({content:e})=>w.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),qw=w.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:u="top",offset:d=10,wrapper:f="div",children:h=null,events:m=["hover"],openOnClick:y=!1,positionStrategy:v="absolute",middlewares:p,delayShow:x=0,delayHide:g=0,float:b=!1,hidden:O=!1,noArrow:_=!1,clickable:T=!1,closeOnEsc:S=!1,closeOnScroll:N=!1,closeOnResize:D=!1,openEvents:q,closeEvents:G,globalCloseEvents:z,imperativeModeOnly:ne=!1,style:B,position:ce,isOpen:oe,defaultIsOpen:te=!1,disableStyleInjection:ge=!1,border:we,opacity:A,arrowColor:k,setIsOpen:$,afterShow:L,afterHide:j,disableTooltip:F,role:Y="tooltip"},Z)=>{const[U,ee]=w.useState(r),[Q,de]=w.useState(o),[M,ve]=w.useState(u),[H,Ee]=w.useState(c),[Le,Ge]=w.useState(d),[Ke,Ie]=w.useState(x),[Rt,Qe]=w.useState(g),[ht,At]=w.useState(b),[Pt,Xe]=w.useState(O),[We,$e]=w.useState(f),[Ae,Dt]=w.useState(m),[tt,en]=w.useState(v),[hn,mt]=w.useState(null),[Pe,tn]=w.useState(null),mn=w.useRef(ge),{anchorRefs:nn,activeAnchor:Vn}=Qu(e),ct=Re=>Re==null?void 0:Re.getAttributeNames().reduce((nt,re)=>{var me;return re.startsWith("data-tooltip-")&&(nt[re.replace(/^data-tooltip-/,"")]=(me=Re==null?void 0:Re.getAttribute(re))!==null&&me!==void 0?me:null),nt},{}),rn=Re=>{const nt={place:re=>{var me;ve((me=re)!==null&&me!==void 0?me:u)},content:re=>{ee(re??r)},html:re=>{de(re??o)},variant:re=>{var me;Ee((me=re)!==null&&me!==void 0?me:c)},offset:re=>{Ge(re===null?d:Number(re))},wrapper:re=>{var me;$e((me=re)!==null&&me!==void 0?me:f)},events:re=>{const me=re==null?void 0:re.split(" ");Dt(me??m)},"position-strategy":re=>{var me;en((me=re)!==null&&me!==void 0?me:v)},"delay-show":re=>{Ie(re===null?x:Number(re))},"delay-hide":re=>{Qe(re===null?g:Number(re))},float:re=>{At(re===null?b:re==="true")},hidden:re=>{Xe(re===null?O:re==="true")},"class-name":re=>{mt(re)}};Object.values(nt).forEach(re=>re(null)),Object.entries(Re).forEach(([re,me])=>{var qe;(qe=nt[re])===null||qe===void 0||qe.call(nt,me)})};w.useEffect(()=>{ee(r)},[r]),w.useEffect(()=>{de(o)},[o]),w.useEffect(()=>{ve(u)},[u]),w.useEffect(()=>{Ee(c)},[c]),w.useEffect(()=>{Ge(d)},[d]),w.useEffect(()=>{Ie(x)},[x]),w.useEffect(()=>{Qe(g)},[g]),w.useEffect(()=>{At(b)},[b]),w.useEffect(()=>{Xe(O)},[O]),w.useEffect(()=>{en(v)},[v]),w.useEffect(()=>{mn.current!==ge&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[ge]),w.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:ge==="core",disableBase:ge}}))},[]),w.useEffect(()=>{var Re;const nt=new Set(nn);let re=n;if(!re&&e&&(re=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),re)try{document.querySelectorAll(re).forEach(ae=>{nt.add({current:ae})})}catch{console.warn(`[react-tooltip] "${re}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&nt.add({current:me}),!nt.size)return()=>null;const qe=(Re=Pe??me)!==null&&Re!==void 0?Re:Vn.current,on=new MutationObserver(ae=>{ae.forEach(le=>{var je;if(!qe||le.type!=="attributes"||!(!((je=le.attributeName)===null||je===void 0)&&je.startsWith("data-tooltip-")))return;const Ue=ct(qe);rn(Ue)})}),W={attributes:!0,childList:!1,subtree:!1};if(qe){const ae=ct(qe);rn(ae),on.observe(qe,W)}return()=>{on.disconnect()}},[nn,Vn,Pe,t,n]),w.useEffect(()=>{B!=null&&B.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),we&&!xc("border",`${we}`)&&console.warn(`[react-tooltip] "${we}" is not a valid \`border\`.`),B!=null&&B.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),A&&!xc("opacity",`${A}`)&&console.warn(`[react-tooltip] "${A}" is not a valid \`opacity\`.`)},[]);let gn=h;const Kn=w.useRef(null);if(i){const Re=i({content:(Pe==null?void 0:Pe.getAttribute("data-tooltip-content"))||U||null,activeAnchor:Pe});gn=Re?w.createElement("div",{ref:Kn,className:"react-tooltip-content-wrapper"},Re):null}else U&&(gn=U);Q&&(gn=w.createElement($w,{content:Q}));const yn={forwardRef:Z,id:e,anchorId:t,anchorSelect:n,className:vt(s,hn),classNameArrow:a,content:gn,contentWrapperRef:Kn,place:M,variant:H,offset:Le,wrapper:We,events:Ae,openOnClick:y,positionStrategy:tt,middlewares:p,delayShow:Ke,delayHide:Rt,float:ht,hidden:Pt,noArrow:_,clickable:T,closeOnEsc:S,closeOnScroll:N,closeOnResize:D,openEvents:q,closeEvents:G,globalCloseEvents:z,imperativeModeOnly:ne,style:B,position:ce,isOpen:oe,defaultIsOpen:te,border:we,opacity:A,arrowColor:k,setIsOpen:$,afterShow:L,afterHide:j,disableTooltip:F,activeAnchor:Pe,setActiveAnchor:Re=>tn(Re),role:Y};return w.createElement(Kw,{...yn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||bc({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||bc({css:`
51
+ .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function Uw(){return l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[l.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[l.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_2896_16290",children:l.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function Hw({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:Uw()}),l.jsx(qw,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const Bw="Each field must be mapped to a unique value";function la({field:e,onSelectChange:t,allFields:n}){var g;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Ht(),[s,a]=w.useState(!0),{isError:c,removeError:u,getError:d}=Tt(),f=(g=r==null?void 0:r.read)==null?void 0:g.selectedFieldMappings,h=f==null?void 0:f[e.mapToName];w.useEffect(()=>{e._default&&!h&&o&&r&&oi(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,h,r]);const m=w.useMemo(()=>n.map(b=>({id:b.fieldName,label:b.displayName,value:b.fieldName})),[n]),y=l.jsx(Ku,{disabled:s,items:m,selectedValue:h||null,onSelectedItemChange:b=>{t({target:{name:e.mapToName,value:b==null?void 0:b.value}})},placeholder:"Please select one",style:{width:"100%"}}),v=w.useCallback(()=>{o&&(oi(o,i,[{field:e.mapToName,value:null}]),c(ue.MAPPING,o)&&u(ue.MAPPING,o))},[e.mapToName,o,i,c,u]),{hasDuplicationError:p,errorMessage:x}=w.useMemo(()=>{const b=d(ue.MAPPING,o),O=Array.isArray(b)&&b.length>0&&b.includes(e.mapToName);return{hasDuplicationError:O,errorMessage:O?Bw:""}},[o,d,e.mapToName]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[l.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName}),l.jsx("span",{children:(e==null?void 0:e.prompt)&&l.jsx(Hw,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[y,l.jsx(at,{type:"button",variant:"ghost",onClick:v,children:"Clear"})]})]},e.mapToName),p&&l.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",x," "]},e.mapToName)]})}const Ww="_formControl_9qd8d_1",Jw="_formLabel_9qd8d_5",zw="_formLabelRequired_9qd8d_11",Gw="_formInput_9qd8d_16",Qw="_formInputInvalid_9qd8d_20",Xw="_formError_9qd8d_24",Yw="_disabled_9qd8d_30",Bn={formControl:Ww,formLabel:Jw,formLabelRequired:zw,formInput:Gw,formInputInvalid:Qw,formError:Xw,disabled:Yw};function bo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return l.jsxs("div",{className:vt(Bn.formControl,{[Bn.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:vt(Bn.formLabel,{[Bn.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:vt(Bn.formInput,{[Bn.formInputInvalid]:o}),children:s}),o&&i&&l.jsx("div",{className:Bn.formError,role:"alert",children:i})]})}const Zw="_divider_1kmoj_1",Sc={divider:Zw};function _o({className:e,style:t}){return l.jsx("hr",{className:e?`${Sc.divider} ${e}`:Sc.divider,style:t})}function yi({string:e}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(_o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Xu({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:o}){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(c=>e[c]===r),a=[n,...s];return o(ue.MAPPING,t,a),!0}return!1}function eI({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>l.jsx(bo,{id:r.mapToName,children:l.jsx(la,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function tI(){var y,v;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Ht(),{isError:r,removeError:o,setError:i}=Tt(),s=((y=t==null?void 0:t.read)==null?void 0:y.allFields)||[],{fieldMapping:a}=et(),c=(v=t==null?void 0:t.read)==null?void 0:v.selectedFieldMappings,u=p=>{const{value:x,name:g}=p.target;!x||Xu({selectedFieldMappings:c,selectedObjectName:e,fieldName:g,fieldValue:x,setError:i})||(e&&oi(e,n,[{field:g,value:x}]),r(ue.MAPPING,g)&&o(ue.MAPPING,g),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},d=w.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(p=>!p.fieldName),[a,e]),f=w.useMemo(()=>{var g;return(((g=t==null?void 0:t.read)==null?void 0:g.optionalMapFields)||[]).filter(b=>!d.some(O=>O.mapToName===b.mapToName))},[t,d]),h=d.length>0;return f.length>0||h?l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:"Map the following optional fields"}),l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[f==null?void 0:f.map(p=>l.jsx(bo,{id:p.mapToName,children:l.jsx(la,{allFields:s,field:p,onSelectChange:u})},p.mapToName)),h&&l.jsx(eI,{dynamicFieldMappings:d,onSelectChange:u,allFields:s})]})]}):null}function nI(){var u;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Ht(),{isError:r,removeError:o,setError:i}=Tt(),s=(u=t==null?void 0:t.read)==null?void 0:u.selectedFieldMappings,a=d=>{const{value:f,name:h}=d.target;!f||Xu({selectedFieldMappings:s,selectedObjectName:e,fieldName:h,fieldValue:f,setError:i})||(e&&oi(e,n,[{field:h,value:f}]),r(ue.MAPPING,h)&&o(ue.MAPPING,h),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},c=w.useMemo(()=>{var d;return((d=t==null?void 0:t.read)==null?void 0:d.requiredMapFields)||[]},[t]);return c!=null&&c.length?l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(d=>{var f;return l.jsx(bo,{id:d.mapToName,isInvalid:r(ue.MAPPING,d.mapToName),errorMessage:"* required",children:l.jsx(la,{allFields:((f=t==null?void 0:t.read)==null?void 0:f.allFields)||[],field:d,onSelectChange:a})},d.mapToName)})})]}):null}const rI={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function iI({children:e,style:t}){return l.jsx(kn,{style:{...rI,...t},children:e})}const oI=e=>{const t=pn(),{provider:n}=et(),r=e||n;return $r({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},jn=e=>{const t=oI(e),{data:n}=t,{provider:r}=et(),o=n&&xl(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function sI(){var u,d,f;const{project:e}=Fe(),{hydratedRevision:t}=Br(),{selectedObjectName:n}=Ht(),{providerName:r}=jn(),o=e==null?void 0:e.appName,i=(f=(d=(u=t==null?void 0:t.content)==null?void 0:u.read)==null?void 0:d.objects)==null?void 0:f.find(h=>h.objectName===n),s=(i==null?void 0:i.displayName)||n&&Ar(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&Ar(a);return c&&o&&r?l.jsx(iI,{style:{marginTop:"1rem"},children:l.jsxs("p",{style:{margin:"1rem 0"},children:[l.jsx("b",{children:c})," in ",o," is mapped to ",l.jsx("b",{children:s})," in ",r,"."]})}):null}function Nc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Yu(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Nc(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():Nc(e[o],null)}}}}function ai(...e){return K.useCallback(Yu(...e),e)}function xo(e,t=[]){let n=[];function r(i,s){const a=K.createContext(s),c=n.length;n=[...n,s];const u=f=>{var x;const{scope:h,children:m,...y}=f,v=((x=h==null?void 0:h[e])==null?void 0:x[c])||a,p=K.useMemo(()=>y,Object.values(y));return l.jsx(v.Provider,{value:p,children:m})};u.displayName=i+"Provider";function d(f,h){var v;const m=((v=h==null?void 0:h[e])==null?void 0:v[c])||a,y=K.useContext(m);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const o=()=>{const i=n.map(s=>K.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return K.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,aI(o,...t)]}function aI(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...a,...f}},{});return K.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function $t(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function ua(e){const t=K.useRef(e);return K.useEffect(()=>{t.current=e}),K.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function da({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=cI({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=ua(n),c=K.useCallback(u=>{if(i){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else o(u)},[i,e,o,a]);return[s,c]}function cI({defaultProp:e,onChange:t}){const n=K.useState(e),[r]=n,o=K.useRef(r),i=ua(t);return K.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function lI(e){const t=K.useRef({value:e,previous:e});return K.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var co=globalThis!=null&&globalThis.document?K.useLayoutEffect:()=>{};function uI(e){const[t,n]=K.useState(void 0);return co(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function dI(e,t){return K.useReducer((n,r)=>t[n][r]??n,e)}var fa=e=>{const{present:t,children:n}=e,r=fI(t),o=typeof n=="function"?n({present:r.isPresent}):K.Children.only(n),i=ai(r.ref,pI(o));return typeof n=="function"||r.isPresent?K.cloneElement(o,{ref:i}):null};fa.displayName="Presence";function fI(e){const[t,n]=K.useState(),r=K.useRef({}),o=K.useRef(e),i=K.useRef("none"),s=e?"mounted":"unmounted",[a,c]=dI(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return K.useEffect(()=>{const u=Ki(r.current);i.current=a==="mounted"?u:"none"},[a]),co(()=>{const u=r.current,d=o.current;if(d!==e){const h=i.current,m=Ki(u);e?c("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),co(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=m=>{const v=Ki(r.current).includes(m.animationName);if(m.target===t&&v&&(c("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},h=m=>{m.target===t&&(i.current=Ki(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:K.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Ki(e){return(e==null?void 0:e.animationName)||"none"}function pI(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var lo=K.forwardRef((e,t)=>{const{children:n,...r}=e,o=K.Children.toArray(n),i=o.find(mI);if(i){const s=i.props.children,a=o.map(c=>c===i?K.Children.count(s)>1?K.Children.only(null):K.isValidElement(s)?s.props.children:null:c);return l.jsx(Es,{...r,ref:t,children:K.isValidElement(s)?K.cloneElement(s,void 0,a):null})}return l.jsx(Es,{...r,ref:t,children:n})});lo.displayName="Slot";var Es=K.forwardRef((e,t)=>{const{children:n,...r}=e;if(K.isValidElement(n)){const o=yI(n),i=gI(r,n.props);return n.type!==K.Fragment&&(i.ref=t?Yu(t,o):o),K.cloneElement(n,i)}return K.Children.count(n)>1?K.Children.only(null):null});Es.displayName="SlotClone";var hI=({children:e})=>l.jsx(l.Fragment,{children:e});function mI(e){return K.isValidElement(e)&&e.type===hI}function gI(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function yI(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ln=vI.reduce((e,t)=>{const n=K.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?lo:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),pa="Checkbox",[wI,K_]=xo(pa),[II,bI]=wI(pa),Zu=K.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,m]=K.useState(null),y=ai(t,O=>m(O)),v=K.useRef(!1),p=h?d||!!h.closest("form"):!0,[x=!1,g]=da({prop:o,defaultProp:i,onChange:u}),b=K.useRef(x);return K.useEffect(()=>{const O=h==null?void 0:h.form;if(O){const _=()=>g(b.current);return O.addEventListener("reset",_),()=>O.removeEventListener("reset",_)}},[h,g]),l.jsxs(II,{scope:n,state:x,disabled:a,children:[l.jsx(Ln.button,{type:"button",role:"checkbox","aria-checked":Pn(x)?"mixed":x,"aria-required":s,"data-state":nd(x),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:y,onKeyDown:$t(e.onKeyDown,O=>{O.key==="Enter"&&O.preventDefault()}),onClick:$t(e.onClick,O=>{g(_=>Pn(_)?!0:!_),p&&(v.current=O.isPropagationStopped(),v.current||O.stopPropagation())})}),p&&l.jsx(_I,{control:h,bubbles:!v.current,name:r,value:c,checked:x,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Pn(i)?!1:i})]})});Zu.displayName=pa;var ed="CheckboxIndicator",td=K.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=bI(ed,n);return l.jsx(fa,{present:r||Pn(i.state)||i.state===!0,children:l.jsx(Ln.span,{"data-state":nd(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});td.displayName=ed;var _I=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=K.useRef(null),a=lI(n),c=uI(t);K.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&m){const y=new Event("click",{bubbles:r});d.indeterminate=Pn(n),m.call(d,Pn(n)?!1:n),d.dispatchEvent(y)}},[a,n,r]);const u=K.useRef(Pn(n)?!1:n);return l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??u.current,...i,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Pn(e){return e==="indeterminate"}function nd(e){return Pn(e)?"indeterminate":e?"checked":"unchecked"}var rd=Zu,id=td;function od(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var xI=["color"],sd=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=od(e,xI);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),w.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),OI=["color"],CI=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=od(e,OI);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),w.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const EI="_checkboxGroupContainer_1ya1t_1",SI="_stack_1ya1t_6",NI="_selectAllContainer_1ya1t_11",TI="_fieldContainer_1ya1t_18",RI="_checkbox_1ya1t_1",Vr={checkboxGroupContainer:EI,stack:SI,selectAllContainer:NI,fieldContainer:TI,checkbox:RI};function ad({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Vr.fieldContainer,children:[l.jsx(rd,{className:Vr.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(id,{children:l.jsx(sd,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function cd({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:Vr.selectAllContainer,children:[l.jsx(rd,{className:Vr.checkbox,id:e,onCheckedChange:r,children:l.jsxs(id,{children:[o&&l.jsx(CI,{}),t===!0&&l.jsx(sd,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function ld({children:e}){return l.jsx("div",{className:Vr.checkboxGroupContainer,children:e})}function ud({children:e}){return l.jsx("div",{className:Vr.stack,children:e})}function AI(e,t,n){var o,i;const r=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(i=e.read)!=null&&i.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,c=!Fl(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function Tc(e,t,n,r){t(e,o=>AI(o,n,r))}function PI(){var f,h;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Ht(),o=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,i=(m,y)=>{m!=="indeterminate"&&r&&t&&Tc(r,n,y,m)},s=(h=t==null?void 0:t.read)==null?void 0:h.optionalFields,a=m=>{r&&s&&s.forEach(y=>{Dn(y)||Tc(r,n,y.fieldName,m)})},c=!!(s&&s.length>0),u=Object.keys(o||{}).length===(s==null?void 0:s.length),d=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:`${e} reads the following optional fields`}),l.jsxs(ld,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(cd,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:a,isIndeterminate:d}),l.jsx(ud,{children:s.map(m=>Dn(m)?null:l.jsx(ad,{id:m.fieldName,isChecked:!!(o!=null&&o[m==null?void 0:m.fieldName]),label:m.displayName,onCheckedChange:y=>i(y,m.fieldName)},m.fieldName))})]})]})}function DI(){return l.jsx(PI,{})}const FI={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 MI({children:e,style:t,...n}){return l.jsx("span",{style:{...FI,...t},...n,children:e})}function kI(){var r,o,i;const{configureState:e,selectedObjectName:t}=Ht(),{appName:n}=Fe();return l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:`${n} reads the following ${t} fields`}),l.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(o=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&o.length?(i=e.read)==null?void 0:i.requiredFields.map(s=>Dn(s)?null:l.jsx(MI,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function jI(e,t,n,r,o){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[o]||(e.read.selectedValueMappings[o]={}),r===""&&e.read.selectedValueMappings[o][n]?delete e.read.selectedValueMappings[o][n]:e.read.selectedValueMappings[o][n]=r)}function dd(e,t,n,r,o){t(e,i=>jI(i,e,n,r,o))}function LI(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function VI({string:e,fieldName:t}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,l.jsx("b",{children:t})]}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(_o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function KI({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var _;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Ht(),[c,u]=w.useState(!0),{getError:d,setError:f,resetBoundary:h,isError:m,removeError:y}=Tt(),v=w.useMemo(()=>{var T,S;return((S=(T=i==null?void 0:i.read)==null?void 0:T.selectedValueMappings)==null?void 0:S[n])||{}},[(_=i==null?void 0:i.read)==null?void 0:_.selectedValueMappings,n]),p=w.useMemo(()=>v==null?void 0:v[e.mappedValue],[v,e.mappedValue]);w.useEffect(()=>{u(!1)},[e,a,s,p,i]);const x=w.useMemo(()=>r.map(T=>({id:T.value,label:T.displayValue,value:T.value})),[r]),g=w.useCallback(T=>{if(T){if(Object.values(v).some(S=>S===T.value&&S!==p)){const S=[...Object.entries(v).filter(([N,D])=>D===T.value&&D!==p).map(([N])=>N),e.mappedValue];f(ue.VALUE_MAPPING,n,S);return}d(ue.VALUE_MAPPING,n)&&h(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:T.value,fieldName:n}})}},[t,v,p,n,e.mappedValue,h,f,d]),b=w.useMemo(()=>l.jsx(Ku,{disabled:c,items:x,selectedValue:p||null,onSelectedItemChange:g,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,c,x,g,o]),O=w.useCallback(()=>{s&&(dd(s,a,e.mappedValue,"",n),m(ue.VALUE_MAPPING,n)&&y(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,m,y]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[l.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:l.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[b,l.jsx(at,{type:"button",variant:"ghost",onClick:O,children:"Clear"})]})]},e.mappedValue)}function $I(){var m,y,v;const{fieldMapping:e}=et(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Ht(),{isError:o,removeError:i,getError:s}=Tt(),a=(m=n==null?void 0:n.read)==null?void 0:m.selectedFieldMappings,c=(y=n==null?void 0:n.read)==null?void 0:y.selectedValueMappings,u=(v=n==null?void 0:n.read)==null?void 0:v.isValueMappingsModified,d=w.useRef(!1),f=w.useMemo(()=>{const p=t&&e?Object.values(e[t]||{}).flat().filter(x=>x.mappedValues).map(x=>({...x})):[];if(a)for(let x=0;x<p.length;x+=1){const{mapToName:g}=p[x];a!=null&&a[g]&&(p[x].fieldName=a[g])}return p},[t,e,a]),h=w.useCallback(p=>{const{value:x,name:g,fieldName:b}=p.target;x&&(t&&dd(t,r,g,x,b),o(ue.VALUE_MAPPING,g)&&i(ue.VALUE_MAPPING,g))},[t,r,o,i]);return w.useEffect(()=>{var p;if(t&&c){const x=((p=e==null?void 0:e[t])==null?void 0:p.filter(b=>b.fieldName&&b.mappedValues.length>0))||[];x.every(b=>{const O=c[b.fieldName]||{};return Object.keys(O).length===Object.keys(b.mappedValues).length})&&x.length>0?!u&&!d.current&&(LI(t,r,!0),d.current=!0):d.current=!1}},[c,f,t,r,e,u]),f!=null&&f.length?l.jsx(l.Fragment,{children:f.map(p=>{var T,S,N;if(!p.fieldName)return null;const x=(S=(T=n==null?void 0:n.read)==null?void 0:T.allFieldsMetadata)==null?void 0:S[p.fieldName],g=x==null?void 0:x.valueType;if(!["singleSelect","multiSelect"].includes(g))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const b=x==null?void 0:x.values;if(!b)return null;const O=Object.keys(b).length,_=Object.keys((p==null?void 0:p.mappedValues)||[]).length;return O!==_?(console.error("field values and the values to be mapped are not of the same length",p,b),null):l.jsxs(l.Fragment,{children:[l.jsx(VI,{string:"Map the values for ",fieldName:p.mapToDisplayName||p.mapToName||p.fieldName}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(bo,{id:p.mapToName||p.fieldName,children:(N=p==null?void 0:p.mappedValues)==null?void 0:N.map(D=>{var ne,B,ce;const q=s(ue.VALUE_MAPPING,p.fieldName),G=Array.isArray(q)&&q.includes(D.mappedValue),z=((ce=(B=(ne=n==null?void 0:n.read)==null?void 0:ne.allFieldsMetadata)==null?void 0:B[p.fieldName])==null?void 0:ce.values)||[];return l.jsxs(l.Fragment,{children:[l.jsx(KI,{allValueOptions:z,mappedValue:D,onSelectChange:h,fieldName:(p==null?void 0:p.fieldName)||"",hasError:G},`${D.mappedValue}-${p.fieldName}`),G&&l.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${p.mapToName||p.fieldName} must be mapped to a unique value`},D.mappedValue)]})})},p.mapToName||p.fieldName)})]})})}):null}function qI(){return Ky(),l.jsxs(l.Fragment,{children:[l.jsx(sI,{}),l.jsx(kI,{}),l.jsx(nI,{}),l.jsx(tI,{}),l.jsx($I,{}),l.jsx(DI,{})]})}function UI(e,t,n){var r,o,i;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const s=e.write.selectedWriteObjects;if(n&&(s[t]={objectName:t}),n||delete s[t],(i=(o=e==null?void 0:e.write)==null?void 0:o.savedConfig)!=null&&i.selectedWriteObjects){const a=e.write.savedConfig.selectedWriteObjects,u=!oy(a,s);e.write.isWriteModified=u}}}function Rc(e,t,n,r){t(e,o=>{UI(o,n,r)})}function HI(){var f,h,m,y;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Ht(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects,s=(v,p)=>{v!=="indeterminate"&&t&&n&&Rc(t,r,p,v)},a=v=>{var p,x;t&&n&&((x=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null||x.forEach(g=>{Rc(t,r,g.objectName,v)}))},c=!!i,u=Object.keys(o||{}).length===((y=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects)==null?void 0:y.length),d=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:`Allow ${e} to write to these objects`}),l.jsxs(ld,{children:[((i==null?void 0:i.length)||0)>=2&&l.jsx(cd,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:u,label:"Select all"}),l.jsx(ud,{children:i.map(v=>l.jsx(ad,{id:v.objectName,onCheckedChange:p=>s(p,v.objectName),isChecked:!!(o!=null&&o[v.objectName]),label:v.displayName},v.objectName))})]})]})}function BI(){return l.jsx(l.Fragment,{children:l.jsx(HI,{})})}const WI=()=>{const e=pn(),t=Yt();return As({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:o})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:o}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),_t(n)}})};function fd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=Fe(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=et(),[c,u]=w.useState(!1),d=!r||!o||!(i!=null&&i.id)||c,f=WI(),h=async()=>{d||(u(!0),console.warn("uninstalling installation",{projectId:r,integrationId:o,installationId:i.id}),f.mutate({projectIdOrName:r,integrationId:o,installationId:i.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",i.id),a==null||a(i==null?void 0:i.id),s()},onSettled:()=>u(!1)}))},m=c?"Uninstalling...":e,y=l.jsx(at,{type:"button",onClick:h,disabled:d,variant:t,style:n,children:m});return i!=null&&i.id?y:null}function JI(){const{installation:e}=et();return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e!=null&&e.id?l.jsx("p",{children:"Once you uninstall this integration, its configuration will be lost."}):l.jsx("p",{children:"You've successfully uninstalled the integration."}),l.jsx(fd,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function pd({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var T,S,N,D;const{installation:i}=et(),{hydratedRevision:s,loading:a}=Br(),{configureState:c,selectedObjectName:u}=Ht(),d=i==null?void 0:i.config,f=d&&u&&!!Rl(d,u)||!1,h=((T=c==null?void 0:c.read)==null?void 0:T.isOptionalFieldsModified)||((S=c==null?void 0:c.read)==null?void 0:S.isRequiredMapFieldsModified)||((N=c==null?void 0:c.read)==null?void 0:N.isValueMappingsModified),m=(D=c==null?void 0:c.write)==null?void 0:D.isWriteModified,x=a||n||!c||!u||!(h||m||r||u!==sr&&!f),g=u===sr,b=u===Xi,O=l.jsx(at,{type:"submit",disabled:x,children:r?"Install":"Save"}),_=l.jsx(at,{type:"button",onClick:t,disabled:x,variant:"ghost",children:"Reset"});return n?l.jsx(ni,{}):l.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px"},children:[O,_]}),l.jsxs(kn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&l.jsx(ql,{children:typeof o=="string"?o:"Installation Failed."}),a&&l.jsx(ni,{}),s&&!b&&!g&&l.jsx(qI,{}),s&&!b&&g&&l.jsx(BI,{}),!a&&b&&l.jsx(JI,{})]})]})}const hd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=et(),{hydratedRevision:s,loading:a}=Br(),{selectedObjectName:c}=Jl(),{selectedConnection:u}=Hr(),d=pi(),{projectId:f}=Fe(),{resetBoundary:h,setErrors:m,setError:y,getError:v}=Tt(),{resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:g}=Vs(),b=Kl(c||"",x),{onNextIncompleteTab:O}=Oy(),_=w.useCallback(()=>{h(ue.INSTALLATION_MUTATION)},[h]),T=w.useCallback(N=>N?D=>{y(ue.INSTALLATION_MUTATION,N,D)}:D=>{console.error("objectName is required to set installation error: ",D)},[y]),S=w.useCallback(N=>N?v(ue.INSTALLATION_MUTATION,N):"",[v]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:u,apiKey:d,projectId:f,resetBoundary:h,setErrors:m,setMutateInstallationError:T,getMutateInstallationError:S,resetMutateInstallationErrorState:_,resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:g,configureState:b,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:O}},zI=void 0;function GI(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:u,resetBoundary:d,setErrors:f,setMutateInstallationError:h,getMutateInstallationError:m,resetMutateInstallationErrorState:y,resetConfigureState:v,objectConfigurationsState:p,resetPendingConfigurationState:x,configureState:g,onInstallSuccess:b,onNextIncompleteTab:O}=hd(),[_,T]=w.useState(!1),S=s===sr,N=m(s),D=w.useCallback(()=>{d(ue.MAPPING),o!=null&&o.content&&!i&&s&&kl(o,zI,s,v)},[d,o,i,s,v]);w.useEffect(()=>{!g&&(o!=null&&o.content)&&!i&&D()},[g,p,o,i,D]);const q=()=>{y();const{requiredMapFields:ne,selectedFieldMappings:B}=(g==null?void 0:g.read)||{},{errorList:ce}=Dl(ne,B,f);ce.length>0||(s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(T(!0),dy(u,e,t,n,a.id,s,c,o,g,h(s),r,b).finally(()=>{T(!1),x(s),O()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},G=()=>{y(),s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(T(!0),hy(u,e,t,n,a.id,c,o,g,h(s),r,b).finally(()=>{T(!1),x(s),O()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},z=ne=>{ne.preventDefault(),S?G():q()};return l.jsx(pd,{errorMsg:N,isCreateMode:!0,isLoading:_,onSave:z,onReset:D})}function QI({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:c}){const u={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${i}`],installation:{config:e}}};return mr().installationApi.updateInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(d=>{s(d),a==null||a(d.id,d.config)}).catch(d=>{_t(d,c)})}const XI=(e,t,n,r,o,i)=>{const s=jl(e),a=Ll(e),c=Vl(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:c||{},backfill:i}}}}};return fo(o)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},YI=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=XI(i,r||"",a,a.schedule,c,a.backfill);return f?QI({updateConfig:f,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:u,setInstallation:s,onUpdateSuccess:d}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},ZI=(e,t)=>{const r={content:{write:{objects:$l(e)}}};return fo(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},eb=(e,t,n,r,o,i,s,a,c)=>{const u=ZI(o,i);if(!u)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const d={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:u}}};return mr().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(f=>{a(f),c==null||c(f.id,f.config)}).catch(f=>{_t(f,s)})};function tb({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:c,setErrors:u,setMutateInstallationError:d,getMutateInstallationError:f,resetConfigureState:h,resetPendingConfigurationState:m,configureState:y,onUpdateSuccess:v,onNextIncompleteTab:p}=hd(),[x,g]=w.useState(!1),b=i===sr,O=f(i),{config:_}=e,T=w.useCallback(()=>{c(ue.MAPPING),r!=null&&r.content&&!o&&i&&kl(r,_,i,h)},[c,r,o,i,_,h]);w.useEffect(()=>{y||T()},[y,T]);const S=w.useMemo(()=>{var z,ne,B;return(B=(ne=(z=r==null?void 0:r.content)==null?void 0:z.read)==null?void 0:ne.objects)==null?void 0:B.find(ce=>(ce==null?void 0:ce.objectName)===i)},[r,i]),N=()=>{const{requiredMapFields:G,selectedFieldMappings:z}=(y==null?void 0:y.read)||{},{errorList:ne}=Dl(G,z,u);ne.length>0||(r&&e&&i&&s&&a&&S?(g(!0),YI(a,t.id,e.id,i,s,y,n,S,r,d(i),v).finally(()=>{g(!1),m(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},D=()=>{e&&i&&s&&a&&r?(g(!0),eb(a,t.id,e.id,s,y,r,d(i),n,v).finally(()=>{g(!1),m(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},q=G=>{G.preventDefault(),b?D():N()};return l.jsx(pd,{errorMsg:O,onSave:q,onReset:T,isLoading:x})}function nb(){const{integrationObj:e,installation:t}=et();return e?t&&e?l.jsx(tb,{installation:t,integrationObj:e}):l.jsx(GI,{}):l.jsx(Il,{message:"We can't load the integration"})}const rb=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function ib({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:o,apiKey:i,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:u}){const d=rb(s,r);return d?ks({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:a,setInstallation:c,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function ob(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),l.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function ha({text:e,children:t}){return l.jsx(qr,{children:l.jsxs(kn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(ob,{}),l.jsx("p",{children:e}),t]})})}function sb({provider:e}){const{providerName:t}=jn(e),n=`You have successfully installed your ${t} integration.`;return l.jsx(ha,{text:n,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(fd,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const ab=e=>{const{read:t,write:n,proxy:r}=(e==null?void 0:e.content)??{};return!t&&!n&&(r==null?void 0:r.enabled)||!1};function cb({children:e}){var O;const{projectId:t}=Fe(),n=pi(),{hydratedRevision:r,loading:o}=Br(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,setInstallation:u,onInstallSuccess:d,isIntegrationDeleted:f}=et(),{selectedConnection:h,isConnectionsLoading:m}=Hr(),[y,v]=w.useState(!1),p=o||y,x=(O=r==null?void 0:r.content)==null?void 0:O.provider,g=ab(r),b=_=>{console.error("Error when creating proxy installation:",_)};return w.useEffect(()=>{!p&&!m&&r&&g&&!s&&h&&n&&(i!=null&&i.id)&&!f&&(v(!0),ib({apiKey:n,projectId:t,integrationId:i==null?void 0:i.id,groupRef:a,consumerRef:c,connectionId:h==null?void 0:h.id,hydratedRevision:r,setError:b,setInstallation:u,onInstallSuccess:d}).then(()=>{v(!1)}).catch(_=>{v(!1),console.error("Error when creating proxy installation:",_)}))},[r,g,s,h,n,t,i==null?void 0:i.id,a,c,u,p,d,f,m]),i?p?l.jsx(Ur,{}):g&&x&&s?l.jsx(sb,{provider:x}):l.jsx("div",{children:e}):l.jsx(Gt,{message:"We can't load the integration"})}function Oo(){const e=pn(),t=Yt();return As({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"),_t(n)}})}function md(){var n,r;const{project:e}=Fe();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:l.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[l.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),l.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:l.jsxs("picture",{children:[l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),l.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function vi({children:e}){return l.jsx(qr,{children:l.jsxs(kn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(md,{})]})})}function wi({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function lb({children:e}){return l.jsx("p",{style:{padding:".5em 0"},children:e})}function Ii({error:e}){return e?l.jsx(ql,{style:{marginTop:"2em"},children:e}):null}function ma({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:o,title:i}){if(!i&&!r)throw new Error("Either title or providerName is required");return l.jsxs(vi,{children:[l.jsx(wi,{children:i||`Set up ${r} integration`}),l.jsx(Ii,{error:t}),o,l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const ub="_link_oo2kv_1",db={link:ub};function gd({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:vt(db.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function yd({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(gd,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const fb="_input_10rzg_1",pb="_inputError_10rzg_27",hb="_error_10rzg_43",Ho={input:fb,inputError:pb,error:hb};function mb({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?vt(Ho.inputError,Ho.input):Ho.input;return l.jsx("input",{id:e,type:t,className:vt(i,n),...o})}const gb="_textarea_18zl4_1",yb="_textareaError_18zl4_14",vb="_error_18zl4_29",Bo={textarea:gb,textareaError:yb,error:vb};function wb({className:e,isError:t=!1,...n}){const r=t?vt(Bo.textareaError,Bo.textarea):Bo.textarea;return l.jsx("textarea",{className:vt(e,r),...n})}const dn={Input:mb,Textarea:wb};function Ib({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){var v;const[i,s]=w.useState(!1),a=()=>s(p=>!p),[c,u]=w.useState(""),d=p=>u(p.currentTarget.value),{providerName:f}=jn(e),h=c.length>0,m=o||!h,y=(v=t.apiKeyOpts)==null?void 0:v.docsURL;return l.jsx(ma,{providerName:f,handleSubmit:()=>{n({apiKey:c})},error:r,isButtonDisabled:m,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[y&&l.jsx(yd,{url:y,providerDisplayName:f||Ar(e),credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(dn.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"API Key",onChange:p=>d(p)}),l.jsx(at,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:i?"Hide":"Show"})]})]})})}function bb({...e}){return l.jsx(Ib,{...e})}function _b({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Fe(),u=Oo(),d=w.useCallback(f=>{const{apiKey:h}=f,m={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:h}};u.mutate(m)},[c,i,o,r,n,e,u]);return a===null?l.jsx(bb,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function xb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){var g;const[i,s]=w.useState(!1),a=()=>s(b=>!b),[c,u]=w.useState({username:"",password:""}),{username:d,password:f}=c,{providerName:h}=jn(e),m=h||Ar(e),y=(g=t.basicOpts)==null?void 0:g.docsURL,v=d.length>0,p=o||!v,x=b=>{const{name:O,value:_}=b.currentTarget;u(T=>({...T,[O]:_}))};return l.jsx(ma,{providerName:h,handleSubmit:()=>{n({user:d,pass:f})},error:r,isButtonDisabled:p,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[y&&l.jsx(yd,{url:y,providerDisplayName:m,credentialName:"credentials"}),l.jsx(dn.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:b=>x(b)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(dn.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:b=>x(b)}),l.jsx(at,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:i?"Hide":"Show"})]})]})})}function Ob({...e}){return l.jsx(xb,{...e})}function Cb({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Fe(),u=Oo(),d=w.useCallback(f=>{const{user:h,pass:m}=f,y={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:h,password:m}}};u.mutate(y)},[c,i,o,r,n,e,u]);return a===null?l.jsx(Ob,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function Eb({...e}){return l.jsx(ma,{...e})}function Sb({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=Fe(),u=Oo(),d=w.useCallback(()=>{const f={projectIdOrName:c,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};u.mutate(f)},[c,o,r,n,t,e,u]);return s===null?l.jsx(Eb,{handleSubmit:d,error:null,providerName:a}):i}const Nb=Fs("VITE_AMP_ENABLE_CSRF",!1),Tb=Fs("NEXT_AMP_ENABLE_CSRF",!1),Rb=Fs("REACT_APP_AMP_ENABLE_CSRF",!1),Ab=!!Nb||!!Tb||!!Rb,vd=async(e,t,n,r,o,i,s,a)=>{var u,d;const c=await mr().providerApi.getProvider({provider:o},{headers:{"X-Api-Key":r??""}});if(!c)throw new Error(`Provider ${o} not found`);if(c.authType==="oauth2"&&(((u=c.oauth2Opts)==null?void 0:u.grantType)==="authorizationCode"||((d=c.oauth2Opts)==null?void 0:d.grantType)==="authorizationCodePKCE")){const h=(await mr().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(p=>p.provider===o),m=xl(o,c);if(!h)throw new Error(`You must first set up a ${m} Provider App using the Ampersand Console.`);const y={connectOAuthParams:{providerWorkspaceRef:i,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:h.id,provider:o,enableCSRFProtection:Ab}};return await mr().oAuthApi.oauthConnect(y,{credentials:"include",headers:{"X-Api-Key":r??"","Content-Type":"application/json"}})}throw new Error(`Provider ${o} does not support an OAuth2 web flow.`)},Ac=600,Pc=600,Pb="AUTHORIZATION_SUCCEEDED",Db="AUTHORIZATION_FAILED";function Fb(e,t,n,r){return w.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Ac)/2,i=window.screenY+(window.outerHeight-Pc)/2.5,s=`width=${Ac},height=${Pc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Mb(e,t,n){const r=Yt();return w.useCallback(o=>{var i,s;if(o.origin===xg){if(o.data.eventType===Pb){const a=(i=o.data.data)==null?void 0:i.connection;a?(e(a),t==null||t.close(),r.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:o})}o.data.eventType===Db&&(console.error("OAuth failed: ",{event:o}),n==null||n(((s=o==null?void 0:o.data)==null?void 0:s.message)??"Something went wrong. Please try again."))}},[t,n,r,e])}function wd({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o}){const[i,s]=w.useState(null),[a,c]=w.useState(null),u=Mb(s,a,r),d=Fb(n,c,u,t);return w.useEffect(()=>{t&&!a&&d()},[t,a,d,u,n]),w.useEffect(()=>{if(!a)return;const f=setInterval(()=>{a.closed&&(clearInterval(f),window.removeEventListener("message",u),c(null),!i&&!o?(console.error("OAuth failed. Please try again."),r==null||r("Something went wrong. Please try again.")):i&&(r==null||r(null)))},500);return()=>{clearInterval(f),window.removeEventListener("message",u)}},[a,i,o,u,r]),l.jsx("div",{children:e})}function kb({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(vi,{children:[l.jsx(wi,{children:`Set up ${r} integration`}),l.jsx(lb,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),l.jsx(Ii,{error:t}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function jb({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const{projectId:s}=Fe(),a=pi(),[c,u]=w.useState(null),[d,f]=w.useState(null),h=async()=>{f(null);try{const y=await vd(s,t,r,a,e,void 0,n,o);u(y)}catch(y){console.error("Could not fetch OAuth popup URL."),_t(y),f(y.message??"Unexpected error")}},m=w.useCallback(y=>{f(y),u(null)},[]);return l.jsx(wd,{windowTitle:`Connect to ${i}`,oauthUrl:c,onError:m,children:l.jsx(kb,{handleSubmit:h,error:d,providerName:i})})}const Lb="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Vb({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(vi,{children:[l.jsx(wi,{children:"Enter your Salesforce subdomain"}),l.jsx(gd,{href:Lb,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(Ii,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(dn.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),l.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function Kb({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:o}){return l.jsxs(vi,{children:[l.jsxs(wi,{children:["Enter your ",o," workspace"]}),l.jsx(Ii,{error:n}),l.jsx("br",{}),l.jsx(dn.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:i=>t(i.currentTarget.value)}),l.jsx("br",{}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const $b="salesforce";function qb({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const{projectId:s}=Fe(),a=pi(),[c,u]=w.useState(""),[d,f]=w.useState(null),[h,m]=w.useState(null),y=async()=>{if(m(null),!c){m("Workspace is required");return}try{const x=await vd(s,t,r,a,e,c,n,o);f(x)}catch(x){console.error(x),m((x==null?void 0:x.message)??"Unexpected error")}},v=w.useCallback(x=>{m(x),f(null)},[]),p=e===$b?l.jsx(Vb,{handleSubmit:y,setWorkspace:u,error:h,isButtonDisabled:c.length===0}):l.jsx(Kb,{handleSubmit:y,setWorkspace:u,error:h,isButtonDisabled:c.length===0,providerName:i});return l.jsx(wd,{windowTitle:`Connect to ${i}`,oauthUrl:d,onError:v,children:p})}function Ub({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:o,explicitWorkspaceRequired:i}){const[s,a]=w.useState(!1),[c,u]=w.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),d=()=>a(_=>!_),f=_=>{const{name:T,value:S}=_.currentTarget;u(N=>({...N,[T]:S}))},{clientSecret:h,clientId:m,workspace:y,scopes:v}=c,p=h.length>0,x=m.length>0,g=i?y.length>0:!0,b=n||!p||!x||!g,O=()=>{const _={clientId:m,clientSecret:h};i&&(_.workspace=y),o&&v.length>0&&(_.scopes=Bg(v)),e(_)};return l.jsxs(vi,{children:[l.jsx(wi,{children:`Set up ${r} integration`}),l.jsx(Ii,{error:t}),l.jsx("br",{}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[i&&l.jsx(dn.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:_=>f(_)}),l.jsx(dn.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:_=>f(_)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(dn.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:_=>f(_)}),l.jsx(at,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:d,children:s?"Hide":"Show"})]}),o&&l.jsx(dn.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:_=>f(_)})]}),l.jsx("br",{}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:b,type:"submit",onClick:O,children:"Next"})]})}function Hb({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c}){const{projectIdOrName:u}=Fe(),d=Oo(),[f,h]=w.useState(null),m=w.useCallback(y=>{h(null);const v={projectIdOrName:u,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:y.workspace,oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret,scopes:y.scopes}}};d.mutate(v,{onError:()=>h("Error loading provider info")})},[u,i,o,r,n,e,d]);return c===null?l.jsx(Ub,{providerName:t,handleSubmit:m,error:f,explicitScopesRequired:s,explicitWorkspaceRequired:a}):l.jsx(ni,{})}function Bb({...e}){return l.jsx(Hb,{...e})}const Wb="authorizationCode",Jb="authorizationCodePKCE",zb="clientCredentials";function Gb({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=jn(e);if(t.oauth2Opts===void 0)return l.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:u,explicitScopesRequired:d,explicitWorkspaceRequired:f}=t.oauth2Opts,h={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return u===Wb||u===Jb?f?l.jsx(qb,{...h}):l.jsx(jb,{...h}):u===zb?l.jsx(Bb,{...h,explicitWorkspaceRequired:f,explicitScopesRequired:d,selectedConnection:s,setSelectedConnection:a}):u==="password"?l.jsx("em",{children:"Password flow not supported yet"}):l.jsxs("em",{children:["Unsupported grant type: ",u]})}function Qb(e){const{selectedConnection:t}=Hr();w.useEffect(()=>{e&&t&&e(t)},[e,t])}function Xb({onSuccess:e}){Qb(e)}function Id({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:u,isLoading:d,isError:f,error:h,providerName:m,selectedProvider:y}=jn(e),{provider:v,isIntegrationDeleted:p}=et(),{selectedConnection:x,setSelectedConnection:g}=Hr();Xb({onSuccess:s});const b=Yt();w.useEffect(()=>{f&&(console.error("Error loading provider info."),_t(h))},[f,h]);const O=w.useCallback(()=>{b.clear(),c()},[c,b]);if(!e&&!v)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return l.jsx(ha,{text:"Integration successfully uninstalled.",children:l.jsx(at,{type:"button",onClick:O,style:{width:"100%"},children:"Reinstall Integration"})});if(x)return i;if(d)return l.jsx(Ur,{});if(u==null)return l.jsx(Gt,{message:"Provider info was not found."});const _={provider:y,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:x,setSelectedConnection:g,providerName:m,providerInfo:u,onDisconnectSuccess:a};return u.authType==="none"?l.jsx(Sb,{..._,children:i}):u.authType==="basic"?l.jsx(Cb,{..._,children:i}):u.authType==="apiKey"?l.jsx(_b,{..._,children:i}):l.jsx(Gb,{..._})}function Yb(e){const t=e+"CollectionProvider",[n,r]=xo(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:y,children:v}=m,p=w.useRef(null),x=w.useRef(new Map).current;return l.jsx(o,{scope:y,itemMap:x,collectionRef:p,children:v})};s.displayName=t;const a=e+"CollectionSlot",c=w.forwardRef((m,y)=>{const{scope:v,children:p}=m,x=i(a,v),g=ai(y,x.collectionRef);return l.jsx(lo,{ref:g,children:p})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=w.forwardRef((m,y)=>{const{scope:v,children:p,...x}=m,g=w.useRef(null),b=ai(y,g),O=i(u,v);return w.useEffect(()=>(O.itemMap.set(g,{ref:g,...x}),()=>void O.itemMap.delete(g))),l.jsx(lo,{[d]:"",ref:b,children:p})});f.displayName=u;function h(m){const y=i(e+"CollectionConsumer",m);return w.useCallback(()=>{const p=y.collectionRef.current;if(!p)return[];const x=Array.from(p.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((O,_)=>x.indexOf(O.ref.current)-x.indexOf(_.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},h,r]}var Zb=K.useId||(()=>{}),e_=0;function bd(e){const[t,n]=K.useState(Zb());return co(()=>{e||n(r=>r??String(e_++))},[e]),e||(t?`radix-${t}`:"")}var t_=K.createContext(void 0);function _d(e){const t=K.useContext(t_);return e||t||"ltr"}var Wo="rovingFocusGroup.onEntryFocus",n_={bubbles:!1,cancelable:!0},Co="RovingFocusGroup",[Ss,xd,r_]=Yb(Co),[i_,Od]=xo(Co,[r_]),[o_,s_]=i_(Co),Cd=K.forwardRef((e,t)=>l.jsx(Ss.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Ss.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(a_,{...e,ref:t})})}));Cd.displayName=Co;var a_=K.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=K.useRef(null),m=ai(t,h),y=_d(i),[v=null,p]=da({prop:s,defaultProp:a,onChange:c}),[x,g]=K.useState(!1),b=ua(u),O=xd(n),_=K.useRef(!1),[T,S]=K.useState(0);return K.useEffect(()=>{const N=h.current;if(N)return N.addEventListener(Wo,b),()=>N.removeEventListener(Wo,b)},[b]),l.jsx(o_,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:v,onItemFocus:K.useCallback(N=>p(N),[p]),onItemShiftTab:K.useCallback(()=>g(!0),[]),onFocusableItemAdd:K.useCallback(()=>S(N=>N+1),[]),onFocusableItemRemove:K.useCallback(()=>S(N=>N-1),[]),children:l.jsx(Ln.div,{tabIndex:x||T===0?-1:0,"data-orientation":r,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:$t(e.onMouseDown,()=>{_.current=!0}),onFocus:$t(e.onFocus,N=>{const D=!_.current;if(N.target===N.currentTarget&&D&&!x){const q=new CustomEvent(Wo,n_);if(N.currentTarget.dispatchEvent(q),!q.defaultPrevented){const G=O().filter(oe=>oe.focusable),z=G.find(oe=>oe.active),ne=G.find(oe=>oe.id===v),ce=[z,ne,...G].filter(Boolean).map(oe=>oe.ref.current);Nd(ce,d)}}_.current=!1}),onBlur:$t(e.onBlur,()=>g(!1))})})}),Ed="RovingFocusGroupItem",Sd=K.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=bd(),c=i||a,u=s_(Ed,n),d=u.currentTabStopId===c,f=xd(n),{onFocusableItemAdd:h,onFocusableItemRemove:m}=u;return K.useEffect(()=>{if(r)return h(),()=>m()},[r,h,m]),l.jsx(Ss.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:l.jsx(Ln.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:$t(e.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:$t(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:$t(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=u_(y,u.orientation,u.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let x=f().filter(g=>g.focusable).map(g=>g.ref.current);if(v==="last")x.reverse();else if(v==="prev"||v==="next"){v==="prev"&&x.reverse();const g=x.indexOf(y.currentTarget);x=u.loop?d_(x,g+1):x.slice(g+1)}setTimeout(()=>Nd(x))}})})})});Sd.displayName=Ed;var c_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function l_(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function u_(e,t,n){const r=l_(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return c_[r]}function Nd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function d_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var f_=Cd,p_=Sd,ga="Tabs",[h_,$_]=xo(ga,[Od]),Td=Od(),[m_,ya]=h_(ga),Rd=K.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=_d(a),[f,h]=da({prop:r,onChange:o,defaultProp:i});return l.jsx(m_,{scope:n,baseId:bd(),value:f,onValueChange:h,orientation:s,dir:d,activationMode:c,children:l.jsx(Ln.div,{dir:d,"data-orientation":s,...u,ref:t})})});Rd.displayName=ga;var Ad="TabsList",Pd=K.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=ya(Ad,n),s=Td(n);return l.jsx(f_,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(Ln.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Pd.displayName=Ad;var Dd="TabsTrigger",Fd=K.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=ya(Dd,n),a=Td(n),c=kd(s.baseId,r),u=jd(s.baseId,r),d=r===s.value;return l.jsx(p_,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(Ln.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:$t(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:$t(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:$t(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!o&&f&&s.onValueChange(r)})})})});Fd.displayName=Dd;var Md="TabsContent",g_=K.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=ya(Md,n),c=kd(a.baseId,r),u=jd(a.baseId,r),d=r===a.value,f=K.useRef(d);return K.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),l.jsx(fa,{present:o||d,children:({present:h})=>l.jsx(Ln.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&i})})});g_.displayName=Md;function kd(e,t){return`${e}-trigger-${t}`}function jd(e,t){return`${e}-content-${t}`}var y_=Rd,v_=Pd,Ld=Fd;const w_=l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[l.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),l.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function I_(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?w_:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:l.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function b_(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const __="_tabsRoot_ktpr0_1",x_="_tabsList_ktpr0_6",O_="_tabTrigger_ktpr0_12",C_="_danger_ktpr0_29",ci={tabsRoot:__,tabsList:x_,tabTrigger:O_,danger:C_};function Vd({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(Ld,{value:e,className:ci.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[I_(t,n),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsx("span",{children:r||e}),n&&l.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function E_({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(_o,{style:{margin:"1rem 0"}}),l.jsx(Vd,{objectName:sr,completed:e,pending:t,displayName:n},"other-write")]})}function S_(){return l.jsxs(l.Fragment,{children:[l.jsx(_o,{style:{margin:"3rem 0 1rem 0"}}),l.jsx(Ld,{value:Xi,className:vt(ci.tabTrigger,ci.danger),children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[b_(),l.jsx("span",{children:"Uninstall"})]})})]})}function N_({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o,showUninstallButton:i}){var s,a;return l.jsx(y_,{value:e,className:ci.tabsRoot,onValueChange:n,children:l.jsxs(v_,{className:ci.tabsList,children:[t.map(c=>{var u,d,f,h,m,y;return l.jsx(Vd,{objectName:c.name,displayName:c.displayName,completed:c.completed,pending:((d=(u=r==null?void 0:r[c.name])==null?void 0:u.read)==null?void 0:d.isOptionalFieldsModified)||((h=(f=r==null?void 0:r[c.name])==null?void 0:f.read)==null?void 0:h.isRequiredMapFieldsModified)||((y=(m=r==null?void 0:r[c.name])==null?void 0:m.read)==null?void 0:y.isValueMappingsModified)||!1},c.name)}),o&&l.jsx(E_,{completed:o.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),i&&l.jsx(S_,{})]})})}function T_(e,t){return t===Xi?{name:Xi,completed:!1}:e.find(n=>n.name===t)}function R_({children:e}){var x;const{project:t}=Fe(),{installation:n}=et(),{providerName:r}=jn(),{hydratedRevision:o}=Br(),{objectConfigurationsState:i}=Vs(),[s,a]=w.useState(""),c=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=o&&Al(u,o),f=d!==null,h=!!((x=o==null?void 0:o.content)!=null&&x.write),m=h?Pl(u):void 0,y=w.useMemo(()=>{const g=[...d||[]];return m&&h&&g.push(m),g},[d,m,h]),v=T_(y,s),p=w.useCallback(()=>{const g=y.find(b=>v!==b&&!b.completed);g&&a(g.name)},[y,v]);return w.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,p]),l.jsx(zl.Provider,{value:p,children:l.jsx(Wl.Provider,{value:v==null?void 0:v.name,children:l.jsxs(qr,{style:{maxWidth:"55rem"},children:[l.jsxs(kn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[l.jsxs("div",{style:{width:"20rem"},children:[l.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),l.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),f&&l.jsx(N_,{value:s,readNavObjects:d,onValueChange:g=>a(g),objectConfigurationsState:i,writeNavObject:m,showUninstallButton:!!n})]}),e]}),l.jsx(md,{})]})})})}function A_({...e}){return l.jsx(R_,{...e})}function P_({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var p;const{projectIdOrName:u,isLoading:d}=Fe(),{isLoading:f}=Ds(),{isError:h,errorState:m}=Tt(),{seed:y,reset:v}=Sl();return d||f?l.jsx(Ur,{}):h(ue.PROJECT,u)?l.jsx(Gt,{message:`Error loading project ${u}`}):h(ue.INTEGRATION_LIST,u)?l.jsx(Gt,{message:"Error retrieving integrations for the project, double check the API key"}):(p=m[ue.INTEGRATION_LIST])!=null&&p.apiError?l.jsx(Gt,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:Nl.resetContainer,children:l.jsx(zg,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(El,{children:l.jsx(Id,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:v,children:l.jsx(xy,{resetComponent:v,children:l.jsx(cb,{children:l.jsx(jy,{children:l.jsx(A_,{children:l.jsx(nb,{})})})})})})})},y)})}function D_(){return l.jsxs(qr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(ni,{}),l.jsx("p",{children:"Redirecting"})]})}function F_({redirectURL:e,children:t}){return w.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(D_,{}):t}function M_({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Fe(),{providerName:o}=jn(e),i=`You have successfully connected your ${o} account to ${r}.`;return l.jsx(ha,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Hl,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function k_({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:u,reset:d}=Sl(),f=w.useCallback(h=>{s?s(h.id):c&&c(h)},[s,c]);return l.jsx("div",{className:Nl.resetContainer,children:l.jsx(El,{groupRef:r,provider:e,children:l.jsx(Id,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:f,onDisconnectSuccess:a,children:l.jsx(F_,{redirectURL:i,children:l.jsx(M_,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},u)}const j_=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=_l(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r;return w.useEffect(()=>{o&&_t(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r}};exports.AmpersandContext=vl;exports.AmpersandProvider=Ag;exports.ConnectProvider=k_;exports.InstallIntegration=P_;exports.useAmpersandProvider=Pg;exports.useIsIntegrationInstalled=j_;