@amp-labs/react 2.9.0 → 2.9.1

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 Tp=Object.defineProperty;var mc=e=>{throw TypeError(e)};var Ap=(e,t,n)=>t in e?Tp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Fe=(e,t,n)=>Ap(e,typeof t!="symbol"?t+"":t,n),ns=(e,t,n)=>t.has(e)||mc("Cannot "+n);var O=(e,t,n)=>(ns(e,t,"read from private field"),n?n.call(e):t.get(e)),ie=(e,t,n)=>t.has(e)?mc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),G=(e,t,n,r)=>(ns(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(ns(e,t,"access private method"),n);var Zi=(e,t,n,r)=>({set _(o){G(e,t,o,n)},get _(){return O(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),b=require("react");require("react-dom");function Rp(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 L=Rp(b);var ai=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(){}},Cr=typeof window>"u"||"Deno"in globalThis;function ht(){}function Pp(e,t){return typeof e=="function"?e(t):e}function Ss(e){return typeof e=="number"&&e>=0&&e!==1/0}function $u(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zn(e,t){return typeof e=="function"?e(t):e}function Kt(e,t){return typeof e=="function"?e(t):e}function gc(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==aa(s,t.options))return!1}else if(!xi(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 yc(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Sr(t.options.mutationKey)!==Sr(i))return!1}else if(!xi(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function aa(e,t){return((t==null?void 0:t.queryKeyHashFn)||Sr)(e)}function Sr(e){return JSON.stringify(e,(t,n)=>Os(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function xi(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>xi(e[n],t[n])):!1}function xs(e,t){if(e===t)return e;const n=vc(e)&&vc(t);if(n||Os(e)&&Os(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{},c=new Set(r);let f=0;for(let d=0;d<s;d++){const l=n?d:i[d];(!n&&c.has(l)||n)&&e[l]===void 0&&t[l]===void 0?(a[l]=void 0,f++):(a[l]=xs(e[l],t[l]),a[l]===e[l]&&e[l]!==void 0&&f++)}return o===s&&f===o?e:a}return t}function yo(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 vc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Os(e){if(!wc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!wc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function wc(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fp(e){return new Promise(t=>{setTimeout(t,e)})}function Es(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 xs(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return xs(e,t)}return t}function Dp(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Mp(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var vo=Symbol();function Uu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===vo&&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===vo?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function qu(e,t){return typeof e=="function"?e(...t):!!e}var pr,Kn,Lr,Au,kp=(Au=class extends ai{constructor(){super();ie(this,pr);ie(this,Kn);ie(this,Lr);G(this,Lr,t=>{if(!Cr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,Kn)||this.setEventListener(O(this,Lr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Kn))==null||t.call(this),G(this,Kn,void 0))}setEventListener(t){var n;G(this,Lr,t),(n=O(this,Kn))==null||n.call(this),G(this,Kn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,pr)!==t&&(G(this,pr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof O(this,pr)=="boolean"?O(this,pr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},pr=new WeakMap,Kn=new WeakMap,Lr=new WeakMap,Au),ca=new kp,jr,$n,Kr,Ru,Lp=(Ru=class extends ai{constructor(){super();ie(this,jr,!0);ie(this,$n);ie(this,Kr);G(this,Kr,t=>{if(!Cr&&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(){O(this,$n)||this.setEventListener(O(this,Kr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,$n))==null||t.call(this),G(this,$n,void 0))}setEventListener(t){var n;G(this,Kr,t),(n=O(this,$n))==null||n.call(this),G(this,$n,t(this.setOnline.bind(this)))}setOnline(t){O(this,jr)!==t&&(G(this,jr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,jr)}},jr=new WeakMap,$n=new WeakMap,Kr=new WeakMap,Ru),wo=new Lp;function _s(){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 jp(e){return Math.min(1e3*2**e,3e4)}function Vu(e){return(e??"online")==="online"?wo.isOnline():!0}var Hu=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Bu(e){let t=!1,n=0,r;const o=_s(),i=()=>o.status!=="pending",s=v=>{var p;i()||(m(new Hu(v)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},c=()=>{t=!1},f=()=>ca.isFocused()&&(e.networkMode==="always"||wo.isOnline())&&e.canRun(),d=()=>Vu(e.networkMode)&&e.canRun(),l=v=>{i()||(r==null||r(),o.resolve(v))},m=v=>{i()||(r==null||r(),o.reject(v))},y=()=>new Promise(v=>{var p;r=S=>{(i()||f())&&v(S)},(p=e.onPause)==null||p.call(e)}).then(()=>{var v;r=void 0,i()||(v=e.onContinue)==null||v.call(e)}),w=()=>{if(i())return;let v;const p=n===0?e.initialPromise:void 0;try{v=p??e.fn()}catch(S){v=Promise.reject(S)}Promise.resolve(v).then(l).catch(S=>{var T;if(i())return;const h=e.retry??(Cr?0:3),g=e.retryDelay??jp,I=typeof g=="function"?g(n,S):g,x=h===!0||typeof h=="number"&&n<h||typeof h=="function"&&h(n,S);if(t||!x){m(S);return}n++,(T=e.onFail)==null||T.call(e,n,S),Fp(I).then(()=>f()?void 0:y()).then(()=>{t?m(S):w()})})};return{promise:o,status:()=>o.status,cancel:s,continue:()=>(r==null||r(),o),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?w():y().then(w),o)}}var Kp=e=>setTimeout(e,0);function $p(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=Kp;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 ze=$p(),hr,Pu,Ju=(Pu=class{constructor(){ie(this,hr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ss(this.gcTime)&&G(this,hr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Cr?1/0:5*60*1e3))}clearGcTimeout(){O(this,hr)&&(clearTimeout(O(this,hr)),G(this,hr,void 0))}},hr=new WeakMap,Pu),$r,Ur,jt,mr,Ye,Pi,gr,zt,bn,Fu,Up=(Fu=class extends Ju{constructor(t){super();ie(this,zt);ie(this,$r);ie(this,Ur);ie(this,jt);ie(this,mr);ie(this,Ye);ie(this,Pi);ie(this,gr);G(this,gr,!1),G(this,Pi,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,mr,t.client),G(this,jt,O(this,mr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,$r,qp(this.options)),this.state=t.state??O(this,$r),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,Ye))==null?void 0:t.promise}setOptions(t){this.options={...O(this,Pi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,jt).remove(this)}setData(t,n){const r=Es(this.state.data,t,this.options);return pe(this,zt,bn).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,zt,bn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=O(this,Ye))==null?void 0:r.promise;return(o=O(this,Ye))==null||o.cancel(t),n?n.then(ht).catch(ht):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,$r))}isActive(){return this.observers.some(t=>Kt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vo||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>zn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!$u(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,Ye))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,Ye))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,jt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(O(this,Ye)&&(O(this,gr)?O(this,Ye).cancel({revert:!0}):O(this,Ye).cancelRetry()),this.scheduleGc()),O(this,jt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,zt,bn).call(this,{type:"invalidate"})}async fetch(t,n){var c,f,d,l,m,y,w,v,p,S,h,g;if(this.state.fetchStatus!=="idle"&&((c=O(this,Ye))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,Ye))return O(this,Ye).continueRetry(),O(this,Ye).promise}if(t&&this.setOptions(t),!this.options.queryFn){const I=this.observers.find(x=>x.options.queryFn);I&&this.setOptions(I.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=I=>{Object.defineProperty(I,"signal",{enumerable:!0,get:()=>(G(this,gr,!0),r.signal)})},i=()=>{const I=Uu(this.options,n),T=(()=>{const E={client:O(this,mr),queryKey:this.queryKey,meta:this.meta};return o(E),E})();return G(this,gr,!1),this.options.persister?this.options.persister(I,T,this):I(T)},a=(()=>{const I={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,mr),state:this.state,fetchFn:i};return o(I),I})();(f=this.options.behavior)==null||f.onFetch(a,this),G(this,Ur,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&pe(this,zt,bn).call(this,{type:"fetch",meta:(l=a.fetchOptions)==null?void 0:l.meta}),G(this,Ye,Bu({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onFail:(I,x)=>{pe(this,zt,bn).call(this,{type:"failed",failureCount:I,error:x})},onPause:()=>{pe(this,zt,bn).call(this,{type:"pause"})},onContinue:()=>{pe(this,zt,bn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const I=await O(this,Ye).start();if(I===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(I),(y=(m=O(this,jt).config).onSuccess)==null||y.call(m,I,this),(v=(w=O(this,jt).config).onSettled)==null||v.call(w,I,this.state.error,this),I}catch(I){if(I instanceof Hu){if(I.silent)return O(this,Ye).promise;if(I.revert){if(this.setState({...O(this,Ur),fetchStatus:"idle"}),this.state.data===void 0)throw I;return this.state.data}}throw pe(this,zt,bn).call(this,{type:"error",error:I}),(S=(p=O(this,jt).config).onError)==null||S.call(p,I,this),(g=(h=O(this,jt).config).onSettled)==null||g.call(h,this.state.data,I,this),I}finally{this.scheduleGc()}}},$r=new WeakMap,Ur=new WeakMap,jt=new WeakMap,mr=new WeakMap,Ye=new WeakMap,Pi=new WeakMap,gr=new WeakMap,zt=new WeakSet,bn=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,...Wu(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...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}};return G(this,Ur,t.manual?o:void 0),o;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ze.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,jt).notify({query:this,type:"updated",action:t})})},Fu);function Wu(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function qp(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 on,Du,Vp=(Du=class extends ai{constructor(t={}){super();ie(this,on);this.config=t,G(this,on,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??aa(o,n);let s=this.get(i);return s||(s=new Up({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){O(this,on).has(t.queryHash)||(O(this,on).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,on).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,on).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ze.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,on).get(t)}getAll(){return[...O(this,on).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>gc(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>gc(t,r)):n}notify(t){ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ze.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ze.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},on=new WeakMap,Du),sn,ft,yr,an,jn,Mu,Hp=(Mu=class extends Ju{constructor(t){super();ie(this,an);ie(this,sn);ie(this,ft);ie(this,yr);this.mutationId=t.mutationId,G(this,ft,t.mutationCache),G(this,sn,[]),this.state=t.state||zu(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,sn).includes(t)||(O(this,sn).push(t),this.clearGcTimeout(),O(this,ft).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,sn,O(this,sn).filter(n=>n!==t)),this.scheduleGc(),O(this,ft).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,sn).length||(this.state.status==="pending"?this.scheduleGc():O(this,ft).remove(this))}continue(){var t;return((t=O(this,yr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,a,c,f,d,l,m,y,w,v,p,S,h,g,I,x,T,E,A;const n=()=>{pe(this,an,jn).call(this,{type:"continue"})};G(this,yr,Bu({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(R,P)=>{pe(this,an,jn).call(this,{type:"failed",failureCount:R,error:P})},onPause:()=>{pe(this,an,jn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,ft).canRun(this)}));const r=this.state.status==="pending",o=!O(this,yr).canStart();try{if(r)n();else{pe(this,an,jn).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(i=O(this,ft).config).onMutate)==null?void 0:s.call(i,t,this));const P=await((c=(a=this.options).onMutate)==null?void 0:c.call(a,t));P!==this.state.context&&pe(this,an,jn).call(this,{type:"pending",context:P,variables:t,isPaused:o})}const R=await O(this,yr).start();return await((d=(f=O(this,ft).config).onSuccess)==null?void 0:d.call(f,R,t,this.state.context,this)),await((m=(l=this.options).onSuccess)==null?void 0:m.call(l,R,t,this.state.context)),await((w=(y=O(this,ft).config).onSettled)==null?void 0:w.call(y,R,null,this.state.variables,this.state.context,this)),await((p=(v=this.options).onSettled)==null?void 0:p.call(v,R,null,t,this.state.context)),pe(this,an,jn).call(this,{type:"success",data:R}),R}catch(R){try{throw await((h=(S=O(this,ft).config).onError)==null?void 0:h.call(S,R,t,this.state.context,this)),await((I=(g=this.options).onError)==null?void 0:I.call(g,R,t,this.state.context)),await((T=(x=O(this,ft).config).onSettled)==null?void 0:T.call(x,void 0,R,this.state.variables,this.state.context,this)),await((A=(E=this.options).onSettled)==null?void 0:A.call(E,void 0,R,t,this.state.context)),R}finally{pe(this,an,jn).call(this,{type:"error",error:R})}}finally{O(this,ft).runNext(this)}}},sn=new WeakMap,ft=new WeakMap,yr=new WeakMap,an=new WeakSet,jn=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),ze.batch(()=>{O(this,sn).forEach(r=>{r.onMutationUpdate(t)}),O(this,ft).notify({mutation:this,type:"updated",action:t})})},Mu);function zu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var In,Gt,Fi,ku,Bp=(ku=class extends ai{constructor(t={}){super();ie(this,In);ie(this,Gt);ie(this,Fi);this.config=t,G(this,In,new Set),G(this,Gt,new Map),G(this,Fi,0)}build(t,n,r){const o=new Hp({mutationCache:this,mutationId:++Zi(this,Fi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,In).add(t);const n=eo(t);if(typeof n=="string"){const r=O(this,Gt).get(n);r?r.push(t):O(this,Gt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,In).delete(t)){const n=eo(t);if(typeof n=="string"){const r=O(this,Gt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&O(this,Gt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=eo(t);if(typeof n=="string"){const r=O(this,Gt).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=eo(t);if(typeof n=="string"){const o=(r=O(this,Gt).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(){ze.batch(()=>{O(this,In).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,In).clear(),O(this,Gt).clear()})}getAll(){return Array.from(O(this,In))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>yc(n,r))}findAll(t={}){return this.getAll().filter(n=>yc(t,n))}notify(t){ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ze.batch(()=>Promise.all(t.map(n=>n.continue().catch(ht))))}},In=new WeakMap,Gt=new WeakMap,Fi=new WeakMap,ku);function eo(e){var t;return(t=e.options.scope)==null?void 0:t.id}function bc(e){return{onFetch:(t,n)=>{var d,l,m,y,w;const r=t.options,o=(m=(l=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:l.fetchMore)==null?void 0:m.direction,i=((y=t.state.data)==null?void 0:y.pages)||[],s=((w=t.state.data)==null?void 0:w.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const f=async()=>{let v=!1;const p=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(t.signal.aborted?v=!0:t.signal.addEventListener("abort",()=>{v=!0}),t.signal)})},S=Uu(t.options,t.fetchOptions),h=async(g,I,x)=>{if(v)return Promise.reject();if(I==null&&g.pages.length)return Promise.resolve(g);const E=(()=>{const K={client:t.client,queryKey:t.queryKey,pageParam:I,direction:x?"backward":"forward",meta:t.options.meta};return p(K),K})(),A=await S(E),{maxPages:R}=t.options,P=x?Mp:Dp;return{pages:P(g.pages,A,R),pageParams:P(g.pageParams,I,R)}};if(o&&i.length){const g=o==="backward",I=g?Jp:Ic,x={pages:i,pageParams:s},T=I(r,x);a=await h(x,T,g)}else{const g=e??i.length;do{const I=c===0?s[0]??r.initialPageParam:Ic(r,a);if(c>0&&I==null)break;a=await h(a,I),c++}while(c<g)}return a};t.options.persister?t.fetchFn=()=>{var v,p;return(p=(v=t.options).persister)==null?void 0:p.call(v,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function Ic(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 Jp(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,Un,qn,qr,Vr,Vn,Hr,Br,Lu,Wp=(Lu=class{constructor(e={}){ie(this,Ke);ie(this,Un);ie(this,qn);ie(this,qr);ie(this,Vr);ie(this,Vn);ie(this,Hr);ie(this,Br);G(this,Ke,e.queryCache||new Vp),G(this,Un,e.mutationCache||new Bp),G(this,qn,e.defaultOptions||{}),G(this,qr,new Map),G(this,Vr,new Map),G(this,Vn,0)}mount(){Zi(this,Vn)._++,O(this,Vn)===1&&(G(this,Hr,ca.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ke).onFocus())})),G(this,Br,wo.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ke).onOnline())})))}unmount(){var e,t;Zi(this,Vn)._--,O(this,Vn)===0&&((e=O(this,Hr))==null||e.call(this),G(this,Hr,void 0),(t=O(this,Br))==null||t.call(this),G(this,Br,void 0))}isFetching(e){return O(this,Ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Un).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,Ke).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(zn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(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=O(this,Ke).get(r.queryHash),i=o==null?void 0:o.state.data,s=Pp(t,i);if(s!==void 0)return O(this,Ke).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return ze.batch(()=>O(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=O(this,Ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,Ke);ze.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,Ke);return ze.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ze.batch(()=>O(this,Ke).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(ht).catch(ht)}invalidateQueries(e,t={}){return ze.batch(()=>(O(this,Ke).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ze.batch(()=>O(this,Ke).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(ht)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(ht)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=O(this,Ke).build(this,t);return n.isStaleByTime(zn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ht).catch(ht)}fetchInfiniteQuery(e){return e.behavior=bc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ht).catch(ht)}ensureInfiniteQueryData(e){return e.behavior=bc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return wo.isOnline()?O(this,Un).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Ke)}getMutationCache(){return O(this,Un)}getDefaultOptions(){return O(this,qn)}setDefaultOptions(e){G(this,qn,e)}setQueryDefaults(e,t){O(this,qr).set(Sr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,qr).values()],n={};return t.forEach(r=>{xi(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,Vr).set(Sr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Vr).values()],n={};return t.forEach(r=>{xi(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,qn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=aa(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===vo&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,qn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Ke).clear(),O(this,Un).clear()}},Ke=new WeakMap,Un=new WeakMap,qn=new WeakMap,qr=new WeakMap,Vr=new WeakMap,Vn=new WeakMap,Hr=new WeakMap,Br=new WeakMap,Lu),wt,ye,Di,pt,vr,Jr,Cn,Hn,Mi,Wr,zr,wr,br,Bn,Gr,xe,wi,Ns,Ts,As,Rs,Ps,Fs,Ds,Gu,ju,zp=(ju=class extends ai{constructor(t,n){super();ie(this,xe);ie(this,wt);ie(this,ye);ie(this,Di);ie(this,pt);ie(this,vr);ie(this,Jr);ie(this,Cn);ie(this,Hn);ie(this,Mi);ie(this,Wr);ie(this,zr);ie(this,wr);ie(this,br);ie(this,Bn);ie(this,Gr,new Set);this.options=n,G(this,wt,t),G(this,Hn,null),G(this,Cn,_s()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,ye).addObserver(this),Cc(O(this,ye),this.options)?pe(this,xe,wi).call(this):this.updateResult(),pe(this,xe,Rs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ms(O(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ms(O(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,xe,Ps).call(this),pe(this,xe,Fs).call(this),O(this,ye).removeObserver(this)}setOptions(t){const n=this.options,r=O(this,ye);if(this.options=O(this,wt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Kt(this.options.enabled,O(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,xe,Ds).call(this),O(this,ye).setOptions(this.options),n._defaulted&&!yo(this.options,n)&&O(this,wt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ye),observer:this});const o=this.hasListeners();o&&Sc(O(this,ye),r,this.options,n)&&pe(this,xe,wi).call(this),this.updateResult(),o&&(O(this,ye)!==r||Kt(this.options.enabled,O(this,ye))!==Kt(n.enabled,O(this,ye))||zn(this.options.staleTime,O(this,ye))!==zn(n.staleTime,O(this,ye)))&&pe(this,xe,Ns).call(this);const i=pe(this,xe,Ts).call(this);o&&(O(this,ye)!==r||Kt(this.options.enabled,O(this,ye))!==Kt(n.enabled,O(this,ye))||i!==O(this,Bn))&&pe(this,xe,As).call(this,i)}getOptimisticResult(t){const n=O(this,wt).getQueryCache().build(O(this,wt),t),r=this.createResult(n,t);return Qp(this,r)&&(G(this,pt,r),G(this,Jr,this.options),G(this,vr,O(this,ye).state)),r}getCurrentResult(){return O(this,pt)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),o==="promise"&&!this.options.experimental_prefetchInRender&&O(this,Cn).status==="pending"&&O(this,Cn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(r,o))})}trackProp(t){O(this,Gr).add(t)}getCurrentQuery(){return O(this,ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=O(this,wt).defaultQueryOptions(t),r=O(this,wt).getQueryCache().build(O(this,wt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,xe,wi).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,pt)))}createResult(t,n){var R;const r=O(this,ye),o=this.options,i=O(this,pt),s=O(this,vr),a=O(this,Jr),f=t!==r?t.state:O(this,Di),{state:d}=t;let l={...d},m=!1,y;if(n._optimisticResults){const P=this.hasListeners(),K=!P&&Cc(t,n),q=P&&Sc(t,r,n,o);(K||q)&&(l={...l,...Wu(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(l.fetchStatus="idle")}let{error:w,errorUpdatedAt:v,status:p}=l;y=l.data;let S=!1;if(n.placeholderData!==void 0&&y===void 0&&p==="pending"){let P;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(P=i.data,S=!0):P=typeof n.placeholderData=="function"?n.placeholderData((R=O(this,zr))==null?void 0:R.state.data,O(this,zr)):n.placeholderData,P!==void 0&&(p="success",y=Es(i==null?void 0:i.data,P,n),m=!0)}if(n.select&&y!==void 0&&!S)if(i&&y===(s==null?void 0:s.data)&&n.select===O(this,Mi))y=O(this,Wr);else try{G(this,Mi,n.select),y=n.select(y),y=Es(i==null?void 0:i.data,y,n),G(this,Wr,y),G(this,Hn,null)}catch(P){G(this,Hn,P)}O(this,Hn)&&(w=O(this,Hn),y=O(this,Wr),v=Date.now(),p="error");const h=l.fetchStatus==="fetching",g=p==="pending",I=p==="error",x=g&&h,T=y!==void 0,A={status:p,fetchStatus:l.fetchStatus,isPending:g,isSuccess:p==="success",isError:I,isInitialLoading:x,isLoading:x,data:y,dataUpdatedAt:l.dataUpdatedAt,error:w,errorUpdatedAt:v,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>f.dataUpdateCount||l.errorUpdateCount>f.errorUpdateCount,isFetching:h,isRefetching:h&&!g,isLoadingError:I&&!T,isPaused:l.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:I&&T,isStale:ua(t,n),refetch:this.refetch,promise:O(this,Cn),isEnabled:Kt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const P=j=>{A.status==="error"?j.reject(A.error):A.data!==void 0&&j.resolve(A.data)},K=()=>{const j=G(this,Cn,A.promise=_s());P(j)},q=O(this,Cn);switch(q.status){case"pending":t.queryHash===r.queryHash&&P(q);break;case"fulfilled":(A.status==="error"||A.data!==q.value)&&K();break;case"rejected":(A.status!=="error"||A.error!==q.reason)&&K();break}}return A}updateResult(){const t=O(this,pt),n=this.createResult(O(this,ye),this.options);if(G(this,vr,O(this,ye).state),G(this,Jr,this.options),O(this,vr).data!==void 0&&G(this,zr,O(this,ye)),yo(n,t))return;G(this,pt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!O(this,Gr).size)return!0;const s=new Set(i??O(this,Gr));return this.options.throwOnError&&s.add("error"),Object.keys(O(this,pt)).some(a=>{const c=a;return O(this,pt)[c]!==t[c]&&s.has(c)})};pe(this,xe,Gu).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,xe,Rs).call(this)}},wt=new WeakMap,ye=new WeakMap,Di=new WeakMap,pt=new WeakMap,vr=new WeakMap,Jr=new WeakMap,Cn=new WeakMap,Hn=new WeakMap,Mi=new WeakMap,Wr=new WeakMap,zr=new WeakMap,wr=new WeakMap,br=new WeakMap,Bn=new WeakMap,Gr=new WeakMap,xe=new WeakSet,wi=function(t){pe(this,xe,Ds).call(this);let n=O(this,ye).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(ht)),n},Ns=function(){pe(this,xe,Ps).call(this);const t=zn(this.options.staleTime,O(this,ye));if(Cr||O(this,pt).isStale||!Ss(t))return;const r=$u(O(this,pt).dataUpdatedAt,t)+1;G(this,wr,setTimeout(()=>{O(this,pt).isStale||this.updateResult()},r))},Ts=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ye)):this.options.refetchInterval)??!1},As=function(t){pe(this,xe,Fs).call(this),G(this,Bn,t),!(Cr||Kt(this.options.enabled,O(this,ye))===!1||!Ss(O(this,Bn))||O(this,Bn)===0)&&G(this,br,setInterval(()=>{(this.options.refetchIntervalInBackground||ca.isFocused())&&pe(this,xe,wi).call(this)},O(this,Bn)))},Rs=function(){pe(this,xe,Ns).call(this),pe(this,xe,As).call(this,pe(this,xe,Ts).call(this))},Ps=function(){O(this,wr)&&(clearTimeout(O(this,wr)),G(this,wr,void 0))},Fs=function(){O(this,br)&&(clearInterval(O(this,br)),G(this,br,void 0))},Ds=function(){const t=O(this,wt).getQueryCache().build(O(this,wt),this.options);if(t===O(this,ye))return;const n=O(this,ye);G(this,ye,t),G(this,Di,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Gu=function(t){ze.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,pt))}),O(this,wt).getQueryCache().notify({query:O(this,ye),type:"observerResultsUpdated"})})},ju);function Gp(e,t){return Kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Cc(e,t){return Gp(e,t)||e.state.data!==void 0&&Ms(e,t,t.refetchOnMount)}function Ms(e,t,n){if(Kt(t.enabled,e)!==!1&&zn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ua(e,t)}return!1}function Sc(e,t,n,r){return(e!==t||Kt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ua(e,n)}function ua(e,t){return Kt(t.enabled,e)!==!1&&e.isStaleByTime(zn(t.staleTime,e))}function Qp(e,t){return!yo(e.getCurrentResult(),t)}var Jn,Wn,bt,Sn,On,lo,ks,Ku,Xp=(Ku=class extends ai{constructor(n,r){super();ie(this,On);ie(this,Jn);ie(this,Wn);ie(this,bt);ie(this,Sn);G(this,Jn,n),this.setOptions(r),this.bindMethods(),pe(this,On,lo).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=O(this,Jn).defaultMutationOptions(n),yo(this.options,r)||O(this,Jn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,bt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Sr(r.mutationKey)!==Sr(this.options.mutationKey)?this.reset():((o=O(this,bt))==null?void 0:o.state.status)==="pending"&&O(this,bt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=O(this,bt))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,On,lo).call(this),pe(this,On,ks).call(this,n)}getCurrentResult(){return O(this,Wn)}reset(){var n;(n=O(this,bt))==null||n.removeObserver(this),G(this,bt,void 0),pe(this,On,lo).call(this),pe(this,On,ks).call(this)}mutate(n,r){var o;return G(this,Sn,r),(o=O(this,bt))==null||o.removeObserver(this),G(this,bt,O(this,Jn).getMutationCache().build(O(this,Jn),this.options)),O(this,bt).addObserver(this),O(this,bt).execute(n)}},Jn=new WeakMap,Wn=new WeakMap,bt=new WeakMap,Sn=new WeakMap,On=new WeakSet,lo=function(){var r;const n=((r=O(this,bt))==null?void 0:r.state)??zu();G(this,Wn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ks=function(n){ze.batch(()=>{var r,o,i,s,a,c,f,d;if(O(this,Sn)&&this.hasListeners()){const l=O(this,Wn).variables,m=O(this,Wn).context;(n==null?void 0:n.type)==="success"?((o=(r=O(this,Sn)).onSuccess)==null||o.call(r,n.data,l,m),(s=(i=O(this,Sn)).onSettled)==null||s.call(i,n.data,null,l,m)):(n==null?void 0:n.type)==="error"&&((c=(a=O(this,Sn)).onError)==null||c.call(a,n.error,l,m),(d=(f=O(this,Sn)).onSettled)==null||d.call(f,void 0,n.error,l,m))}this.listeners.forEach(l=>{l(O(this,Wn))})})},Ku),Qu=L.createContext(void 0),$e=e=>{const t=L.useContext(Qu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Yp=({client:e,children:t})=>(L.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(Qu.Provider,{value:e,children:t})),Xu=L.createContext(!1),Zp=()=>L.useContext(Xu);Xu.Provider;function eh(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var th=L.createContext(eh()),nh=()=>L.useContext(th),rh=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},ih=e=>{L.useEffect(()=>{e.clearReset()},[e])},oh=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||qu(n,[e.error,r])),sh=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...r)=>t(n(...r)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},ah=(e,t)=>e.isLoading&&e.isFetching&&!t,ch=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,xc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function uh(e,t,n){var l,m,y,w,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=Zp(),o=nh(),i=$e(),s=i.defaultQueryOptions(e);(m=(l=i.getDefaultOptions().queries)==null?void 0:l._experimental_beforeQuery)==null||m.call(l,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=r?"isRestoring":"optimistic",sh(s),rh(s,o),ih(o);const a=!i.getQueryCache().get(s.queryHash),[c]=L.useState(()=>new t(i,s)),f=c.getOptimisticResult(s),d=!r&&e.subscribed!==!1;if(L.useSyncExternalStore(L.useCallback(p=>{const S=d?c.subscribe(ze.batchCalls(p)):ht;return c.updateResult(),S},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),L.useEffect(()=>{c.setOptions(s)},[s,c]),ch(s,f))throw xc(s,c,o);if(oh({result:f,errorResetBoundary:o,throwOnError:s.throwOnError,query:i.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((w=(y=i.getDefaultOptions().queries)==null?void 0:y._experimental_afterQuery)==null||w.call(y,s,f),s.experimental_prefetchInRender&&!Cr&&ah(f,r)){const p=a?xc(s,c,o):(v=i.getQueryCache().get(s.queryHash))==null?void 0:v.promise;p==null||p.catch(ht).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?f:c.trackResult(f)}function Zn(e,t){return uh(e,zp)}function En(e,t){const n=$e(),[r]=L.useState(()=>new Xp(n,e));L.useEffect(()=>{r.setOptions(e)},[r,e]);const o=L.useSyncExternalStore(L.useCallback(s=>r.subscribe(ze.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=L.useCallback((s,a)=>{r.mutate(s,a).catch(ht)},[r]);if(o.error&&qu(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const Yu=b.createContext(null),lh=Yu.Provider,Zu=()=>b.useContext(Yu);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 el=b.createContext(void 0);function Ut(){const e=b.useContext(el);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const dh=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function fh({children:e}){const[t,n]=b.useState(dh),r=b.useCallback((d,l,m=!0)=>{n(y=>{const w={...y};return w[d]=w[d]||{},w[d][l]=m,w})},[n]),o=b.useCallback((d,l)=>{var m;return!!((m=t[d])!=null&&m[l])},[t]),i=b.useCallback((d,l)=>{var m;return(m=t[d])==null?void 0:m[l]},[t]),s=b.useCallback((d,l)=>{n(m=>{var w;const y={...m};return(w=y[d])==null||delete w[l],y})},[n]),a=b.useCallback(d=>{n(l=>{const m={...l};return m[d]={},m})},[n]),c=b.useCallback((d,l)=>{n(m=>{const y={...m};return y[d]=y[d]||{},l.forEach(w=>{y[d][w]=!0}),y})},[n]),f=b.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 u.jsx(el.Provider,{value:f,children:e})}const to=new TextEncoder,Oi=new TextDecoder;function ph(...e){const t=e.reduce((o,{length:i})=>o+i,0),n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function hh(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function fo(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:Oi.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=Oi.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return hh(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class er extends Error{constructor(n,r){var o;super(n,r);Fe(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(o=Error.captureStackTrace)==null||o.call(Error,this,this.constructor)}}Fe(er,"code","ERR_JOSE_GENERIC");class Wt extends er{constructor(n,r,o="unspecified",i="unspecified"){super(n,{cause:{claim:o,reason:i,payload:r}});Fe(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");Fe(this,"claim");Fe(this,"reason");Fe(this,"payload");this.claim=o,this.reason=i,this.payload=r}}Fe(Wt,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Ls extends er{constructor(n,r,o="unspecified",i="unspecified"){super(n,{cause:{claim:o,reason:i,payload:r}});Fe(this,"code","ERR_JWT_EXPIRED");Fe(this,"claim");Fe(this,"reason");Fe(this,"payload");this.claim=o,this.reason=i,this.payload=r}}Fe(Ls,"code","ERR_JWT_EXPIRED");class tl extends er{constructor(){super(...arguments);Fe(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}Fe(tl,"code","ERR_JOSE_ALG_NOT_ALLOWED");class dr extends er{constructor(){super(...arguments);Fe(this,"code","ERR_JOSE_NOT_SUPPORTED")}}Fe(dr,"code","ERR_JOSE_NOT_SUPPORTED");class Xe extends er{constructor(){super(...arguments);Fe(this,"code","ERR_JWS_INVALID")}}Fe(Xe,"code","ERR_JWS_INVALID");class la extends er{constructor(){super(...arguments);Fe(this,"code","ERR_JWT_INVALID")}}Fe(la,"code","ERR_JWT_INVALID");class nl extends er{constructor(n="signature verification failed",r){super(n,r);Fe(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}Fe(nl,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function wn(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function gi(e,t){return e.name===t}function rs(e){return parseInt(e.name.slice(4),10)}function mh(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function gh(e,t){if(!e.usages.includes(t))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function yh(e,t,n){switch(t){case"HS256":case"HS384":case"HS512":{if(!gi(e.algorithm,"HMAC"))throw wn("HMAC");const r=parseInt(t.slice(2),10);if(rs(e.algorithm.hash)!==r)throw wn(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!gi(e.algorithm,"RSASSA-PKCS1-v1_5"))throw wn("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(rs(e.algorithm.hash)!==r)throw wn(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!gi(e.algorithm,"RSA-PSS"))throw wn("RSA-PSS");const r=parseInt(t.slice(2),10);if(rs(e.algorithm.hash)!==r)throw wn(`SHA-${r}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":{if(!gi(e.algorithm,"Ed25519"))throw wn("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!gi(e.algorithm,"ECDSA"))throw wn("ECDSA");const r=mh(t);if(e.algorithm.namedCurve!==r)throw wn(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}gh(e,n)}function rl(e,t,...n){var r;if(n=n.filter(Boolean),n.length>2){const o=n.pop();e+=`one of type ${n.join(", ")}, or ${o}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t=="function"&&t.name?e+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&(r=t.constructor)!=null&&r.name&&(e+=` Received an instance of ${t.constructor.name}`),e}const vh=(e,...t)=>rl("Key must be ",e,...t);function il(e,t,...n){return rl(`Key for the ${e} algorithm must be `,t,...n)}function ol(e){return(e==null?void 0:e[Symbol.toStringTag])==="CryptoKey"}function sl(e){return(e==null?void 0:e[Symbol.toStringTag])==="KeyObject"}const al=e=>ol(e)||sl(e),wh=(...e)=>{const t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(const r of t){const o=Object.keys(r);if(!n||n.size===0){n=new Set(o);continue}for(const i of o){if(n.has(i))return!1;n.add(i)}}return!0};function bh(e){return typeof e=="object"&&e!==null}const bo=e=>{if(!bh(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},Ih=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if(typeof n!="number"||n<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}};function Ch(e){let t,n;switch(e.kty){case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new dr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new dr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new dr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new dr('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}const Sh=async e=>{if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:t,keyUsages:n}=Ch(e),r={...e};return delete r.alg,delete r.use,crypto.subtle.importKey("jwk",r,t,e.ext??!e.d,e.key_ops??n)},xh=(e,t,n,r,o)=>{if(o.crit!==void 0&&(r==null?void 0:r.crit)===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(s=>typeof s!="string"||s.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;n!==void 0?i=new Map([...Object.entries(n),...t.entries()]):i=t;for(const s of r.crit){if(!i.has(s))throw new dr(`Extension Header Parameter "${s}" is not recognized`);if(o[s]===void 0)throw new e(`Extension Header Parameter "${s}" is missing`);if(i.get(s)&&r[s]===void 0)throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(r.crit)},Oh=(e,t)=>{if(t!==void 0&&(!Array.isArray(t)||t.some(n=>typeof n!="string")))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)};function da(e){return bo(e)&&typeof e.kty=="string"}function Eh(e){return e.kty!=="oct"&&typeof e.d=="string"}function _h(e){return e.kty!=="oct"&&typeof e.d>"u"}function Nh(e){return e.kty==="oct"&&typeof e.k=="string"}let Mr;const Oc=async(e,t,n,r=!1)=>{Mr||(Mr=new WeakMap);let o=Mr.get(e);if(o!=null&&o[n])return o[n];const i=await Sh({...t,alg:n});return r&&Object.freeze(e),o?o[n]=i:Mr.set(e,{[n]:i}),i},Th=(e,t)=>{var s;Mr||(Mr=new WeakMap);let n=Mr.get(e);if(n!=null&&n[t])return n[t];const r=e.type==="public",o=!!r;let i;if(e.asymmetricKeyType==="x25519"){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if(e.asymmetricKeyType==="ed25519"){if(t!=="EdDSA"&&t!=="Ed25519")throw new TypeError("given KeyObject instance cannot be used for this algorithm");i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if(e.asymmetricKeyType==="rsa"){let a;switch(t){case"RSA-OAEP":a="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":a="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":a="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":a="SHA-512";break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:a},o,r?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:a},o,[r?"verify":"sign"])}if(e.asymmetricKeyType==="ec"){const c=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get((s=e.asymmetricKeyDetails)==null?void 0:s.namedCurve);if(!c)throw new TypeError("given KeyObject instance cannot be used for this algorithm");t==="ES256"&&c==="P-256"&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:c},o,[r?"verify":"sign"])),t==="ES384"&&c==="P-384"&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:c},o,[r?"verify":"sign"])),t==="ES512"&&c==="P-521"&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:c},o,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:c},o,r?[]:["deriveBits"]))}if(!i)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return n?n[t]=i:Mr.set(e,{[t]:i}),i},Ah=async(e,t)=>{if(e instanceof Uint8Array||ol(e))return e;if(sl(e)){if(e.type==="secret")return e.export();if("toCryptoKey"in e&&typeof e.toCryptoKey=="function")try{return Th(e,t)}catch(r){if(r instanceof TypeError)throw r}let n=e.export({format:"jwk"});return Oc(e,n,t)}if(da(e))return e.k?fo(e.k):Oc(e,e,t,!0);throw new Error("unreachable")},Fr=e=>e==null?void 0:e[Symbol.toStringTag],js=(e,t,n)=>{var r,o;if(t.use!==void 0){let i;switch(n){case"sign":case"verify":i="sig";break;case"encrypt":case"decrypt":i="enc";break}if(t.use!==i)throw new TypeError(`Invalid key for this operation, its "use" must be "${i}" when present`)}if(t.alg!==void 0&&t.alg!==e)throw new TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);if(Array.isArray(t.key_ops)){let i;switch(!0){case n==="verify":case e==="dir":case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):!e.includes("GCM")&&e.endsWith("KW")?i="unwrapKey":i=n;break;case n==="encrypt":i="wrapKey";break;case n==="decrypt":i=e.startsWith("RSA")?"unwrapKey":"deriveBits";break}if(i&&((o=(r=t.key_ops)==null?void 0:r.includes)==null?void 0:o.call(r,i))===!1)throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${i}" when present`)}return!0},Rh=(e,t,n)=>{if(!(t instanceof Uint8Array)){if(da(t)){if(Nh(t)&&js(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!al(t))throw new TypeError(il(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(t.type!=="secret")throw new TypeError(`${Fr(t)} instances for symmetric algorithms must be of type "secret"`)}},Ph=(e,t,n)=>{if(da(t))switch(n){case"decrypt":case"sign":if(Eh(t)&&js(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(_h(t)&&js(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!al(t))throw new TypeError(il(e,t,"CryptoKey","KeyObject","JSON Web Key"));if(t.type==="secret")throw new TypeError(`${Fr(t)} instances for asymmetric algorithms must not be of type "secret"`);if(t.type==="public")switch(n){case"sign":throw new TypeError(`${Fr(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${Fr(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if(t.type==="private")switch(n){case"verify":throw new TypeError(`${Fr(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${Fr(t)} instances for asymmetric algorithm encryption must be of type "public"`)}},Fh=(e,t,n)=>{e.startsWith("HS")||e==="dir"||e.startsWith("PBES2")||/^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(e)||/^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(e)?Rh(e,t,n):Ph(e,t,n)},Dh=(e,t)=>{const n=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};default:throw new dr(`alg ${e} is not supported either by JOSE or your javascript runtime`)}},Mh=async(e,t,n)=>{if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(vh(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[n])}return yh(t,e,n),t},kh=async(e,t,n,r)=>{const o=await Mh(e,t,"verify");Ih(e,o);const i=Dh(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch{return!1}};async function Lh(e,t,n){if(!bo(e))throw new Xe("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new Xe('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new Xe("JWS Protected Header incorrect type");if(e.payload===void 0)throw new Xe("JWS Payload missing");if(typeof e.signature!="string")throw new Xe("JWS Signature missing or incorrect type");if(e.header!==void 0&&!bo(e.header))throw new Xe("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const p=fo(e.protected);r=JSON.parse(Oi.decode(p))}catch{throw new Xe("JWS Protected Header is invalid")}if(!wh(r,e.header))throw new Xe("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const o={...r,...e.header},i=xh(Xe,new Map([["b64",!0]]),n==null?void 0:n.crit,r,o);let s=!0;if(i.has("b64")&&(s=r.b64,typeof s!="boolean"))throw new Xe('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:a}=o;if(typeof a!="string"||!a)throw new Xe('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&Oh("algorithms",n.algorithms);if(c&&!c.has(a))throw new tl('"alg" (Algorithm) Header Parameter value not allowed');if(s){if(typeof e.payload!="string")throw new Xe("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new Xe("JWS Payload must be a string or an Uint8Array instance");let f=!1;typeof t=="function"&&(t=await t(r,e),f=!0),Fh(a,t,"verify");const d=ph(to.encode(e.protected??""),to.encode("."),typeof e.payload=="string"?to.encode(e.payload):e.payload);let l;try{l=fo(e.signature)}catch{throw new Xe("Failed to base64url decode the signature")}const m=await Ah(t,a);if(!await kh(a,m,l,d))throw new nl;let w;if(s)try{w=fo(e.payload)}catch{throw new Xe("Failed to base64url decode the payload")}else typeof e.payload=="string"?w=to.encode(e.payload):w=e.payload;const v={payload:w};return e.protected!==void 0&&(v.protectedHeader=r),e.header!==void 0&&(v.unprotectedHeader=e.header),f?{...v,key:m}:v}async function jh(e,t,n){if(e instanceof Uint8Array&&(e=Oi.decode(e)),typeof e!="string")throw new Xe("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:s}=e.split(".");if(s!==3)throw new Xe("Invalid Compact JWS");const a=await Lh({payload:o,protected:r,signature:i},t,n),c={payload:a.payload,protectedHeader:a.protectedHeader};return typeof t=="function"?{...c,key:a.key}:c}const Kh=e=>Math.floor(e.getTime()/1e3),cl=60,ul=cl*60,fa=ul*24,$h=fa*7,Uh=fa*365.25,qh=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Ec=e=>{const t=qh.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]),r=t[3].toLowerCase();let o;switch(r){case"sec":case"secs":case"second":case"seconds":case"s":o=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":o=Math.round(n*cl);break;case"hour":case"hours":case"hr":case"hrs":case"h":o=Math.round(n*ul);break;case"day":case"days":case"d":o=Math.round(n*fa);break;case"week":case"weeks":case"w":o=Math.round(n*$h);break;default:o=Math.round(n*Uh);break}return t[1]==="-"||t[4]==="ago"?-o:o},_c=e=>e.includes("/")?e.toLowerCase():`application/${e.toLowerCase()}`,Vh=(e,t)=>typeof e=="string"?t.includes(e):Array.isArray(e)?t.some(Set.prototype.has.bind(new Set(e))):!1;function Hh(e,t,n={}){let r;try{r=JSON.parse(Oi.decode(t))}catch{}if(!bo(r))throw new la("JWT Claims Set must be a top-level JSON object");const{typ:o}=n;if(o&&(typeof e.typ!="string"||_c(e.typ)!==_c(o)))throw new Wt('unexpected "typ" JWT header value',r,"typ","check_failed");const{requiredClaims:i=[],issuer:s,subject:a,audience:c,maxTokenAge:f}=n,d=[...i];f!==void 0&&d.push("iat"),c!==void 0&&d.push("aud"),a!==void 0&&d.push("sub"),s!==void 0&&d.push("iss");for(const w of new Set(d.reverse()))if(!(w in r))throw new Wt(`missing required "${w}" claim`,r,w,"missing");if(s&&!(Array.isArray(s)?s:[s]).includes(r.iss))throw new Wt('unexpected "iss" claim value',r,"iss","check_failed");if(a&&r.sub!==a)throw new Wt('unexpected "sub" claim value',r,"sub","check_failed");if(c&&!Vh(r.aud,typeof c=="string"?[c]:c))throw new Wt('unexpected "aud" claim value',r,"aud","check_failed");let l;switch(typeof n.clockTolerance){case"string":l=Ec(n.clockTolerance);break;case"number":l=n.clockTolerance;break;case"undefined":l=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:m}=n,y=Kh(m||new Date);if((r.iat!==void 0||f)&&typeof r.iat!="number")throw new Wt('"iat" claim must be a number',r,"iat","invalid");if(r.nbf!==void 0){if(typeof r.nbf!="number")throw new Wt('"nbf" claim must be a number',r,"nbf","invalid");if(r.nbf>y+l)throw new Wt('"nbf" claim timestamp check failed',r,"nbf","check_failed")}if(r.exp!==void 0){if(typeof r.exp!="number")throw new Wt('"exp" claim must be a number',r,"exp","invalid");if(r.exp<=y-l)throw new Ls('"exp" claim timestamp check failed',r,"exp","check_failed")}if(f){const w=y-r.iat,v=typeof f=="number"?f:Ec(f);if(w-l>v)throw new Ls('"iat" claim timestamp check failed (too far in the past)',r,"iat","check_failed");if(w<0-l)throw new Wt('"iat" claim timestamp check failed (it should be in the past)',r,"iat","check_failed")}return r}async function Bh(e,t,n){var s;const r=await jh(e,t,n);if((s=r.protectedHeader.crit)!=null&&s.includes("b64")&&r.protectedHeader.b64===!1)throw new la("JWTs MUST NOT use unencoded payload");const i={payload:Hh(r.protectedHeader,r.payload,n),protectedHeader:r.protectedHeader};return typeof t=="function"?{...i,key:r.key}:i}const Ks="amp-labs_jwt_",Jh=10*60*1e3,Nc=(e,t)=>`${e}:${t}`,Tc=e=>`${Ks}${e}`,ll=b.createContext(null),Wh=async e=>{try{const n=(await Bh(e,new Uint8Array(0),{algorithms:[]})).payload;return n.exp&&typeof n.exp=="number"?n.exp*1e3:null}catch(t){return console.warn("Failed to decode JWT token:",t),null}};function zh({getTokenCallback:e,children:t}){const[n,r]=b.useState(new Map);b.useEffect(()=>{try{const c=new Map,f=Date.now();Object.keys(sessionStorage).forEach(d=>{if(d.startsWith(Ks)){const l=d.replace(Ks,""),m=sessionStorage.getItem(d);if(m)try{const y=JSON.parse(m);y.expiresAt>f?c.set(l,y):sessionStorage.removeItem(d)}catch{sessionStorage.removeItem(d)}}}),c.size>0&&r(c)}catch{console.warn("Failed to load JWT tokens from sessionStorage")}},[]);const o=b.useCallback((c,f)=>{const d=Nc(c,f),l=Date.now(),m=n.get(d);if(m&&m.expiresAt>l)return m.token;n.delete(d);const y=Tc(d),w=sessionStorage.getItem(y);if(w)try{const v=JSON.parse(w);if(v.expiresAt>l)return r(p=>new Map(p).set(d,v)),v.token;sessionStorage.removeItem(y)}catch{sessionStorage.removeItem(y)}return null},[n]),i=b.useCallback(async(c,f,d)=>{const l=Nc(c,f),y=await Wh(d)||Date.now()+Jh,w={token:d,expiresAt:y};r(v=>new Map(v).set(l,w));try{sessionStorage.setItem(Tc(l),JSON.stringify(w))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=b.useCallback(async({consumerRef:c,groupRef:f})=>{const d=o(c,f);if(d)return d;if(!e)throw new Error("JWT token callback not provided");try{const l=await e({consumerRef:c,groupRef:f});return await i(c,f,l),l}catch(l){throw console.error("Failed to get JWT token:",l),new Error("Failed to get JWT token")}},[e,o,i]),a={getToken:e?s:void 0};return u.jsx(ll.Provider,{value:a,children:t})}const Gh=()=>{const e=b.useContext(ll);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},pa=b.createContext(null);function De(){const e=b.useContext(pa);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
2
- component is wrapped with AmpersandProvider`);return e}const Qh=new Wp;function Xh(e){const{options:{apiKey:t,projectId:n,project:r,getToken:o},children:i}=e,s=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!s)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t&&!o)throw new Error("Cannot use AmpersandProvider without an apiKey or getToken.");if(t&&o)throw new Error("Cannot use AmpersandProvider with both apiKey and getToken.");const a={options:e.options,projectIdOrName:s};return u.jsx(Yp,{client:Qh,children:u.jsx(pa.Provider,{value:a,children:u.jsx(fh,{children:u.jsx(zh,{getTokenCallback:o||null,children:u.jsx(lh,{value:t||null,children:i})})})})})}const Yh="https://api.withampersand.com/v1".replace(/\/+$/,"");class ha{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Yh}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||fl}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 Zh=new ha,Mo=class Mo{constructor(t=Zh){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 nm(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?Mo.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 dl(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(f=>o[f]===void 0?delete o[f]:{});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:tm(a.body)||a.body instanceof URLSearchParams||em(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}};Mo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let cn=Mo;function em(e){return typeof Blob<"u"&&e instanceof Blob}function tm(e){return typeof FormData<"u"&&e instanceof FormData}class dl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class nm extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ne extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function _(e,t){const n=e[t];return n!=null}function fl(e,t=""){return Object.keys(e).map(n=>pl(n,e[n],t)).filter(n=>n.length>0).join("&")}function pl(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 pl(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?fl(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function qe(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Re{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Qr{constructor(t){this.raw=t}async value(){}}class Ac{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function rm(e){return im(e)}function im(e,t){return e==null?e:{fieldUsed:_(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:_(e,"keyFormat")?e.keyFormat:void 0}}function om(e){return sm(e)}function sm(e,t){return e==null?e:{name:e.name,valuePrefix:_(e,"valuePrefix")?e.valuePrefix:void 0}}function am(e){return cm(e)}function cm(e,t){return e==null?e:{name:e.name}}function um(e){return lm(e)}function lm(e,t){return e==null?e:{attachmentType:e.attachmentType,query:_(e,"query")?am(e.query):void 0,header:_(e,"header")?om(e.header):void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0}}function dm(e){return fm(e)}function fm(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,includeFullRecords:_(e,"includeFullRecords")?e.includeFullRecords:void 0}}function pm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function hm(e){return mm(e)}function mm(e,t){return e==null?e:{url:e.url,method:_(e,"method")?e.method:void 0,successStatusCodes:_(e,"successStatusCodes")?e.successStatusCodes:void 0}}const Rc={ApiKey:"apiKey",Basic:"basic"};function gm(e){return ym(e)}function ym(e,t){return e}function vm(e){return wm(e)}function wm(e,t){return e==null?e:{days:_(e,"days")?e.days:void 0,fullHistory:_(e,"fullHistory")?e.fullHistory:void 0}}function bm(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function hl(e){return Im(e)}function Im(e,t){return e==null?e:{defaultPeriod:vm(e.defaultPeriod)}}function Cm(e){if(e!==void 0)return e===null?null:{defaultPeriod:bm(e.defaultPeriod)}}function Sm(e){return xm(e)}function xm(e,t){return e==null?e:{days:_(e,"days")?e.days:void 0,fullHistory:_(e,"fullHistory")?e.fullHistory:void 0}}function Om(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Em(e){return _m(e)}function _m(e,t){return e==null?e:{defaultPeriod:Sm(e.defaultPeriod)}}function ml(e){if(e!==void 0)return e===null?null:{defaultPeriod:Om(e.defaultPeriod)}}function Nm(e){return Tm(e)}function Tm(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,useModule:_(e,"useModule")?e.useModule:void 0}}function gl(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function Am(e){return Rm(e)}function Rm(e,t){return e}function Pm(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:ml(e.backfill)}}function Fm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,Pm)}}function Dm(e){return Mm(e)}function Mm(e,t){return e==null?e:{stringValue:_(e,"stringValue")?e.stringValue:void 0,integerValue:_(e,"integerValue")?e.integerValue:void 0,booleanValue:_(e,"booleanValue")?e.booleanValue:void 0}}function km(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const Lm={Always:"always",Never:"never"},jm={Always:"always",Never:"never"};function Km(e){return $m(e)}function $m(e,t){return e==null?e:{default:_(e,"default")?Dm(e.default):void 0,writeOnCreate:_(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:_(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function yl(e){if(e!==void 0)return e===null?null:{default:km(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function Um(e){let t=!0;return t=t&&"value"in e,t}function qm(e,t){return e==null?e:{value:e.value,applyOnUpdate:_(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Vm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Hm(e){let t=!0;return t=t&&"value"in e,t}function Bm(e,t){return e==null?e:{value:e.value,applyOnUpdate:_(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Jm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Wm(e){let t=!0;return t=t&&"value"in e,t}function zm(e,t){return e==null?e:{value:e.value,applyOnUpdate:_(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Gm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Qm(e){return Xm(e)}function Xm(e,t){return e==null?e:{...qm(e),...Bm(e),...zm(e)}}function vl(e){if(e!==void 0)return e===null?null:Um(e)?Vm(e):Hm(e)?Jm(e):Wm(e)?Gm(e):{}}function Ym(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:qe(e.selectedValueDefaults,vl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:qe(e.selectedFieldSettings,yl)}}function Zm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,Ym)}}function eg(e){return tg(e)}function tg(e,t){return e==null?e:{enabled:e.enabled}}function ng(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function rg(e){return ig(e)}function ig(e,t){return e==null?e:{enabled:e.enabled}}function og(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function sg(e){return ag(e)}function ag(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:_(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:_(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function cg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function ug(e){return lg(e)}function lg(e,t){return e==null?e:{apiKeyAsBasic:_(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:_(e,"apiKeyAsBasicOpts")?rm(e.apiKeyAsBasicOpts):void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0}}function dg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function fg(e){return pg(e)}function pg(e,t){return e==null?e:{value:e.value}}function hg(e){return mg(e)}function mg(e,t){return e==null?e:{brandingRemoval:_(e,"brandingRemoval")?fg(e.brandingRemoval):void 0}}function no(e){return gg(e)}function gg(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:_(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:_(e,"entitlements")?hg(e.entitlements):void 0}}function yg(e){return vg(e)}function vg(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function wg(e){return bg(e)}function bg(e,t){return e==null?e:{objectName:e.objectName,schedule:_(e,"schedule")?e.schedule:void 0,destination:_(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:_(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:_(e,"selectedFieldsAuto")?Am(e.selectedFieldsAuto):void 0,backfill:_(e,"backfill")?Em(e.backfill):void 0}}function Ig(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:ml(e.backfill)}}function Cg(e){return Sg(e)}function Sg(e,t){return e==null?e:{objects:qe(e.objects,wg)}}function xg(e){if(e!==void 0)return e===null?null:{objects:qe(e.objects,Ig)}}function Og(e){return Eg(e)}function Eg(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:_(e,"createEvent")?eg(e.createEvent):void 0,updateEvent:_(e,"updateEvent")?sg(e.updateEvent):void 0,deleteEvent:_(e,"deleteEvent")?rg(e.deleteEvent):void 0}}function _g(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:ng(e.createEvent),updateEvent:cg(e.updateEvent),deleteEvent:og(e.deleteEvent)}}function Ng(e){return Tg(e)}function Tg(e,t){return e==null?e:{objects:qe(e.objects,Og)}}function Ag(e){if(e!==void 0)return e===null?null:{objects:qe(e.objects,_g)}}function Rg(e){return Pg(e)}function Pg(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:_(e,"selectedValueDefaults")?qe(e.selectedValueDefaults,Qm):void 0,selectedFieldSettings:_(e,"selectedFieldSettings")?qe(e.selectedFieldSettings,Km):void 0}}function Fg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:qe(e.selectedValueDefaults,vl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:qe(e.selectedFieldSettings,yl)}}function Dg(e){return Mg(e)}function Mg(e,t){return e==null?e:{objects:_(e,"objects")?qe(e.objects,Rg):void 0}}function kg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,Fg)}}function Lg(e){return jg(e)}function jg(e,t){return e==null?e:{provider:e.provider,module:_(e,"module")?e.module:void 0,read:_(e,"read")?Cg(e.read):void 0,write:_(e,"write")?Dg(e.write):void 0,proxy:_(e,"proxy")?Nm(e.proxy):void 0,subscribe:_(e,"subscribe")?Ng(e.subscribe):void 0}}function Kg(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:xg(e.read),write:kg(e.write),proxy:gl(e.proxy),subscribe:Ag(e.subscribe)}}function $g(e){return Ug(e)}function Ug(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Lg(e.content)}}function qg(e){return Vg(e)}function Vg(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0}}function wl(e){return Hg(e)}function Hg(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0}}function Bg(e){return Jg(e)}function Jg(e,t){return e==null?e:{token:e.token,issuedAt:_(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:_(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Wg(e){return zg(e)}function zg(e,t){return e==null?e:{token:e.token,issuedAt:_(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:_(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Gg(e){return Qg(e)}function Qg(e,t){return e==null?e:{accessToken:_(e,"accessToken")?Bg(e.accessToken):void 0,refreshToken:_(e,"refreshToken")?Wg(e.refreshToken):void 0,scopes:_(e,"scopes")?e.scopes:void 0}}function po(e){return Xg(e)}function Xg(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:_(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:_(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0}}function Yg(e){return Zg(e)}function Zg(e,t){return e==null?e:{value:e.value,source:e.source,displayName:_(e,"displayName")?e.displayName:void 0}}function ma(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function bi(e){return ey(e)}function ey(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:_(e,"providerApp")?po(e.providerApp):void 0,group:wl(e.group),consumer:qg(e.consumer),providerWorkspaceRef:_(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:_(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:_(e,"oauth2AuthorizationCode")?Gg(e.oauth2AuthorizationCode):void 0,apiKey:_(e,"apiKey")?e.apiKey:void 0,providerMetadata:_(e,"providerMetadata")?qe(e.providerMetadata,Yg):void 0}}function bl(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Il(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Cl(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 ty(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 ny(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 Sl(e){if(e!==void 0)return e===null?null:{accessToken:ty(e.accessToken),refreshToken:ny(e.refreshToken),scopes:e.scopes}}function ry(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,ma),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:bl(e.basicAuth),oauth2ClientCredentials:Il(e.oauth2ClientCredentials),oauth2PasswordCredentials:Cl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Sl(e.oauth2AuthorizationCode)}}function iy(e){return oy(e)}function oy(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0}}function sy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ay(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Kg(e.content)}}function cy(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:ay(e.config)}}function uy(e){return ly(e)}function ly(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,useModule:_(e,"useModule")?e.useModule:void 0}}function dy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function fy(e){return py(e)}function py(e,t){return e==null?e:{mode:_(e,"mode")?e.mode:void 0,pageSize:_(e,"pageSize")?e.pageSize:void 0}}function hy(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function my(e){let t=!0;return t=t&&"fieldName"in e,t}function gy(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function yy(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function vy(e){let t=!0;return t=t&&"mapToName"in e,t}function xl(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:_(e,"default")?e.default:void 0,prompt:_(e,"prompt")?e.prompt:void 0}}function wy(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Pc(e){return by(e)}function by(e,t){return e==null?e:{...gy(e),...xl(e)}}function Fc(e){if(e!==void 0)return e===null?null:my(e)?yy(e):vy(e)?wy(e):{}}function Ol(e){return Iy(e)}function Iy(e,t){return e}function Cy(e){return Sy(e)}function Sy(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:_(e,"requiredFields")?e.requiredFields.map(Pc):void 0,optionalFields:_(e,"optionalFields")?e.optionalFields.map(Pc):void 0,optionalFieldsAuto:_(e,"optionalFieldsAuto")?Ol(e.optionalFieldsAuto):void 0,backfill:_(e,"backfill")?hl(e.backfill):void 0,delivery:_(e,"delivery")?fy(e.delivery):void 0,enabled:_(e,"enabled")?e.enabled:void 0}}function xy(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(Fc),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Fc),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Cm(e.backfill),delivery:hy(e.delivery),enabled:e.enabled}}function Oy(e){return Ey(e)}function Ey(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(Cy):void 0}}function _y(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(xy)}}function Ny(e){return Ty(e)}function Ty(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0}}function Ay(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Ry(e){return Py(e)}function Py(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,watchFieldsAuto:_(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:_(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function Fy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Dy(e){return My(e)}function My(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:_(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:_(e,"createEvent")?iy(e.createEvent):void 0,updateEvent:_(e,"updateEvent")?Ry(e.updateEvent):void 0,deleteEvent:_(e,"deleteEvent")?Ny(e.deleteEvent):void 0,associationChangeEvent:_(e,"associationChangeEvent")?dm(e.associationChangeEvent):void 0,otherEvents:_(e,"otherEvents")?e.otherEvents:void 0}}function ky(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:sy(e.createEvent),updateEvent:Fy(e.updateEvent),deleteEvent:Ay(e.deleteEvent),associationChangeEvent:pm(e.associationChangeEvent),otherEvents:e.otherEvents}}function Ly(e){return jy(e)}function jy(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(Dy):void 0}}function Ky(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ky)}}function El(e){return $y(e)}function $y(e,t){return e==null?e:{allowAnyFields:_(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Uy(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function qy(e){return Vy(e)}function Vy(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:_(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:_(e,"valueDefaults")?El(e.valueDefaults):void 0}}function Hy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Uy(e.valueDefaults)}}function By(e){return Jy(e)}function Jy(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(qy):void 0}}function Wy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Hy)}}function zy(e){return Gy(e)}function Gy(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:_(e,"displayName")?e.displayName:void 0,module:_(e,"module")?e.module:void 0,read:_(e,"read")?Oy(e.read):void 0,write:_(e,"write")?By(e.write):void 0,proxy:_(e,"proxy")?uy(e.proxy):void 0,subscribe:_(e,"subscribe")?Ly(e.subscribe):void 0}}function Qy(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:_y(e.read),write:Wy(e.write),proxy:dy(e.proxy),subscribe:Ky(e.subscribe)}}function Xy(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Qy(e.content)}}function Yy(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Xy(e.latestRevision)}}function Zy(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function ev(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 tv(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function nv(e){return rv(e)}function rv(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function iv(e){return ov(e)}function ov(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:_(e,"prompt")?e.prompt:void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0}}function sv(e){return av(e)}function av(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function cv(e){return uv(e)}function uv(e,t){return e==null?e:{headers:_(e,"headers")?e.headers.map(nv):void 0,queryParams:_(e,"queryParams")?e.queryParams.map(sv):void 0,inputs:_(e,"inputs")?e.inputs.map(iv):void 0}}function lv(e){return dv(e)}function dv(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function fv(e){return pv(e)}function pv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:_(e,"valueType")?e.valueType:void 0,providerType:_(e,"providerType")?e.providerType:void 0,readOnly:_(e,"readOnly")?e.readOnly:void 0,values:_(e,"values")?e.values.map(lv):void 0}}function hv(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,ma),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:bl(e.basicAuth),oauth2ClientCredentials:Il(e.oauth2ClientCredentials),oauth2PasswordCredentials:Cl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Sl(e.oauth2AuthorizationCode)}}function mv(e){return gv(e)}function gv(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,useModule:_(e,"useModule")?e.useModule:void 0}}function yv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function is(e){return vv(e)}function vv(e,t){return e==null?e:{...yv(e),...xl(e)}}function wv(e){return bv(e)}function bv(e,t){return e==null?e:{error:_(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:_(e,"requiredFields")?e.requiredFields.map(is):void 0,optionalFields:_(e,"optionalFields")?e.optionalFields.map(is):void 0,optionalFieldsAuto:_(e,"optionalFieldsAuto")?Ol(e.optionalFieldsAuto):void 0,allFieldsMetadata:_(e,"allFieldsMetadata")?qe(e.allFieldsMetadata,fv):void 0,allFields:_(e,"allFields")?e.allFields.map(is):void 0,backfill:_(e,"backfill")?hl(e.backfill):void 0}}function Iv(e){return Cv(e)}function Cv(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(wv):void 0}}function Sv(e){return xv(e)}function xv(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:_(e,"valueDefaults")?El(e.valueDefaults):void 0}}function Ov(e){return Ev(e)}function Ev(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(Sv):void 0}}function _v(e){return Nv(e)}function Nv(e,t){return e==null?e:{name:e.name,displayName:_(e,"displayName")?e.displayName:void 0,module:_(e,"module")?e.module:void 0,provider:e.provider,read:_(e,"read")?Iv(e.read):void 0,write:_(e,"write")?Ov(e.write):void 0,proxy:_(e,"proxy")?mv(e.proxy):void 0}}function Tv(e){return Av(e)}function Av(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:_v(e.content)}}function yi(e){return Rv(e)}function Rv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:_(e,"group")?wl(e.group):void 0,healthStatus:e.healthStatus,connection:bi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,config:$g(e.config)}}function Pv(e){return Fv(e)}function Fv(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:zy(e.content)}}function os(e){return Dv(e)}function Dv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Pv(e.latestRevision)}}function Mv(e){return kv(e)}function kv(e,t){return e==null?e:{iconURL:_(e,"iconURL")?e.iconURL:void 0,logoURL:_(e,"logoURL")?e.logoURL:void 0}}function Lv(e){return jv(e)}function jv(e,t){return e==null?e:{iconURL:_(e,"iconURL")?e.iconURL:void 0,logoURL:_(e,"logoURL")?e.logoURL:void 0}}function Kv(e){return $v(e)}function $v(e,t){return e==null?e:{regular:_(e,"regular")?Lv(e.regular):void 0,darkMode:_(e,"darkMode")?Mv(e.darkMode):void 0}}function Uv(e){return qv(e)}function qv(e,t){return e==null?e:{name:e.name,displayName:_(e,"displayName")?e.displayName:void 0,defaultValue:_(e,"defaultValue")?e.defaultValue:void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0,moduleDependencies:_(e,"moduleDependencies")?e.moduleDependencies:void 0}}function Vv(e){return Hv(e)}function Hv(e,t){return e==null?e:{name:e.name,moduleDependencies:_(e,"moduleDependencies")?e.moduleDependencies:void 0}}function Bv(e){return Jv(e)}function Jv(e,t){return e==null?e:{create:_(e,"create")?e.create:void 0,update:_(e,"update")?e.update:void 0,_delete:_(e,"delete")?e.delete:void 0,passThrough:_(e,"passThrough")?e.passThrough:void 0}}function _l(e){return Wv(e)}function Wv(e,t){return e==null?e:{bulkWrite:yg(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:_(e,"subscribeSupport")?Bv(e.subscribeSupport):void 0}}function zv(e){return Gv(e)}function Gv(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:_l(e.support)}}function Qv(e){return Xv(e)}function Xv(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:_(e,"capture")?e.capture:void 0}}function Yv(e){return Zv(e)}function Zv(e,t){return e==null?e:{workspaceRefField:_(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:_(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:_(e,"scopesField")?e.scopesField:void 0,otherFields:_(e,"otherFields")?e.otherFields.map(Qv):void 0}}const ss={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function ew(e){return tw(e)}function tw(e,t){return e==null?e:{grantType:e.grantType,authURL:_(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:_(e,"audience")?e.audience:void 0,tokenMetadataFields:Yv(e.tokenMetadataFields),docsURL:_(e,"docsURL")?e.docsURL:void 0,authURLParams:_(e,"authURLParams")?e.authURLParams:void 0}}function nw(e){if(e!==void 0)return e===null?null:{projectId:e.projectId,provider:e.provider,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,ma),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function rw(e){return iw(e)}function iw(e,t){return e==null?e:{input:_(e,"input")?e.input.map(Uv):void 0,postAuthentication:_(e,"postAuthentication")?e.postAuthentication.map(Vv):void 0}}function ow(e){return sw(e)}function sw(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Dc(e){return aw(e)}function aw(e,t){return e==null?e:{name:e.name,authType:gm(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:_(e,"oauth2Opts")?ew(e.oauth2Opts):void 0,apiKeyOpts:_(e,"apiKeyOpts")?um(e.apiKeyOpts):void 0,basicOpts:_(e,"basicOpts")?ug(e.basicOpts):void 0,customOpts:_(e,"customOpts")?cv(e.customOpts):void 0,support:_l(e.support),providerOpts:e.providerOpts,authHealthCheck:_(e,"authHealthCheck")?hm(e.authHealthCheck):void 0,displayName:_(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:_(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:_(e,"media")?Kv(e.media):void 0,labels:_(e,"labels")?e.labels:void 0,subscribeOpts:_(e,"subscribeOpts")?ow(e.subscribeOpts):void 0,modules:_(e,"modules")?qe(e.modules,zv):void 0,metadata:_(e,"metadata")?rw(e.metadata):void 0}}function cw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:ry(e.connection)}}function uw(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:Fm(e.read),write:Zm(e.write),proxy:gl(e.proxy)}}function lw(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:uw(e.content)}}function dw(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:lw(e.config)}}function fw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:dw(e.installation)}}function pw(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function hw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:pw(e.project)}}function mw(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 gw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:mw(e.providerApp)}}class yw extends cn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Qr(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:hv(t.generateConnectionParams)},n);return new Re(i,s=>bi(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 ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("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={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Re(i,s=>bi(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 ne("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={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>s.map(bi))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}async updateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ne("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:cw(t.updateConnectionRequest)},n);return new Re(i,s=>bi(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class vw extends cn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ne("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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:cy(t.installation)},n);return new Re(i,s=>yi(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 ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ne("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Qr(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ne("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Re(i,s=>yi(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 ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Re(i,s=>s.map(yi))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async listInstallationsForProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallationsForProject.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>s.map(yi))}async listInstallationsForProject(t,n){return await(await this.listInstallationsForProjectRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ne("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ne("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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:fw(t.installationUpdate)},n);return new Re(i,s=>yi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class ww extends cn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ne("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:dg(t.batchUpsertIntegrationsRequest)},n);return new Re(i,s=>s.map(os))}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 ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ne("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Yy(t.integration)},n);return new Qr(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Qr(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new ne("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getIntegration.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationIdOrName}".replace("{integrationIdOrName}",encodeURIComponent(String(t.integrationIdOrName))).replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>os(s))}async getIntegration(t,n){return await(await this.getIntegrationRaw(t,n)).value()}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>s.map(os))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class bw extends cn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ne("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:nw(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Re(i):new Ac(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new Re(i):new Ac(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Iw extends cn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ne("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:Zy(t.project)},n);return new Re(i,s=>no(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>no(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const i=this.configuration.accessToken,s=await i("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Re(o,i=>i.map(no))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ne("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:hw(t.projectUpdate)},n);return new Re(i,s=>no(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Cw extends cn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ne("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new Re(i,s=>Dc(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const i=this.configuration.accessToken,s=await i("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Re(o,i=>qe(i,Dc))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Sw extends cn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ne("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:ev(t.providerApp)},n);return new Re(i,s=>po(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 ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ne("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Qr(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Re(i,s=>s.map(po))}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 ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ne("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ne("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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:gw(t.providerAppUpdate)},n);return new Re(i,s=>po(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class xw extends cn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ne("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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:tv(t.revision)},n);return new Qr(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ne("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Re(i,s=>Tv(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var Nl=Symbol.for("immer-nothing"),Mc=Symbol.for("immer-draftable"),Tt=Symbol.for("immer-state"),Ow=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 Ct(e,...t){if(process.env.NODE_ENV!=="production"){const n=Ow[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 Xr=Object.getPrototypeOf;function Yr(e){return!!e&&!!e[Tt]}function xr(e){var t;return e?Tl(e)||Array.isArray(e)||!!e[Mc]||!!((t=e.constructor)!=null&&t[Mc])||Lo(e)||jo(e):!1}var Ew=Object.prototype.constructor.toString();function Tl(e){if(!e||typeof e!="object")return!1;const t=Xr(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)===Ew}function Io(e,t){ko(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ko(e){const t=e[Tt];return t?t.type_:Array.isArray(e)?1:Lo(e)?2:jo(e)?3:0}function $s(e,t){return ko(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Al(e,t,n){const r=ko(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function _w(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Lo(e){return e instanceof Map}function jo(e){return e instanceof Set}function lr(e){return e.copy_||e.base_}function Us(e,t){if(Lo(e))return new Map(e);if(jo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Tl(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Tt];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(Xr(e),r)}else{const r=Xr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function ga(e,t=!1){return Ko(e)||Yr(e)||!xr(e)||(ko(e)>1&&(e.set=e.add=e.clear=e.delete=Nw),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>ga(r,!0))),e}function Nw(){Ct(2)}function Ko(e){return Object.isFrozen(e)}var Tw={};function Or(e){const t=Tw[e];return t||Ct(0,e),t}var Ei;function Rl(){return Ei}function Aw(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function kc(e,t){t&&(Or("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function qs(e){Vs(e),e.drafts_.forEach(Rw),e.drafts_=null}function Vs(e){e===Ei&&(Ei=e.parent_)}function Lc(e){return Ei=Aw(Ei,e)}function Rw(e){const t=e[Tt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function jc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Tt].modified_&&(qs(t),Ct(4)),xr(e)&&(e=Co(t,e),t.parent_||So(t,e)),t.patches_&&Or("Patches").generateReplacementPatches_(n[Tt].base_,e,t.patches_,t.inversePatches_)):e=Co(t,n,[]),qs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Nl?e:void 0}function Co(e,t,n){if(Ko(t))return t;const r=t[Tt];if(!r)return Io(t,(o,i)=>Kc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return So(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),Io(i,(a,c)=>Kc(e,r,o,a,c,n,s)),So(e,o,!1),n&&e.patches_&&Or("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Kc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&Ct(5),Yr(o)){const a=i&&t&&t.type_!==3&&!$s(t.assigned_,r)?i.concat(r):void 0,c=Co(e,o,a);if(Al(n,r,c),Yr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(xr(o)&&!Ko(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Co(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&So(e,o)}}function So(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ga(t,n)}function Pw(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Rl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=ya;n&&(o=[r],i=_i);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var ya={get(e,t){if(t===Tt)return e;const n=lr(e);if(!$s(n,t))return Fw(e,n,t);const r=n[t];return e.finalized_||!xr(r)?r:r===as(e.base_,t)?(cs(e),e.copy_[t]=Bs(r,e)):r},has(e,t){return t in lr(e)},ownKeys(e){return Reflect.ownKeys(lr(e))},set(e,t,n){const r=Pl(lr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=as(lr(e),t),i=o==null?void 0:o[Tt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(_w(n,o)&&(n!==void 0||$s(e.base_,t)))return!0;cs(e),Hs(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 as(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,cs(e),Hs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=lr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Ct(11)},getPrototypeOf(e){return Xr(e.base_)},setPrototypeOf(){Ct(12)}},_i={};Io(ya,(e,t)=>{_i[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});_i.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ct(13),_i.set.call(this,e,t,void 0)};_i.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ct(14),ya.set.call(this,e[0],t,n,e[0])};function as(e,t){const n=e[Tt];return(n?lr(n):e)[t]}function Fw(e,t,n){var o;const r=Pl(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Pl(e,t){if(!(t in e))return;let n=Xr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Xr(n)}}function Hs(e){e.modified_||(e.modified_=!0,e.parent_&&Hs(e.parent_))}function cs(e){e.copy_||(e.copy_=Us(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Dw=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,...f){return s.produce(c,d=>n.call(this,d,...f))}}typeof n!="function"&&Ct(6),r!==void 0&&typeof r!="function"&&Ct(7);let o;if(xr(t)){const i=Lc(this),s=Bs(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?qs(i):Vs(i)}return kc(i,r),jc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===Nl&&(o=void 0),this.autoFreeze_&&ga(o,!0),r){const i=[],s=[];Or("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else Ct(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){xr(e)||Ct(8),Yr(e)&&(e=Mw(e));const t=Lc(this),n=Bs(e,void 0);return n[Tt].isManual_=!0,Vs(t),n}finishDraft(e,t){const n=e&&e[Tt];(!n||!n.isManual_)&&Ct(9);const{scope_:r}=n;return kc(r,t),jc(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=Or("Patches").applyPatches_;return Yr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Bs(e,t){const n=Lo(e)?Or("MapSet").proxyMap_(e,t):jo(e)?Or("MapSet").proxySet_(e,t):Pw(e,t);return(t?t.scope_:Rl()).drafts_.push(n),n}function Mw(e){return Yr(e)||Ct(10,e),Fl(e)}function Fl(e){if(!xr(e)||Ko(e))return e;const t=e[Tt];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 Io(n,(r,o)=>{Al(n,r,Fl(o))}),t&&(t.finalized_=!1),n}var At=new Dw,It=At.produce;At.produceWithPatches.bind(At);At.setAutoFreeze.bind(At);At.setUseStrictShallowCopy.bind(At);At.applyPatches.bind(At);At.createDraft.bind(At);At.finishDraft.bind(At);const He=async(e,t)=>{var n;if(e instanceof dl){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(`
1
+ "use strict";var Tp=Object.defineProperty;var gc=e=>{throw TypeError(e)};var Ap=(e,t,n)=>t in e?Tp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Fe=(e,t,n)=>Ap(e,typeof t!="symbol"?t+"":t,n),ns=(e,t,n)=>t.has(e)||gc("Cannot "+n);var O=(e,t,n)=>(ns(e,t,"read from private field"),n?n.call(e):t.get(e)),ie=(e,t,n)=>t.has(e)?gc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),G=(e,t,n,r)=>(ns(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(ns(e,t,"access private method"),n);var Zi=(e,t,n,r)=>({set _(o){G(e,t,o,n)},get _(){return O(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),b=require("react");require("react-dom");function Rp(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 $=Rp(b);var si=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(){}},Ir=typeof window>"u"||"Deno"in globalThis;function ht(){}function Pp(e,t){return typeof e=="function"?e(t):e}function Ss(e){return typeof e=="number"&&e>=0&&e!==1/0}function Uu(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Wn(e,t){return typeof e=="function"?e(t):e}function jt(e,t){return typeof e=="function"?e(t):e}function yc(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==aa(s,t.options))return!1}else if(!Si(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 vc(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Cr(t.options.mutationKey)!==Cr(i))return!1}else if(!Si(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function aa(e,t){return((t==null?void 0:t.queryKeyHashFn)||Cr)(e)}function Cr(e){return JSON.stringify(e,(t,n)=>Os(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Si(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Si(e[n],t[n])):!1}function xs(e,t){if(e===t)return e;const n=wc(e)&&wc(t);if(n||Os(e)&&Os(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{},c=new Set(r);let f=0;for(let d=0;d<s;d++){const l=n?d:i[d];(!n&&c.has(l)||n)&&e[l]===void 0&&t[l]===void 0?(a[l]=void 0,f++):(a[l]=xs(e[l],t[l]),a[l]===e[l]&&e[l]!==void 0&&f++)}return o===s&&f===o?e:a}return t}function vo(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 wc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Os(e){if(!bc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!bc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function bc(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fp(e){return new Promise(t=>{setTimeout(t,e)})}function Es(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 xs(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return xs(e,t)}return t}function Dp(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Mp(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var wo=Symbol();function qu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===wo&&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===wo?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Vu(e,t){return typeof e=="function"?e(...t):!!e}var fr,jn,kr,Ru,kp=(Ru=class extends si{constructor(){super();ie(this,fr);ie(this,jn);ie(this,kr);G(this,kr,t=>{if(!Ir&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,jn)||this.setEventListener(O(this,kr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,jn))==null||t.call(this),G(this,jn,void 0))}setEventListener(t){var n;G(this,kr,t),(n=O(this,jn))==null||n.call(this),G(this,jn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,fr)!==t&&(G(this,fr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof O(this,fr)=="boolean"?O(this,fr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},fr=new WeakMap,jn=new WeakMap,kr=new WeakMap,Ru),ca=new kp,Lr,Kn,jr,Pu,Lp=(Pu=class extends si{constructor(){super();ie(this,Lr,!0);ie(this,Kn);ie(this,jr);G(this,jr,t=>{if(!Ir&&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(){O(this,Kn)||this.setEventListener(O(this,jr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Kn))==null||t.call(this),G(this,Kn,void 0))}setEventListener(t){var n;G(this,jr,t),(n=O(this,Kn))==null||n.call(this),G(this,Kn,t(this.setOnline.bind(this)))}setOnline(t){O(this,Lr)!==t&&(G(this,Lr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,Lr)}},Lr=new WeakMap,Kn=new WeakMap,jr=new WeakMap,Pu),bo=new Lp;function _s(){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 jp(e){return Math.min(1e3*2**e,3e4)}function Hu(e){return(e??"online")==="online"?bo.isOnline():!0}var Bu=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ju(e){let t=!1,n=0,r;const o=_s(),i=()=>o.status!=="pending",s=v=>{var m;i()||(h(new Bu(v)),(m=e.abort)==null||m.call(e))},a=()=>{t=!0},c=()=>{t=!1},f=()=>ca.isFocused()&&(e.networkMode==="always"||bo.isOnline())&&e.canRun(),d=()=>Hu(e.networkMode)&&e.canRun(),l=v=>{i()||(r==null||r(),o.resolve(v))},h=v=>{i()||(r==null||r(),o.reject(v))},g=()=>new Promise(v=>{var m;r=S=>{(i()||f())&&v(S)},(m=e.onPause)==null||m.call(e)}).then(()=>{var v;r=void 0,i()||(v=e.onContinue)==null||v.call(e)}),w=()=>{if(i())return;let v;const m=n===0?e.initialPromise:void 0;try{v=m??e.fn()}catch(S){v=Promise.reject(S)}Promise.resolve(v).then(l).catch(S=>{var T;if(i())return;const p=e.retry??(Ir?0:3),y=e.retryDelay??jp,I=typeof y=="function"?y(n,S):y,x=p===!0||typeof p=="number"&&n<p||typeof p=="function"&&p(n,S);if(t||!x){h(S);return}n++,(T=e.onFail)==null||T.call(e,n,S),Fp(I).then(()=>f()?void 0:g()).then(()=>{t?h(S):w()})})};return{promise:o,status:()=>o.status,cancel:s,continue:()=>(r==null||r(),o),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?w():g().then(w),o)}}var Kp=e=>setTimeout(e,0);function $p(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=Kp;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 ze=$p(),pr,Fu,Wu=(Fu=class{constructor(){ie(this,pr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ss(this.gcTime)&&G(this,pr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ir?1/0:5*60*1e3))}clearGcTimeout(){O(this,pr)&&(clearTimeout(O(this,pr)),G(this,pr,void 0))}},pr=new WeakMap,Fu),Kr,$r,Lt,hr,Ye,Ri,mr,Wt,wn,Du,Up=(Du=class extends Wu{constructor(t){super();ie(this,Wt);ie(this,Kr);ie(this,$r);ie(this,Lt);ie(this,hr);ie(this,Ye);ie(this,Ri);ie(this,mr);G(this,mr,!1),G(this,Ri,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,hr,t.client),G(this,Lt,O(this,hr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Kr,qp(this.options)),this.state=t.state??O(this,Kr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,Ye))==null?void 0:t.promise}setOptions(t){this.options={...O(this,Ri),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Lt).remove(this)}setData(t,n){const r=Es(this.state.data,t,this.options);return pe(this,Wt,wn).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,Wt,wn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=O(this,Ye))==null?void 0:r.promise;return(o=O(this,Ye))==null||o.cancel(t),n?n.then(ht).catch(ht):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Kr))}isActive(){return this.observers.some(t=>jt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wo||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Wn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Uu(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,Ye))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,Ye))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Lt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(O(this,Ye)&&(O(this,mr)?O(this,Ye).cancel({revert:!0}):O(this,Ye).cancelRetry()),this.scheduleGc()),O(this,Lt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,Wt,wn).call(this,{type:"invalidate"})}async fetch(t,n){var c,f,d,l,h,g,w,v,m,S,p,y;if(this.state.fetchStatus!=="idle"&&((c=O(this,Ye))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,Ye))return O(this,Ye).continueRetry(),O(this,Ye).promise}if(t&&this.setOptions(t),!this.options.queryFn){const I=this.observers.find(x=>x.options.queryFn);I&&this.setOptions(I.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=I=>{Object.defineProperty(I,"signal",{enumerable:!0,get:()=>(G(this,mr,!0),r.signal)})},i=()=>{const I=qu(this.options,n),T=(()=>{const A={client:O(this,hr),queryKey:this.queryKey,meta:this.meta};return o(A),A})();return G(this,mr,!1),this.options.persister?this.options.persister(I,T,this):I(T)},a=(()=>{const I={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,hr),state:this.state,fetchFn:i};return o(I),I})();(f=this.options.behavior)==null||f.onFetch(a,this),G(this,$r,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&pe(this,Wt,wn).call(this,{type:"fetch",meta:(l=a.fetchOptions)==null?void 0:l.meta}),G(this,Ye,Ju({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onFail:(I,x)=>{pe(this,Wt,wn).call(this,{type:"failed",failureCount:I,error:x})},onPause:()=>{pe(this,Wt,wn).call(this,{type:"pause"})},onContinue:()=>{pe(this,Wt,wn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const I=await O(this,Ye).start();if(I===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(I),(g=(h=O(this,Lt).config).onSuccess)==null||g.call(h,I,this),(v=(w=O(this,Lt).config).onSettled)==null||v.call(w,I,this.state.error,this),I}catch(I){if(I instanceof Bu){if(I.silent)return O(this,Ye).promise;if(I.revert){if(this.setState({...O(this,$r),fetchStatus:"idle"}),this.state.data===void 0)throw I;return this.state.data}}throw pe(this,Wt,wn).call(this,{type:"error",error:I}),(S=(m=O(this,Lt).config).onError)==null||S.call(m,I,this),(y=(p=O(this,Lt).config).onSettled)==null||y.call(p,this.state.data,I,this),I}finally{this.scheduleGc()}}},Kr=new WeakMap,$r=new WeakMap,Lt=new WeakMap,hr=new WeakMap,Ye=new WeakMap,Ri=new WeakMap,mr=new WeakMap,Wt=new WeakSet,wn=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,...zu(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...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}};return G(this,$r,t.manual?o:void 0),o;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ze.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,Lt).notify({query:this,type:"updated",action:t})})},Du);function zu(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Hu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function qp(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 rn,Mu,Vp=(Mu=class extends si{constructor(t={}){super();ie(this,rn);this.config=t,G(this,rn,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??aa(o,n);let s=this.get(i);return s||(s=new Up({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){O(this,rn).has(t.queryHash)||(O(this,rn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,rn).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,rn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ze.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,rn).get(t)}getAll(){return[...O(this,rn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>yc(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>yc(t,r)):n}notify(t){ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ze.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ze.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},rn=new WeakMap,Mu),on,ft,gr,sn,Ln,ku,Hp=(ku=class extends Wu{constructor(t){super();ie(this,sn);ie(this,on);ie(this,ft);ie(this,gr);this.mutationId=t.mutationId,G(this,ft,t.mutationCache),G(this,on,[]),this.state=t.state||Gu(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,on).includes(t)||(O(this,on).push(t),this.clearGcTimeout(),O(this,ft).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,on,O(this,on).filter(n=>n!==t)),this.scheduleGc(),O(this,ft).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,on).length||(this.state.status==="pending"?this.scheduleGc():O(this,ft).remove(this))}continue(){var t;return((t=O(this,gr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,a,c,f,d,l,h,g,w,v,m,S,p,y,I,x,T,A,E;const n=()=>{pe(this,sn,Ln).call(this,{type:"continue"})};G(this,gr,Ju({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(R,P)=>{pe(this,sn,Ln).call(this,{type:"failed",failureCount:R,error:P})},onPause:()=>{pe(this,sn,Ln).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,ft).canRun(this)}));const r=this.state.status==="pending",o=!O(this,gr).canStart();try{if(r)n();else{pe(this,sn,Ln).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(i=O(this,ft).config).onMutate)==null?void 0:s.call(i,t,this));const P=await((c=(a=this.options).onMutate)==null?void 0:c.call(a,t));P!==this.state.context&&pe(this,sn,Ln).call(this,{type:"pending",context:P,variables:t,isPaused:o})}const R=await O(this,gr).start();return await((d=(f=O(this,ft).config).onSuccess)==null?void 0:d.call(f,R,t,this.state.context,this)),await((h=(l=this.options).onSuccess)==null?void 0:h.call(l,R,t,this.state.context)),await((w=(g=O(this,ft).config).onSettled)==null?void 0:w.call(g,R,null,this.state.variables,this.state.context,this)),await((m=(v=this.options).onSettled)==null?void 0:m.call(v,R,null,t,this.state.context)),pe(this,sn,Ln).call(this,{type:"success",data:R}),R}catch(R){try{throw await((p=(S=O(this,ft).config).onError)==null?void 0:p.call(S,R,t,this.state.context,this)),await((I=(y=this.options).onError)==null?void 0:I.call(y,R,t,this.state.context)),await((T=(x=O(this,ft).config).onSettled)==null?void 0:T.call(x,void 0,R,this.state.variables,this.state.context,this)),await((E=(A=this.options).onSettled)==null?void 0:E.call(A,void 0,R,t,this.state.context)),R}finally{pe(this,sn,Ln).call(this,{type:"error",error:R})}}finally{O(this,ft).runNext(this)}}},on=new WeakMap,ft=new WeakMap,gr=new WeakMap,sn=new WeakSet,Ln=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),ze.batch(()=>{O(this,on).forEach(r=>{r.onMutationUpdate(t)}),O(this,ft).notify({mutation:this,type:"updated",action:t})})},ku);function Gu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var bn,zt,Pi,Lu,Bp=(Lu=class extends si{constructor(t={}){super();ie(this,bn);ie(this,zt);ie(this,Pi);this.config=t,G(this,bn,new Set),G(this,zt,new Map),G(this,Pi,0)}build(t,n,r){const o=new Hp({mutationCache:this,mutationId:++Zi(this,Pi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,bn).add(t);const n=eo(t);if(typeof n=="string"){const r=O(this,zt).get(n);r?r.push(t):O(this,zt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,bn).delete(t)){const n=eo(t);if(typeof n=="string"){const r=O(this,zt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&O(this,zt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=eo(t);if(typeof n=="string"){const r=O(this,zt).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=eo(t);if(typeof n=="string"){const o=(r=O(this,zt).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(){ze.batch(()=>{O(this,bn).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,bn).clear(),O(this,zt).clear()})}getAll(){return Array.from(O(this,bn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>vc(n,r))}findAll(t={}){return this.getAll().filter(n=>vc(t,n))}notify(t){ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ze.batch(()=>Promise.all(t.map(n=>n.continue().catch(ht))))}},bn=new WeakMap,zt=new WeakMap,Pi=new WeakMap,Lu);function eo(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Ic(e){return{onFetch:(t,n)=>{var d,l,h,g,w;const r=t.options,o=(h=(l=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:l.fetchMore)==null?void 0:h.direction,i=((g=t.state.data)==null?void 0:g.pages)||[],s=((w=t.state.data)==null?void 0:w.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const f=async()=>{let v=!1;const m=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?v=!0:t.signal.addEventListener("abort",()=>{v=!0}),t.signal)})},S=qu(t.options,t.fetchOptions),p=async(y,I,x)=>{if(v)return Promise.reject();if(I==null&&y.pages.length)return Promise.resolve(y);const A=(()=>{const M={client:t.client,queryKey:t.queryKey,pageParam:I,direction:x?"backward":"forward",meta:t.options.meta};return m(M),M})(),E=await S(A),{maxPages:R}=t.options,P=x?Mp:Dp;return{pages:P(y.pages,E,R),pageParams:P(y.pageParams,I,R)}};if(o&&i.length){const y=o==="backward",I=y?Jp:Cc,x={pages:i,pageParams:s},T=I(r,x);a=await p(x,T,y)}else{const y=e??i.length;do{const I=c===0?s[0]??r.initialPageParam:Cc(r,a);if(c>0&&I==null)break;a=await p(a,I),c++}while(c<y)}return a};t.options.persister?t.fetchFn=()=>{var v,m;return(m=(v=t.options).persister)==null?void 0:m.call(v,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function Cc(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 Jp(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,$n,Un,Ur,qr,qn,Vr,Hr,ju,Wp=(ju=class{constructor(e={}){ie(this,Ke);ie(this,$n);ie(this,Un);ie(this,Ur);ie(this,qr);ie(this,qn);ie(this,Vr);ie(this,Hr);G(this,Ke,e.queryCache||new Vp),G(this,$n,e.mutationCache||new Bp),G(this,Un,e.defaultOptions||{}),G(this,Ur,new Map),G(this,qr,new Map),G(this,qn,0)}mount(){Zi(this,qn)._++,O(this,qn)===1&&(G(this,Vr,ca.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ke).onFocus())})),G(this,Hr,bo.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ke).onOnline())})))}unmount(){var e,t;Zi(this,qn)._--,O(this,qn)===0&&((e=O(this,Vr))==null||e.call(this),G(this,Vr,void 0),(t=O(this,Hr))==null||t.call(this),G(this,Hr,void 0))}isFetching(e){return O(this,Ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,$n).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,Ke).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Wn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(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=O(this,Ke).get(r.queryHash),i=o==null?void 0:o.state.data,s=Pp(t,i);if(s!==void 0)return O(this,Ke).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return ze.batch(()=>O(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=O(this,Ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,Ke);ze.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,Ke);return ze.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ze.batch(()=>O(this,Ke).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(ht).catch(ht)}invalidateQueries(e,t={}){return ze.batch(()=>(O(this,Ke).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ze.batch(()=>O(this,Ke).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(ht)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(ht)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=O(this,Ke).build(this,t);return n.isStaleByTime(Wn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ht).catch(ht)}fetchInfiniteQuery(e){return e.behavior=Ic(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ht).catch(ht)}ensureInfiniteQueryData(e){return e.behavior=Ic(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return bo.isOnline()?O(this,$n).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Ke)}getMutationCache(){return O(this,$n)}getDefaultOptions(){return O(this,Un)}setDefaultOptions(e){G(this,Un,e)}setQueryDefaults(e,t){O(this,Ur).set(Cr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,Ur).values()],n={};return t.forEach(r=>{Si(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,qr).set(Cr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,qr).values()],n={};return t.forEach(r=>{Si(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,Un).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=aa(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===wo&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Un).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Ke).clear(),O(this,$n).clear()}},Ke=new WeakMap,$n=new WeakMap,Un=new WeakMap,Ur=new WeakMap,qr=new WeakMap,qn=new WeakMap,Vr=new WeakMap,Hr=new WeakMap,ju),wt,ye,Fi,pt,yr,Br,In,Vn,Di,Jr,Wr,vr,wr,Hn,zr,xe,vi,Ns,Ts,As,Rs,Ps,Fs,Ds,Qu,Ku,zp=(Ku=class extends si{constructor(t,n){super();ie(this,xe);ie(this,wt);ie(this,ye);ie(this,Fi);ie(this,pt);ie(this,yr);ie(this,Br);ie(this,In);ie(this,Vn);ie(this,Di);ie(this,Jr);ie(this,Wr);ie(this,vr);ie(this,wr);ie(this,Hn);ie(this,zr,new Set);this.options=n,G(this,wt,t),G(this,Vn,null),G(this,In,_s()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,ye).addObserver(this),Sc(O(this,ye),this.options)?pe(this,xe,vi).call(this):this.updateResult(),pe(this,xe,Rs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ms(O(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ms(O(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,xe,Ps).call(this),pe(this,xe,Fs).call(this),O(this,ye).removeObserver(this)}setOptions(t){const n=this.options,r=O(this,ye);if(this.options=O(this,wt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof jt(this.options.enabled,O(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,xe,Ds).call(this),O(this,ye).setOptions(this.options),n._defaulted&&!vo(this.options,n)&&O(this,wt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ye),observer:this});const o=this.hasListeners();o&&xc(O(this,ye),r,this.options,n)&&pe(this,xe,vi).call(this),this.updateResult(),o&&(O(this,ye)!==r||jt(this.options.enabled,O(this,ye))!==jt(n.enabled,O(this,ye))||Wn(this.options.staleTime,O(this,ye))!==Wn(n.staleTime,O(this,ye)))&&pe(this,xe,Ns).call(this);const i=pe(this,xe,Ts).call(this);o&&(O(this,ye)!==r||jt(this.options.enabled,O(this,ye))!==jt(n.enabled,O(this,ye))||i!==O(this,Hn))&&pe(this,xe,As).call(this,i)}getOptimisticResult(t){const n=O(this,wt).getQueryCache().build(O(this,wt),t),r=this.createResult(n,t);return Qp(this,r)&&(G(this,pt,r),G(this,Br,this.options),G(this,yr,O(this,ye).state)),r}getCurrentResult(){return O(this,pt)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),o==="promise"&&!this.options.experimental_prefetchInRender&&O(this,In).status==="pending"&&O(this,In).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(r,o))})}trackProp(t){O(this,zr).add(t)}getCurrentQuery(){return O(this,ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=O(this,wt).defaultQueryOptions(t),r=O(this,wt).getQueryCache().build(O(this,wt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,xe,vi).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,pt)))}createResult(t,n){var R;const r=O(this,ye),o=this.options,i=O(this,pt),s=O(this,yr),a=O(this,Br),f=t!==r?t.state:O(this,Fi),{state:d}=t;let l={...d},h=!1,g;if(n._optimisticResults){const P=this.hasListeners(),M=!P&&Sc(t,n),q=P&&xc(t,r,n,o);(M||q)&&(l={...l,...zu(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(l.fetchStatus="idle")}let{error:w,errorUpdatedAt:v,status:m}=l;g=l.data;let S=!1;if(n.placeholderData!==void 0&&g===void 0&&m==="pending"){let P;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(P=i.data,S=!0):P=typeof n.placeholderData=="function"?n.placeholderData((R=O(this,Wr))==null?void 0:R.state.data,O(this,Wr)):n.placeholderData,P!==void 0&&(m="success",g=Es(i==null?void 0:i.data,P,n),h=!0)}if(n.select&&g!==void 0&&!S)if(i&&g===(s==null?void 0:s.data)&&n.select===O(this,Di))g=O(this,Jr);else try{G(this,Di,n.select),g=n.select(g),g=Es(i==null?void 0:i.data,g,n),G(this,Jr,g),G(this,Vn,null)}catch(P){G(this,Vn,P)}O(this,Vn)&&(w=O(this,Vn),g=O(this,Jr),v=Date.now(),m="error");const p=l.fetchStatus==="fetching",y=m==="pending",I=m==="error",x=y&&p,T=g!==void 0,E={status:m,fetchStatus:l.fetchStatus,isPending:y,isSuccess:m==="success",isError:I,isInitialLoading:x,isLoading:x,data:g,dataUpdatedAt:l.dataUpdatedAt,error:w,errorUpdatedAt:v,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>f.dataUpdateCount||l.errorUpdateCount>f.errorUpdateCount,isFetching:p,isRefetching:p&&!y,isLoadingError:I&&!T,isPaused:l.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:I&&T,isStale:ua(t,n),refetch:this.refetch,promise:O(this,In),isEnabled:jt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const P=k=>{E.status==="error"?k.reject(E.error):E.data!==void 0&&k.resolve(E.data)},M=()=>{const k=G(this,In,E.promise=_s());P(k)},q=O(this,In);switch(q.status){case"pending":t.queryHash===r.queryHash&&P(q);break;case"fulfilled":(E.status==="error"||E.data!==q.value)&&M();break;case"rejected":(E.status!=="error"||E.error!==q.reason)&&M();break}}return E}updateResult(){const t=O(this,pt),n=this.createResult(O(this,ye),this.options);if(G(this,yr,O(this,ye).state),G(this,Br,this.options),O(this,yr).data!==void 0&&G(this,Wr,O(this,ye)),vo(n,t))return;G(this,pt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!O(this,zr).size)return!0;const s=new Set(i??O(this,zr));return this.options.throwOnError&&s.add("error"),Object.keys(O(this,pt)).some(a=>{const c=a;return O(this,pt)[c]!==t[c]&&s.has(c)})};pe(this,xe,Qu).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,xe,Rs).call(this)}},wt=new WeakMap,ye=new WeakMap,Fi=new WeakMap,pt=new WeakMap,yr=new WeakMap,Br=new WeakMap,In=new WeakMap,Vn=new WeakMap,Di=new WeakMap,Jr=new WeakMap,Wr=new WeakMap,vr=new WeakMap,wr=new WeakMap,Hn=new WeakMap,zr=new WeakMap,xe=new WeakSet,vi=function(t){pe(this,xe,Ds).call(this);let n=O(this,ye).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(ht)),n},Ns=function(){pe(this,xe,Ps).call(this);const t=Wn(this.options.staleTime,O(this,ye));if(Ir||O(this,pt).isStale||!Ss(t))return;const r=Uu(O(this,pt).dataUpdatedAt,t)+1;G(this,vr,setTimeout(()=>{O(this,pt).isStale||this.updateResult()},r))},Ts=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ye)):this.options.refetchInterval)??!1},As=function(t){pe(this,xe,Fs).call(this),G(this,Hn,t),!(Ir||jt(this.options.enabled,O(this,ye))===!1||!Ss(O(this,Hn))||O(this,Hn)===0)&&G(this,wr,setInterval(()=>{(this.options.refetchIntervalInBackground||ca.isFocused())&&pe(this,xe,vi).call(this)},O(this,Hn)))},Rs=function(){pe(this,xe,Ns).call(this),pe(this,xe,As).call(this,pe(this,xe,Ts).call(this))},Ps=function(){O(this,vr)&&(clearTimeout(O(this,vr)),G(this,vr,void 0))},Fs=function(){O(this,wr)&&(clearInterval(O(this,wr)),G(this,wr,void 0))},Ds=function(){const t=O(this,wt).getQueryCache().build(O(this,wt),this.options);if(t===O(this,ye))return;const n=O(this,ye);G(this,ye,t),G(this,Fi,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Qu=function(t){ze.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,pt))}),O(this,wt).getQueryCache().notify({query:O(this,ye),type:"observerResultsUpdated"})})},Ku);function Gp(e,t){return jt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Sc(e,t){return Gp(e,t)||e.state.data!==void 0&&Ms(e,t,t.refetchOnMount)}function Ms(e,t,n){if(jt(t.enabled,e)!==!1&&Wn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ua(e,t)}return!1}function xc(e,t,n,r){return(e!==t||jt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ua(e,n)}function ua(e,t){return jt(t.enabled,e)!==!1&&e.isStaleByTime(Wn(t.staleTime,e))}function Qp(e,t){return!vo(e.getCurrentResult(),t)}var Bn,Jn,bt,Cn,xn,fo,ks,$u,Xp=($u=class extends si{constructor(n,r){super();ie(this,xn);ie(this,Bn);ie(this,Jn);ie(this,bt);ie(this,Cn);G(this,Bn,n),this.setOptions(r),this.bindMethods(),pe(this,xn,fo).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=O(this,Bn).defaultMutationOptions(n),vo(this.options,r)||O(this,Bn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,bt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Cr(r.mutationKey)!==Cr(this.options.mutationKey)?this.reset():((o=O(this,bt))==null?void 0:o.state.status)==="pending"&&O(this,bt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=O(this,bt))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,xn,fo).call(this),pe(this,xn,ks).call(this,n)}getCurrentResult(){return O(this,Jn)}reset(){var n;(n=O(this,bt))==null||n.removeObserver(this),G(this,bt,void 0),pe(this,xn,fo).call(this),pe(this,xn,ks).call(this)}mutate(n,r){var o;return G(this,Cn,r),(o=O(this,bt))==null||o.removeObserver(this),G(this,bt,O(this,Bn).getMutationCache().build(O(this,Bn),this.options)),O(this,bt).addObserver(this),O(this,bt).execute(n)}},Bn=new WeakMap,Jn=new WeakMap,bt=new WeakMap,Cn=new WeakMap,xn=new WeakSet,fo=function(){var r;const n=((r=O(this,bt))==null?void 0:r.state)??Gu();G(this,Jn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ks=function(n){ze.batch(()=>{var r,o,i,s,a,c,f,d;if(O(this,Cn)&&this.hasListeners()){const l=O(this,Jn).variables,h=O(this,Jn).context;(n==null?void 0:n.type)==="success"?((o=(r=O(this,Cn)).onSuccess)==null||o.call(r,n.data,l,h),(s=(i=O(this,Cn)).onSettled)==null||s.call(i,n.data,null,l,h)):(n==null?void 0:n.type)==="error"&&((c=(a=O(this,Cn)).onError)==null||c.call(a,n.error,l,h),(d=(f=O(this,Cn)).onSettled)==null||d.call(f,void 0,n.error,l,h))}this.listeners.forEach(l=>{l(O(this,Jn))})})},$u),Xu=$.createContext(void 0),$e=e=>{const t=$.useContext(Xu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Yp=({client:e,children:t})=>($.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(Xu.Provider,{value:e,children:t})),Yu=$.createContext(!1),Zp=()=>$.useContext(Yu);Yu.Provider;function eh(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var th=$.createContext(eh()),nh=()=>$.useContext(th),rh=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},ih=e=>{$.useEffect(()=>{e.clearReset()},[e])},oh=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||Vu(n,[e.error,r])),sh=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...r)=>t(n(...r)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},ah=(e,t)=>e.isLoading&&e.isFetching&&!t,ch=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Oc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function uh(e,t,n){var l,h,g,w,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=Zp(),o=nh(),i=$e(),s=i.defaultQueryOptions(e);(h=(l=i.getDefaultOptions().queries)==null?void 0:l._experimental_beforeQuery)==null||h.call(l,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=r?"isRestoring":"optimistic",sh(s),rh(s,o),ih(o);const a=!i.getQueryCache().get(s.queryHash),[c]=$.useState(()=>new t(i,s)),f=c.getOptimisticResult(s),d=!r&&e.subscribed!==!1;if($.useSyncExternalStore($.useCallback(m=>{const S=d?c.subscribe(ze.batchCalls(m)):ht;return c.updateResult(),S},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),$.useEffect(()=>{c.setOptions(s)},[s,c]),ch(s,f))throw Oc(s,c,o);if(oh({result:f,errorResetBoundary:o,throwOnError:s.throwOnError,query:i.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((w=(g=i.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||w.call(g,s,f),s.experimental_prefetchInRender&&!Ir&&ah(f,r)){const m=a?Oc(s,c,o):(v=i.getQueryCache().get(s.queryHash))==null?void 0:v.promise;m==null||m.catch(ht).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?f:c.trackResult(f)}function Yn(e,t){return uh(e,zp)}function On(e,t){const n=$e(),[r]=$.useState(()=>new Xp(n,e));$.useEffect(()=>{r.setOptions(e)},[r,e]);const o=$.useSyncExternalStore($.useCallback(s=>r.subscribe(ze.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=$.useCallback((s,a)=>{r.mutate(s,a).catch(ht)},[r]);if(o.error&&Vu(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const Zu=b.createContext(null),lh=Zu.Provider,el=()=>b.useContext(Zu);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 tl=b.createContext(void 0);function $t(){const e=b.useContext(tl);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const dh=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function fh({children:e}){const[t,n]=b.useState(dh),r=b.useCallback((d,l,h=!0)=>{n(g=>{const w={...g};return w[d]=w[d]||{},w[d][l]=h,w})},[n]),o=b.useCallback((d,l)=>{var h;return!!((h=t[d])!=null&&h[l])},[t]),i=b.useCallback((d,l)=>{var h;return(h=t[d])==null?void 0:h[l]},[t]),s=b.useCallback((d,l)=>{n(h=>{var w;const g={...h};return(w=g[d])==null||delete w[l],g})},[n]),a=b.useCallback(d=>{n(l=>{const h={...l};return h[d]={},h})},[n]),c=b.useCallback((d,l)=>{n(h=>{const g={...h};return g[d]=g[d]||{},l.forEach(w=>{g[d][w]=!0}),g})},[n]),f=b.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 u.jsx(tl.Provider,{value:f,children:e})}const to=new TextEncoder,xi=new TextDecoder;function ph(...e){const t=e.reduce((o,{length:i})=>o+i,0),n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function hh(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function po(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:xi.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=xi.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return hh(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class Zn extends Error{constructor(n,r){var o;super(n,r);Fe(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(o=Error.captureStackTrace)==null||o.call(Error,this,this.constructor)}}Fe(Zn,"code","ERR_JOSE_GENERIC");class Jt extends Zn{constructor(n,r,o="unspecified",i="unspecified"){super(n,{cause:{claim:o,reason:i,payload:r}});Fe(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");Fe(this,"claim");Fe(this,"reason");Fe(this,"payload");this.claim=o,this.reason=i,this.payload=r}}Fe(Jt,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Ls extends Zn{constructor(n,r,o="unspecified",i="unspecified"){super(n,{cause:{claim:o,reason:i,payload:r}});Fe(this,"code","ERR_JWT_EXPIRED");Fe(this,"claim");Fe(this,"reason");Fe(this,"payload");this.claim=o,this.reason=i,this.payload=r}}Fe(Ls,"code","ERR_JWT_EXPIRED");class nl extends Zn{constructor(){super(...arguments);Fe(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}Fe(nl,"code","ERR_JOSE_ALG_NOT_ALLOWED");class lr extends Zn{constructor(){super(...arguments);Fe(this,"code","ERR_JOSE_NOT_SUPPORTED")}}Fe(lr,"code","ERR_JOSE_NOT_SUPPORTED");class Xe extends Zn{constructor(){super(...arguments);Fe(this,"code","ERR_JWS_INVALID")}}Fe(Xe,"code","ERR_JWS_INVALID");class la extends Zn{constructor(){super(...arguments);Fe(this,"code","ERR_JWT_INVALID")}}Fe(la,"code","ERR_JWT_INVALID");class rl extends Zn{constructor(n="signature verification failed",r){super(n,r);Fe(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}Fe(rl,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function vn(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function mi(e,t){return e.name===t}function rs(e){return parseInt(e.name.slice(4),10)}function mh(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function gh(e,t){if(!e.usages.includes(t))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function yh(e,t,n){switch(t){case"HS256":case"HS384":case"HS512":{if(!mi(e.algorithm,"HMAC"))throw vn("HMAC");const r=parseInt(t.slice(2),10);if(rs(e.algorithm.hash)!==r)throw vn(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!mi(e.algorithm,"RSASSA-PKCS1-v1_5"))throw vn("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(rs(e.algorithm.hash)!==r)throw vn(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!mi(e.algorithm,"RSA-PSS"))throw vn("RSA-PSS");const r=parseInt(t.slice(2),10);if(rs(e.algorithm.hash)!==r)throw vn(`SHA-${r}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":{if(!mi(e.algorithm,"Ed25519"))throw vn("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!mi(e.algorithm,"ECDSA"))throw vn("ECDSA");const r=mh(t);if(e.algorithm.namedCurve!==r)throw vn(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}gh(e,n)}function il(e,t,...n){var r;if(n=n.filter(Boolean),n.length>2){const o=n.pop();e+=`one of type ${n.join(", ")}, or ${o}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t=="function"&&t.name?e+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&(r=t.constructor)!=null&&r.name&&(e+=` Received an instance of ${t.constructor.name}`),e}const vh=(e,...t)=>il("Key must be ",e,...t);function ol(e,t,...n){return il(`Key for the ${e} algorithm must be `,t,...n)}function sl(e){return(e==null?void 0:e[Symbol.toStringTag])==="CryptoKey"}function al(e){return(e==null?void 0:e[Symbol.toStringTag])==="KeyObject"}const cl=e=>sl(e)||al(e),wh=(...e)=>{const t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(const r of t){const o=Object.keys(r);if(!n||n.size===0){n=new Set(o);continue}for(const i of o){if(n.has(i))return!1;n.add(i)}}return!0};function bh(e){return typeof e=="object"&&e!==null}const Io=e=>{if(!bh(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},Ih=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if(typeof n!="number"||n<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}};function Ch(e){let t,n;switch(e.kty){case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new lr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new lr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new lr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new lr('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}const Sh=async e=>{if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:t,keyUsages:n}=Ch(e),r={...e};return delete r.alg,delete r.use,crypto.subtle.importKey("jwk",r,t,e.ext??!e.d,e.key_ops??n)},xh=(e,t,n,r,o)=>{if(o.crit!==void 0&&(r==null?void 0:r.crit)===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(s=>typeof s!="string"||s.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;n!==void 0?i=new Map([...Object.entries(n),...t.entries()]):i=t;for(const s of r.crit){if(!i.has(s))throw new lr(`Extension Header Parameter "${s}" is not recognized`);if(o[s]===void 0)throw new e(`Extension Header Parameter "${s}" is missing`);if(i.get(s)&&r[s]===void 0)throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(r.crit)},Oh=(e,t)=>{if(t!==void 0&&(!Array.isArray(t)||t.some(n=>typeof n!="string")))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)};function da(e){return Io(e)&&typeof e.kty=="string"}function Eh(e){return e.kty!=="oct"&&typeof e.d=="string"}function _h(e){return e.kty!=="oct"&&typeof e.d>"u"}function Nh(e){return e.kty==="oct"&&typeof e.k=="string"}let Dr;const Ec=async(e,t,n,r=!1)=>{Dr||(Dr=new WeakMap);let o=Dr.get(e);if(o!=null&&o[n])return o[n];const i=await Sh({...t,alg:n});return r&&Object.freeze(e),o?o[n]=i:Dr.set(e,{[n]:i}),i},Th=(e,t)=>{var s;Dr||(Dr=new WeakMap);let n=Dr.get(e);if(n!=null&&n[t])return n[t];const r=e.type==="public",o=!!r;let i;if(e.asymmetricKeyType==="x25519"){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if(e.asymmetricKeyType==="ed25519"){if(t!=="EdDSA"&&t!=="Ed25519")throw new TypeError("given KeyObject instance cannot be used for this algorithm");i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if(e.asymmetricKeyType==="rsa"){let a;switch(t){case"RSA-OAEP":a="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":a="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":a="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":a="SHA-512";break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:a},o,r?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:a},o,[r?"verify":"sign"])}if(e.asymmetricKeyType==="ec"){const c=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get((s=e.asymmetricKeyDetails)==null?void 0:s.namedCurve);if(!c)throw new TypeError("given KeyObject instance cannot be used for this algorithm");t==="ES256"&&c==="P-256"&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:c},o,[r?"verify":"sign"])),t==="ES384"&&c==="P-384"&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:c},o,[r?"verify":"sign"])),t==="ES512"&&c==="P-521"&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:c},o,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:c},o,r?[]:["deriveBits"]))}if(!i)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return n?n[t]=i:Dr.set(e,{[t]:i}),i},Ah=async(e,t)=>{if(e instanceof Uint8Array||sl(e))return e;if(al(e)){if(e.type==="secret")return e.export();if("toCryptoKey"in e&&typeof e.toCryptoKey=="function")try{return Th(e,t)}catch(r){if(r instanceof TypeError)throw r}let n=e.export({format:"jwk"});return Ec(e,n,t)}if(da(e))return e.k?po(e.k):Ec(e,e,t,!0);throw new Error("unreachable")},Pr=e=>e==null?void 0:e[Symbol.toStringTag],js=(e,t,n)=>{var r,o;if(t.use!==void 0){let i;switch(n){case"sign":case"verify":i="sig";break;case"encrypt":case"decrypt":i="enc";break}if(t.use!==i)throw new TypeError(`Invalid key for this operation, its "use" must be "${i}" when present`)}if(t.alg!==void 0&&t.alg!==e)throw new TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);if(Array.isArray(t.key_ops)){let i;switch(!0){case n==="verify":case e==="dir":case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):!e.includes("GCM")&&e.endsWith("KW")?i="unwrapKey":i=n;break;case n==="encrypt":i="wrapKey";break;case n==="decrypt":i=e.startsWith("RSA")?"unwrapKey":"deriveBits";break}if(i&&((o=(r=t.key_ops)==null?void 0:r.includes)==null?void 0:o.call(r,i))===!1)throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${i}" when present`)}return!0},Rh=(e,t,n)=>{if(!(t instanceof Uint8Array)){if(da(t)){if(Nh(t)&&js(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!cl(t))throw new TypeError(ol(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(t.type!=="secret")throw new TypeError(`${Pr(t)} instances for symmetric algorithms must be of type "secret"`)}},Ph=(e,t,n)=>{if(da(t))switch(n){case"decrypt":case"sign":if(Eh(t)&&js(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(_h(t)&&js(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!cl(t))throw new TypeError(ol(e,t,"CryptoKey","KeyObject","JSON Web Key"));if(t.type==="secret")throw new TypeError(`${Pr(t)} instances for asymmetric algorithms must not be of type "secret"`);if(t.type==="public")switch(n){case"sign":throw new TypeError(`${Pr(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${Pr(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if(t.type==="private")switch(n){case"verify":throw new TypeError(`${Pr(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${Pr(t)} instances for asymmetric algorithm encryption must be of type "public"`)}},Fh=(e,t,n)=>{e.startsWith("HS")||e==="dir"||e.startsWith("PBES2")||/^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(e)||/^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(e)?Rh(e,t,n):Ph(e,t,n)},Dh=(e,t)=>{const n=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};default:throw new lr(`alg ${e} is not supported either by JOSE or your javascript runtime`)}},Mh=async(e,t,n)=>{if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(vh(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[n])}return yh(t,e,n),t},kh=async(e,t,n,r)=>{const o=await Mh(e,t,"verify");Ih(e,o);const i=Dh(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch{return!1}};async function Lh(e,t,n){if(!Io(e))throw new Xe("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new Xe('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new Xe("JWS Protected Header incorrect type");if(e.payload===void 0)throw new Xe("JWS Payload missing");if(typeof e.signature!="string")throw new Xe("JWS Signature missing or incorrect type");if(e.header!==void 0&&!Io(e.header))throw new Xe("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const m=po(e.protected);r=JSON.parse(xi.decode(m))}catch{throw new Xe("JWS Protected Header is invalid")}if(!wh(r,e.header))throw new Xe("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const o={...r,...e.header},i=xh(Xe,new Map([["b64",!0]]),n==null?void 0:n.crit,r,o);let s=!0;if(i.has("b64")&&(s=r.b64,typeof s!="boolean"))throw new Xe('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:a}=o;if(typeof a!="string"||!a)throw new Xe('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&Oh("algorithms",n.algorithms);if(c&&!c.has(a))throw new nl('"alg" (Algorithm) Header Parameter value not allowed');if(s){if(typeof e.payload!="string")throw new Xe("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new Xe("JWS Payload must be a string or an Uint8Array instance");let f=!1;typeof t=="function"&&(t=await t(r,e),f=!0),Fh(a,t,"verify");const d=ph(to.encode(e.protected??""),to.encode("."),typeof e.payload=="string"?to.encode(e.payload):e.payload);let l;try{l=po(e.signature)}catch{throw new Xe("Failed to base64url decode the signature")}const h=await Ah(t,a);if(!await kh(a,h,l,d))throw new rl;let w;if(s)try{w=po(e.payload)}catch{throw new Xe("Failed to base64url decode the payload")}else typeof e.payload=="string"?w=to.encode(e.payload):w=e.payload;const v={payload:w};return e.protected!==void 0&&(v.protectedHeader=r),e.header!==void 0&&(v.unprotectedHeader=e.header),f?{...v,key:h}:v}async function jh(e,t,n){if(e instanceof Uint8Array&&(e=xi.decode(e)),typeof e!="string")throw new Xe("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:s}=e.split(".");if(s!==3)throw new Xe("Invalid Compact JWS");const a=await Lh({payload:o,protected:r,signature:i},t,n),c={payload:a.payload,protectedHeader:a.protectedHeader};return typeof t=="function"?{...c,key:a.key}:c}const Kh=e=>Math.floor(e.getTime()/1e3),ul=60,ll=ul*60,fa=ll*24,$h=fa*7,Uh=fa*365.25,qh=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,_c=e=>{const t=qh.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]),r=t[3].toLowerCase();let o;switch(r){case"sec":case"secs":case"second":case"seconds":case"s":o=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":o=Math.round(n*ul);break;case"hour":case"hours":case"hr":case"hrs":case"h":o=Math.round(n*ll);break;case"day":case"days":case"d":o=Math.round(n*fa);break;case"week":case"weeks":case"w":o=Math.round(n*$h);break;default:o=Math.round(n*Uh);break}return t[1]==="-"||t[4]==="ago"?-o:o},Nc=e=>e.includes("/")?e.toLowerCase():`application/${e.toLowerCase()}`,Vh=(e,t)=>typeof e=="string"?t.includes(e):Array.isArray(e)?t.some(Set.prototype.has.bind(new Set(e))):!1;function Hh(e,t,n={}){let r;try{r=JSON.parse(xi.decode(t))}catch{}if(!Io(r))throw new la("JWT Claims Set must be a top-level JSON object");const{typ:o}=n;if(o&&(typeof e.typ!="string"||Nc(e.typ)!==Nc(o)))throw new Jt('unexpected "typ" JWT header value',r,"typ","check_failed");const{requiredClaims:i=[],issuer:s,subject:a,audience:c,maxTokenAge:f}=n,d=[...i];f!==void 0&&d.push("iat"),c!==void 0&&d.push("aud"),a!==void 0&&d.push("sub"),s!==void 0&&d.push("iss");for(const w of new Set(d.reverse()))if(!(w in r))throw new Jt(`missing required "${w}" claim`,r,w,"missing");if(s&&!(Array.isArray(s)?s:[s]).includes(r.iss))throw new Jt('unexpected "iss" claim value',r,"iss","check_failed");if(a&&r.sub!==a)throw new Jt('unexpected "sub" claim value',r,"sub","check_failed");if(c&&!Vh(r.aud,typeof c=="string"?[c]:c))throw new Jt('unexpected "aud" claim value',r,"aud","check_failed");let l;switch(typeof n.clockTolerance){case"string":l=_c(n.clockTolerance);break;case"number":l=n.clockTolerance;break;case"undefined":l=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:h}=n,g=Kh(h||new Date);if((r.iat!==void 0||f)&&typeof r.iat!="number")throw new Jt('"iat" claim must be a number',r,"iat","invalid");if(r.nbf!==void 0){if(typeof r.nbf!="number")throw new Jt('"nbf" claim must be a number',r,"nbf","invalid");if(r.nbf>g+l)throw new Jt('"nbf" claim timestamp check failed',r,"nbf","check_failed")}if(r.exp!==void 0){if(typeof r.exp!="number")throw new Jt('"exp" claim must be a number',r,"exp","invalid");if(r.exp<=g-l)throw new Ls('"exp" claim timestamp check failed',r,"exp","check_failed")}if(f){const w=g-r.iat,v=typeof f=="number"?f:_c(f);if(w-l>v)throw new Ls('"iat" claim timestamp check failed (too far in the past)',r,"iat","check_failed");if(w<0-l)throw new Jt('"iat" claim timestamp check failed (it should be in the past)',r,"iat","check_failed")}return r}async function Bh(e,t,n){var s;const r=await jh(e,t,n);if((s=r.protectedHeader.crit)!=null&&s.includes("b64")&&r.protectedHeader.b64===!1)throw new la("JWTs MUST NOT use unencoded payload");const i={payload:Hh(r.protectedHeader,r.payload,n),protectedHeader:r.protectedHeader};return typeof t=="function"?{...i,key:r.key}:i}const Ks="amp-labs_jwt_",Jh=10*60*1e3,Tc=(e,t)=>`${e}:${t}`,Ac=e=>`${Ks}${e}`,dl=b.createContext(null),Wh=async e=>{try{const n=(await Bh(e,new Uint8Array(0),{algorithms:[]})).payload;return n.exp&&typeof n.exp=="number"?n.exp*1e3:null}catch(t){return console.warn("Failed to decode JWT token:",t),null}};function zh({getTokenCallback:e,children:t}){const[n,r]=b.useState(new Map);b.useEffect(()=>{try{const c=new Map,f=Date.now();Object.keys(sessionStorage).forEach(d=>{if(d.startsWith(Ks)){const l=d.replace(Ks,""),h=sessionStorage.getItem(d);if(h)try{const g=JSON.parse(h);g.expiresAt>f?c.set(l,g):sessionStorage.removeItem(d)}catch{sessionStorage.removeItem(d)}}}),c.size>0&&r(c)}catch{console.warn("Failed to load JWT tokens from sessionStorage")}},[]);const o=b.useCallback((c,f)=>{const d=Tc(c,f),l=Date.now(),h=n.get(d);if(h&&h.expiresAt>l)return h.token;n.delete(d);const g=Ac(d),w=sessionStorage.getItem(g);if(w)try{const v=JSON.parse(w);if(v.expiresAt>l)return r(m=>new Map(m).set(d,v)),v.token;sessionStorage.removeItem(g)}catch{sessionStorage.removeItem(g)}return null},[n]),i=b.useCallback(async(c,f,d)=>{const l=Tc(c,f),g=await Wh(d)||Date.now()+Jh,w={token:d,expiresAt:g};r(v=>new Map(v).set(l,w));try{sessionStorage.setItem(Ac(l),JSON.stringify(w))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=b.useCallback(async({consumerRef:c,groupRef:f})=>{const d=o(c,f);if(d)return d;if(!e)throw new Error("JWT token callback not provided");try{const l=await e({consumerRef:c,groupRef:f});return await i(c,f,l),l}catch(l){throw console.error("Failed to get JWT token:",l),new Error("Failed to get JWT token")}},[e,o,i]),a={getToken:e?s:void 0};return u.jsx(dl.Provider,{value:a,children:t})}const Gh=()=>{const e=b.useContext(dl);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},pa=b.createContext(null);function De(){const e=b.useContext(pa);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
2
+ component is wrapped with AmpersandProvider`);return e}const Qh=new Wp;function Xh(e){const{options:{apiKey:t,projectId:n,project:r,getToken:o},children:i}=e,s=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!s)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t&&!o)throw new Error("Cannot use AmpersandProvider without an apiKey or getToken.");if(t&&o)throw new Error("Cannot use AmpersandProvider with both apiKey and getToken.");const a={options:e.options,projectIdOrName:s};return u.jsx(Yp,{client:Qh,children:u.jsx(pa.Provider,{value:a,children:u.jsx(fh,{children:u.jsx(zh,{getTokenCallback:o||null,children:u.jsx(lh,{value:t||null,children:i})})})})})}const Yh="https://api.withampersand.com/v1".replace(/\/+$/,"");class ha{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Yh}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||pl}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 Zh=new ha,ko=class ko{constructor(t=Zh){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 nm(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?ko.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 fl(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(f=>o[f]===void 0?delete o[f]:{});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:tm(a.body)||a.body instanceof URLSearchParams||em(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}};ko.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let an=ko;function em(e){return typeof Blob<"u"&&e instanceof Blob}function tm(e){return typeof FormData<"u"&&e instanceof FormData}class fl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class nm extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ne extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function _(e,t){const n=e[t];return n!=null}function pl(e,t=""){return Object.keys(e).map(n=>hl(n,e[n],t)).filter(n=>n.length>0).join("&")}function hl(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 hl(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?pl(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function qe(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Re{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Gr{constructor(t){this.raw=t}async value(){}}class Rc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function rm(e){return im(e)}function im(e,t){return e==null?e:{fieldUsed:_(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:_(e,"keyFormat")?e.keyFormat:void 0}}function om(e){return sm(e)}function sm(e,t){return e==null?e:{name:e.name,valuePrefix:_(e,"valuePrefix")?e.valuePrefix:void 0}}function am(e){return cm(e)}function cm(e,t){return e==null?e:{name:e.name}}function um(e){return lm(e)}function lm(e,t){return e==null?e:{attachmentType:e.attachmentType,query:_(e,"query")?am(e.query):void 0,header:_(e,"header")?om(e.header):void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0}}function dm(e){return fm(e)}function fm(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,includeFullRecords:_(e,"includeFullRecords")?e.includeFullRecords:void 0}}function pm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function hm(e){return mm(e)}function mm(e,t){return e==null?e:{url:e.url,method:_(e,"method")?e.method:void 0,successStatusCodes:_(e,"successStatusCodes")?e.successStatusCodes:void 0}}const Pc={ApiKey:"apiKey",Basic:"basic"};function gm(e){return ym(e)}function ym(e,t){return e}function vm(e){return wm(e)}function wm(e,t){return e==null?e:{days:_(e,"days")?e.days:void 0,fullHistory:_(e,"fullHistory")?e.fullHistory:void 0}}function bm(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function ml(e){return Im(e)}function Im(e,t){return e==null?e:{defaultPeriod:vm(e.defaultPeriod)}}function Cm(e){if(e!==void 0)return e===null?null:{defaultPeriod:bm(e.defaultPeriod)}}function Sm(e){return xm(e)}function xm(e,t){return e==null?e:{days:_(e,"days")?e.days:void 0,fullHistory:_(e,"fullHistory")?e.fullHistory:void 0}}function Om(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Em(e){return _m(e)}function _m(e,t){return e==null?e:{defaultPeriod:Sm(e.defaultPeriod)}}function gl(e){if(e!==void 0)return e===null?null:{defaultPeriod:Om(e.defaultPeriod)}}function Nm(e){return Tm(e)}function Tm(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,useModule:_(e,"useModule")?e.useModule:void 0}}function yl(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function Am(e){return Rm(e)}function Rm(e,t){return e}function Pm(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:gl(e.backfill)}}function Fm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,Pm)}}function Dm(e){return Mm(e)}function Mm(e,t){return e==null?e:{stringValue:_(e,"stringValue")?e.stringValue:void 0,integerValue:_(e,"integerValue")?e.integerValue:void 0,booleanValue:_(e,"booleanValue")?e.booleanValue:void 0}}function km(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const Lm={Always:"always",Never:"never"},jm={Always:"always",Never:"never"};function Km(e){return $m(e)}function $m(e,t){return e==null?e:{default:_(e,"default")?Dm(e.default):void 0,writeOnCreate:_(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:_(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function vl(e){if(e!==void 0)return e===null?null:{default:km(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function Um(e){let t=!0;return t=t&&"value"in e,t}function qm(e,t){return e==null?e:{value:e.value,applyOnUpdate:_(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Vm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Hm(e){let t=!0;return t=t&&"value"in e,t}function Bm(e,t){return e==null?e:{value:e.value,applyOnUpdate:_(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Jm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Wm(e){let t=!0;return t=t&&"value"in e,t}function zm(e,t){return e==null?e:{value:e.value,applyOnUpdate:_(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Gm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Qm(e){return Xm(e)}function Xm(e,t){return e==null?e:{...qm(e),...Bm(e),...zm(e)}}function wl(e){if(e!==void 0)return e===null?null:Um(e)?Vm(e):Hm(e)?Jm(e):Wm(e)?Gm(e):{}}function Ym(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:qe(e.selectedValueDefaults,wl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:qe(e.selectedFieldSettings,vl)}}function Zm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,Ym)}}function eg(e){return tg(e)}function tg(e,t){return e==null?e:{enabled:e.enabled}}function ng(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function rg(e){return ig(e)}function ig(e,t){return e==null?e:{enabled:e.enabled}}function og(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function sg(e){return ag(e)}function ag(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:_(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:_(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function cg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function ug(e){return lg(e)}function lg(e,t){return e==null?e:{apiKeyAsBasic:_(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:_(e,"apiKeyAsBasicOpts")?rm(e.apiKeyAsBasicOpts):void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0}}function dg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function fg(e){return pg(e)}function pg(e,t){return e==null?e:{value:e.value}}function hg(e){return mg(e)}function mg(e,t){return e==null?e:{brandingRemoval:_(e,"brandingRemoval")?fg(e.brandingRemoval):void 0}}function no(e){return gg(e)}function gg(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:_(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:_(e,"entitlements")?hg(e.entitlements):void 0}}function yg(e){return vg(e)}function vg(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function wg(e){return bg(e)}function bg(e,t){return e==null?e:{objectName:e.objectName,schedule:_(e,"schedule")?e.schedule:void 0,destination:_(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:_(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:_(e,"selectedFieldsAuto")?Am(e.selectedFieldsAuto):void 0,backfill:_(e,"backfill")?Em(e.backfill):void 0}}function Ig(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:gl(e.backfill)}}function Cg(e){return Sg(e)}function Sg(e,t){return e==null?e:{objects:qe(e.objects,wg)}}function xg(e){if(e!==void 0)return e===null?null:{objects:qe(e.objects,Ig)}}function Og(e){return Eg(e)}function Eg(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:_(e,"createEvent")?eg(e.createEvent):void 0,updateEvent:_(e,"updateEvent")?sg(e.updateEvent):void 0,deleteEvent:_(e,"deleteEvent")?rg(e.deleteEvent):void 0}}function _g(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:ng(e.createEvent),updateEvent:cg(e.updateEvent),deleteEvent:og(e.deleteEvent)}}function Ng(e){return Tg(e)}function Tg(e,t){return e==null?e:{objects:qe(e.objects,Og)}}function Ag(e){if(e!==void 0)return e===null?null:{objects:qe(e.objects,_g)}}function Rg(e){return Pg(e)}function Pg(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:_(e,"selectedValueDefaults")?qe(e.selectedValueDefaults,Qm):void 0,selectedFieldSettings:_(e,"selectedFieldSettings")?qe(e.selectedFieldSettings,Km):void 0}}function Fg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:qe(e.selectedValueDefaults,wl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:qe(e.selectedFieldSettings,vl)}}function Dg(e){return Mg(e)}function Mg(e,t){return e==null?e:{objects:_(e,"objects")?qe(e.objects,Rg):void 0}}function kg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,Fg)}}function Lg(e){return jg(e)}function jg(e,t){return e==null?e:{provider:e.provider,module:_(e,"module")?e.module:void 0,read:_(e,"read")?Cg(e.read):void 0,write:_(e,"write")?Dg(e.write):void 0,proxy:_(e,"proxy")?Nm(e.proxy):void 0,subscribe:_(e,"subscribe")?Ng(e.subscribe):void 0}}function Kg(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:xg(e.read),write:kg(e.write),proxy:yl(e.proxy),subscribe:Ag(e.subscribe)}}function $g(e){return Ug(e)}function Ug(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Lg(e.content)}}function qg(e){return Vg(e)}function Vg(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0}}function bl(e){return Hg(e)}function Hg(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0}}function Bg(e){return Jg(e)}function Jg(e,t){return e==null?e:{token:e.token,issuedAt:_(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:_(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Wg(e){return zg(e)}function zg(e,t){return e==null?e:{token:e.token,issuedAt:_(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:_(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Gg(e){return Qg(e)}function Qg(e,t){return e==null?e:{accessToken:_(e,"accessToken")?Bg(e.accessToken):void 0,refreshToken:_(e,"refreshToken")?Wg(e.refreshToken):void 0,scopes:_(e,"scopes")?e.scopes:void 0}}function ho(e){return Xg(e)}function Xg(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:_(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:_(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0}}function Yg(e){return Zg(e)}function Zg(e,t){return e==null?e:{value:e.value,source:e.source,displayName:_(e,"displayName")?e.displayName:void 0}}function ma(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function wi(e){return ey(e)}function ey(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:_(e,"providerApp")?ho(e.providerApp):void 0,group:bl(e.group),consumer:qg(e.consumer),providerWorkspaceRef:_(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:_(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:_(e,"oauth2AuthorizationCode")?Gg(e.oauth2AuthorizationCode):void 0,apiKey:_(e,"apiKey")?e.apiKey:void 0,providerMetadata:_(e,"providerMetadata")?qe(e.providerMetadata,Yg):void 0}}function Il(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Cl(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Sl(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 ty(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 ny(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 xl(e){if(e!==void 0)return e===null?null:{accessToken:ty(e.accessToken),refreshToken:ny(e.refreshToken),scopes:e.scopes}}function ry(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,ma),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:Il(e.basicAuth),oauth2ClientCredentials:Cl(e.oauth2ClientCredentials),oauth2PasswordCredentials:Sl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:xl(e.oauth2AuthorizationCode)}}function iy(e){return oy(e)}function oy(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0}}function sy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ay(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Kg(e.content)}}function cy(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:ay(e.config)}}function uy(e){return ly(e)}function ly(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,useModule:_(e,"useModule")?e.useModule:void 0}}function dy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function fy(e){return py(e)}function py(e,t){return e==null?e:{mode:_(e,"mode")?e.mode:void 0,pageSize:_(e,"pageSize")?e.pageSize:void 0}}function hy(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function my(e){let t=!0;return t=t&&"fieldName"in e,t}function gy(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function yy(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function vy(e){let t=!0;return t=t&&"mapToName"in e,t}function Ol(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:_(e,"default")?e.default:void 0,prompt:_(e,"prompt")?e.prompt:void 0}}function wy(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Fc(e){return by(e)}function by(e,t){return e==null?e:{...gy(e),...Ol(e)}}function Dc(e){if(e!==void 0)return e===null?null:my(e)?yy(e):vy(e)?wy(e):{}}function El(e){return Iy(e)}function Iy(e,t){return e}function Cy(e){return Sy(e)}function Sy(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:_(e,"requiredFields")?e.requiredFields.map(Fc):void 0,optionalFields:_(e,"optionalFields")?e.optionalFields.map(Fc):void 0,optionalFieldsAuto:_(e,"optionalFieldsAuto")?El(e.optionalFieldsAuto):void 0,backfill:_(e,"backfill")?ml(e.backfill):void 0,delivery:_(e,"delivery")?fy(e.delivery):void 0,enabled:_(e,"enabled")?e.enabled:void 0}}function xy(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(Dc),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Dc),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Cm(e.backfill),delivery:hy(e.delivery),enabled:e.enabled}}function Oy(e){return Ey(e)}function Ey(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(Cy):void 0}}function _y(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(xy)}}function Ny(e){return Ty(e)}function Ty(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0}}function Ay(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Ry(e){return Py(e)}function Py(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,watchFieldsAuto:_(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:_(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function Fy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Dy(e){return My(e)}function My(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:_(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:_(e,"createEvent")?iy(e.createEvent):void 0,updateEvent:_(e,"updateEvent")?Ry(e.updateEvent):void 0,deleteEvent:_(e,"deleteEvent")?Ny(e.deleteEvent):void 0,associationChangeEvent:_(e,"associationChangeEvent")?dm(e.associationChangeEvent):void 0,otherEvents:_(e,"otherEvents")?e.otherEvents:void 0}}function ky(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:sy(e.createEvent),updateEvent:Fy(e.updateEvent),deleteEvent:Ay(e.deleteEvent),associationChangeEvent:pm(e.associationChangeEvent),otherEvents:e.otherEvents}}function Ly(e){return jy(e)}function jy(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(Dy):void 0}}function Ky(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ky)}}function _l(e){return $y(e)}function $y(e,t){return e==null?e:{allowAnyFields:_(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Uy(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function qy(e){return Vy(e)}function Vy(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:_(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:_(e,"valueDefaults")?_l(e.valueDefaults):void 0}}function Hy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Uy(e.valueDefaults)}}function By(e){return Jy(e)}function Jy(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(qy):void 0}}function Wy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Hy)}}function zy(e){return Gy(e)}function Gy(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:_(e,"displayName")?e.displayName:void 0,module:_(e,"module")?e.module:void 0,read:_(e,"read")?Oy(e.read):void 0,write:_(e,"write")?By(e.write):void 0,proxy:_(e,"proxy")?uy(e.proxy):void 0,subscribe:_(e,"subscribe")?Ly(e.subscribe):void 0}}function Qy(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:_y(e.read),write:Wy(e.write),proxy:dy(e.proxy),subscribe:Ky(e.subscribe)}}function Xy(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Qy(e.content)}}function Yy(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Xy(e.latestRevision)}}function Zy(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function ev(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 tv(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function nv(e){return rv(e)}function rv(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function iv(e){return ov(e)}function ov(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:_(e,"prompt")?e.prompt:void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0}}function sv(e){return av(e)}function av(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function cv(e){return uv(e)}function uv(e,t){return e==null?e:{headers:_(e,"headers")?e.headers.map(nv):void 0,queryParams:_(e,"queryParams")?e.queryParams.map(sv):void 0,inputs:_(e,"inputs")?e.inputs.map(iv):void 0}}function lv(e){return dv(e)}function dv(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function fv(e){return pv(e)}function pv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:_(e,"valueType")?e.valueType:void 0,providerType:_(e,"providerType")?e.providerType:void 0,readOnly:_(e,"readOnly")?e.readOnly:void 0,values:_(e,"values")?e.values.map(lv):void 0}}function hv(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,ma),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:Il(e.basicAuth),oauth2ClientCredentials:Cl(e.oauth2ClientCredentials),oauth2PasswordCredentials:Sl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:xl(e.oauth2AuthorizationCode)}}function mv(e){return gv(e)}function gv(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,useModule:_(e,"useModule")?e.useModule:void 0}}function yv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function is(e){return vv(e)}function vv(e,t){return e==null?e:{...yv(e),...Ol(e)}}function wv(e){return bv(e)}function bv(e,t){return e==null?e:{error:_(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:_(e,"requiredFields")?e.requiredFields.map(is):void 0,optionalFields:_(e,"optionalFields")?e.optionalFields.map(is):void 0,optionalFieldsAuto:_(e,"optionalFieldsAuto")?El(e.optionalFieldsAuto):void 0,allFieldsMetadata:_(e,"allFieldsMetadata")?qe(e.allFieldsMetadata,fv):void 0,allFields:_(e,"allFields")?e.allFields.map(is):void 0,backfill:_(e,"backfill")?ml(e.backfill):void 0}}function Iv(e){return Cv(e)}function Cv(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(wv):void 0}}function Sv(e){return xv(e)}function xv(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:_(e,"valueDefaults")?_l(e.valueDefaults):void 0}}function Ov(e){return Ev(e)}function Ev(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(Sv):void 0}}function _v(e){return Nv(e)}function Nv(e,t){return e==null?e:{name:e.name,displayName:_(e,"displayName")?e.displayName:void 0,module:_(e,"module")?e.module:void 0,provider:e.provider,read:_(e,"read")?Iv(e.read):void 0,write:_(e,"write")?Ov(e.write):void 0,proxy:_(e,"proxy")?mv(e.proxy):void 0}}function Tv(e){return Av(e)}function Av(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:_v(e.content)}}function gi(e){return Rv(e)}function Rv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:_(e,"group")?bl(e.group):void 0,healthStatus:e.healthStatus,connection:wi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,config:$g(e.config)}}function Pv(e){return Fv(e)}function Fv(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:zy(e.content)}}function os(e){return Dv(e)}function Dv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Pv(e.latestRevision)}}function Mv(e){return kv(e)}function kv(e,t){return e==null?e:{iconURL:_(e,"iconURL")?e.iconURL:void 0,logoURL:_(e,"logoURL")?e.logoURL:void 0}}function Lv(e){return jv(e)}function jv(e,t){return e==null?e:{iconURL:_(e,"iconURL")?e.iconURL:void 0,logoURL:_(e,"logoURL")?e.logoURL:void 0}}function Kv(e){return $v(e)}function $v(e,t){return e==null?e:{regular:_(e,"regular")?Lv(e.regular):void 0,darkMode:_(e,"darkMode")?Mv(e.darkMode):void 0}}function Uv(e){return qv(e)}function qv(e,t){return e==null?e:{name:e.name,displayName:_(e,"displayName")?e.displayName:void 0,defaultValue:_(e,"defaultValue")?e.defaultValue:void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0,moduleDependencies:_(e,"moduleDependencies")?e.moduleDependencies:void 0}}function Vv(e){return Hv(e)}function Hv(e,t){return e==null?e:{name:e.name,moduleDependencies:_(e,"moduleDependencies")?e.moduleDependencies:void 0}}function Bv(e){return Jv(e)}function Jv(e,t){return e==null?e:{create:_(e,"create")?e.create:void 0,update:_(e,"update")?e.update:void 0,_delete:_(e,"delete")?e.delete:void 0,passThrough:_(e,"passThrough")?e.passThrough:void 0}}function Nl(e){return Wv(e)}function Wv(e,t){return e==null?e:{bulkWrite:yg(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:_(e,"subscribeSupport")?Bv(e.subscribeSupport):void 0}}function zv(e){return Gv(e)}function Gv(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Nl(e.support)}}function Qv(e){return Xv(e)}function Xv(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:_(e,"capture")?e.capture:void 0}}function Yv(e){return Zv(e)}function Zv(e,t){return e==null?e:{workspaceRefField:_(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:_(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:_(e,"scopesField")?e.scopesField:void 0,otherFields:_(e,"otherFields")?e.otherFields.map(Qv):void 0}}const ss={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function ew(e){return tw(e)}function tw(e,t){return e==null?e:{grantType:e.grantType,authURL:_(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:_(e,"audience")?e.audience:void 0,tokenMetadataFields:Yv(e.tokenMetadataFields),docsURL:_(e,"docsURL")?e.docsURL:void 0,authURLParams:_(e,"authURLParams")?e.authURLParams:void 0}}function nw(e){if(e!==void 0)return e===null?null:{projectId:e.projectId,provider:e.provider,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,ma),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function rw(e){return iw(e)}function iw(e,t){return e==null?e:{input:_(e,"input")?e.input.map(Uv):void 0,postAuthentication:_(e,"postAuthentication")?e.postAuthentication.map(Vv):void 0}}function ow(e){return sw(e)}function sw(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Mc(e){return aw(e)}function aw(e,t){return e==null?e:{name:e.name,authType:gm(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:_(e,"oauth2Opts")?ew(e.oauth2Opts):void 0,apiKeyOpts:_(e,"apiKeyOpts")?um(e.apiKeyOpts):void 0,basicOpts:_(e,"basicOpts")?ug(e.basicOpts):void 0,customOpts:_(e,"customOpts")?cv(e.customOpts):void 0,support:Nl(e.support),providerOpts:e.providerOpts,authHealthCheck:_(e,"authHealthCheck")?hm(e.authHealthCheck):void 0,displayName:_(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:_(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:_(e,"media")?Kv(e.media):void 0,labels:_(e,"labels")?e.labels:void 0,subscribeOpts:_(e,"subscribeOpts")?ow(e.subscribeOpts):void 0,modules:_(e,"modules")?qe(e.modules,zv):void 0,metadata:_(e,"metadata")?rw(e.metadata):void 0}}function cw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:ry(e.connection)}}function uw(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:Fm(e.read),write:Zm(e.write),proxy:yl(e.proxy)}}function lw(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:uw(e.content)}}function dw(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:lw(e.config)}}function fw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:dw(e.installation)}}function pw(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function hw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:pw(e.project)}}function mw(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 gw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:mw(e.providerApp)}}class yw extends an{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Gr(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:hv(t.generateConnectionParams)},n);return new Re(i,s=>wi(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 ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("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={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Re(i,s=>wi(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 ne("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={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>s.map(wi))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}async updateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ne("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:cw(t.updateConnectionRequest)},n);return new Re(i,s=>wi(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class vw extends an{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ne("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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:cy(t.installation)},n);return new Re(i,s=>gi(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 ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ne("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Gr(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ne("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Re(i,s=>gi(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 ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Re(i,s=>s.map(gi))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async listInstallationsForProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallationsForProject.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>s.map(gi))}async listInstallationsForProject(t,n){return await(await this.listInstallationsForProjectRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ne("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ne("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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:fw(t.installationUpdate)},n);return new Re(i,s=>gi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class ww extends an{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ne("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:dg(t.batchUpsertIntegrationsRequest)},n);return new Re(i,s=>s.map(os))}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 ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ne("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Yy(t.integration)},n);return new Gr(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Gr(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new ne("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getIntegration.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationIdOrName}".replace("{integrationIdOrName}",encodeURIComponent(String(t.integrationIdOrName))).replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>os(s))}async getIntegration(t,n){return await(await this.getIntegrationRaw(t,n)).value()}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>s.map(os))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class bw extends an{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ne("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:nw(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Re(i):new Rc(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new Re(i):new Rc(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Iw extends an{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ne("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:Zy(t.project)},n);return new Re(i,s=>no(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>no(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const i=this.configuration.accessToken,s=await i("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Re(o,i=>i.map(no))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ne("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:hw(t.projectUpdate)},n);return new Re(i,s=>no(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Cw extends an{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ne("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new Re(i,s=>Mc(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const i=this.configuration.accessToken,s=await i("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Re(o,i=>qe(i,Mc))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Sw extends an{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ne("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:ev(t.providerApp)},n);return new Re(i,s=>ho(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 ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ne("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Gr(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Re(i,s=>s.map(ho))}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 ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ne("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ne("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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:gw(t.providerAppUpdate)},n);return new Re(i,s=>ho(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class xw extends an{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ne("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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:tv(t.revision)},n);return new Gr(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ne("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}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 Re(i,s=>Tv(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var Tl=Symbol.for("immer-nothing"),kc=Symbol.for("immer-draftable"),Tt=Symbol.for("immer-state"),Ow=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 Ct(e,...t){if(process.env.NODE_ENV!=="production"){const n=Ow[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 Qr=Object.getPrototypeOf;function Xr(e){return!!e&&!!e[Tt]}function Sr(e){var t;return e?Al(e)||Array.isArray(e)||!!e[kc]||!!((t=e.constructor)!=null&&t[kc])||Mi(e)||jo(e):!1}var Ew=Object.prototype.constructor.toString();function Al(e){if(!e||typeof e!="object")return!1;const t=Qr(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)===Ew}function Co(e,t){Lo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Lo(e){const t=e[Tt];return t?t.type_:Array.isArray(e)?1:Mi(e)?2:jo(e)?3:0}function $s(e,t){return Lo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Rl(e,t,n){const r=Lo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function _w(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Mi(e){return e instanceof Map}function jo(e){return e instanceof Set}function ur(e){return e.copy_||e.base_}function Us(e,t){if(Mi(e))return new Map(e);if(jo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Al(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Tt];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(Qr(e),r)}else{const r=Qr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function ga(e,t=!1){return Ko(e)||Xr(e)||!Sr(e)||(Lo(e)>1&&Object.defineProperties(e,{set:{value:ro},add:{value:ro},clear:{value:ro},delete:{value:ro}}),Object.freeze(e),t&&Object.values(e).forEach(n=>ga(n,!0))),e}function ro(){Ct(2)}function Ko(e){return Object.isFrozen(e)}var Nw={};function xr(e){const t=Nw[e];return t||Ct(0,e),t}var Oi;function Pl(){return Oi}function Tw(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Lc(e,t){t&&(xr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function qs(e){Vs(e),e.drafts_.forEach(Aw),e.drafts_=null}function Vs(e){e===Oi&&(Oi=e.parent_)}function jc(e){return Oi=Tw(Oi,e)}function Aw(e){const t=e[Tt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Kc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Tt].modified_&&(qs(t),Ct(4)),Sr(e)&&(e=So(t,e),t.parent_||xo(t,e)),t.patches_&&xr("Patches").generateReplacementPatches_(n[Tt].base_,e,t.patches_,t.inversePatches_)):e=So(t,n,[]),qs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Tl?e:void 0}function So(e,t,n){if(Ko(t))return t;const r=t[Tt];if(!r)return Co(t,(o,i)=>$c(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return xo(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),Co(i,(a,c)=>$c(e,r,o,a,c,n,s)),xo(e,o,!1),n&&e.patches_&&xr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function $c(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&Ct(5),Xr(o)){const a=i&&t&&t.type_!==3&&!$s(t.assigned_,r)?i.concat(r):void 0,c=So(e,o,a);if(Rl(n,r,c),Xr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(Sr(o)&&!Ko(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;So(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Mi(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&xo(e,o)}}function xo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ga(t,n)}function Rw(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Pl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=ya;n&&(o=[r],i=Ei);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var ya={get(e,t){if(t===Tt)return e;const n=ur(e);if(!$s(n,t))return Pw(e,n,t);const r=n[t];return e.finalized_||!Sr(r)?r:r===as(e.base_,t)?(cs(e),e.copy_[t]=Bs(r,e)):r},has(e,t){return t in ur(e)},ownKeys(e){return Reflect.ownKeys(ur(e))},set(e,t,n){const r=Fl(ur(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=as(ur(e),t),i=o==null?void 0:o[Tt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(_w(n,o)&&(n!==void 0||$s(e.base_,t)))return!0;cs(e),Hs(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 as(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,cs(e),Hs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ur(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Ct(11)},getPrototypeOf(e){return Qr(e.base_)},setPrototypeOf(){Ct(12)}},Ei={};Co(ya,(e,t)=>{Ei[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Ei.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ct(13),Ei.set.call(this,e,t,void 0)};Ei.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ct(14),ya.set.call(this,e[0],t,n,e[0])};function as(e,t){const n=e[Tt];return(n?ur(n):e)[t]}function Pw(e,t,n){var o;const r=Fl(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Fl(e,t){if(!(t in e))return;let n=Qr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Qr(n)}}function Hs(e){e.modified_||(e.modified_=!0,e.parent_&&Hs(e.parent_))}function cs(e){e.copy_||(e.copy_=Us(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Fw=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,...f){return s.produce(c,d=>n.call(this,d,...f))}}typeof n!="function"&&Ct(6),r!==void 0&&typeof r!="function"&&Ct(7);let o;if(Sr(t)){const i=jc(this),s=Bs(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?qs(i):Vs(i)}return Lc(i,r),Kc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===Tl&&(o=void 0),this.autoFreeze_&&ga(o,!0),r){const i=[],s=[];xr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else Ct(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)||Ct(8),Xr(e)&&(e=Dw(e));const t=jc(this),n=Bs(e,void 0);return n[Tt].isManual_=!0,Vs(t),n}finishDraft(e,t){const n=e&&e[Tt];(!n||!n.isManual_)&&Ct(9);const{scope_:r}=n;return Lc(r,t),Kc(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=xr("Patches").applyPatches_;return Xr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Bs(e,t){const n=Mi(e)?xr("MapSet").proxyMap_(e,t):jo(e)?xr("MapSet").proxySet_(e,t):Rw(e,t);return(t?t.scope_:Pl()).drafts_.push(n),n}function Dw(e){return Xr(e)||Ct(10,e),Dl(e)}function Dl(e){if(!Sr(e)||Ko(e))return e;const t=e[Tt];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 Co(n,(r,o)=>{Rl(n,r,Dl(o))}),t&&(t.finalized_=!1),n}var Mw=new Fw,It=Mw.produce,io=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function va(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Oo={exports:{}};Oo.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",d="[object Boolean]",l="[object Date]",h="[object Error]",g="[object Function]",w="[object GeneratorFunction]",v="[object Map]",m="[object Number]",S="[object Null]",p="[object Object]",y="[object Promise]",I="[object Proxy]",x="[object RegExp]",T="[object Set]",A="[object String]",E="[object Symbol]",R="[object Undefined]",P="[object WeakMap]",M="[object ArrayBuffer]",q="[object DataView]",k="[object Float32Array]",L="[object Float64Array]",ae="[object Int8Array]",oe="[object Int16Array]",ge="[object Int32Array]",me="[object Uint8Array]",Oe="[object Uint8ClampedArray]",F="[object Uint16Array]",U="[object Uint32Array]",J=/[\\^$.*+?()[\]{}|]/g,B=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,j={};j[k]=j[L]=j[ae]=j[oe]=j[ge]=j[me]=j[Oe]=j[F]=j[U]=!0,j[a]=j[c]=j[M]=j[d]=j[q]=j[l]=j[h]=j[g]=j[v]=j[m]=j[p]=j[x]=j[T]=j[A]=j[P]=!1;var Q=typeof io=="object"&&io&&io.Object===Object&&io,Z=typeof self=="object"&&self&&self.Object===Object&&self,Y=Q||Z||Function("return this")(),ee=t&&!t.nodeType&&t,te=ee&&!0&&e&&!e.nodeType&&e,le=te&&te.exports===ee,K=le&&Q.process,we=function(){try{return K&&K.binding&&K.binding("util")}catch{}}(),W=we&&we.isTypedArray;function ot(C,N){for(var D=-1,X=C==null?0:C.length,Ae=0,de=[];++D<X;){var je=C[D];N(je,D,C)&&(de[Ae++]=je)}return de}function _e(C,N){for(var D=-1,X=N.length,Ae=C.length;++D<X;)C[Ae+D]=N[D];return C}function mt(C,N){for(var D=-1,X=C==null?0:C.length;++D<X;)if(N(C[D],D,C))return!0;return!1}function Je(C,N){for(var D=-1,X=Array(C);++D<C;)X[D]=N(D);return X}function gt(C){return function(N){return C(N)}}function Ee(C,N){return C.has(N)}function et(C,N){return C==null?void 0:C[N]}function xt(C){var N=-1,D=Array(C.size);return C.forEach(function(X,Ae){D[++N]=[Ae,X]}),D}function Ut(C,N){return function(D){return C(N(D))}}function Rt(C){var N=-1,D=Array(C.size);return C.forEach(function(X){D[++N]=X}),D}var lt=Array.prototype,st=Function.prototype,Me=Object.prototype,Ue=Y["__core-js_shared__"],Pt=st.toString,tt=Me.hasOwnProperty,Tr=function(){var C=/[^.]+$/.exec(Ue&&Ue.keys&&Ue.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),fn=Me.toString,pn=RegExp("^"+Pt.call(tt).replace(J,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),yt=le?Y.Buffer:void 0,Te=Y.Symbol,ir=Y.Uint8Array,Nn=Me.propertyIsEnumerable,Tn=lt.splice,Ot=Te?Te.toStringTag:void 0,hn=Object.getOwnPropertySymbols,An=yt?yt.isBuffer:void 0,Rn=Ut(Object.keys,Object),mn=Ar(Y,"DataView"),tn=Ar(Y,"Map"),ke=Ar(Y,"Promise"),at=Ar(Y,"Set"),re=Ar(Y,"WeakMap"),fe=Ar(Object,"create"),dt=sr(mn),gn=sr(tn),z=sr(ke),se=sr(at),ce=sr(re),Le=Te?Te.prototype:void 0,Ve=Le?Le.valueOf:void 0;function Ge(C){var N=-1,D=C==null?0:C.length;for(this.clear();++N<D;){var X=C[N];this.set(X[0],X[1])}}function Ft(){this.__data__=fe?fe(null):{},this.size=0}function nt(C){var N=this.has(C)&&delete this.__data__[C];return this.size-=N?1:0,N}function vt(C){var N=this.__data__;if(fe){var D=N[C];return D===r?void 0:D}return tt.call(N,C)?N[C]:void 0}function Ne(C){var N=this.__data__;return fe?N[C]!==void 0:tt.call(N,C)}function Pn(C,N){var D=this.__data__;return this.size+=this.has(C)?0:1,D[C]=fe&&N===void 0?r:N,this}Ge.prototype.clear=Ft,Ge.prototype.delete=nt,Ge.prototype.get=vt,Ge.prototype.has=Ne,Ge.prototype.set=Pn;function qt(C){var N=-1,D=C==null?0:C.length;for(this.clear();++N<D;){var X=C[N];this.set(X[0],X[1])}}function Zo(){this.__data__=[],this.size=0}function Hi(C){var N=this.__data__,D=zi(N,C);if(D<0)return!1;var X=N.length-1;return D==X?N.pop():Tn.call(N,D,1),--this.size,!0}function Bi(C){var N=this.__data__,D=zi(N,C);return D<0?void 0:N[D][1]}function Ji(C){return zi(this.__data__,C)>-1}function Wi(C,N){var D=this.__data__,X=zi(D,C);return X<0?(++this.size,D.push([C,N])):D[X][1]=N,this}qt.prototype.clear=Zo,qt.prototype.delete=Hi,qt.prototype.get=Bi,qt.prototype.has=Ji,qt.prototype.set=Wi;function nn(C){var N=-1,D=C==null?0:C.length;for(this.clear();++N<D;){var X=C[N];this.set(X[0],X[1])}}function ve(){this.size=0,this.__data__={hash:new Ge,map:new(tn||qt),string:new Ge}}function Vt(C){var N=Gi(this,C).delete(C);return this.size-=N?1:0,N}function fi(C){return Gi(this,C).get(C)}function or(C){return Gi(this,C).has(C)}function es(C,N){var D=Gi(this,C),X=D.size;return D.set(C,N),this.size+=D.size==X?0:1,this}nn.prototype.clear=ve,nn.prototype.delete=Vt,nn.prototype.get=fi,nn.prototype.has=or,nn.prototype.set=es;function Fn(C){var N=-1,D=C==null?0:C.length;for(this.__data__=new nn;++N<D;)this.add(C[N])}function tp(C){return this.__data__.set(C,r),this}function np(C){return this.__data__.has(C)}Fn.prototype.add=Fn.prototype.push=tp,Fn.prototype.has=np;function Dn(C){var N=this.__data__=new qt(C);this.size=N.size}function rp(){this.__data__=new qt,this.size=0}function ip(C){var N=this.__data__,D=N.delete(C);return this.size=N.size,D}function op(C){return this.__data__.get(C)}function sp(C){return this.__data__.has(C)}function ap(C,N){var D=this.__data__;if(D instanceof qt){var X=D.__data__;if(!tn||X.length<n-1)return X.push([C,N]),this.size=++D.size,this;D=this.__data__=new nn(X)}return D.set(C,N),this.size=D.size,this}Dn.prototype.clear=rp,Dn.prototype.delete=ip,Dn.prototype.get=op,Dn.prototype.has=sp,Dn.prototype.set=ap;function cp(C,N){var D=Qi(C),X=!D&&Sp(C),Ae=!D&&!X&&ts(C),de=!D&&!X&&!Ae&&hc(C),je=D||X||Ae||de,Qe=je?Je(C.length,String):[],rt=Qe.length;for(var Pe in C)tt.call(C,Pe)&&!(je&&(Pe=="length"||Ae&&(Pe=="offset"||Pe=="parent")||de&&(Pe=="buffer"||Pe=="byteLength"||Pe=="byteOffset")||vp(Pe,rt)))&&Qe.push(Pe);return Qe}function zi(C,N){for(var D=C.length;D--;)if(lc(C[D][0],N))return D;return-1}function up(C,N,D){var X=N(C);return Qi(C)?X:_e(X,D(C))}function pi(C){return C==null?C===void 0?R:S:Ot&&Ot in Object(C)?gp(C):Cp(C)}function sc(C){return hi(C)&&pi(C)==a}function ac(C,N,D,X,Ae){return C===N?!0:C==null||N==null||!hi(C)&&!hi(N)?C!==C&&N!==N:lp(C,N,D,X,ac,Ae)}function lp(C,N,D,X,Ae,de){var je=Qi(C),Qe=Qi(N),rt=je?c:Mn(C),Pe=Qe?c:Mn(N);rt=rt==a?p:rt,Pe=Pe==a?p:Pe;var Et=rt==p,Ht=Pe==p,ct=rt==Pe;if(ct&&ts(C)){if(!ts(N))return!1;je=!0,Et=!1}if(ct&&!Et)return de||(de=new Dn),je||hc(C)?cc(C,N,D,X,Ae,de):hp(C,N,rt,D,X,Ae,de);if(!(D&o)){var Dt=Et&&tt.call(C,"__wrapped__"),Mt=Ht&&tt.call(N,"__wrapped__");if(Dt||Mt){var kn=Dt?C.value():C,yn=Mt?N.value():N;return de||(de=new Dn),Ae(kn,yn,D,X,de)}}return ct?(de||(de=new Dn),mp(C,N,D,X,Ae,de)):!1}function dp(C){if(!pc(C)||bp(C))return!1;var N=dc(C)?pn:B;return N.test(sr(C))}function fp(C){return hi(C)&&fc(C.length)&&!!j[pi(C)]}function pp(C){if(!Ip(C))return Rn(C);var N=[];for(var D in Object(C))tt.call(C,D)&&D!="constructor"&&N.push(D);return N}function cc(C,N,D,X,Ae,de){var je=D&o,Qe=C.length,rt=N.length;if(Qe!=rt&&!(je&&rt>Qe))return!1;var Pe=de.get(C);if(Pe&&de.get(N))return Pe==N;var Et=-1,Ht=!0,ct=D&i?new Fn:void 0;for(de.set(C,N),de.set(N,C);++Et<Qe;){var Dt=C[Et],Mt=N[Et];if(X)var kn=je?X(Mt,Dt,Et,N,C,de):X(Dt,Mt,Et,C,N,de);if(kn!==void 0){if(kn)continue;Ht=!1;break}if(ct){if(!mt(N,function(yn,ar){if(!Ee(ct,ar)&&(Dt===yn||Ae(Dt,yn,D,X,de)))return ct.push(ar)})){Ht=!1;break}}else if(!(Dt===Mt||Ae(Dt,Mt,D,X,de))){Ht=!1;break}}return de.delete(C),de.delete(N),Ht}function hp(C,N,D,X,Ae,de,je){switch(D){case q:if(C.byteLength!=N.byteLength||C.byteOffset!=N.byteOffset)return!1;C=C.buffer,N=N.buffer;case M:return!(C.byteLength!=N.byteLength||!de(new ir(C),new ir(N)));case d:case l:case m:return lc(+C,+N);case h:return C.name==N.name&&C.message==N.message;case x:case A:return C==N+"";case v:var Qe=xt;case T:var rt=X&o;if(Qe||(Qe=Rt),C.size!=N.size&&!rt)return!1;var Pe=je.get(C);if(Pe)return Pe==N;X|=i,je.set(C,N);var Et=cc(Qe(C),Qe(N),X,Ae,de,je);return je.delete(C),Et;case E:if(Ve)return Ve.call(C)==Ve.call(N)}return!1}function mp(C,N,D,X,Ae,de){var je=D&o,Qe=uc(C),rt=Qe.length,Pe=uc(N),Et=Pe.length;if(rt!=Et&&!je)return!1;for(var Ht=rt;Ht--;){var ct=Qe[Ht];if(!(je?ct in N:tt.call(N,ct)))return!1}var Dt=de.get(C);if(Dt&&de.get(N))return Dt==N;var Mt=!0;de.set(C,N),de.set(N,C);for(var kn=je;++Ht<rt;){ct=Qe[Ht];var yn=C[ct],ar=N[ct];if(X)var mc=je?X(ar,yn,ct,N,C,de):X(yn,ar,ct,C,N,de);if(!(mc===void 0?yn===ar||Ae(yn,ar,D,X,de):mc)){Mt=!1;break}kn||(kn=ct=="constructor")}if(Mt&&!kn){var Xi=C.constructor,Yi=N.constructor;Xi!=Yi&&"constructor"in C&&"constructor"in N&&!(typeof Xi=="function"&&Xi instanceof Xi&&typeof Yi=="function"&&Yi instanceof Yi)&&(Mt=!1)}return de.delete(C),de.delete(N),Mt}function uc(C){return up(C,Ep,yp)}function Gi(C,N){var D=C.__data__;return wp(N)?D[typeof N=="string"?"string":"hash"]:D.map}function Ar(C,N){var D=et(C,N);return dp(D)?D:void 0}function gp(C){var N=tt.call(C,Ot),D=C[Ot];try{C[Ot]=void 0;var X=!0}catch{}var Ae=fn.call(C);return X&&(N?C[Ot]=D:delete C[Ot]),Ae}var yp=hn?function(C){return C==null?[]:(C=Object(C),ot(hn(C),function(N){return Nn.call(C,N)}))}:_p,Mn=pi;(mn&&Mn(new mn(new ArrayBuffer(1)))!=q||tn&&Mn(new tn)!=v||ke&&Mn(ke.resolve())!=y||at&&Mn(new at)!=T||re&&Mn(new re)!=P)&&(Mn=function(C){var N=pi(C),D=N==p?C.constructor:void 0,X=D?sr(D):"";if(X)switch(X){case dt:return q;case gn:return v;case z:return y;case se:return T;case ce:return P}return N});function vp(C,N){return N=N??s,!!N&&(typeof C=="number"||V.test(C))&&C>-1&&C%1==0&&C<N}function wp(C){var N=typeof C;return N=="string"||N=="number"||N=="symbol"||N=="boolean"?C!=="__proto__":C===null}function bp(C){return!!Tr&&Tr in C}function Ip(C){var N=C&&C.constructor,D=typeof N=="function"&&N.prototype||Me;return C===D}function Cp(C){return fn.call(C)}function sr(C){if(C!=null){try{return Pt.call(C)}catch{}try{return C+""}catch{}}return""}function lc(C,N){return C===N||C!==C&&N!==N}var Sp=sc(function(){return arguments}())?sc:function(C){return hi(C)&&tt.call(C,"callee")&&!Nn.call(C,"callee")},Qi=Array.isArray;function xp(C){return C!=null&&fc(C.length)&&!dc(C)}var ts=An||Np;function Op(C,N){return ac(C,N)}function dc(C){if(!pc(C))return!1;var N=pi(C);return N==g||N==w||N==f||N==I}function fc(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=s}function pc(C){var N=typeof C;return C!=null&&(N=="object"||N=="function")}function hi(C){return C!=null&&typeof C=="object"}var hc=W?gt(W):fp;function Ep(C){return xp(C)?cp(C):pp(C)}function _p(){return[]}function Np(){return!1}e.exports=Op})(Oo,Oo.exports);var kw=Oo.exports;const wa=va(kw),He=async(e,t)=>{var n;if(e instanceof fl){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(`
3
3
  `))||(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?`
4
4
 
5
- [Remedy] ${s.remedy}`:""}`;t&&t(c)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)};function $o(){const e=it(),{projectIdOrName:t}=De(),{setError:n,removeError:r}=Ut(),o=Zn({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});return b.useEffect(()=>{o.isError?(He(o.error),n(ue.INTEGRATION_LIST,t)):r(ue.INTEGRATION_LIST,t)},[o.isError,o.error,t,n,r]),o}const va=(e,t)=>{var s;const n=it(),{projectIdOrName:r}=De(),{data:o}=$o(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return Zn({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})},tr=()=>{var o,i;const{setError:e}=Ut(),t=it(),{projectIdOrName:n}=De(),r=Zn({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return b.useEffect(()=>{r.isError&&e(ue.PROJECT,n)},[r.isError,n,e]),{...r,projectIdOrName:n,appName:(o=r.data)==null?void 0:o.name,projectId:(i=r.data)==null?void 0:i.id}};function ki(){const{integrationNameOrId:e,groupRef:t}=Tr(),n=va(e,t),{isPending:r,isFetching:o,isError:i,isSuccess:s,error:a,data:c}=n;return{installation:c==null?void 0:c[0],isPending:r,isFetching:o,isError:i,isSuccess:s,error:a}}const ci=e=>{const t=$o(),n=t.data,r=n==null?void 0:n.find(o=>o.name===e||o.id===e);return{...t,data:r,provider:r==null?void 0:r.provider}},wa=()=>{const{groupRef:e,integrationNameOrId:t}=Tr(),{provider:n}=ci(t),r=Ca({groupRef:e,provider:n}),{isPending:o,isFetching:i,isError:s,isSuccess:a,error:c,data:f}=r;return{connection:f==null?void 0:f[0],error:c,isPending:o,isFetching:i,isError:s,isSuccess:a}},kw=()=>{var m;const e=$e(),t=it(),{connection:n,isPending:r,isFetching:o}=wa(),{projectIdOrName:i}=De(),{integrationNameOrId:s}=Tr(),{data:a}=ci(s),c=n==null?void 0:n.id,f=a==null?void 0:a.id,d=(m=a==null?void 0:a.latestRevision)==null?void 0:m.id,l=r||o;return b.useEffect(()=>{c||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[c,e]),Zn({queryKey:["amp","hydratedRevision",i,f,d,c],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!f)throw new Error("integrationId is required");if(!d)throw new Error("revisionId is required");if(!c)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:f,revisionId:d,connectionId:c})},retry:3,enabled:!!i&&!!f&&!!d&&!!c&&!l})};function Dl(){var f,d;const e=kw(),{isPending:t,isFetching:n,isError:r,isSuccess:o,error:i,data:s}=e,a=s==null?void 0:s.content,c=b.useMemo(()=>({getReadObject:l=>{var y,w;const m=(w=(y=a==null?void 0:a.read)==null?void 0:y.objects)==null?void 0:w.find(v=>v.objectName===l);return m?{object:m,getRequiredFields:()=>m.requiredFields??[],getOptionalFields:()=>m.optionalFields??[]}:(console.error(`Object ${l} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:l=>{var y,w;const m=(w=(y=a==null?void 0:a.write)==null?void 0:y.objects)==null?void 0:w.find(v=>v.objectName===l);return m?{object:m}:(console.error(`Object ${l} not found`),{object:null})},getCustomerFieldsForObject:l=>{var y,w;const m=(w=(y=a==null?void 0:a.read)==null?void 0:y.objects)==null?void 0:w.find(v=>v.objectName===l);return m?{allFields:m.allFieldsMetadata??{},getField:v=>{var S;const p=(S=m.allFieldsMetadata)==null?void 0:S[v];return p||(console.error(`Field ${v} not found`),null)}}:(console.error(`Object ${l} not found`),{allFields:null,getField:()=>null})}}),[(f=a==null?void 0:a.read)==null?void 0:f.objects,(d=a==null?void 0:a.write)==null?void 0:d.objects]);return{data:s,...c,isPending:t,isFetching:n,isError:r,isSuccess:o,error:i}}function Lw(e){var m,y,w,v;const[t,n]=b.useState(e),{getReadObject:r,data:o}=Dl(),{installation:i}=ki(),s=b.useCallback(()=>t,[t]),a=b.useCallback((p,S)=>{var E,A;S.provider=S.provider||((E=o==null?void 0:o.content)==null?void 0:E.provider)||"";const h=S.read||{objects:{}},g=h.objects||{},I=g[p]||{},x=r(p),T={};return(A=x==null?void 0:x.getRequiredFields())==null||A.forEach(R=>{"fieldName"in R&&(T[R.fieldName]=!0)}),I.objectName=I.objectName||p,I.selectedFields=I.selectedFields||T,g[p]=I,h.objects=g,S.read=h,{read:h,objects:g,obj:I}},[r,(m=o==null?void 0:o.content)==null?void 0:m.provider]),c=b.useCallback(p=>{var S,h;return{object:(h=(S=t.read)==null?void 0:S.objects)==null?void 0:h[p],getSelectedField:g=>{var I,x,T,E;return!!((E=(T=(x=(I=t.read)==null?void 0:I.objects)==null?void 0:x[p])==null?void 0:T.selectedFields)!=null&&E[g])},setSelectedField:({fieldName:g,selected:I})=>{n(x=>It(x,T=>{const{obj:E}=a(p,T);E.selectedFields=E.selectedFields||{},E.selectedFields[g]=I,E.selectedFields[g]===!1&&delete E.selectedFields[g]}))},getFieldMapping:g=>{var I,x,T,E;return(E=(T=(x=(I=t.read)==null?void 0:I.objects)==null?void 0:x[p])==null?void 0:T.selectedFieldMappings)==null?void 0:E[g]},setFieldMapping:({fieldName:g,mapToName:I})=>{n(x=>It(x,T=>{const{obj:E}=a(p,T);E.selectedFieldMappings=E.selectedFieldMappings||{},E.selectedFieldMappings[I]=g}))}}},[(y=t.read)==null?void 0:y.objects,a]),f=b.useCallback(p=>{var x,T;const S=(T=(x=t.write)==null?void 0:x.objects)==null?void 0:T[p],h=E=>{const A=E.write||{},R=A.objects||{},P=R[p]||{objectName:p};return R[p]=P,A.objects=R,E.write=A,{write:A,objects:R,obj:P}},g=(E,A)=>{var R,P;return(P=(R=S==null?void 0:S.selectedFieldSettings)==null?void 0:R[E])==null?void 0:P[A]},I=(E,A,R)=>{n(P=>It(P,K=>{var j;const{obj:q}=h(K);q.selectedFieldSettings={...q.selectedFieldSettings,[E]:{...(j=q.selectedFieldSettings)==null?void 0:j[E],[A]:R}}}))};return{object:S,setEnableWrite:()=>{n(E=>It(E,A=>{const{obj:R}=h(A);R.objectName=p}))},setDisableWrite:()=>{n(E=>It(E,A=>{const{objects:R}=h(A);delete R[p]}))},getWriteObject:()=>{var E,A;return(A=(E=t.write)==null?void 0:E.objects)==null?void 0:A[p]},getSelectedFieldSettings:E=>{var A;return(A=S==null?void 0:S.selectedFieldSettings)==null?void 0:A[E]},setSelectedFieldSettings:({fieldName:E,settings:A})=>{n(R=>It(R,P=>{const{obj:K}=h(P),q=K.selectedFieldSettings||{};K.selectedFieldSettings={...q,[E]:A},A===void 0&&delete K.selectedFieldSettings[E]}))},getDefaultValues:E=>g(E,"default"),setDefaultValues:({fieldName:E,value:A})=>I(E,"default",A),getWriteOnCreateSetting:E=>g(E,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:E,value:A})=>I(E,"writeOnCreate",A),getWriteOnUpdateSetting:E=>g(E,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:E,value:A})=>I(E,"writeOnUpdate",A)}},[(w=t.write)==null?void 0:w.objects]),d=b.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(p=>It(p,S=>{S.proxy={enabled:!0}}))},setDisableProxy:()=>{n(p=>It(p,S=>{S.proxy={enabled:!1}}))},getProxyEnabled:()=>{var p;return((p=t.proxy)==null?void 0:p.enabled)||!1}}),[t.proxy]),l=b.useCallback(()=>{n(p=>It(p,S=>{var h;Object.assign(S,(h=i==null?void 0:i.config)==null?void 0:h.content)}))},[(v=i==null?void 0:i.config)==null?void 0:v.content]);return b.useEffect(()=>{i&&(console.debug("Installation found",{installation:i}),l())},[i,l]),{draft:t,get:s,reset:l,setDraft:n,readObject:c,writeObject:f,proxy:d}}const ba=b.createContext(null);function jw({children:e,initialConfig:t}){const n=Lw(t);return u.jsx(ba.Provider,{value:n,children:e})}function Kw(){const e=b.useContext(ba);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function $w(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=b.useContext(ba);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const Ml=b.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Tr(){const e=b.useContext(Ml);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function Ia({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}){const s=b.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}),[t,n,r,o,i]);return u.jsx(Ml.Provider,{value:s,children:u.jsx(jw,{initialConfig:{},children:e})})}class Js{constructor(t){this.connectionApi=new yw(t),this.installationApi=new vw(t),this.integrationApi=new ww(t),this.oAuthApi=new bw(t),this.projectApi=new Iw(t),this.providerApi=new Cw(t),this.providerAppApi=new Sw(t),this.revisionApi=new xw(t)}}const kl="2.9.0",Uw="v1",ro="https://api.withampersand.com";function Ll(){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 ro;case"mock":return"http://127.0.0.1:4010";case"":return ro;default:return e??ro}}catch{return ro}}const qw=(e,t)=>`${e}/${t}`;function Vw(){return qw(Ll(),Uw)}const jl=Ll(),Kl=Vw(),Hw=new ha({basePath:Kl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":kl}});new Js(Hw);const Bw=e=>({header:"X-Api-Key",value:e}),Jw=e=>{try{return{header:"Authorization",value:`Bearer ${e}`}}catch(t){throw console.error("Failed to get JWT token for API authentication:",t),new Error("Failed to authenticate with JWT token")}},$c=(e,t)=>new ha({basePath:Kl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":kl,[e]:t}});function it(){const e=Zu(),{getToken:t}=Gh(),{consumerRef:n,groupRef:r}=Tr();return b.useCallback(async()=>{if(e){const i=Bw(e),s=$c(i.header,i.value);return new Js(s)}if(t){if(!n||!r)throw console.error("Unable to create JWT API service without consumerRef or groupRef.",{consumerRef:n,groupRef:r}),new Error("Unable to create JWT API service without consumerRef or groupRef.");const i=await t({consumerRef:n,groupRef:r}),s=Jw(i),a=$c(s.header,s.value);return new Js(a)}throw console.error("Unable to create API service without API key or JWT token."),new Error("Unable to create API service without API key or JWT token.")},[e,t,n,r])}const Ca=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=De(),r=it();return Zn({queryKey:["amp","connections",n,e,t],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!e)throw new Error("Group reference not found.");if(!t)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:n,groupRef:e,provider:t})},retry:3,enabled:!!n&&!!e&&!!t})};function Ww(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const zw="_box_1p7c5_1",Uc={box:zw};function _n({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Uc.box} ${t}`:Uc.box,style:n,children:e})}const Gw="_container_1wvzr_1",qc={container:Gw};function ui({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${qc.container} ${t}`:qc.container,style:n,children:e})}const Qw="_errorBoxContainer_4sdb2_1",Xw="_errorBox_4sdb2_1",Yw="_errorText_4sdb2_20",Ws={errorBoxContainer:Qw,errorBox:Xw,errorText:Yw};function $l({message:e}){return u.jsx(_n,{className:Ws.errorBox,children:u.jsx("p",{className:Ws.errorText,children:e})})}function Ul({message:e,children:t}){return u.jsxs(ui,{className:Ws.errorBoxContainer,children:[u.jsx(Ww,{}),u.jsx($l,{message:e}),t]})}const Zw="_loader_6ubm6_1",eb={loader:Zw};function tb(){return u.jsx("span",{className:eb.loader})}function Ni(){return u.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:u.jsx(tb,{})})}function ql({children:e}){return u.jsx(ui,{style:{maxWidth:"55rem"},children:u.jsx(_n,{children:e})})}function li(){return u.jsx(ql,{children:u.jsx(Ni,{})})}function Qt({message:e,children:t}){return u.jsx(ql,{children:u.jsx(Ul,{message:e,children:t})})}function un(e){return e.charAt(0).toUpperCase()+e.slice(1)}function nb(e,t){return(t==null?void 0:t.displayName)??un(e)}const rb=e=>e.split(`
6
- `).filter(n=>n.trim()!==""),ib=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null;function ob(e){return!e||typeof e!="string"?"id_"+Math.random().toString(36).substr(2,9):e.toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").replace(/^[^a-z]/,"id-").substring(0,50)}const sb=()=>{const[e,t]=b.useState(!1),n=b.useCallback(()=>{t(!0)},[t]),r=b.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},Vl=b.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{},resetComponent:()=>{}});function Ze(){const e=b.useContext(Vl);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function ab({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:f,resetComponent:d}){const{data:l}=$o(),{setError:m,isError:y,removeError:w}=Ut(),{isIntegrationDeleted:v,setIntegrationDeleted:p,resetIntegrationDeleted:S}=sb(),h=b.useMemo(()=>ib(t,l||[]),[t,l]),{data:g,isLoading:I,isError:x,error:T}=va(t,o),E=(g==null?void 0:g[0])||null;b.useEffect(()=>{S()},[t,n,r,o,i,f]),b.useEffect(()=>{h===null&&(l!=null&&l.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,h,l]),b.useEffect(()=>{x?(m(ue.INSTALLATION_LIST,(h==null?void 0:h.id)||""),He(T)):w(ue.INSTALLATION_LIST,(h==null?void 0:h.id)||"")},[x,h,m,w,T]);const A=$e(),R=b.useCallback(()=>{A.invalidateQueries({queryKey:["amp","installations"]})},[A]),P=b.useCallback(j=>{A.setQueryData(["amp","installations"],[j]),A.invalidateQueries({queryKey:["amp","installations"]})},[A]),K=(h==null?void 0:h.id)||"",q=b.useMemo(()=>({integrationId:(h==null?void 0:h.id)||"",provider:(h==null?void 0:h.provider)||"",integrationObj:h,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:E||void 0,setInstallation:P,resetInstallations:R,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:v,setIntegrationDeleted:p,fieldMapping:f,resetComponent:d}),[h,n,r,o,i,E,P,R,s,a,c,v,p,f,d]);if(I)return u.jsx(li,{});if(h===null)return u.jsx(Qt,{message:`Integration "${t}" not found`});if(y(ue.INSTALLATION_LIST,K)){const j=`Error retrieving installation information for integration "${(h==null?void 0:h.name)||"unknown"}"`;return u.jsx(Qt,{message:j})}return u.jsx(Vl.Provider,{value:q,children:e})}const Hl=b.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),en=()=>{const e=b.useContext(Hl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Bl({groupRef:e,provider:t,children:n}){const r=$e(),{setError:o,isError:i}=Ut(),{projectIdOrName:s,isLoading:a}=tr(),{integrationId:c,groupRef:f}=Ze(),{provider:d}=ci(c),{data:l,isLoading:m,isError:y,error:w}=Ca({groupRef:e||f,provider:d||t}),v=l==null?void 0:l[0],p=b.useCallback(g=>{r.setQueryData(["amp","connections"],()=>g),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),S=b.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);b.useEffect(()=>{y?(o(ue.CONNECTION_LIST,s,!0),He(w)):o(ue.CONNECTION_LIST,s,!1)},[y,o,s,w]);const h=b.useMemo(()=>({connections:l||null,isConnectionsLoading:m,selectedConnection:v||null,setConnections:p,setSelectedConnection:S}),[l,m,v,p,S]);if(m||a)return u.jsx(li,{});if(s&&i(ue.PROJECT,s))return u.jsx(Qt,{message:`Error loading project ${s}`});if(s&&i(ue.CONNECTION_LIST,s))return u.jsx(Qt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID or Project Name not found. ConnectionsProvider must be used within AmpersandProvider");return u.jsx(Hl.Provider,{value:h,children:n})}const Jl=()=>{const e=it(),t=$e(),[n,r]=b.useState(null);return{...En({mutationKey:["createInstallation"],mutationFn:async i=>(await e()).installationApi.createInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error creating installation"),He(i,r)}}),errorMsg:n}};function cb(e){return typeof e.provider=="string"}function ub(e){if(!cb(e))throw new Error("Config must have a provider field for creation");return e}function Wl(){const{projectIdOrName:e}=De(),{groupRef:t,integrationNameOrId:n}=Tr(),{data:r}=ci(n),{connection:o}=wa(),{installation:i}=ki(),s=$e(),{mutate:a,isIdle:c,isPending:f,error:d,errorMsg:l}=Jl();return{createInstallation:({config:y,onSuccess:w,onError:v,onSettled:p})=>{if(i)throw Error("Installation already created. Try updating instead.");if(!r)throw Error("No integration found");const S={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:o==null?void 0:o.id,config:{content:ub(y)}}};return a(S,{onSuccess:h=>{w==null||w(h)},onError:h=>{v==null||v(h)},onSettled:()=>{p==null||p(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:c,isPending:f,error:d,errorMsg:l}}const lb=()=>{const e=it(),t=$e(),[n,r]=b.useState(null);return{...En({mutationKey:["updateInstallation"],mutationFn:async i=>(await e()).installationApi.updateInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error updating installation"),He(i,r)}}),errorMsg:n}};function zl(){const{projectIdOrName:e}=De(),{integrationNameOrId:t}=Tr(),{data:n}=ci(t),{installation:r}=ki(),o=$e(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=lb();return{updateInstallation:({config:l,onSuccess:m,onError:y,onSettled:w})=>{var S,h;if(!r)throw Error("Installation not created yet. Try creating the installation first.");if(!n)throw Error("No integration found");const v=[];if((S=l==null?void 0:l.write)!=null&&S.objects&&Object.keys(l.write.objects).length>0&&v.push("config.content.write.objects"),(h=l==null?void 0:l.read)!=null&&h.objects){const g=Object.keys(l.read.objects);v.push(...g.map(I=>`config.content.read.objects.${I}`))}const p={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:v,installation:{config:{content:l}}}};return i(p,{onSuccess:g=>{m==null||m(g)},onError:g=>{y==null||y(g)},onSettled:()=>{w==null||w(),o.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}const db=()=>{const e=it(),t=$e(),[n,r]=b.useState(null);return{...En({mutationKey:["deleteInstallation"],mutationFn:async i=>(await e()).installationApi.deleteInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error deleting installation"),He(i,r)}}),errorMsg:n}};function fb(){const{projectIdOrName:e}=De(),{integrationNameOrId:t}=Tr(),{data:n}=ci(t),{installation:r}=ki(),o=$e(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=db();return{deleteInstallation:({onSuccess:l,onError:m,onSettled:y})=>{if(!r)throw Error("Installation not found. Not able to delete installation.");if(!n)throw Error("No integration found");return i({projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id},{onSuccess:()=>{l==null||l()},onError:w=>{m==null||m(w)},onSettled:()=>{y==null||y(),o.invalidateQueries({queryKey:["amp","installations"]}),o.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}function Gl(){const[e,t]=b.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var io=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xo={exports:{}};xo.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",d="[object Boolean]",l="[object Date]",m="[object Error]",y="[object Function]",w="[object GeneratorFunction]",v="[object Map]",p="[object Number]",S="[object Null]",h="[object Object]",g="[object Promise]",I="[object Proxy]",x="[object RegExp]",T="[object Set]",E="[object String]",A="[object Symbol]",R="[object Undefined]",P="[object WeakMap]",K="[object ArrayBuffer]",q="[object DataView]",j="[object Float32Array]",$="[object Float64Array]",ae="[object Int8Array]",oe="[object Int16Array]",ge="[object Int32Array]",me="[object Uint8Array]",Oe="[object Uint8ClampedArray]",F="[object Uint16Array]",U="[object Uint32Array]",J=/[\\^$.*+?()[\]{}|]/g,B=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,M={};M[j]=M[$]=M[ae]=M[oe]=M[ge]=M[me]=M[Oe]=M[F]=M[U]=!0,M[a]=M[c]=M[K]=M[d]=M[q]=M[l]=M[m]=M[y]=M[v]=M[p]=M[h]=M[x]=M[T]=M[E]=M[P]=!1;var Q=typeof io=="object"&&io&&io.Object===Object&&io,Z=typeof self=="object"&&self&&self.Object===Object&&self,Y=Q||Z||Function("return this")(),ee=t&&!t.nodeType&&t,te=ee&&!0&&e&&!e.nodeType&&e,le=te&&te.exports===ee,k=le&&Q.process,we=function(){try{return k&&k.binding&&k.binding("util")}catch{}}(),W=we&&we.isTypedArray;function ot(C,N){for(var D=-1,X=C==null?0:C.length,Ae=0,de=[];++D<X;){var je=C[D];N(je,D,C)&&(de[Ae++]=je)}return de}function _e(C,N){for(var D=-1,X=N.length,Ae=C.length;++D<X;)C[Ae+D]=N[D];return C}function mt(C,N){for(var D=-1,X=C==null?0:C.length;++D<X;)if(N(C[D],D,C))return!0;return!1}function Je(C,N){for(var D=-1,X=Array(C);++D<C;)X[D]=N(D);return X}function gt(C){return function(N){return C(N)}}function Ee(C,N){return C.has(N)}function et(C,N){return C==null?void 0:C[N]}function xt(C){var N=-1,D=Array(C.size);return C.forEach(function(X,Ae){D[++N]=[Ae,X]}),D}function qt(C,N){return function(D){return C(N(D))}}function Pt(C){var N=-1,D=Array(C.size);return C.forEach(function(X){D[++N]=X}),D}var lt=Array.prototype,st=Function.prototype,Me=Object.prototype,Ue=Y["__core-js_shared__"],Ft=st.toString,tt=Me.hasOwnProperty,Ar=function(){var C=/[^.]+$/.exec(Ue&&Ue.keys&&Ue.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),pn=Me.toString,hn=RegExp("^"+Ft.call(tt).replace(J,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),yt=le?Y.Buffer:void 0,Te=Y.Symbol,or=Y.Uint8Array,Tn=Me.propertyIsEnumerable,An=lt.splice,Ot=Te?Te.toStringTag:void 0,mn=Object.getOwnPropertySymbols,Rn=yt?yt.isBuffer:void 0,Pn=qt(Object.keys,Object),gn=Rr(Y,"DataView"),nn=Rr(Y,"Map"),ke=Rr(Y,"Promise"),at=Rr(Y,"Set"),re=Rr(Y,"WeakMap"),fe=Rr(Object,"create"),dt=ar(gn),yn=ar(nn),z=ar(ke),se=ar(at),ce=ar(re),Le=Te?Te.prototype:void 0,Ve=Le?Le.valueOf:void 0;function Ge(C){var N=-1,D=C==null?0:C.length;for(this.clear();++N<D;){var X=C[N];this.set(X[0],X[1])}}function Dt(){this.__data__=fe?fe(null):{},this.size=0}function nt(C){var N=this.has(C)&&delete this.__data__[C];return this.size-=N?1:0,N}function vt(C){var N=this.__data__;if(fe){var D=N[C];return D===r?void 0:D}return tt.call(N,C)?N[C]:void 0}function Ne(C){var N=this.__data__;return fe?N[C]!==void 0:tt.call(N,C)}function Fn(C,N){var D=this.__data__;return this.size+=this.has(C)?0:1,D[C]=fe&&N===void 0?r:N,this}Ge.prototype.clear=Dt,Ge.prototype.delete=nt,Ge.prototype.get=vt,Ge.prototype.has=Ne,Ge.prototype.set=Fn;function Vt(C){var N=-1,D=C==null?0:C.length;for(this.clear();++N<D;){var X=C[N];this.set(X[0],X[1])}}function Zo(){this.__data__=[],this.size=0}function Hi(C){var N=this.__data__,D=zi(N,C);if(D<0)return!1;var X=N.length-1;return D==X?N.pop():An.call(N,D,1),--this.size,!0}function Bi(C){var N=this.__data__,D=zi(N,C);return D<0?void 0:N[D][1]}function Ji(C){return zi(this.__data__,C)>-1}function Wi(C,N){var D=this.__data__,X=zi(D,C);return X<0?(++this.size,D.push([C,N])):D[X][1]=N,this}Vt.prototype.clear=Zo,Vt.prototype.delete=Hi,Vt.prototype.get=Bi,Vt.prototype.has=Ji,Vt.prototype.set=Wi;function rn(C){var N=-1,D=C==null?0:C.length;for(this.clear();++N<D;){var X=C[N];this.set(X[0],X[1])}}function ve(){this.size=0,this.__data__={hash:new Ge,map:new(nn||Vt),string:new Ge}}function Ht(C){var N=Gi(this,C).delete(C);return this.size-=N?1:0,N}function pi(C){return Gi(this,C).get(C)}function sr(C){return Gi(this,C).has(C)}function es(C,N){var D=Gi(this,C),X=D.size;return D.set(C,N),this.size+=D.size==X?0:1,this}rn.prototype.clear=ve,rn.prototype.delete=Ht,rn.prototype.get=pi,rn.prototype.has=sr,rn.prototype.set=es;function Dn(C){var N=-1,D=C==null?0:C.length;for(this.__data__=new rn;++N<D;)this.add(C[N])}function tp(C){return this.__data__.set(C,r),this}function np(C){return this.__data__.has(C)}Dn.prototype.add=Dn.prototype.push=tp,Dn.prototype.has=np;function Mn(C){var N=this.__data__=new Vt(C);this.size=N.size}function rp(){this.__data__=new Vt,this.size=0}function ip(C){var N=this.__data__,D=N.delete(C);return this.size=N.size,D}function op(C){return this.__data__.get(C)}function sp(C){return this.__data__.has(C)}function ap(C,N){var D=this.__data__;if(D instanceof Vt){var X=D.__data__;if(!nn||X.length<n-1)return X.push([C,N]),this.size=++D.size,this;D=this.__data__=new rn(X)}return D.set(C,N),this.size=D.size,this}Mn.prototype.clear=rp,Mn.prototype.delete=ip,Mn.prototype.get=op,Mn.prototype.has=sp,Mn.prototype.set=ap;function cp(C,N){var D=Qi(C),X=!D&&Sp(C),Ae=!D&&!X&&ts(C),de=!D&&!X&&!Ae&&pc(C),je=D||X||Ae||de,Qe=je?Je(C.length,String):[],rt=Qe.length;for(var Pe in C)tt.call(C,Pe)&&!(je&&(Pe=="length"||Ae&&(Pe=="offset"||Pe=="parent")||de&&(Pe=="buffer"||Pe=="byteLength"||Pe=="byteOffset")||vp(Pe,rt)))&&Qe.push(Pe);return Qe}function zi(C,N){for(var D=C.length;D--;)if(uc(C[D][0],N))return D;return-1}function up(C,N,D){var X=N(C);return Qi(C)?X:_e(X,D(C))}function hi(C){return C==null?C===void 0?R:S:Ot&&Ot in Object(C)?gp(C):Cp(C)}function oc(C){return mi(C)&&hi(C)==a}function sc(C,N,D,X,Ae){return C===N?!0:C==null||N==null||!mi(C)&&!mi(N)?C!==C&&N!==N:lp(C,N,D,X,sc,Ae)}function lp(C,N,D,X,Ae,de){var je=Qi(C),Qe=Qi(N),rt=je?c:kn(C),Pe=Qe?c:kn(N);rt=rt==a?h:rt,Pe=Pe==a?h:Pe;var Et=rt==h,Bt=Pe==h,ct=rt==Pe;if(ct&&ts(C)){if(!ts(N))return!1;je=!0,Et=!1}if(ct&&!Et)return de||(de=new Mn),je||pc(C)?ac(C,N,D,X,Ae,de):hp(C,N,rt,D,X,Ae,de);if(!(D&o)){var Mt=Et&&tt.call(C,"__wrapped__"),kt=Bt&&tt.call(N,"__wrapped__");if(Mt||kt){var Ln=Mt?C.value():C,vn=kt?N.value():N;return de||(de=new Mn),Ae(Ln,vn,D,X,de)}}return ct?(de||(de=new Mn),mp(C,N,D,X,Ae,de)):!1}function dp(C){if(!fc(C)||bp(C))return!1;var N=lc(C)?hn:B;return N.test(ar(C))}function fp(C){return mi(C)&&dc(C.length)&&!!M[hi(C)]}function pp(C){if(!Ip(C))return Pn(C);var N=[];for(var D in Object(C))tt.call(C,D)&&D!="constructor"&&N.push(D);return N}function ac(C,N,D,X,Ae,de){var je=D&o,Qe=C.length,rt=N.length;if(Qe!=rt&&!(je&&rt>Qe))return!1;var Pe=de.get(C);if(Pe&&de.get(N))return Pe==N;var Et=-1,Bt=!0,ct=D&i?new Dn:void 0;for(de.set(C,N),de.set(N,C);++Et<Qe;){var Mt=C[Et],kt=N[Et];if(X)var Ln=je?X(kt,Mt,Et,N,C,de):X(Mt,kt,Et,C,N,de);if(Ln!==void 0){if(Ln)continue;Bt=!1;break}if(ct){if(!mt(N,function(vn,cr){if(!Ee(ct,cr)&&(Mt===vn||Ae(Mt,vn,D,X,de)))return ct.push(cr)})){Bt=!1;break}}else if(!(Mt===kt||Ae(Mt,kt,D,X,de))){Bt=!1;break}}return de.delete(C),de.delete(N),Bt}function hp(C,N,D,X,Ae,de,je){switch(D){case q:if(C.byteLength!=N.byteLength||C.byteOffset!=N.byteOffset)return!1;C=C.buffer,N=N.buffer;case K:return!(C.byteLength!=N.byteLength||!de(new or(C),new or(N)));case d:case l:case p:return uc(+C,+N);case m:return C.name==N.name&&C.message==N.message;case x:case E:return C==N+"";case v:var Qe=xt;case T:var rt=X&o;if(Qe||(Qe=Pt),C.size!=N.size&&!rt)return!1;var Pe=je.get(C);if(Pe)return Pe==N;X|=i,je.set(C,N);var Et=ac(Qe(C),Qe(N),X,Ae,de,je);return je.delete(C),Et;case A:if(Ve)return Ve.call(C)==Ve.call(N)}return!1}function mp(C,N,D,X,Ae,de){var je=D&o,Qe=cc(C),rt=Qe.length,Pe=cc(N),Et=Pe.length;if(rt!=Et&&!je)return!1;for(var Bt=rt;Bt--;){var ct=Qe[Bt];if(!(je?ct in N:tt.call(N,ct)))return!1}var Mt=de.get(C);if(Mt&&de.get(N))return Mt==N;var kt=!0;de.set(C,N),de.set(N,C);for(var Ln=je;++Bt<rt;){ct=Qe[Bt];var vn=C[ct],cr=N[ct];if(X)var hc=je?X(cr,vn,ct,N,C,de):X(vn,cr,ct,C,N,de);if(!(hc===void 0?vn===cr||Ae(vn,cr,D,X,de):hc)){kt=!1;break}Ln||(Ln=ct=="constructor")}if(kt&&!Ln){var Xi=C.constructor,Yi=N.constructor;Xi!=Yi&&"constructor"in C&&"constructor"in N&&!(typeof Xi=="function"&&Xi instanceof Xi&&typeof Yi=="function"&&Yi instanceof Yi)&&(kt=!1)}return de.delete(C),de.delete(N),kt}function cc(C){return up(C,Ep,yp)}function Gi(C,N){var D=C.__data__;return wp(N)?D[typeof N=="string"?"string":"hash"]:D.map}function Rr(C,N){var D=et(C,N);return dp(D)?D:void 0}function gp(C){var N=tt.call(C,Ot),D=C[Ot];try{C[Ot]=void 0;var X=!0}catch{}var Ae=pn.call(C);return X&&(N?C[Ot]=D:delete C[Ot]),Ae}var yp=mn?function(C){return C==null?[]:(C=Object(C),ot(mn(C),function(N){return Tn.call(C,N)}))}:_p,kn=hi;(gn&&kn(new gn(new ArrayBuffer(1)))!=q||nn&&kn(new nn)!=v||ke&&kn(ke.resolve())!=g||at&&kn(new at)!=T||re&&kn(new re)!=P)&&(kn=function(C){var N=hi(C),D=N==h?C.constructor:void 0,X=D?ar(D):"";if(X)switch(X){case dt:return q;case yn:return v;case z:return g;case se:return T;case ce:return P}return N});function vp(C,N){return N=N??s,!!N&&(typeof C=="number"||V.test(C))&&C>-1&&C%1==0&&C<N}function wp(C){var N=typeof C;return N=="string"||N=="number"||N=="symbol"||N=="boolean"?C!=="__proto__":C===null}function bp(C){return!!Ar&&Ar in C}function Ip(C){var N=C&&C.constructor,D=typeof N=="function"&&N.prototype||Me;return C===D}function Cp(C){return pn.call(C)}function ar(C){if(C!=null){try{return Ft.call(C)}catch{}try{return C+""}catch{}}return""}function uc(C,N){return C===N||C!==C&&N!==N}var Sp=oc(function(){return arguments}())?oc:function(C){return mi(C)&&tt.call(C,"callee")&&!Tn.call(C,"callee")},Qi=Array.isArray;function xp(C){return C!=null&&dc(C.length)&&!lc(C)}var ts=Rn||Np;function Op(C,N){return sc(C,N)}function lc(C){if(!fc(C))return!1;var N=hi(C);return N==y||N==w||N==f||N==I}function dc(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=s}function fc(C){var N=typeof C;return C!=null&&(N=="object"||N=="function")}function mi(C){return C!=null&&typeof C=="object"}var pc=W?gt(W):fp;function Ep(C){return xp(C)?cp(C):pp(C)}function _p(){return[]}function Np(){return!1}e.exports=Op})(xo,xo.exports);var pb=xo.exports;const Ql=Sa(pb),Er="other",Oo="manage-tab";function nr(e){return!e.fieldName}function hb(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function mb(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!nr(n)&&!!n.fieldName))||null}function gb(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>nr(r)&&!!r.mapToName))||[]}function yb(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>nr(r)&&!!r.mapToName))||[]}function vb(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!nr(n)&&!!n.fieldName))||null}const Xl=(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 wb(e){return nr(e)?e.mapToName:e.fieldName}const Yl=(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)&&un(s==null?void 0:s.objectName),completed:e?!!Xl(e,s.objectName):!1})}),n},Zl=e=>{var n;return{name:Er,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function bb(e,t){var i;const n=Yl(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?Zl(e):void 0;return o&&n.push(o),n}function ed(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 Ib(e,t){return Ql(e,t)}function td(e,t){return Ql(e,t)}const Cb=(e,t,n)=>{var p,S,h,g,I,x,T,E,A;if(!e)return null;const r=hb(e,t),o=r&&mb(r),i=r&&vb(r),s=r&&gb(r),a=r&&yb(r),c=(r==null?void 0:r.allFields)||[],f=(r==null?void 0:r.allFieldsMetadata)||{},d=n==null?void 0:n.content,l=((h=(S=(p=d==null?void 0:d.read)==null?void 0:p.objects)==null?void 0:S[t])==null?void 0:h.selectedFields)||{},m=((x=(I=(g=d==null?void 0:d.read)==null?void 0:g.objects)==null?void 0:I[t])==null?void 0:x.selectedValueMappings)||{},y=((A=(E=(T=d==null?void 0:d.read)==null?void 0:T.objects)==null?void 0:E[t])==null?void 0:A.selectedFieldMappings)||{},w=Object.entries(l).reduce((R,[P,K])=>((i==null?void 0:i.some(j=>!nr(j)&&"fieldName"in j&&j.fieldName===P))&&(R[P]=K),R),{}),v={...y};return{allFields:c,allFieldsMetadata:f,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:w,selectedFieldMappings:y,selectedValueMappings:m,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:w,requiredMapFields:v,selectedValueMappings:m}}},Sb=(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 nd(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:Cb(r,t,n),write:Sb(o,n)}}const rd=(e,t,n,r)=>{const o=nd(e,n,t);r(n,o)},xb=(e,t,n)=>{const r=bb(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=nd(e,i,t))}),n(o)},id=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(wb(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},od=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},sd=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function ad(e,t){return t[e]||void 0}function Li(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Ob=(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)},Eb=(e,t,n,r)=>{const o=id(e),i=od(e),s=sd(e),a=Ob(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return Li(n)&&(c.content.proxy={enabled:!0}),c},cd=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},_b=e=>{const t=e.content.write;return t==null?void 0:t.objects},Nb=(e,t,n)=>{if(!_b(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=cd(e),i={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return Li(t)&&(i.content.proxy={enabled:!0}),i};var ud={exports:{}};/*!
5
+ [Remedy] ${s.remedy}`:""}`;t&&t(c)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)};function $o(){const e=it(),{projectIdOrName:t}=De(),{setError:n,removeError:r}=$t(),o=Yn({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});return b.useEffect(()=>{o.isError?(He(o.error),n(ue.INTEGRATION_LIST,t)):r(ue.INTEGRATION_LIST,t)},[o.isError,o.error,t,n,r]),o}const ba=(e,t)=>{var s;const n=it(),{projectIdOrName:r}=De(),{data:o}=$o(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return Yn({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})},er=()=>{var o,i;const{setError:e}=$t(),t=it(),{projectIdOrName:n}=De(),r=Yn({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return b.useEffect(()=>{r.isError&&e(ue.PROJECT,n)},[r.isError,n,e]),{...r,projectIdOrName:n,appName:(o=r.data)==null?void 0:o.name,projectId:(i=r.data)==null?void 0:i.id}};function ki(){const{integrationNameOrId:e,groupRef:t}=Nr(),n=ba(e,t),{isPending:r,isFetching:o,isError:i,isSuccess:s,error:a,data:c}=n;return{installation:c==null?void 0:c[0],isPending:r,isFetching:o,isError:i,isSuccess:s,error:a}}const ai=e=>{const t=$o(),n=t.data,r=n==null?void 0:n.find(o=>o.name===e||o.id===e);return{...t,data:r,provider:r==null?void 0:r.provider}},Ia=()=>{const{groupRef:e,integrationNameOrId:t}=Nr(),{provider:n}=ai(t),r=xa({groupRef:e,provider:n}),{isPending:o,isFetching:i,isError:s,isSuccess:a,error:c,data:f}=r;return{connection:f==null?void 0:f[0],error:c,isPending:o,isFetching:i,isError:s,isSuccess:a}},Lw=()=>{var h;const e=$e(),t=it(),{connection:n,isPending:r,isFetching:o}=Ia(),{projectIdOrName:i}=De(),{integrationNameOrId:s}=Nr(),{data:a}=ai(s),c=n==null?void 0:n.id,f=a==null?void 0:a.id,d=(h=a==null?void 0:a.latestRevision)==null?void 0:h.id,l=r||o;return b.useEffect(()=>{c||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[c,e]),Yn({queryKey:["amp","hydratedRevision",i,f,d,c],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!f)throw new Error("integrationId is required");if(!d)throw new Error("revisionId is required");if(!c)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:f,revisionId:d,connectionId:c})},retry:3,enabled:!!i&&!!f&&!!d&&!!c&&!l})};function Ml(){var f,d;const e=Lw(),{isPending:t,isFetching:n,isError:r,isSuccess:o,error:i,data:s}=e,a=s==null?void 0:s.content,c=b.useMemo(()=>({getReadObject:l=>{var g,w;const h=(w=(g=a==null?void 0:a.read)==null?void 0:g.objects)==null?void 0:w.find(v=>v.objectName===l);return h?{object:h,getRequiredFields:()=>h.requiredFields??[],getOptionalFields:()=>h.optionalFields??[]}:(console.error(`Object ${l} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:l=>{var g,w;const h=(w=(g=a==null?void 0:a.write)==null?void 0:g.objects)==null?void 0:w.find(v=>v.objectName===l);return h?{object:h}:(console.error(`Object ${l} not found`),{object:null})},getCustomerFieldsForObject:l=>{var g,w;const h=(w=(g=a==null?void 0:a.read)==null?void 0:g.objects)==null?void 0:w.find(v=>v.objectName===l);return h?{allFields:h.allFieldsMetadata??{},getField:v=>{var S;const m=(S=h.allFieldsMetadata)==null?void 0:S[v];return m||(console.error(`Field ${v} not found`),null)}}:(console.error(`Object ${l} not found`),{allFields:null,getField:()=>null})}}),[(f=a==null?void 0:a.read)==null?void 0:f.objects,(d=a==null?void 0:a.write)==null?void 0:d.objects]);return{data:s,...c,isPending:t,isFetching:n,isError:r,isSuccess:o,error:i}}function jw(e){var g,w,v,m;const[t,n]=b.useState(e),r=b.useRef(void 0),{getReadObject:o,data:i}=Ml(),{installation:s}=ki(),a=b.useCallback(()=>t,[t]),c=b.useCallback((S,p)=>{var E,R;p.provider=p.provider||((E=i==null?void 0:i.content)==null?void 0:E.provider)||"";const y=p.read||{objects:{}},I=y.objects||{},x=I[S]||{},T=o(S),A={};return(R=T==null?void 0:T.getRequiredFields())==null||R.forEach(P=>{"fieldName"in P&&(A[P.fieldName]=!0)}),x.objectName=x.objectName||S,x.selectedFields=x.selectedFields||A,I[S]=x,y.objects=I,p.read=y,{read:y,objects:I,obj:x}},[o,(g=i==null?void 0:i.content)==null?void 0:g.provider]),f=b.useCallback(S=>{var p,y;return{object:(y=(p=t.read)==null?void 0:p.objects)==null?void 0:y[S],getSelectedField:I=>{var x,T,A,E;return!!((E=(A=(T=(x=t.read)==null?void 0:x.objects)==null?void 0:T[S])==null?void 0:A.selectedFields)!=null&&E[I])},setSelectedField:({fieldName:I,selected:x})=>{n(T=>It(T,A=>{const{obj:E}=c(S,A);E.selectedFields=E.selectedFields||{},E.selectedFields[I]=x,E.selectedFields[I]===!1&&delete E.selectedFields[I]}))},getFieldMapping:I=>{var x,T,A,E;return(E=(A=(T=(x=t.read)==null?void 0:x.objects)==null?void 0:T[S])==null?void 0:A.selectedFieldMappings)==null?void 0:E[I]},setFieldMapping:({fieldName:I,mapToName:x})=>{n(T=>It(T,A=>{const{obj:E}=c(S,A);E.selectedFieldMappings=E.selectedFieldMappings||{},E.selectedFieldMappings[x]=I}))}}},[(w=t.read)==null?void 0:w.objects,c]),d=b.useCallback(S=>{var T,A;const p=(A=(T=t.write)==null?void 0:T.objects)==null?void 0:A[S],y=E=>{const R=E.write||{},P=R.objects||{},M=P[S]||{objectName:S};return P[S]=M,R.objects=P,E.write=R,{write:R,objects:P,obj:M}},I=(E,R)=>{var P,M;return(M=(P=p==null?void 0:p.selectedFieldSettings)==null?void 0:P[E])==null?void 0:M[R]},x=(E,R,P)=>{n(M=>It(M,q=>{var L;const{obj:k}=y(q);k.selectedFieldSettings={...k.selectedFieldSettings,[E]:{...(L=k.selectedFieldSettings)==null?void 0:L[E],[R]:P}}}))};return{object:p,setEnableWrite:()=>{n(E=>It(E,R=>{const{obj:P}=y(R);P.objectName=S}))},setDisableWrite:()=>{n(E=>It(E,R=>{const{objects:P}=y(R);delete P[S]}))},getWriteObject:()=>{var E,R;return(R=(E=t.write)==null?void 0:E.objects)==null?void 0:R[S]},getSelectedFieldSettings:E=>{var R;return(R=p==null?void 0:p.selectedFieldSettings)==null?void 0:R[E]},setSelectedFieldSettings:({fieldName:E,settings:R})=>{n(P=>It(P,M=>{const{obj:q}=y(M),k=q.selectedFieldSettings||{};q.selectedFieldSettings={...k,[E]:R},R===void 0&&delete q.selectedFieldSettings[E]}))},getDefaultValues:E=>I(E,"default"),setDefaultValues:({fieldName:E,value:R})=>x(E,"default",R),getWriteOnCreateSetting:E=>I(E,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:E,value:R})=>x(E,"writeOnCreate",R),getWriteOnUpdateSetting:E=>I(E,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:E,value:R})=>x(E,"writeOnUpdate",R)}},[(v=t.write)==null?void 0:v.objects]),l=b.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(S=>It(S,p=>{p.proxy={enabled:!0}}))},setDisableProxy:()=>{n(S=>It(S,p=>{p.proxy={enabled:!1}}))},getProxyEnabled:()=>{var S;return((S=t.proxy)==null?void 0:S.enabled)||!1}}),[t.proxy]),h=b.useCallback(()=>{n(S=>It(S,p=>{var y;Object.assign(p,(y=s==null?void 0:s.config)==null?void 0:y.content)}))},[(m=s==null?void 0:s.config)==null?void 0:m.content]);return b.useEffect(()=>{s&&(console.debug("Installation found",{installation:s}),r.current?wa(r.current,s)||(console.debug("Installation changed, resetting config",{previous:r.current,current:s}),h(),r.current=s):(r.current=s,h()))},[s,h]),{draft:t,get:a,reset:h,setDraft:n,readObject:f,writeObject:d,proxy:l}}const Ca=b.createContext(null);function Kw({children:e,initialConfig:t}){const n=jw(t);return u.jsx(Ca.Provider,{value:n,children:e})}function $w(){const e=b.useContext(Ca);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function Uw(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=b.useContext(Ca);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const kl=b.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Nr(){const e=b.useContext(kl);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function Sa({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}){const s=b.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}),[t,n,r,o,i]);return u.jsx(kl.Provider,{value:s,children:u.jsx(Kw,{initialConfig:{},children:e})})}class Js{constructor(t){this.connectionApi=new yw(t),this.installationApi=new vw(t),this.integrationApi=new ww(t),this.oAuthApi=new bw(t),this.projectApi=new Iw(t),this.providerApi=new Cw(t),this.providerAppApi=new Sw(t),this.revisionApi=new xw(t)}}const Ll="2.9.1",qw="v1",oo="https://api.withampersand.com";function jl(){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 oo;case"mock":return"http://127.0.0.1:4010";case"":return oo;default:return e??oo}}catch{return oo}}const Vw=(e,t)=>`${e}/${t}`;function Hw(){return Vw(jl(),qw)}const Kl=jl(),$l=Hw(),Bw=new ha({basePath:$l,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Ll}});new Js(Bw);const Jw=e=>({header:"X-Api-Key",value:e}),Ww=e=>{try{return{header:"Authorization",value:`Bearer ${e}`}}catch(t){throw console.error("Failed to get JWT token for API authentication:",t),new Error("Failed to authenticate with JWT token")}},Uc=(e,t)=>new ha({basePath:$l,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Ll,[e]:t}});function it(){const e=el(),{getToken:t}=Gh(),{consumerRef:n,groupRef:r}=Nr();return b.useCallback(async()=>{if(e){const i=Jw(e),s=Uc(i.header,i.value);return new Js(s)}if(t){if(!n||!r)throw console.error("Unable to create JWT API service without consumerRef or groupRef.",{consumerRef:n,groupRef:r}),new Error("Unable to create JWT API service without consumerRef or groupRef.");const i=await t({consumerRef:n,groupRef:r}),s=Ww(i),a=Uc(s.header,s.value);return new Js(a)}throw console.error("Unable to create API service without API key or JWT token."),new Error("Unable to create API service without API key or JWT token.")},[e,t,n,r])}const xa=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=De(),r=it();return Yn({queryKey:["amp","connections",n,e,t],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!e)throw new Error("Group reference not found.");if(!t)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:n,groupRef:e,provider:t})},retry:3,enabled:!!n&&!!e&&!!t})};function zw(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Gw="_box_1p7c5_1",qc={box:Gw};function En({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${qc.box} ${t}`:qc.box,style:n,children:e})}const Qw="_container_1wvzr_1",Vc={container:Qw};function ci({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Vc.container} ${t}`:Vc.container,style:n,children:e})}const Xw="_errorBoxContainer_4sdb2_1",Yw="_errorBox_4sdb2_1",Zw="_errorText_4sdb2_20",Ws={errorBoxContainer:Xw,errorBox:Yw,errorText:Zw};function Ul({message:e}){return u.jsx(En,{className:Ws.errorBox,children:u.jsx("p",{className:Ws.errorText,children:e})})}function ql({message:e,children:t}){return u.jsxs(ci,{className:Ws.errorBoxContainer,children:[u.jsx(zw,{}),u.jsx(Ul,{message:e}),t]})}const eb="_loader_6ubm6_1",tb={loader:eb};function nb(){return u.jsx("span",{className:tb.loader})}function _i(){return u.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:u.jsx(nb,{})})}function Vl({children:e}){return u.jsx(ci,{style:{maxWidth:"55rem"},children:u.jsx(En,{children:e})})}function ui(){return u.jsx(Vl,{children:u.jsx(_i,{})})}function Gt({message:e,children:t}){return u.jsx(Vl,{children:u.jsx(ql,{message:e,children:t})})}function cn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function rb(e,t){return(t==null?void 0:t.displayName)??cn(e)}const ib=e=>e.split(`
6
+ `).filter(n=>n.trim()!==""),ob=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null;function sb(e){return!e||typeof e!="string"?"id_"+Math.random().toString(36).substr(2,9):e.toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").replace(/^[^a-z]/,"id-").substring(0,50)}const ab=()=>{const[e,t]=b.useState(!1),n=b.useCallback(()=>{t(!0)},[t]),r=b.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},Hl=b.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{},resetComponent:()=>{}});function Ze(){const e=b.useContext(Hl);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function cb({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:f,resetComponent:d}){const{data:l}=$o(),{setError:h,isError:g,removeError:w}=$t(),{isIntegrationDeleted:v,setIntegrationDeleted:m,resetIntegrationDeleted:S}=ab(),p=b.useMemo(()=>ob(t,l||[]),[t,l]),{data:y,isLoading:I,isError:x,error:T}=ba(t,o),A=(y==null?void 0:y[0])||null;b.useEffect(()=>{S()},[t,n,r,o,i,f]),b.useEffect(()=>{p===null&&(l!=null&&l.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,p,l]),b.useEffect(()=>{x?(h(ue.INSTALLATION_LIST,(p==null?void 0:p.id)||""),He(T)):w(ue.INSTALLATION_LIST,(p==null?void 0:p.id)||"")},[x,p,h,w,T]);const E=$e(),R=b.useCallback(()=>{E.invalidateQueries({queryKey:["amp","installations"]})},[E]),P=b.useCallback(k=>{E.setQueryData(["amp","installations"],[k]),E.invalidateQueries({queryKey:["amp","installations"]})},[E]),M=(p==null?void 0:p.id)||"",q=b.useMemo(()=>({integrationId:(p==null?void 0:p.id)||"",provider:(p==null?void 0:p.provider)||"",integrationObj:p,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:A||void 0,setInstallation:P,resetInstallations:R,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:v,setIntegrationDeleted:m,fieldMapping:f,resetComponent:d}),[p,n,r,o,i,A,P,R,s,a,c,v,m,f,d]);if(I)return u.jsx(ui,{});if(p===null)return u.jsx(Gt,{message:`Integration "${t}" not found`});if(g(ue.INSTALLATION_LIST,M)){const k=`Error retrieving installation information for integration "${(p==null?void 0:p.name)||"unknown"}"`;return u.jsx(Gt,{message:k})}return u.jsx(Hl.Provider,{value:q,children:e})}const Bl=b.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Zt=()=>{const e=b.useContext(Bl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Jl({groupRef:e,provider:t,children:n}){const r=$e(),{setError:o,isError:i}=$t(),{projectIdOrName:s,isLoading:a}=er(),{integrationId:c,groupRef:f}=Ze(),{provider:d}=ai(c),{data:l,isLoading:h,isError:g,error:w}=xa({groupRef:e||f,provider:d||t}),v=l==null?void 0:l[0],m=b.useCallback(y=>{r.setQueryData(["amp","connections"],()=>y),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),S=b.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);b.useEffect(()=>{g?(o(ue.CONNECTION_LIST,s,!0),He(w)):o(ue.CONNECTION_LIST,s,!1)},[g,o,s,w]);const p=b.useMemo(()=>({connections:l||null,isConnectionsLoading:h,selectedConnection:v||null,setConnections:m,setSelectedConnection:S}),[l,h,v,m,S]);if(h||a)return u.jsx(ui,{});if(s&&i(ue.PROJECT,s))return u.jsx(Gt,{message:`Error loading project ${s}`});if(s&&i(ue.CONNECTION_LIST,s))return u.jsx(Gt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID or Project Name not found. ConnectionsProvider must be used within AmpersandProvider");return u.jsx(Bl.Provider,{value:p,children:n})}const Wl=()=>{const e=it(),t=$e(),[n,r]=b.useState(null);return{...On({mutationKey:["createInstallation"],mutationFn:async i=>(await e()).installationApi.createInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error creating installation"),He(i,r)}}),errorMsg:n}};function ub(e){return typeof e.provider=="string"}function lb(e){if(!ub(e))throw new Error("Config must have a provider field for creation");return e}function zl(){const{projectIdOrName:e}=De(),{groupRef:t,integrationNameOrId:n}=Nr(),{data:r}=ai(n),{connection:o}=Ia(),{installation:i}=ki(),s=$e(),{mutate:a,isIdle:c,isPending:f,error:d,errorMsg:l}=Wl();return{createInstallation:({config:g,onSuccess:w,onError:v,onSettled:m})=>{if(i)throw Error("Installation already created. Try updating instead.");if(!r)throw Error("No integration found");const S={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:o==null?void 0:o.id,config:{content:lb(g)}}};return a(S,{onSuccess:p=>{w==null||w(p)},onError:p=>{v==null||v(p)},onSettled:()=>{m==null||m(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:c,isPending:f,error:d,errorMsg:l}}const db=()=>{const e=it(),t=$e(),[n,r]=b.useState(null);return{...On({mutationKey:["updateInstallation"],mutationFn:async i=>(await e()).installationApi.updateInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error updating installation"),He(i,r)}}),errorMsg:n}};function Gl(){const{projectIdOrName:e}=De(),{integrationNameOrId:t}=Nr(),{data:n}=ai(t),{installation:r}=ki(),o=$e(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=db();return{updateInstallation:({config:l,onSuccess:h,onError:g,onSettled:w})=>{var S,p;if(!r)throw Error("Installation not created yet. Try creating the installation first.");if(!n)throw Error("No integration found");const v=[];if((S=l==null?void 0:l.write)!=null&&S.objects&&Object.keys(l.write.objects).length>0&&v.push("config.content.write.objects"),(p=l==null?void 0:l.read)!=null&&p.objects){const y=Object.keys(l.read.objects);v.push(...y.map(I=>`config.content.read.objects.${I}`))}const m={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:v,installation:{config:{content:l}}}};return i(m,{onSuccess:y=>{h==null||h(y)},onError:y=>{g==null||g(y)},onSettled:()=>{w==null||w(),o.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}const fb=()=>{const e=it(),t=$e(),[n,r]=b.useState(null);return{...On({mutationKey:["deleteInstallation"],mutationFn:async i=>(await e()).installationApi.deleteInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error deleting installation"),He(i,r)}}),errorMsg:n}};function pb(){const{projectIdOrName:e}=De(),{integrationNameOrId:t}=Nr(),{data:n}=ai(t),{installation:r}=ki(),o=$e(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=fb();return{deleteInstallation:({onSuccess:l,onError:h,onSettled:g})=>{if(!r)throw Error("Installation not found. Not able to delete installation.");if(!n)throw Error("No integration found");return i({projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id},{onSuccess:()=>{l==null||l()},onError:w=>{h==null||h(w)},onSettled:()=>{g==null||g(),o.invalidateQueries({queryKey:["amp","installations"]}),o.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}function Ql(){const[e,t]=b.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const Or="other",Eo="manage-tab";function tr(e){return!e.fieldName}function hb(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function mb(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!tr(n)&&!!n.fieldName))||null}function gb(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>tr(r)&&!!r.mapToName))||[]}function yb(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>tr(r)&&!!r.mapToName))||[]}function vb(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!tr(n)&&!!n.fieldName))||null}const Xl=(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 wb(e){return tr(e)?e.mapToName:e.fieldName}const Yl=(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)&&cn(s==null?void 0:s.objectName),completed:e?!!Xl(e,s.objectName):!1})}),n},Zl=e=>{var n;return{name:Or,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function bb(e,t){var i;const n=Yl(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?Zl(e):void 0;return o&&n.push(o),n}function ed(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 Ib(e,t){return wa(e,t)}function td(e,t){return wa(e,t)}const Cb=(e,t,n)=>{var m,S,p,y,I,x,T,A,E;if(!e)return null;const r=hb(e,t),o=r&&mb(r),i=r&&vb(r),s=r&&gb(r),a=r&&yb(r),c=(r==null?void 0:r.allFields)||[],f=(r==null?void 0:r.allFieldsMetadata)||{},d=n==null?void 0:n.content,l=((p=(S=(m=d==null?void 0:d.read)==null?void 0:m.objects)==null?void 0:S[t])==null?void 0:p.selectedFields)||{},h=((x=(I=(y=d==null?void 0:d.read)==null?void 0:y.objects)==null?void 0:I[t])==null?void 0:x.selectedValueMappings)||{},g=((E=(A=(T=d==null?void 0:d.read)==null?void 0:T.objects)==null?void 0:A[t])==null?void 0:E.selectedFieldMappings)||{},w=Object.entries(l).reduce((R,[P,M])=>((i==null?void 0:i.some(k=>!tr(k)&&"fieldName"in k&&k.fieldName===P))&&(R[P]=M),R),{}),v={...g};return{allFields:c,allFieldsMetadata:f,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:w,selectedFieldMappings:g,selectedValueMappings:h,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:w,requiredMapFields:v,selectedValueMappings:h}}},Sb=(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 nd(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:Cb(r,t,n),write:Sb(o,n)}}const rd=(e,t,n,r)=>{const o=nd(e,n,t);r(n,o)},xb=(e,t,n)=>{const r=bb(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=nd(e,i,t))}),n(o)},id=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(wb(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},od=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},sd=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function ad(e,t){return t[e]||void 0}function Li(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Ob=(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)},Eb=(e,t,n,r)=>{const o=id(e),i=od(e),s=sd(e),a=Ob(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return Li(n)&&(c.content.proxy={enabled:!0}),c},cd=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},_b=e=>{const t=e.content.write;return t==null?void 0:t.objects},Nb=(e,t,n)=>{if(!_b(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=cd(e),i={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return Li(t)&&(i.content.proxy={enabled:!0}),i};var ud={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})()})(ud);var Tb=ud.exports;const $t=Sa(Tb),Ab="_button_kwfiu_1",Rb="_danger_kwfiu_42",Pb="_ghost_kwfiu_47",us={button:Ab,danger:Rb,ghost:Pb};function Be({className:e,style:t,type:n,children:r,variant:o,...i}){const s=$t(us.button,{[us.danger]:o==="danger",[us.ghost]:o==="ghost",[e||""]:!!e});return u.jsx("button",{type:n,className:s,style:t,...i,children:r})}const Fb={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 ji({children:e,style:t}){return u.jsx(_n,{style:{...Fb,...t},children:e})}const Uo=e=>{const t=it(),{provider:n}=Ze(),r=e||n;return Zn({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},ut=e=>{const t=Uo(e),{data:n}=t,{provider:r}=Ze(),o=n&&nb(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function dn({error:e}){return e?u.jsx(ji,{style:{marginTop:"2em"},children:e}):null}const Db="_input_1ymb7_1",Mb="_inputError_1ymb7_27",ls={input:Db,inputError:Mb};function ld({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?$t(ls.inputError,ls.input):ls.input;return u.jsx("input",{id:e,type:t,className:$t(i,n),...o})}function kb(){return u.jsx("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:u.jsxs("g",{opacity:"0.5",children:[u.jsx("path",{d:"M14.2821 11.0004C14.2821 12.8154 12.8154 14.2821 11.0004 14.2821C9.18542 14.2821 7.71875 12.8154 7.71875 11.0004C7.71875 9.18542 9.18542 7.71875 11.0004 7.71875C12.8154 7.71875 14.2821 9.18542 14.2821 11.0004Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.9999 18.581C14.2357 18.581 17.2515 16.6743 19.3507 13.3743C20.1757 12.0818 20.1757 9.90932 19.3507 8.61682C17.2515 5.31682 14.2357 3.41016 10.9999 3.41016C7.76402 3.41016 4.74819 5.31682 2.64902 8.61682C1.82402 9.90932 1.82402 12.0818 2.64902 13.3743C4.74819 16.6743 7.76402 18.581 10.9999 18.581Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function Lb(){return u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[u.jsx("path",{d:"M13.3187 8.68036L8.68036 13.3187C8.06528 12.7036 7.71973 11.8694 7.71973 10.9995C7.71973 10.5688 7.80456 10.1423 7.96939 9.7444C8.13421 9.34648 8.3758 8.98491 8.68036 8.68036C8.98491 8.3758 9.34648 8.13421 9.7444 7.96939C10.1423 7.80456 10.5688 7.71973 10.9995 7.71973C11.8694 7.71973 12.7036 8.06528 13.3187 8.68036Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M16.3349 5.28895C14.7307 4.07895 12.8974 3.41895 10.9999 3.41895C7.76402 3.41895 4.74819 5.32561 2.64902 8.62561C1.82402 9.91811 1.82402 12.0906 2.64902 13.3831C3.37319 14.5198 4.21652 15.5006 5.13319 16.2889M7.71819 17.9023C8.76319 18.3423 9.87236 18.5806 10.9999 18.5806C14.2357 18.5806 17.2515 16.6739 19.3507 13.3739C20.1757 12.0814 20.1757 9.90895 19.3507 8.61645C19.0482 8.13978 18.7182 7.69061 18.379 7.26895",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M14.2172 11.6413C14.093 12.2808 13.7806 12.8685 13.32 13.3291C12.8594 13.7897 12.2716 14.1022 11.6322 14.2263M8.68051 13.3188L1.83301 20.1663M20.1663 1.83301L13.3188 8.68051",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function jb({id:e,name:t,placeholder:n="Password",onChange:r,value:o,className:i,isError:s}){const[a,c]=b.useState(!1),f=()=>c(d=>!d);return u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(St.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:o,className:i,isError:s}),u.jsx(Be,{type:"button","aria-label":a?"Hide password":"Show password",style:{height:"2.5rem",width:"2.5rem",display:"flex",alignItems:"center",justifyContent:"center"},onClick:f,variant:"ghost",children:u.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?u.jsx(Lb,{}):u.jsx(kb,{})})})]})}const Kb="_textarea_18zl4_1",$b="_textareaError_18zl4_14",ds={textarea:Kb,textareaError:$b};function Ub({className:e,isError:t=!1,...n}){const r=t?$t(ds.textareaError,ds.textarea):ds.textarea;return u.jsx("textarea",{className:$t(e,r),...n})}const St={Input:ld,Textarea:Ub,PasswordInput:jb},qb=()=>{const{projectIdOrName:e}=De(),t=it();return Zn({queryKey:["project",e,"entitlements"],queryFn:async()=>{if(!e)throw new Error("Project ID is required");return(await t()).projectApi.getProject({projectIdOrName:e,includeEntitlements:!0})},enabled:!!e})};function dd(){var n,r;const{data:e}=qb();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:u.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[u.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),u.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:u.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})})]})}function rr({children:e}){return u.jsx(ui,{children:u.jsxs(_n,{children:[u.jsx("div",{style:{padding:"3rem 2rem"},children:e}),u.jsx(dd,{})]})})}function ir({children:e}){return u.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function Vb({children:e}){return u.jsx("p",{style:{padding:".5em 0"},children:e})}const Hb="_link_oo2kv_1",Bb={link:Hb};function xa({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return u.jsx("a",{className:$t(Bb.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function Eo({url:e,providerDisplayName:t,credentialName:n}){return u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[u.jsx(xa,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function qo(e,t){const n={},r=[];if(e.forEach(o=>{const i=t[o.name];!i||i.trim()===""?r.push(o.displayName||o.name):n[o.name]={value:i,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function Zr(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function fd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var S,h;const[s,a]=b.useState({apiKey:""}),c=((S=t.metadata)==null?void 0:S.input)||[],f=g=>{const{name:I,value:x}=g.currentTarget;a(T=>({...T,[I]:x.trim()}))},{apiKey:d}=s,{providerName:l}=ut(e),m=d.length>0,y=Zr(c,s),w=r||!m||!y,v=(h=t.apiKeyOpts)==null?void 0:h.docsURL,p=()=>{const g=qo(c,s);n({apiKey:d,providerMetadata:g})};return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&u.jsx(Eo,{url:v,providerDisplayName:l||un(e),credentialName:"API key"}),u.jsx(St.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:f}),c.map(g=>u.jsxs("div",{children:[g.docsURL&&u.jsx(Eo,{url:g.docsURL,providerDisplayName:l||un(e),credentialName:g.displayName||g.name}),u.jsx(St.Input,{id:g.name,name:g.name,type:"text",placeholder:g.displayName||g.name,onChange:f})]},g.name)),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:w,type:i||"submit",onClick:p,variant:o,children:"Next"})]})}function Jb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=ut(e);return u.jsxs(rr,{children:[u.jsx(ir,{children:`Set up ${i} integration`}),u.jsx(dn,{error:r}),u.jsx(fd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function Wb({...e}){return u.jsx(Jb,{...e})}const zb={backgroundColor:"var(--amp-colors-status-success-muted)",borderColor:"var(--amp-colors-status-success-muted)",color:"var(--amp-colors-status-success-dark)",padding:".5rem 1rem"};function Vo({children:e,style:t}){return u.jsx(_n,{style:{...zb,...t},children:e})}const Oa=()=>{const e=it(),t=$e(),[n,r]=b.useState(null);return{...En({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},Gb="_divider_1kmoj_1",Vc={divider:Gb};function Ho({className:e,style:t}){return u.jsx("hr",{className:e?`${Vc.divider} ${e}`:Vc.divider,style:t})}function Rt({string:e}){return u.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[u.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),u.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:u.jsx(Ho,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Qb({provider:e}){const{projectIdOrName:t}=De(),{providerName:n,data:r}=ut(e),{selectedConnection:o,isConnectionsLoading:i}=en(),{mutateAsync:s,isPending:a,error:c}=Oa(),[f,d]=b.useState(null),[l,m]=b.useState(!1),y=()=>m(!1),w=()=>{m(!0),d(null)},v=(c==null?void 0:c.message)||f||null,p=async S=>{y(),d(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:S.apiKey}}},{onError:h=>{console.error("Update connection error:",h),He(h,d)},onSuccess:()=>{w()}})}catch(h){console.error("Update connection caught error:",h),He(h,d)}};return r?u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Update ${n} API Key`}),l&&u.jsx(Vo,{children:"Connection updated successfully"}),v&&u.jsx(ji,{children:`Error updating connection ${v}`}),u.jsx(fd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function pd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var p,S;const[i,s]=b.useState({username:"",password:""}),a=((p=t.metadata)==null?void 0:p.input)||[],{username:c,password:f}=i,{providerName:d}=ut(e),l=h=>{const{name:g,value:I}=h.currentTarget;s(x=>({...x,[g]:I.trim()}))},m=Zr(a,i),y=r||!m,w=()=>{const h=qo(a,i);n({user:c,pass:f,providerMetadata:h})},v=(S=t.basicOpts)==null?void 0:S.docsURL;return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&u.jsx(Eo,{url:v,providerDisplayName:d||un(e),credentialName:"credentials"}),u.jsx(St.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:l}),u.jsx(St.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:l}),a.map(h=>u.jsxs("div",{children:[h.docsURL&&u.jsx(Eo,{url:h.docsURL,providerDisplayName:d||un(e),credentialName:h.displayName||h.name}),u.jsx(St.Input,{id:h.name,name:h.name,type:"text",placeholder:h.displayName||h.name,onChange:l})]},h.name)),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:y,type:"button",onClick:w,variant:o,children:"Next"})]})}function Xb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=ut(e);return u.jsxs(rr,{children:[u.jsx(ir,{children:`Set up ${i} integration`}),u.jsx(dn,{error:r}),u.jsx(pd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function Yb({...e}){return u.jsx(Xb,{...e})}function Zb({provider:e}){const{projectIdOrName:t}=De(),{providerName:n,data:r}=ut(e),{selectedConnection:o,isConnectionsLoading:i}=en(),{mutateAsync:s,isPending:a,error:c}=Oa(),[f,d]=b.useState(null),[l,m]=b.useState(!1),y=()=>m(!1),w=()=>{m(!0),d(null)},v=(c==null?void 0:c.message)||f||null,p=async S=>{y(),d(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:S.user,password:S.pass}}}},{onError:h=>{console.error(h),He(h,d)},onSuccess:()=>{w()}})}catch(h){console.error(h),He(h,d)}};return r?u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Update ${n} credentials`}),l&&u.jsx(Vo,{children:"Connection updated successfully"}),v&&u.jsx(ji,{children:`Error updating connection: ${v}`}),u.jsx(pd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function hd({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:o}){var I;const[i,s]=b.useState({clientSecret:"",clientId:"",scopes:""}),[a,c]=b.useState(null),{data:f}=Uo(e),d=((I=f==null?void 0:f.metadata)==null?void 0:I.input)||[],l=x=>{const{name:T,value:E}=x.currentTarget;s(A=>({...A,[T]:E.trim()})),c(null)},{clientSecret:m,clientId:y,scopes:w}=i,v=m.length>0,p=y.length>0,S=Zr(d,i),h=n||!v||!p||!S,g=()=>{const x=qo(d,i),T={clientId:y,clientSecret:m,providerMetadata:x};r&&w.length>0&&(T.scopes=rb(w)),t(T)};return u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[u.jsx(St.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:l}),u.jsx(St.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:l}),r&&u.jsx(St.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:l}),d.map(x=>u.jsx(St.Input,{id:x.name,name:x.name,type:"text",placeholder:x.displayName||x.name,onChange:l},x.name))]}),u.jsx(dn,{error:a}),u.jsx("br",{}),u.jsx(Be,{style:{width:"100%"},disabled:h,type:"button",onClick:g,variant:o,children:"Next"})]})}function eI({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return u.jsxs(rr,{children:[u.jsx(ir,{children:`Set up ${o} integration`}),u.jsx(dn,{error:n}),u.jsx("br",{}),u.jsx(hd,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function tI({provider:e}){var h;const{projectIdOrName:t}=De(),{selectedConnection:n,isConnectionsLoading:r}=en(),{providerName:o,data:i}=ut(e),{mutateAsync:s,isPending:a,error:c}=Oa(),[f,d]=b.useState(null),[l,m]=b.useState(!1),y=()=>{m(!1)},w=()=>{m(!0),d(null)},v=(h=i==null?void 0:i.oauth2Opts)==null?void 0:h.explicitScopesRequired,p=(c==null?void 0:c.message)||f||null,S=async g=>{y(),d(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:g.clientId,clientSecret:g.clientSecret,scopes:g.scopes}}}}),w()}catch(I){He(I,d)}};return u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Re-authenticate to ${o}`}),l&&u.jsx(Vo,{children:"Connection updated successfully"}),p&&u.jsx(ji,{children:`Error updating connection ${p}`}),u.jsx(hd,{provider:o||"",handleSubmit:S,isButtonDisabled:a||r,explicitScopesRequired:v,buttonVariant:"ghost"})]})]})}const Hc=600,Bc=600,nI="AUTHORIZATION_SUCCEEDED",rI="AUTHORIZATION_FAILED";function iI(e,t,n,r){return b.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Hc)/2,i=window.screenY+(window.outerHeight-Bc)/2.5,s=`width=${Hc},height=${Bc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function oI(e,t,n,r){const o=$e();return b.useCallback(i=>{var s,a;if(i.origin===jl){if(i.data.eventType===nI){const c=(s=i.data.data)==null?void 0:s.connection;c?(e(c),o.setQueriesData({queryKey:["amp","connections"]},()=>[c]),t==null||t.close(),r==null||r(),o.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:i})}i.data.eventType===rI&&(console.error("OAuth failed: ",{event:i}),n==null||n(((a=i==null?void 0:i.data)==null?void 0:a.message)??"Something went wrong. Please try again."))}},[t,n,o,e,r])}function sI({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s,onWindowClose:a}){const[c,f]=b.useState(null),[d,l]=b.useState(null),m=$e(),y=b.useRef(null),w=oI(f,d,r,i),v=iI(n,l,w,t);b.useEffect(()=>{t&&!d&&!c&&!o&&!s&&(r==null||r(null),v())},[t,d,v,c,o,s,r]);const p=b.useCallback(()=>{m.invalidateQueries({queryKey:["amp","connections"]}),l(null),!c&&!o?console.error("Window closed and no connection was found. Please try again."):c&&(r==null||r(null)),a==null||a()},[c,o,r,a,m]);return b.useEffect(()=>{if(d)return y.current=setInterval(()=>{d!=null&&d.closed&&(y.current&&clearInterval(y.current),y.current=null,p())},500),()=>{y.current&&(clearInterval(y.current),y.current=null),window.removeEventListener("message",w)}},[p,d,w]),u.jsx("div",{children:e})}const aI=()=>{const e=it(),t=$e();return En({mutationKey:["updateOauthConnection"],mutationFn:async n=>{const r=await e();if(!n.projectIdOrName||!n.connectionId)throw new Error("Project ID and connection ID are required");return r.oAuthApi.oauthUpdate(n)},onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function cI({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs("div",{style:{padding:"1rem 0"},children:[u.jsx("p",{children:`Re-authenticate to ${r}`}),u.jsx(dn,{error:t}),u.jsx(Be,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function uI({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=en(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=ut(e),{mutateAsync:s,isPending:a,error:c}=aI(),[f,d]=b.useState(null),[l,m]=b.useState(!1),[y,w]=b.useState(null),v=()=>{m(!1)},p=()=>{m(!0),d(null),w(null)},S=(c==null?void 0:c.message)||f||null,h=async()=>{v(),d(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});w(I)}catch(I){He(I,d)}},g=b.useCallback(I=>{d(I)},[]);return u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Update connection"}),l&&u.jsx(Vo,{children:"Connection updated successfully"}),u.jsx(sI,{windowTitle:`Connect to ${i}`,oauthUrl:y||null,onError:g,error:S,isSuccessConnect:l,onSuccessConnect:p,children:u.jsx(cI,{handleSubmit:h,error:S,providerName:i,isButtonDisabled:a||n||l})})]})}function Ea({provider:e}){var r;const{data:t}=Uo(e);if((t==null?void 0:t.authType)===Rc.Basic)return u.jsx(Zb,{provider:e});if((t==null?void 0:t.authType)===Rc.ApiKey)return u.jsx(Qb,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===ss.AuthorizationCode||n===ss.AuthorizationCodePkce)return u.jsx(uI,{provider:e});if(n===ss.ClientCredentials)return u.jsx(tI,{provider:e})}return null}const lI=()=>{const e=it(),t=$e(),[n,r]=b.useState(null);return{...En({mutationKey:["deleteConnection"],mutationFn:async i=>(await e()).connectionApi.deleteConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)},onError:i=>{console.error("Error deleting connection"),He(i,r)}}),errorMsg:n}};function md({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectIdOrName:s}=De(),{selectedConnection:a}=en(),{mutate:c,isPending:f}=lI(),d=!s||!a||!a.id||f,l=async()=>{d||(console.warn("deleting connection",{projectIdOrName:s,connectionId:a==null?void 0:a.id}),c({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:w=>{He(w,i)}}))},m=f?"Pending...":e;return u.jsx(Be,{type:"button",onClick:l,disabled:d,variant:t,style:n,children:m})}const gd=b.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),di=()=>{const e=b.useContext(gd);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},dI=()=>{var f;const e=$e(),t=it(),{selectedConnection:n,isConnectionsLoading:r}=en(),{projectIdOrName:o}=De(),{integrationId:i,integrationObj:s}=Ze(),a=n==null?void 0:n.id,c=(f=s==null?void 0:s.latestRevision)==null?void 0:f.id;return b.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),Zn({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 fI({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=Ze(),{isError:o,removeError:i,setError:s}=Ut(),a=(r==null?void 0:r.name)||n,[c,f]=b.useState(null),[d,l]=b.useState(null),{data:m,isLoading:y,isError:w,error:v}=dI();b.useEffect(()=>{w?(s(ue.HYDRATED_REVISION,a),He(v,f)):(i(ue.HYDRATED_REVISION,a),f(null),l(null))},[w,a,s,i,v,f]);const p=b.useMemo(()=>{var h,g,I;return{hydratedRevision:m||null,loading:y,readAction:(h=m==null?void 0:m.content)==null?void 0:h.read,writeObjects:((I=(g=m==null?void 0:m.content)==null?void 0:g.write)==null?void 0:I.objects)||[]}},[m,y]);if(y)return u.jsx(li,{});const S=(r==null?void 0:r.provider)||"provider";if(o(ue.HYDRATED_REVISION,a)){const h=(r==null?void 0:r.name)||n||"unknown integration",g=`${c?`: ${c}`:`Error retrieving objects from ${S} or integration details for ${h}`}`;return u.jsx(Qt,{message:g,children:u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[u.jsx(Ea,{provider:S}),u.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),d&&u.jsx($l,{message:d}),u.jsx(md,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:I=>l(I)})]})})}return u.jsx(gd.Provider,{value:p,children:e})}const yd=b.createContext(null);function vd(){const e=b.useContext(yd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const wd=b.createContext(()=>{});function pI(){const e=b.useContext(wd);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const bd=b.createContext(void 0),hI={};function _a(){const e=b.useContext(bd);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function mI({children:e}){const{installation:t}=Ze(),{hydratedRevision:n,loading:r}=di(),[o,i]=b.useState(hI),s=t==null?void 0:t.config;b.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&xb(n,s,i)},[n,r,s,o]);const a=b.useCallback((y,w)=>{i(v=>It(v,p=>{p[y]=It(p[y],w)}))},[i]),c=b.useCallback((y,w)=>{i(v=>It(v,p=>{p[y]=w}))},[i]),f=b.useCallback(()=>{i(It(y=>{const w=y.other.write;w&&(w.isWriteModified=!1)}))},[i]),d=b.useCallback(y=>{i(It(w=>{var p;const v=(p=w[y])==null?void 0:p.read;v&&(v.isOptionalFieldsModified=!1,v.isRequiredMapFieldsModified=!1,v.isValueMappingsModified=!1)}))},[i]),l=b.useCallback(y=>{y===Er?f():d(y)},[d,f]),m=b.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:l}),[o,c,l,a]);return u.jsx(bd.Provider,{value:m,children:e})}const tn=()=>{const{appName:e}=tr(),{objectConfigurationsState:t,setConfigureState:n}=_a(),{selectedObjectName:r}=vd(),o=ad(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function xn(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 zs(e,t){return zs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},zs(e,t)}function gI(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,zs(e,t)}var Gs={exports:{}},oo={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})()})(ud);var Tb=ud.exports;const Kt=va(Tb),Ab="_button_kwfiu_1",Rb="_danger_kwfiu_42",Pb="_ghost_kwfiu_47",us={button:Ab,danger:Rb,ghost:Pb};function Be({className:e,style:t,type:n,children:r,variant:o,...i}){const s=Kt(us.button,{[us.danger]:o==="danger",[us.ghost]:o==="ghost",[e||""]:!!e});return u.jsx("button",{type:n,className:s,style:t,...i,children:r})}const Fb={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 ji({children:e,style:t}){return u.jsx(En,{style:{...Fb,...t},children:e})}const Uo=e=>{const t=it(),{provider:n}=Ze(),r=e||n;return Yn({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},ut=e=>{const t=Uo(e),{data:n}=t,{provider:r}=Ze(),o=n&&rb(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function ln({error:e}){return e?u.jsx(ji,{style:{marginTop:"2em"},children:e}):null}const Db="_input_1ymb7_1",Mb="_inputError_1ymb7_27",ls={input:Db,inputError:Mb};function ld({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Kt(ls.inputError,ls.input):ls.input;return u.jsx("input",{id:e,type:t,className:Kt(i,n),...o})}function kb(){return u.jsx("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:u.jsxs("g",{opacity:"0.5",children:[u.jsx("path",{d:"M14.2821 11.0004C14.2821 12.8154 12.8154 14.2821 11.0004 14.2821C9.18542 14.2821 7.71875 12.8154 7.71875 11.0004C7.71875 9.18542 9.18542 7.71875 11.0004 7.71875C12.8154 7.71875 14.2821 9.18542 14.2821 11.0004Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.9999 18.581C14.2357 18.581 17.2515 16.6743 19.3507 13.3743C20.1757 12.0818 20.1757 9.90932 19.3507 8.61682C17.2515 5.31682 14.2357 3.41016 10.9999 3.41016C7.76402 3.41016 4.74819 5.31682 2.64902 8.61682C1.82402 9.90932 1.82402 12.0818 2.64902 13.3743C4.74819 16.6743 7.76402 18.581 10.9999 18.581Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function Lb(){return u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[u.jsx("path",{d:"M13.3187 8.68036L8.68036 13.3187C8.06528 12.7036 7.71973 11.8694 7.71973 10.9995C7.71973 10.5688 7.80456 10.1423 7.96939 9.7444C8.13421 9.34648 8.3758 8.98491 8.68036 8.68036C8.98491 8.3758 9.34648 8.13421 9.7444 7.96939C10.1423 7.80456 10.5688 7.71973 10.9995 7.71973C11.8694 7.71973 12.7036 8.06528 13.3187 8.68036Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M16.3349 5.28895C14.7307 4.07895 12.8974 3.41895 10.9999 3.41895C7.76402 3.41895 4.74819 5.32561 2.64902 8.62561C1.82402 9.91811 1.82402 12.0906 2.64902 13.3831C3.37319 14.5198 4.21652 15.5006 5.13319 16.2889M7.71819 17.9023C8.76319 18.3423 9.87236 18.5806 10.9999 18.5806C14.2357 18.5806 17.2515 16.6739 19.3507 13.3739C20.1757 12.0814 20.1757 9.90895 19.3507 8.61645C19.0482 8.13978 18.7182 7.69061 18.379 7.26895",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M14.2172 11.6413C14.093 12.2808 13.7806 12.8685 13.32 13.3291C12.8594 13.7897 12.2716 14.1022 11.6322 14.2263M8.68051 13.3188L1.83301 20.1663M20.1663 1.83301L13.3188 8.68051",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function jb({id:e,name:t,placeholder:n="Password",onChange:r,value:o,className:i,isError:s}){const[a,c]=b.useState(!1),f=()=>c(d=>!d);return u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(St.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:o,className:i,isError:s}),u.jsx(Be,{type:"button","aria-label":a?"Hide password":"Show password",style:{height:"2.5rem",width:"2.5rem",display:"flex",alignItems:"center",justifyContent:"center"},onClick:f,variant:"ghost",children:u.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?u.jsx(Lb,{}):u.jsx(kb,{})})})]})}const Kb="_textarea_18zl4_1",$b="_textareaError_18zl4_14",ds={textarea:Kb,textareaError:$b};function Ub({className:e,isError:t=!1,...n}){const r=t?Kt(ds.textareaError,ds.textarea):ds.textarea;return u.jsx("textarea",{className:Kt(e,r),...n})}const St={Input:ld,Textarea:Ub,PasswordInput:jb},qb=()=>{const{projectIdOrName:e}=De(),t=it();return Yn({queryKey:["project",e,"entitlements"],queryFn:async()=>{if(!e)throw new Error("Project ID is required");return(await t()).projectApi.getProject({projectIdOrName:e,includeEntitlements:!0})},enabled:!!e})};function dd(){var n,r;const{data:e}=qb();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:u.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[u.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),u.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:u.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})})]})}function nr({children:e}){return u.jsx(ci,{children:u.jsxs(En,{children:[u.jsx("div",{style:{padding:"3rem 2rem"},children:e}),u.jsx(dd,{})]})})}function rr({children:e}){return u.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function Vb({children:e}){return u.jsx("p",{style:{padding:".5em 0"},children:e})}const Hb="_link_oo2kv_1",Bb={link:Hb};function Oa({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return u.jsx("a",{className:Kt(Bb.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function _o({url:e,providerDisplayName:t,credentialName:n}){return u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[u.jsx(Oa,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function qo(e,t){const n={},r=[];if(e.forEach(o=>{const i=t[o.name];!i||i.trim()===""?r.push(o.displayName||o.name):n[o.name]={value:i,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function Yr(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function fd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var S,p;const[s,a]=b.useState({apiKey:""}),c=((S=t.metadata)==null?void 0:S.input)||[],f=y=>{const{name:I,value:x}=y.currentTarget;a(T=>({...T,[I]:x.trim()}))},{apiKey:d}=s,{providerName:l}=ut(e),h=d.length>0,g=Yr(c,s),w=r||!h||!g,v=(p=t.apiKeyOpts)==null?void 0:p.docsURL,m=()=>{const y=qo(c,s);n({apiKey:d,providerMetadata:y})};return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&u.jsx(_o,{url:v,providerDisplayName:l||cn(e),credentialName:"API key"}),u.jsx(St.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:f}),c.map(y=>u.jsxs("div",{children:[y.docsURL&&u.jsx(_o,{url:y.docsURL,providerDisplayName:l||cn(e),credentialName:y.displayName||y.name}),u.jsx(St.Input,{id:y.name,name:y.name,type:"text",placeholder:y.displayName||y.name,onChange:f})]},y.name)),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:w,type:i||"submit",onClick:m,variant:o,children:"Next"})]})}function Jb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=ut(e);return u.jsxs(nr,{children:[u.jsx(rr,{children:`Set up ${i} integration`}),u.jsx(ln,{error:r}),u.jsx(fd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function Wb({...e}){return u.jsx(Jb,{...e})}const zb={backgroundColor:"var(--amp-colors-status-success-muted)",borderColor:"var(--amp-colors-status-success-muted)",color:"var(--amp-colors-status-success-dark)",padding:".5rem 1rem"};function Vo({children:e,style:t}){return u.jsx(En,{style:{...zb,...t},children:e})}const Ea=()=>{const e=it(),t=$e(),[n,r]=b.useState(null);return{...On({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},Gb="_divider_1kmoj_1",Hc={divider:Gb};function Ho({className:e,style:t}){return u.jsx("hr",{className:e?`${Hc.divider} ${e}`:Hc.divider,style:t})}function At({string:e}){return u.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[u.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),u.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:u.jsx(Ho,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Qb({provider:e}){const{projectIdOrName:t}=De(),{providerName:n,data:r}=ut(e),{selectedConnection:o,isConnectionsLoading:i}=Zt(),{mutateAsync:s,isPending:a,error:c}=Ea(),[f,d]=b.useState(null),[l,h]=b.useState(!1),g=()=>h(!1),w=()=>{h(!0),d(null)},v=(c==null?void 0:c.message)||f||null,m=async S=>{g(),d(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:S.apiKey}}},{onError:p=>{console.error("Update connection error:",p),He(p,d)},onSuccess:()=>{w()}})}catch(p){console.error("Update connection caught error:",p),He(p,d)}};return r?u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Update ${n} API Key`}),l&&u.jsx(Vo,{children:"Connection updated successfully"}),v&&u.jsx(ji,{children:`Error updating connection ${v}`}),u.jsx(fd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:m,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function pd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var m,S;const[i,s]=b.useState({username:"",password:""}),a=((m=t.metadata)==null?void 0:m.input)||[],{username:c,password:f}=i,{providerName:d}=ut(e),l=p=>{const{name:y,value:I}=p.currentTarget;s(x=>({...x,[y]:I.trim()}))},h=Yr(a,i),g=r||!h,w=()=>{const p=qo(a,i);n({user:c,pass:f,providerMetadata:p})},v=(S=t.basicOpts)==null?void 0:S.docsURL;return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&u.jsx(_o,{url:v,providerDisplayName:d||cn(e),credentialName:"credentials"}),u.jsx(St.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:l}),u.jsx(St.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:l}),a.map(p=>u.jsxs("div",{children:[p.docsURL&&u.jsx(_o,{url:p.docsURL,providerDisplayName:d||cn(e),credentialName:p.displayName||p.name}),u.jsx(St.Input,{id:p.name,name:p.name,type:"text",placeholder:p.displayName||p.name,onChange:l})]},p.name)),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:g,type:"button",onClick:w,variant:o,children:"Next"})]})}function Xb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=ut(e);return u.jsxs(nr,{children:[u.jsx(rr,{children:`Set up ${i} integration`}),u.jsx(ln,{error:r}),u.jsx(pd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function Yb({...e}){return u.jsx(Xb,{...e})}function Zb({provider:e}){const{projectIdOrName:t}=De(),{providerName:n,data:r}=ut(e),{selectedConnection:o,isConnectionsLoading:i}=Zt(),{mutateAsync:s,isPending:a,error:c}=Ea(),[f,d]=b.useState(null),[l,h]=b.useState(!1),g=()=>h(!1),w=()=>{h(!0),d(null)},v=(c==null?void 0:c.message)||f||null,m=async S=>{g(),d(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:S.user,password:S.pass}}}},{onError:p=>{console.error(p),He(p,d)},onSuccess:()=>{w()}})}catch(p){console.error(p),He(p,d)}};return r?u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Update ${n} credentials`}),l&&u.jsx(Vo,{children:"Connection updated successfully"}),v&&u.jsx(ji,{children:`Error updating connection: ${v}`}),u.jsx(pd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:m,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function hd({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:o}){var I;const[i,s]=b.useState({clientSecret:"",clientId:"",scopes:""}),[a,c]=b.useState(null),{data:f}=Uo(e),d=((I=f==null?void 0:f.metadata)==null?void 0:I.input)||[],l=x=>{const{name:T,value:A}=x.currentTarget;s(E=>({...E,[T]:A.trim()})),c(null)},{clientSecret:h,clientId:g,scopes:w}=i,v=h.length>0,m=g.length>0,S=Yr(d,i),p=n||!v||!m||!S,y=()=>{const x=qo(d,i),T={clientId:g,clientSecret:h,providerMetadata:x};r&&w.length>0&&(T.scopes=ib(w)),t(T)};return u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[u.jsx(St.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:l}),u.jsx(St.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:l}),r&&u.jsx(St.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:l}),d.map(x=>u.jsx(St.Input,{id:x.name,name:x.name,type:"text",placeholder:x.displayName||x.name,onChange:l},x.name))]}),u.jsx(ln,{error:a}),u.jsx("br",{}),u.jsx(Be,{style:{width:"100%"},disabled:p,type:"button",onClick:y,variant:o,children:"Next"})]})}function eI({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return u.jsxs(nr,{children:[u.jsx(rr,{children:`Set up ${o} integration`}),u.jsx(ln,{error:n}),u.jsx("br",{}),u.jsx(hd,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function tI({provider:e}){var p;const{projectIdOrName:t}=De(),{selectedConnection:n,isConnectionsLoading:r}=Zt(),{providerName:o,data:i}=ut(e),{mutateAsync:s,isPending:a,error:c}=Ea(),[f,d]=b.useState(null),[l,h]=b.useState(!1),g=()=>{h(!1)},w=()=>{h(!0),d(null)},v=(p=i==null?void 0:i.oauth2Opts)==null?void 0:p.explicitScopesRequired,m=(c==null?void 0:c.message)||f||null,S=async y=>{g(),d(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret,scopes:y.scopes}}}}),w()}catch(I){He(I,d)}};return u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Re-authenticate to ${o}`}),l&&u.jsx(Vo,{children:"Connection updated successfully"}),m&&u.jsx(ji,{children:`Error updating connection ${m}`}),u.jsx(hd,{provider:o||"",handleSubmit:S,isButtonDisabled:a||r,explicitScopesRequired:v,buttonVariant:"ghost"})]})]})}const Bc=600,Jc=600,nI="AUTHORIZATION_SUCCEEDED",rI="AUTHORIZATION_FAILED";function iI(e,t,n,r){return b.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Bc)/2,i=window.screenY+(window.outerHeight-Jc)/2.5,s=`width=${Bc},height=${Jc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function oI(e,t,n,r){const o=$e();return b.useCallback(i=>{var s,a;if(i.origin===Kl){if(i.data.eventType===nI){const c=(s=i.data.data)==null?void 0:s.connection;c?(e(c),o.setQueriesData({queryKey:["amp","connections"]},()=>[c]),t==null||t.close(),r==null||r(),o.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:i})}i.data.eventType===rI&&(console.error("OAuth failed: ",{event:i}),n==null||n(((a=i==null?void 0:i.data)==null?void 0:a.message)??"Something went wrong. Please try again."))}},[t,n,o,e,r])}function sI({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s,onWindowClose:a}){const[c,f]=b.useState(null),[d,l]=b.useState(null),h=$e(),g=b.useRef(null),w=oI(f,d,r,i),v=iI(n,l,w,t);b.useEffect(()=>{t&&!d&&!c&&!o&&!s&&(r==null||r(null),v())},[t,d,v,c,o,s,r]);const m=b.useCallback(()=>{h.invalidateQueries({queryKey:["amp","connections"]}),l(null),!c&&!o?console.error("Window closed and no connection was found. Please try again."):c&&(r==null||r(null)),a==null||a()},[c,o,r,a,h]);return b.useEffect(()=>{if(d)return g.current=setInterval(()=>{d!=null&&d.closed&&(g.current&&clearInterval(g.current),g.current=null,m())},500),()=>{g.current&&(clearInterval(g.current),g.current=null),window.removeEventListener("message",w)}},[m,d,w]),u.jsx("div",{children:e})}const aI=()=>{const e=it(),t=$e();return On({mutationKey:["updateOauthConnection"],mutationFn:async n=>{const r=await e();if(!n.projectIdOrName||!n.connectionId)throw new Error("Project ID and connection ID are required");return r.oAuthApi.oauthUpdate(n)},onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function cI({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs("div",{style:{padding:"1rem 0"},children:[u.jsx("p",{children:`Re-authenticate to ${r}`}),u.jsx(ln,{error:t}),u.jsx(Be,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function uI({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Zt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=ut(e),{mutateAsync:s,isPending:a,error:c}=aI(),[f,d]=b.useState(null),[l,h]=b.useState(!1),[g,w]=b.useState(null),v=()=>{h(!1)},m=()=>{h(!0),d(null),w(null)},S=(c==null?void 0:c.message)||f||null,p=async()=>{v(),d(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});w(I)}catch(I){He(I,d)}},y=b.useCallback(I=>{d(I)},[]);return u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Update connection"}),l&&u.jsx(Vo,{children:"Connection updated successfully"}),u.jsx(sI,{windowTitle:`Connect to ${i}`,oauthUrl:g||null,onError:y,error:S,isSuccessConnect:l,onSuccessConnect:m,children:u.jsx(cI,{handleSubmit:p,error:S,providerName:i,isButtonDisabled:a||n||l})})]})}function _a({provider:e}){var r;const{data:t}=Uo(e);if((t==null?void 0:t.authType)===Pc.Basic)return u.jsx(Zb,{provider:e});if((t==null?void 0:t.authType)===Pc.ApiKey)return u.jsx(Qb,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===ss.AuthorizationCode||n===ss.AuthorizationCodePkce)return u.jsx(uI,{provider:e});if(n===ss.ClientCredentials)return u.jsx(tI,{provider:e})}return null}const lI=()=>{const e=it(),t=$e(),[n,r]=b.useState(null);return{...On({mutationKey:["deleteConnection"],mutationFn:async i=>(await e()).connectionApi.deleteConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)},onError:i=>{console.error("Error deleting connection"),He(i,r)}}),errorMsg:n}};function md({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectIdOrName:s}=De(),{selectedConnection:a}=Zt(),{mutate:c,isPending:f}=lI(),d=!s||!a||!a.id||f,l=async()=>{d||(console.warn("deleting connection",{projectIdOrName:s,connectionId:a==null?void 0:a.id}),c({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:w=>{He(w,i)}}))},h=f?"Pending...":e;return u.jsx(Be,{type:"button",onClick:l,disabled:d,variant:t,style:n,children:h})}const gd=b.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),li=()=>{const e=b.useContext(gd);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},dI=()=>{var f;const e=$e(),t=it(),{selectedConnection:n,isConnectionsLoading:r}=Zt(),{projectIdOrName:o}=De(),{integrationId:i,integrationObj:s}=Ze(),a=n==null?void 0:n.id,c=(f=s==null?void 0:s.latestRevision)==null?void 0:f.id;return b.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),Yn({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 fI({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=Ze(),{isError:o,removeError:i,setError:s}=$t(),a=(r==null?void 0:r.name)||n,[c,f]=b.useState(null),[d,l]=b.useState(null),{data:h,isLoading:g,isError:w,error:v}=dI();b.useEffect(()=>{w?(s(ue.HYDRATED_REVISION,a),He(v,f)):(i(ue.HYDRATED_REVISION,a),f(null),l(null))},[w,a,s,i,v,f]);const m=b.useMemo(()=>{var p,y,I;return{hydratedRevision:h||null,loading:g,readAction:(p=h==null?void 0:h.content)==null?void 0:p.read,writeObjects:((I=(y=h==null?void 0:h.content)==null?void 0:y.write)==null?void 0:I.objects)||[]}},[h,g]);if(g)return u.jsx(ui,{});const S=(r==null?void 0:r.provider)||"provider";if(o(ue.HYDRATED_REVISION,a)){const p=(r==null?void 0:r.name)||n||"unknown integration",y=`${c?`: ${c}`:`Error retrieving objects from ${S} or integration details for ${p}`}`;return u.jsx(Gt,{message:y,children:u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[u.jsx(_a,{provider:S}),u.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),d&&u.jsx(Ul,{message:d}),u.jsx(md,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:I=>l(I)})]})})}return u.jsx(gd.Provider,{value:m,children:e})}const yd=b.createContext(null);function vd(){const e=b.useContext(yd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const wd=b.createContext(()=>{});function pI(){const e=b.useContext(wd);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const bd=b.createContext(void 0),hI={};function Na(){const e=b.useContext(bd);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function mI({children:e}){const{installation:t}=Ze(),{hydratedRevision:n,loading:r}=li(),[o,i]=b.useState(hI),s=t==null?void 0:t.config;b.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&xb(n,s,i)},[n,r,s,o]);const a=b.useCallback((g,w)=>{i(v=>It(v,m=>{m[g]=It(m[g],w)}))},[i]),c=b.useCallback((g,w)=>{i(v=>It(v,m=>{m[g]=w}))},[i]),f=b.useCallback(()=>{i(It(g=>{const w=g.other.write;w&&(w.isWriteModified=!1)}))},[i]),d=b.useCallback(g=>{i(It(w=>{var m;const v=(m=w[g])==null?void 0:m.read;v&&(v.isOptionalFieldsModified=!1,v.isRequiredMapFieldsModified=!1,v.isValueMappingsModified=!1)}))},[i]),l=b.useCallback(g=>{g===Or?f():d(g)},[d,f]),h=b.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:l}),[o,c,l,a]);return u.jsx(bd.Provider,{value:h,children:e})}const en=()=>{const{appName:e}=er(),{objectConfigurationsState:t,setConfigureState:n}=Na(),{selectedObjectName:r}=vd(),o=ad(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function Sn(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 zs(e,t){return zs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},zs(e,t)}function gI(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,zs(e,t)}var Gs={exports:{}},so={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 Jc;function yI(){if(Jc)return be;Jc=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,f=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,y=e?Symbol.for("react.memo"):60115,w=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,S=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function g(x){if(typeof x=="object"&&x!==null){var T=x.$$typeof;switch(T){case t:switch(x=x.type,x){case c:case f:case r:case i:case o:case l:return x;default:switch(x=x&&x.$$typeof,x){case a:case d:case w:case y:case s:return x;default:return T}}case n:return T}}}function I(x){return g(x)===f}return be.AsyncMode=c,be.ConcurrentMode=f,be.ContextConsumer=a,be.ContextProvider=s,be.Element=t,be.ForwardRef=d,be.Fragment=r,be.Lazy=w,be.Memo=y,be.Portal=n,be.Profiler=i,be.StrictMode=o,be.Suspense=l,be.isAsyncMode=function(x){return I(x)||g(x)===c},be.isConcurrentMode=I,be.isContextConsumer=function(x){return g(x)===a},be.isContextProvider=function(x){return g(x)===s},be.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===t},be.isForwardRef=function(x){return g(x)===d},be.isFragment=function(x){return g(x)===r},be.isLazy=function(x){return g(x)===w},be.isMemo=function(x){return g(x)===y},be.isPortal=function(x){return g(x)===n},be.isProfiler=function(x){return g(x)===i},be.isStrictMode=function(x){return g(x)===o},be.isSuspense=function(x){return g(x)===l},be.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===r||x===f||x===i||x===o||x===l||x===m||typeof x=="object"&&x!==null&&(x.$$typeof===w||x.$$typeof===y||x.$$typeof===s||x.$$typeof===a||x.$$typeof===d||x.$$typeof===p||x.$$typeof===S||x.$$typeof===h||x.$$typeof===v)},be.typeOf=g,be}var Ie={};/** @license React v16.13.1
17
+ */var Wc;function yI(){if(Wc)return be;Wc=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,f=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,g=e?Symbol.for("react.memo"):60115,w=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,S=e?Symbol.for("react.responder"):60118,p=e?Symbol.for("react.scope"):60119;function y(x){if(typeof x=="object"&&x!==null){var T=x.$$typeof;switch(T){case t:switch(x=x.type,x){case c:case f:case r:case i:case o:case l:return x;default:switch(x=x&&x.$$typeof,x){case a:case d:case w:case g:case s:return x;default:return T}}case n:return T}}}function I(x){return y(x)===f}return be.AsyncMode=c,be.ConcurrentMode=f,be.ContextConsumer=a,be.ContextProvider=s,be.Element=t,be.ForwardRef=d,be.Fragment=r,be.Lazy=w,be.Memo=g,be.Portal=n,be.Profiler=i,be.StrictMode=o,be.Suspense=l,be.isAsyncMode=function(x){return I(x)||y(x)===c},be.isConcurrentMode=I,be.isContextConsumer=function(x){return y(x)===a},be.isContextProvider=function(x){return y(x)===s},be.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===t},be.isForwardRef=function(x){return y(x)===d},be.isFragment=function(x){return y(x)===r},be.isLazy=function(x){return y(x)===w},be.isMemo=function(x){return y(x)===g},be.isPortal=function(x){return y(x)===n},be.isProfiler=function(x){return y(x)===i},be.isStrictMode=function(x){return y(x)===o},be.isSuspense=function(x){return y(x)===l},be.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===r||x===f||x===i||x===o||x===l||x===h||typeof x=="object"&&x!==null&&(x.$$typeof===w||x.$$typeof===g||x.$$typeof===s||x.$$typeof===a||x.$$typeof===d||x.$$typeof===m||x.$$typeof===S||x.$$typeof===p||x.$$typeof===v)},be.typeOf=y,be}var Ie={};/** @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 Wc;function vI(){return Wc||(Wc=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,f=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,y=e?Symbol.for("react.memo"):60115,w=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,S=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function g(k){return typeof k=="string"||typeof k=="function"||k===r||k===f||k===i||k===o||k===l||k===m||typeof k=="object"&&k!==null&&(k.$$typeof===w||k.$$typeof===y||k.$$typeof===s||k.$$typeof===a||k.$$typeof===d||k.$$typeof===p||k.$$typeof===S||k.$$typeof===h||k.$$typeof===v)}function I(k){if(typeof k=="object"&&k!==null){var we=k.$$typeof;switch(we){case t:var W=k.type;switch(W){case c:case f:case r:case i:case o:case l:return W;default:var ot=W&&W.$$typeof;switch(ot){case a:case d:case w:case y:case s:return ot;default:return we}}case n:return we}}}var x=c,T=f,E=a,A=s,R=t,P=d,K=r,q=w,j=y,$=n,ae=i,oe=o,ge=l,me=!1;function Oe(k){return me||(me=!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.")),F(k)||I(k)===c}function F(k){return I(k)===f}function U(k){return I(k)===a}function J(k){return I(k)===s}function B(k){return typeof k=="object"&&k!==null&&k.$$typeof===t}function V(k){return I(k)===d}function M(k){return I(k)===r}function Q(k){return I(k)===w}function Z(k){return I(k)===y}function Y(k){return I(k)===n}function ee(k){return I(k)===i}function te(k){return I(k)===o}function le(k){return I(k)===l}Ie.AsyncMode=x,Ie.ConcurrentMode=T,Ie.ContextConsumer=E,Ie.ContextProvider=A,Ie.Element=R,Ie.ForwardRef=P,Ie.Fragment=K,Ie.Lazy=q,Ie.Memo=j,Ie.Portal=$,Ie.Profiler=ae,Ie.StrictMode=oe,Ie.Suspense=ge,Ie.isAsyncMode=Oe,Ie.isConcurrentMode=F,Ie.isContextConsumer=U,Ie.isContextProvider=J,Ie.isElement=B,Ie.isForwardRef=V,Ie.isFragment=M,Ie.isLazy=Q,Ie.isMemo=Z,Ie.isPortal=Y,Ie.isProfiler=ee,Ie.isStrictMode=te,Ie.isSuspense=le,Ie.isValidElementType=g,Ie.typeOf=I}()),Ie}var zc;function Id(){return zc||(zc=1,process.env.NODE_ENV==="production"?oo.exports=yI():oo.exports=vI()),oo.exports}/*
24
+ */var zc;function vI(){return zc||(zc=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,f=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,g=e?Symbol.for("react.memo"):60115,w=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,S=e?Symbol.for("react.responder"):60118,p=e?Symbol.for("react.scope"):60119;function y(K){return typeof K=="string"||typeof K=="function"||K===r||K===f||K===i||K===o||K===l||K===h||typeof K=="object"&&K!==null&&(K.$$typeof===w||K.$$typeof===g||K.$$typeof===s||K.$$typeof===a||K.$$typeof===d||K.$$typeof===m||K.$$typeof===S||K.$$typeof===p||K.$$typeof===v)}function I(K){if(typeof K=="object"&&K!==null){var we=K.$$typeof;switch(we){case t:var W=K.type;switch(W){case c:case f:case r:case i:case o:case l:return W;default:var ot=W&&W.$$typeof;switch(ot){case a:case d:case w:case g:case s:return ot;default:return we}}case n:return we}}}var x=c,T=f,A=a,E=s,R=t,P=d,M=r,q=w,k=g,L=n,ae=i,oe=o,ge=l,me=!1;function Oe(K){return me||(me=!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.")),F(K)||I(K)===c}function F(K){return I(K)===f}function U(K){return I(K)===a}function J(K){return I(K)===s}function B(K){return typeof K=="object"&&K!==null&&K.$$typeof===t}function V(K){return I(K)===d}function j(K){return I(K)===r}function Q(K){return I(K)===w}function Z(K){return I(K)===g}function Y(K){return I(K)===n}function ee(K){return I(K)===i}function te(K){return I(K)===o}function le(K){return I(K)===l}Ie.AsyncMode=x,Ie.ConcurrentMode=T,Ie.ContextConsumer=A,Ie.ContextProvider=E,Ie.Element=R,Ie.ForwardRef=P,Ie.Fragment=M,Ie.Lazy=q,Ie.Memo=k,Ie.Portal=L,Ie.Profiler=ae,Ie.StrictMode=oe,Ie.Suspense=ge,Ie.isAsyncMode=Oe,Ie.isConcurrentMode=F,Ie.isContextConsumer=U,Ie.isContextProvider=J,Ie.isElement=B,Ie.isForwardRef=V,Ie.isFragment=j,Ie.isLazy=Q,Ie.isMemo=Z,Ie.isPortal=Y,Ie.isProfiler=ee,Ie.isStrictMode=te,Ie.isSuspense=le,Ie.isValidElementType=y,Ie.typeOf=I}()),Ie}var Gc;function Id(){return Gc||(Gc=1,process.env.NODE_ENV==="production"?so.exports=yI():so.exports=vI()),so.exports}/*
25
25
  object-assign
26
26
  (c) Sindre Sorhus
27
27
  @license MIT
28
- */var fs,Gc;function wI(){if(Gc)return fs;Gc=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 f={};return"abcdefghijklmnopqrst".split("").forEach(function(d){f[d]=d}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return fs=o()?Object.assign:function(i,s){for(var a,c=r(i),f,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var l in a)t.call(a,l)&&(c[l]=a[l]);if(e){f=e(a);for(var m=0;m<f.length;m++)n.call(a,f[m])&&(c[f[m]]=a[f[m]])}}return c},fs}var ps,Qc;function Na(){if(Qc)return ps;Qc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ps=e,ps}var hs,Xc;function Cd(){return Xc||(Xc=1,hs=Function.call.bind(Object.prototype.hasOwnProperty)),hs}var ms,Yc;function bI(){if(Yc)return ms;Yc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Na(),n={},r=Cd();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,f){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var l;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}l=i[d](s,d,c,a,null,t)}catch(w){l=w}if(l&&!(l 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 l+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),l instanceof Error&&!(l.message in n)){n[l.message]=!0;var y=f?f():"";e("Failed "+a+" type: "+l.message+(y??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ms=o,ms}var gs,Zc;function II(){if(Zc)return gs;Zc=1;var e=Id(),t=wI(),n=Na(),r=Cd(),o=bI(),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 gs=function(a,c){var f=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function l(F){var U=F&&(f&&F[f]||F[d]);if(typeof U=="function")return U}var m="<<anonymous>>",y={array:S("array"),bigint:S("bigint"),bool:S("boolean"),func:S("function"),number:S("number"),object:S("object"),string:S("string"),symbol:S("symbol"),any:h(),arrayOf:g,element:I(),elementType:x(),instanceOf:T,node:P(),objectOf:A,oneOf:E,oneOfType:R,shape:q,exact:j};function w(F,U){return F===U?F!==0||1/F===1/U:F!==F&&U!==U}function v(F,U){this.message=F,this.data=U&&typeof U=="object"?U:{},this.stack=""}v.prototype=Error.prototype;function p(F){if(process.env.NODE_ENV!=="production")var U={},J=0;function B(M,Q,Z,Y,ee,te,le){if(Y=Y||m,te=te||Z,le!==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 we=Y+":"+Z;!U[we]&&J<3&&(i("You are manually calling a React.PropTypes validation function for the `"+te+"` prop on `"+Y+"`. 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."),U[we]=!0,J++)}}return Q[Z]==null?M?Q[Z]===null?new v("The "+ee+" `"+te+"` is marked as required "+("in `"+Y+"`, but its value is `null`.")):new v("The "+ee+" `"+te+"` is marked as required in "+("`"+Y+"`, but its value is `undefined`.")):null:F(Q,Z,Y,ee,te)}var V=B.bind(null,!1);return V.isRequired=B.bind(null,!0),V}function S(F){function U(J,B,V,M,Q,Z){var Y=J[B],ee=oe(Y);if(ee!==F){var te=ge(Y);return new v("Invalid "+M+" `"+Q+"` of type "+("`"+te+"` supplied to `"+V+"`, expected ")+("`"+F+"`."),{expectedType:F})}return null}return p(U)}function h(){return p(s)}function g(F){function U(J,B,V,M,Q){if(typeof F!="function")return new v("Property `"+Q+"` of component `"+V+"` has invalid PropType notation inside arrayOf.");var Z=J[B];if(!Array.isArray(Z)){var Y=oe(Z);return new v("Invalid "+M+" `"+Q+"` of type "+("`"+Y+"` supplied to `"+V+"`, expected an array."))}for(var ee=0;ee<Z.length;ee++){var te=F(Z,ee,V,M,Q+"["+ee+"]",n);if(te instanceof Error)return te}return null}return p(U)}function I(){function F(U,J,B,V,M){var Q=U[J];if(!a(Q)){var Z=oe(Q);return new v("Invalid "+V+" `"+M+"` of type "+("`"+Z+"` supplied to `"+B+"`, expected a single ReactElement."))}return null}return p(F)}function x(){function F(U,J,B,V,M){var Q=U[J];if(!e.isValidElementType(Q)){var Z=oe(Q);return new v("Invalid "+V+" `"+M+"` of type "+("`"+Z+"` supplied to `"+B+"`, expected a single ReactElement type."))}return null}return p(F)}function T(F){function U(J,B,V,M,Q){if(!(J[B]instanceof F)){var Z=F.name||m,Y=Oe(J[B]);return new v("Invalid "+M+" `"+Q+"` of type "+("`"+Y+"` supplied to `"+V+"`, expected ")+("instance of `"+Z+"`."))}return null}return p(U)}function E(F){if(!Array.isArray(F))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 U(J,B,V,M,Q){for(var Z=J[B],Y=0;Y<F.length;Y++)if(w(Z,F[Y]))return null;var ee=JSON.stringify(F,function(le,k){var we=ge(k);return we==="symbol"?String(k):k});return new v("Invalid "+M+" `"+Q+"` of value `"+String(Z)+"` "+("supplied to `"+V+"`, expected one of "+ee+"."))}return p(U)}function A(F){function U(J,B,V,M,Q){if(typeof F!="function")return new v("Property `"+Q+"` of component `"+V+"` has invalid PropType notation inside objectOf.");var Z=J[B],Y=oe(Z);if(Y!=="object")return new v("Invalid "+M+" `"+Q+"` of type "+("`"+Y+"` supplied to `"+V+"`, expected an object."));for(var ee in Z)if(r(Z,ee)){var te=F(Z,ee,V,M,Q+"."+ee,n);if(te instanceof Error)return te}return null}return p(U)}function R(F){if(!Array.isArray(F))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var U=0;U<F.length;U++){var J=F[U];if(typeof J!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+me(J)+" at index "+U+"."),s}function B(V,M,Q,Z,Y){for(var ee=[],te=0;te<F.length;te++){var le=F[te],k=le(V,M,Q,Z,Y,n);if(k==null)return null;k.data&&r(k.data,"expectedType")&&ee.push(k.data.expectedType)}var we=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new v("Invalid "+Z+" `"+Y+"` supplied to "+("`"+Q+"`"+we+"."))}return p(B)}function P(){function F(U,J,B,V,M){return $(U[J])?null:new v("Invalid "+V+" `"+M+"` supplied to "+("`"+B+"`, expected a ReactNode."))}return p(F)}function K(F,U,J,B,V){return new v((F||"React class")+": "+U+" type `"+J+"."+B+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+V+"`.")}function q(F){function U(J,B,V,M,Q){var Z=J[B],Y=oe(Z);if(Y!=="object")return new v("Invalid "+M+" `"+Q+"` of type `"+Y+"` "+("supplied to `"+V+"`, expected `object`."));for(var ee in F){var te=F[ee];if(typeof te!="function")return K(V,M,Q,ee,ge(te));var le=te(Z,ee,V,M,Q+"."+ee,n);if(le)return le}return null}return p(U)}function j(F){function U(J,B,V,M,Q){var Z=J[B],Y=oe(Z);if(Y!=="object")return new v("Invalid "+M+" `"+Q+"` of type `"+Y+"` "+("supplied to `"+V+"`, expected `object`."));var ee=t({},J[B],F);for(var te in ee){var le=F[te];if(r(F,te)&&typeof le!="function")return K(V,M,Q,te,ge(le));if(!le)return new v("Invalid "+M+" `"+Q+"` key `"+te+"` supplied to `"+V+"`.\nBad object: "+JSON.stringify(J[B],null," ")+`
29
- Valid keys: `+JSON.stringify(Object.keys(F),null," "));var k=le(Z,te,V,M,Q+"."+te,n);if(k)return k}return null}return p(U)}function $(F){switch(typeof F){case"number":case"string":case"undefined":return!0;case"boolean":return!F;case"object":if(Array.isArray(F))return F.every($);if(F===null||a(F))return!0;var U=l(F);if(U){var J=U.call(F),B;if(U!==F.entries){for(;!(B=J.next()).done;)if(!$(B.value))return!1}else for(;!(B=J.next()).done;){var V=B.value;if(V&&!$(V[1]))return!1}}else return!1;return!0;default:return!1}}function ae(F,U){return F==="symbol"?!0:U?U["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&U instanceof Symbol:!1}function oe(F){var U=typeof F;return Array.isArray(F)?"array":F instanceof RegExp?"object":ae(U,F)?"symbol":U}function ge(F){if(typeof F>"u"||F===null)return""+F;var U=oe(F);if(U==="object"){if(F instanceof Date)return"date";if(F instanceof RegExp)return"regexp"}return U}function me(F){var U=ge(F);switch(U){case"array":case"object":return"an "+U;case"boolean":case"date":case"regexp":return"a "+U;default:return U}}function Oe(F){return!F.constructor||!F.constructor.name?m:F.constructor.name}return y.checkPropTypes=o,y.resetWarningCache=o.resetWarningCache,y.PropTypes=y,y},gs}var ys,eu;function CI(){if(eu)return ys;eu=1;var e=Na();function t(){}function n(){}return n.resetWarningCache=t,ys=function(){function r(s,a,c,f,d,l){if(l!==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},ys}if(process.env.NODE_ENV!=="production"){var SI=Id(),xI=!0;Gs.exports=II()(SI.isElement,xI)}else Gs.exports=CI()();var OI=Gs.exports;const H=Sa(OI);var Qs={exports:{}},Ce={};/**
28
+ */var fs,Qc;function wI(){if(Qc)return fs;Qc=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 f={};return"abcdefghijklmnopqrst".split("").forEach(function(d){f[d]=d}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return fs=o()?Object.assign:function(i,s){for(var a,c=r(i),f,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var l in a)t.call(a,l)&&(c[l]=a[l]);if(e){f=e(a);for(var h=0;h<f.length;h++)n.call(a,f[h])&&(c[f[h]]=a[f[h]])}}return c},fs}var ps,Xc;function Ta(){if(Xc)return ps;Xc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ps=e,ps}var hs,Yc;function Cd(){return Yc||(Yc=1,hs=Function.call.bind(Object.prototype.hasOwnProperty)),hs}var ms,Zc;function bI(){if(Zc)return ms;Zc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Ta(),n={},r=Cd();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,f){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var l;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}l=i[d](s,d,c,a,null,t)}catch(w){l=w}if(l&&!(l 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 l+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),l instanceof Error&&!(l.message in n)){n[l.message]=!0;var g=f?f():"";e("Failed "+a+" type: "+l.message+(g??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ms=o,ms}var gs,eu;function II(){if(eu)return gs;eu=1;var e=Id(),t=wI(),n=Ta(),r=Cd(),o=bI(),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 gs=function(a,c){var f=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function l(F){var U=F&&(f&&F[f]||F[d]);if(typeof U=="function")return U}var h="<<anonymous>>",g={array:S("array"),bigint:S("bigint"),bool:S("boolean"),func:S("function"),number:S("number"),object:S("object"),string:S("string"),symbol:S("symbol"),any:p(),arrayOf:y,element:I(),elementType:x(),instanceOf:T,node:P(),objectOf:E,oneOf:A,oneOfType:R,shape:q,exact:k};function w(F,U){return F===U?F!==0||1/F===1/U:F!==F&&U!==U}function v(F,U){this.message=F,this.data=U&&typeof U=="object"?U:{},this.stack=""}v.prototype=Error.prototype;function m(F){if(process.env.NODE_ENV!=="production")var U={},J=0;function B(j,Q,Z,Y,ee,te,le){if(Y=Y||h,te=te||Z,le!==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 we=Y+":"+Z;!U[we]&&J<3&&(i("You are manually calling a React.PropTypes validation function for the `"+te+"` prop on `"+Y+"`. 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."),U[we]=!0,J++)}}return Q[Z]==null?j?Q[Z]===null?new v("The "+ee+" `"+te+"` is marked as required "+("in `"+Y+"`, but its value is `null`.")):new v("The "+ee+" `"+te+"` is marked as required in "+("`"+Y+"`, but its value is `undefined`.")):null:F(Q,Z,Y,ee,te)}var V=B.bind(null,!1);return V.isRequired=B.bind(null,!0),V}function S(F){function U(J,B,V,j,Q,Z){var Y=J[B],ee=oe(Y);if(ee!==F){var te=ge(Y);return new v("Invalid "+j+" `"+Q+"` of type "+("`"+te+"` supplied to `"+V+"`, expected ")+("`"+F+"`."),{expectedType:F})}return null}return m(U)}function p(){return m(s)}function y(F){function U(J,B,V,j,Q){if(typeof F!="function")return new v("Property `"+Q+"` of component `"+V+"` has invalid PropType notation inside arrayOf.");var Z=J[B];if(!Array.isArray(Z)){var Y=oe(Z);return new v("Invalid "+j+" `"+Q+"` of type "+("`"+Y+"` supplied to `"+V+"`, expected an array."))}for(var ee=0;ee<Z.length;ee++){var te=F(Z,ee,V,j,Q+"["+ee+"]",n);if(te instanceof Error)return te}return null}return m(U)}function I(){function F(U,J,B,V,j){var Q=U[J];if(!a(Q)){var Z=oe(Q);return new v("Invalid "+V+" `"+j+"` of type "+("`"+Z+"` supplied to `"+B+"`, expected a single ReactElement."))}return null}return m(F)}function x(){function F(U,J,B,V,j){var Q=U[J];if(!e.isValidElementType(Q)){var Z=oe(Q);return new v("Invalid "+V+" `"+j+"` of type "+("`"+Z+"` supplied to `"+B+"`, expected a single ReactElement type."))}return null}return m(F)}function T(F){function U(J,B,V,j,Q){if(!(J[B]instanceof F)){var Z=F.name||h,Y=Oe(J[B]);return new v("Invalid "+j+" `"+Q+"` of type "+("`"+Y+"` supplied to `"+V+"`, expected ")+("instance of `"+Z+"`."))}return null}return m(U)}function A(F){if(!Array.isArray(F))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 U(J,B,V,j,Q){for(var Z=J[B],Y=0;Y<F.length;Y++)if(w(Z,F[Y]))return null;var ee=JSON.stringify(F,function(le,K){var we=ge(K);return we==="symbol"?String(K):K});return new v("Invalid "+j+" `"+Q+"` of value `"+String(Z)+"` "+("supplied to `"+V+"`, expected one of "+ee+"."))}return m(U)}function E(F){function U(J,B,V,j,Q){if(typeof F!="function")return new v("Property `"+Q+"` of component `"+V+"` has invalid PropType notation inside objectOf.");var Z=J[B],Y=oe(Z);if(Y!=="object")return new v("Invalid "+j+" `"+Q+"` of type "+("`"+Y+"` supplied to `"+V+"`, expected an object."));for(var ee in Z)if(r(Z,ee)){var te=F(Z,ee,V,j,Q+"."+ee,n);if(te instanceof Error)return te}return null}return m(U)}function R(F){if(!Array.isArray(F))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var U=0;U<F.length;U++){var J=F[U];if(typeof J!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+me(J)+" at index "+U+"."),s}function B(V,j,Q,Z,Y){for(var ee=[],te=0;te<F.length;te++){var le=F[te],K=le(V,j,Q,Z,Y,n);if(K==null)return null;K.data&&r(K.data,"expectedType")&&ee.push(K.data.expectedType)}var we=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new v("Invalid "+Z+" `"+Y+"` supplied to "+("`"+Q+"`"+we+"."))}return m(B)}function P(){function F(U,J,B,V,j){return L(U[J])?null:new v("Invalid "+V+" `"+j+"` supplied to "+("`"+B+"`, expected a ReactNode."))}return m(F)}function M(F,U,J,B,V){return new v((F||"React class")+": "+U+" type `"+J+"."+B+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+V+"`.")}function q(F){function U(J,B,V,j,Q){var Z=J[B],Y=oe(Z);if(Y!=="object")return new v("Invalid "+j+" `"+Q+"` of type `"+Y+"` "+("supplied to `"+V+"`, expected `object`."));for(var ee in F){var te=F[ee];if(typeof te!="function")return M(V,j,Q,ee,ge(te));var le=te(Z,ee,V,j,Q+"."+ee,n);if(le)return le}return null}return m(U)}function k(F){function U(J,B,V,j,Q){var Z=J[B],Y=oe(Z);if(Y!=="object")return new v("Invalid "+j+" `"+Q+"` of type `"+Y+"` "+("supplied to `"+V+"`, expected `object`."));var ee=t({},J[B],F);for(var te in ee){var le=F[te];if(r(F,te)&&typeof le!="function")return M(V,j,Q,te,ge(le));if(!le)return new v("Invalid "+j+" `"+Q+"` key `"+te+"` supplied to `"+V+"`.\nBad object: "+JSON.stringify(J[B],null," ")+`
29
+ Valid keys: `+JSON.stringify(Object.keys(F),null," "));var K=le(Z,te,V,j,Q+"."+te,n);if(K)return K}return null}return m(U)}function L(F){switch(typeof F){case"number":case"string":case"undefined":return!0;case"boolean":return!F;case"object":if(Array.isArray(F))return F.every(L);if(F===null||a(F))return!0;var U=l(F);if(U){var J=U.call(F),B;if(U!==F.entries){for(;!(B=J.next()).done;)if(!L(B.value))return!1}else for(;!(B=J.next()).done;){var V=B.value;if(V&&!L(V[1]))return!1}}else return!1;return!0;default:return!1}}function ae(F,U){return F==="symbol"?!0:U?U["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&U instanceof Symbol:!1}function oe(F){var U=typeof F;return Array.isArray(F)?"array":F instanceof RegExp?"object":ae(U,F)?"symbol":U}function ge(F){if(typeof F>"u"||F===null)return""+F;var U=oe(F);if(U==="object"){if(F instanceof Date)return"date";if(F instanceof RegExp)return"regexp"}return U}function me(F){var U=ge(F);switch(U){case"array":case"object":return"an "+U;case"boolean":case"date":case"regexp":return"a "+U;default:return U}}function Oe(F){return!F.constructor||!F.constructor.name?h:F.constructor.name}return g.checkPropTypes=o,g.resetWarningCache=o.resetWarningCache,g.PropTypes=g,g},gs}var ys,tu;function CI(){if(tu)return ys;tu=1;var e=Ta();function t(){}function n(){}return n.resetWarningCache=t,ys=function(){function r(s,a,c,f,d,l){if(l!==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},ys}if(process.env.NODE_ENV!=="production"){var SI=Id(),xI=!0;Gs.exports=II()(SI.isElement,xI)}else Gs.exports=CI()();var OI=Gs.exports;const H=va(OI);var Qs={exports:{}},Ce={};/**
30
30
  * @license React
31
31
  * react-is.production.min.js
32
32
  *
@@ -34,7 +34,7 @@ Valid keys: `+JSON.stringify(Object.keys(F),null," "));var k=le(Z,te,V,M,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 tu;function EI(){if(tu)return Ce;tu=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"),f=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),l=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),w;w=Symbol.for("react.module.reference");function v(p){if(typeof p=="object"&&p!==null){var S=p.$$typeof;switch(S){case e:switch(p=p.type,p){case n:case o:case r:case f:case d:return p;default:switch(p=p&&p.$$typeof,p){case a:case s:case c:case m:case l:case i:return p;default:return S}}case t:return S}}}return Ce.ContextConsumer=s,Ce.ContextProvider=i,Ce.Element=e,Ce.ForwardRef=c,Ce.Fragment=n,Ce.Lazy=m,Ce.Memo=l,Ce.Portal=t,Ce.Profiler=o,Ce.StrictMode=r,Ce.Suspense=f,Ce.SuspenseList=d,Ce.isAsyncMode=function(){return!1},Ce.isConcurrentMode=function(){return!1},Ce.isContextConsumer=function(p){return v(p)===s},Ce.isContextProvider=function(p){return v(p)===i},Ce.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===e},Ce.isForwardRef=function(p){return v(p)===c},Ce.isFragment=function(p){return v(p)===n},Ce.isLazy=function(p){return v(p)===m},Ce.isMemo=function(p){return v(p)===l},Ce.isPortal=function(p){return v(p)===t},Ce.isProfiler=function(p){return v(p)===o},Ce.isStrictMode=function(p){return v(p)===r},Ce.isSuspense=function(p){return v(p)===f},Ce.isSuspenseList=function(p){return v(p)===d},Ce.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===o||p===r||p===f||p===d||p===y||typeof p=="object"&&p!==null&&(p.$$typeof===m||p.$$typeof===l||p.$$typeof===i||p.$$typeof===s||p.$$typeof===c||p.$$typeof===w||p.getModuleId!==void 0)},Ce.typeOf=v,Ce}var Se={};/**
37
+ */var nu;function EI(){if(nu)return Ce;nu=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"),f=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),l=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),w;w=Symbol.for("react.module.reference");function v(m){if(typeof m=="object"&&m!==null){var S=m.$$typeof;switch(S){case e:switch(m=m.type,m){case n:case o:case r:case f:case d:return m;default:switch(m=m&&m.$$typeof,m){case a:case s:case c:case h:case l:case i:return m;default:return S}}case t:return S}}}return Ce.ContextConsumer=s,Ce.ContextProvider=i,Ce.Element=e,Ce.ForwardRef=c,Ce.Fragment=n,Ce.Lazy=h,Ce.Memo=l,Ce.Portal=t,Ce.Profiler=o,Ce.StrictMode=r,Ce.Suspense=f,Ce.SuspenseList=d,Ce.isAsyncMode=function(){return!1},Ce.isConcurrentMode=function(){return!1},Ce.isContextConsumer=function(m){return v(m)===s},Ce.isContextProvider=function(m){return v(m)===i},Ce.isElement=function(m){return typeof m=="object"&&m!==null&&m.$$typeof===e},Ce.isForwardRef=function(m){return v(m)===c},Ce.isFragment=function(m){return v(m)===n},Ce.isLazy=function(m){return v(m)===h},Ce.isMemo=function(m){return v(m)===l},Ce.isPortal=function(m){return v(m)===t},Ce.isProfiler=function(m){return v(m)===o},Ce.isStrictMode=function(m){return v(m)===r},Ce.isSuspense=function(m){return v(m)===f},Ce.isSuspenseList=function(m){return v(m)===d},Ce.isValidElementType=function(m){return typeof m=="string"||typeof m=="function"||m===n||m===o||m===r||m===f||m===d||m===g||typeof m=="object"&&m!==null&&(m.$$typeof===h||m.$$typeof===l||m.$$typeof===i||m.$$typeof===s||m.$$typeof===c||m.$$typeof===w||m.getModuleId!==void 0)},Ce.typeOf=v,Ce}var Se={};/**
38
38
  * @license React
39
39
  * react-is.development.js
40
40
  *
@@ -42,11 +42,11 @@ Valid keys: `+JSON.stringify(Object.keys(F),null," "));var k=le(Z,te,V,M,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 nu;function _I(){return nu||(nu=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"),f=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),l=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),w=!1,v=!1,p=!1,S=!1,h=!1,g;g=Symbol.for("react.module.reference");function I(W){return!!(typeof W=="string"||typeof W=="function"||W===n||W===o||h||W===r||W===f||W===d||S||W===y||w||v||p||typeof W=="object"&&W!==null&&(W.$$typeof===m||W.$$typeof===l||W.$$typeof===i||W.$$typeof===s||W.$$typeof===c||W.$$typeof===g||W.getModuleId!==void 0))}function x(W){if(typeof W=="object"&&W!==null){var ot=W.$$typeof;switch(ot){case e:var _e=W.type;switch(_e){case n:case o:case r:case f:case d:return _e;default:var mt=_e&&_e.$$typeof;switch(mt){case a:case s:case c:case m:case l:case i:return mt;default:return ot}}case t:return ot}}}var T=s,E=i,A=e,R=c,P=n,K=m,q=l,j=t,$=o,ae=r,oe=f,ge=d,me=!1,Oe=!1;function F(W){return me||(me=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function U(W){return Oe||(Oe=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function J(W){return x(W)===s}function B(W){return x(W)===i}function V(W){return typeof W=="object"&&W!==null&&W.$$typeof===e}function M(W){return x(W)===c}function Q(W){return x(W)===n}function Z(W){return x(W)===m}function Y(W){return x(W)===l}function ee(W){return x(W)===t}function te(W){return x(W)===o}function le(W){return x(W)===r}function k(W){return x(W)===f}function we(W){return x(W)===d}Se.ContextConsumer=T,Se.ContextProvider=E,Se.Element=A,Se.ForwardRef=R,Se.Fragment=P,Se.Lazy=K,Se.Memo=q,Se.Portal=j,Se.Profiler=$,Se.StrictMode=ae,Se.Suspense=oe,Se.SuspenseList=ge,Se.isAsyncMode=F,Se.isConcurrentMode=U,Se.isContextConsumer=J,Se.isContextProvider=B,Se.isElement=V,Se.isForwardRef=M,Se.isFragment=Q,Se.isLazy=Z,Se.isMemo=Y,Se.isPortal=ee,Se.isProfiler=te,Se.isStrictMode=le,Se.isSuspense=k,Se.isSuspenseList=we,Se.isValidElementType=I,Se.typeOf=x}()),Se}process.env.NODE_ENV==="production"?Qs.exports=EI():Qs.exports=_I();var ru=Qs.exports;const iu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,ou=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",vs=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return ou(n.overflowY,t)||ou(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},so=(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,NI=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},TI=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{inline:s,boundary:a,skipOverflowHiddenElements:c}=t,f=typeof a=="function"?a:j=>j!==a;if(!iu(e))throw new TypeError("Invalid target");const d=document.scrollingElement||document.documentElement,l=[];let m=e;for(;iu(m)&&f(m);){if(m=NI(m),m===d){l.push(m);break}m!=null&&m===document.body&&vs(m)&&!vs(document.documentElement)||m!=null&&vs(m,c)&&l.push(m)}const y=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,w=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:v,scrollY:p}=window,{height:S,width:h,top:g,right:I,bottom:x,left:T}=e.getBoundingClientRect(),{top:E,right:A,left:R}=(j=>{const $=window.getComputedStyle(j);return{top:parseFloat($.scrollMarginTop)||0,right:parseFloat($.scrollMarginRight)||0,bottom:parseFloat($.scrollMarginBottom)||0,left:parseFloat($.scrollMarginLeft)||0}})(e);let P=g-E,K=s==="center"?T+h/2-R+A:s==="end"?I+A:T-R;const q=[];for(let j=0;j<l.length;j++){const $=l[j],{height:ae,width:oe,top:ge,right:me,bottom:Oe,left:F}=$.getBoundingClientRect();if(g>=0&&T>=0&&x<=w&&I<=y&&g>=ge&&x<=Oe&&T>=F&&I<=me)return q;const U=getComputedStyle($),J=parseInt(U.borderLeftWidth,10),B=parseInt(U.borderTopWidth,10),V=parseInt(U.borderRightWidth,10),M=parseInt(U.borderBottomWidth,10);let Q=0,Z=0;const Y="offsetWidth"in $?$.offsetWidth-$.clientWidth-J-V:0,ee="offsetHeight"in $?$.offsetHeight-$.clientHeight-B-M:0,te="offsetWidth"in $?$.offsetWidth===0?0:oe/$.offsetWidth:0,le="offsetHeight"in $?$.offsetHeight===0?0:ae/$.offsetHeight:0;if(d===$)Q=so(p,p+w,w,B,M,p+P,p+P+S,S),Z=s==="start"?K:s==="center"?K-y/2:s==="end"?K-y:so(v,v+y,y,J,V,v+K,v+K+h,h),Q=Math.max(0,Q+p),Z=Math.max(0,Z+v);else{Q=so(ge,Oe,ae,B,M+ee,P,P+S,S),Z=s==="start"?K-F-J:s==="center"?K-(F+oe/2)+Y/2:s==="end"?K-me+V+Y:so(F,me,oe,J,V+Y,K,K+h,h);const{scrollLeft:k,scrollTop:we}=$;Q=le===0?0:Math.max(0,Math.min(we+Q/le,$.scrollHeight-ae/le+ee)),Z=te===0?0:Math.max(0,Math.min(k+Z/te,$.scrollWidth-oe/te+Y)),P+=we-Q,K+=k-Z}q.push({el:$,top:Q,left:Z})}return q};var ei=function(){return ei=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},ei.apply(this,arguments)};var AI=0;function su(e){return typeof e=="function"?e:_t}function _t(){}function Sd(e,t){if(e){var n=TI(e,{boundary:t});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function au(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Ta(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 We(){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 Dr(){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 xd(){return String(AI++)}function RI(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 cu(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Od(e){return typeof e.type=="string"}function Ed(e){return e.props}function PI(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var FI=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function ao(e){e===void 0&&(e={});var t={};return FI.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function _o(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 Xs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function DI(e){return Object.prototype.toString.call(e)==="[object Object]"}function fr(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=ti(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function ti(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?ti(t?i-1:0,t,n,r):-1}function To(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(au(o,e,n)||r&&au(o,n.document.activeElement,n))})}var Aa=_t;process.env.NODE_ENV!=="production"&&(Aa=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 MI=Ta(function(e){_d(e).textContent=""},500);function _d(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 Nd(e,t){if(!(!e||!t)){var n=_d(t);n.textContent=e,MI(t)}}function kI(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Td=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Ad=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Rd=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,ho=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,mo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Pd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Fd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Dd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Md=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,kd=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Ld=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,jd=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Kd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Ys=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,$d=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Ud=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,qd=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,LI=Object.freeze({__proto__:null,blurButton:$d,blurInput:Ld,changeInput:jd,clickButton:Ys,clickItem:kd,controlledPropUpdatedSelectedItem:Ud,itemMouseEnter:Rd,keyDownArrowDown:mo,keyDownArrowUp:ho,keyDownEnd:Md,keyDownEnter:Fd,keyDownEscape:Pd,keyDownHome:Dd,keyDownSpaceButton:Kd,mouseUp:Ad,touchEnd:qd,unknown:Td}),jI=["refKey","ref"],KI=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],$I=["onKeyDown","onBlur","onChange","onInput","onChangeText"],UI=["refKey","ref"],qI=["onMouseMove","onMouseDown","onClick","onPress","index","item"],VI=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+xd(),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(h){return i.id+"-item-"+h},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(h,g){var I=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(x){return x!==I}),h()},g);i.timeoutIds.push(I)},i.setItemCount=function(h){i.itemCount=h},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(h,g){var I=i.getItemNodeFromIndex(g);return I&&I.hasAttribute("disabled")},i.setHighlightedIndex=function(h,g){h===void 0&&(h=i.props.defaultHighlightedIndex),g===void 0&&(g={}),g=ao(g),i.internalSetState(he({highlightedIndex:h},g))},i.clearSelection=function(h){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},h)},i.selectItem=function(h,g,I){g=ao(g),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:h,inputValue:i.props.itemToString(h)},g),I)},i.selectItemAtIndex=function(h,g,I){var x=i.items[h];x!=null&&i.selectItem(x,g,I)},i.selectHighlightedItem=function(h,g){return i.selectItemAtIndex(i.getState().highlightedIndex,h,g)},i.internalSetState=function(h,g){var I,x,T={},E=typeof h=="function";return!E&&h.hasOwnProperty("inputValue")&&i.props.onInputValueChange(h.inputValue,he({},i.getStateAndHelpers(),h)),i.setState(function(A){var R;A=i.getState(A);var P=E?h(A):h;P=i.props.stateReducer(A,P),I=P.hasOwnProperty("selectedItem");var K={};return I&&P.selectedItem!==A.selectedItem&&(x=P.selectedItem),(R=P).type||(R.type=Td),Object.keys(P).forEach(function(q){A[q]!==P[q]&&(T[q]=P[q]),q!=="type"&&(P[q],No(i.props,q)||(K[q]=P[q]))}),E&&P.hasOwnProperty("inputValue")&&i.props.onInputValueChange(P.inputValue,he({},i.getStateAndHelpers(),P)),K},function(){su(g)();var A=Object.keys(T).length>1;A&&i.props.onStateChange(T,i.getStateAndHelpers()),I&&i.props.onSelect(h.selectedItem,i.getStateAndHelpers()),x!==void 0&&i.props.onChange(x,i.getStateAndHelpers()),i.props.onUserAction(T,i.getStateAndHelpers())})},i.rootRef=function(h){return i._rootNode=h},i.getRootProps=function(h,g){var I,x=h===void 0?{}:h,T=x.refKey,E=T===void 0?"ref":T,A=x.ref,R=xn(x,jI),P=g===void 0?{}:g,K=P.suppressRefError,q=K===void 0?!1:K;i.getRootProps.called=!0,i.getRootProps.refKey=E,i.getRootProps.suppressRefError=q;var j=i.getState(),$=j.isOpen;return he((I={},I[E]=Dr(A,i.rootRef),I.role="combobox",I["aria-expanded"]=$,I["aria-haspopup"]="listbox",I["aria-owns"]=$?i.menuId:void 0,I["aria-labelledby"]=i.labelId,I),R)},i.keyDownHandlers={ArrowDown:function(g){var I=this;if(g.preventDefault(),this.getState().isOpen){var x=g.shiftKey?5:1;this.moveHighlightedIndex(x,{type:mo})}else this.internalSetState({isOpen:!0,type:mo},function(){var T=I.getItemCount();if(T>0){var E=I.getState(),A=E.highlightedIndex,R=fr(A,1,{length:T},I.isItemDisabled,!0);I.setHighlightedIndex(R,{type:mo})}})},ArrowUp:function(g){var I=this;if(g.preventDefault(),this.getState().isOpen){var x=g.shiftKey?-5:-1;this.moveHighlightedIndex(x,{type:ho})}else this.internalSetState({isOpen:!0,type:ho},function(){var T=I.getItemCount();if(T>0){var E=I.getState(),A=E.highlightedIndex,R=fr(A,-1,{length:T},I.isItemDisabled,!0);I.setHighlightedIndex(R,{type:ho})}})},Enter:function(g){if(g.which!==229){var I=this.getState(),x=I.isOpen,T=I.highlightedIndex;if(x&&T!=null){g.preventDefault();var E=this.items[T],A=this.getItemNodeFromIndex(T);if(E==null||A&&A.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Fd})}}},Escape:function(g){g.preventDefault(),this.reset(he({type:Pd},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(g){g.preventDefault(),this.toggleMenu({type:Kd})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(g){var I=this.getState(),x=I.isOpen;if(x){g.preventDefault();var T=this.getItemCount();if(!(T<=0||!x)){var E=ti(0,!1,{length:T},this.isItemDisabled);this.setHighlightedIndex(E,{type:Dd})}}},End:function(g){var I=this.getState(),x=I.isOpen;if(x){g.preventDefault();var T=this.getItemCount();if(!(T<=0||!x)){var E=ti(T-1,!0,{length:T},this.isItemDisabled);this.setHighlightedIndex(E,{type:Md})}}}}),i.getToggleButtonProps=function(h){var g=h===void 0?{}:h,I=g.onClick;g.onPress;var x=g.onKeyDown,T=g.onKeyUp,E=g.onBlur,A=xn(g,KI),R=i.getState(),P=R.isOpen,K={onClick:We(I,i.buttonHandleClick),onKeyDown:We(x,i.buttonHandleKeyDown),onKeyUp:We(T,i.buttonHandleKeyUp),onBlur:We(E,i.buttonHandleBlur)},q=A.disabled?{}:K;return he({type:"button",role:"button","aria-label":P?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},q,A)},i.buttonHandleKeyUp=function(h){h.preventDefault()},i.buttonHandleKeyDown=function(h){var g=Xs(h);i.buttonKeyDownHandlers[g]&&i.buttonKeyDownHandlers[g].call(i,h)},i.buttonHandleClick=function(h){if(h.preventDefault(),i.props.environment){var g=i.props.environment.document,I=g.body,x=g.activeElement;I&&I===x&&h.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:Ys}):i.internalSetTimeout(function(){return i.toggleMenu({type:Ys})})},i.buttonHandleBlur=function(h){var g=h.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var I=i.props.environment.document.activeElement;(I==null||I.id!==i.inputId)&&I!==g&&i.reset({type:$d})}})},i.getLabelProps=function(h){return he({htmlFor:i.inputId,id:i.labelId},h)},i.getInputProps=function(h){var g=h===void 0?{}:h,I=g.onKeyDown,x=g.onBlur,T=g.onChange,E=g.onInput;g.onChangeText;var A=xn(g,$I),R,P={};R="onChange";var K=i.getState(),q=K.inputValue,j=K.isOpen,$=K.highlightedIndex;if(!A.disabled){var ae;P=(ae={},ae[R]=We(T,E,i.inputHandleChange),ae.onKeyDown=We(I,i.inputHandleKeyDown),ae.onBlur=We(x,i.inputHandleBlur),ae)}return he({"aria-autocomplete":"list","aria-activedescendant":j&&typeof $=="number"&&$>=0?i.getItemId($):void 0,"aria-controls":j?i.menuId:void 0,"aria-labelledby":A&&A["aria-label"]?void 0:i.labelId,autoComplete:"off",value:q,id:i.inputId},P,A)},i.inputHandleKeyDown=function(h){var g=Xs(h);g&&i.inputKeyDownHandlers[g]&&i.inputKeyDownHandlers[g].call(i,h)},i.inputHandleChange=function(h){i.internalSetState({type:jd,isOpen:!0,inputValue:h.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var h;if(!(i.isMouseDown||!i.props.environment)){var g=i.props.environment.document.activeElement,I=(g==null||(h=g.dataset)==null?void 0:h.toggle)&&i._rootNode&&i._rootNode.contains(g);I||i.reset({type:Ld})}})},i.menuRef=function(h){i._menuNode=h},i.getMenuProps=function(h,g){var I,x=h===void 0?{}:h,T=x.refKey,E=T===void 0?"ref":T,A=x.ref,R=xn(x,UI),P=g===void 0?{}:g,K=P.suppressRefError,q=K===void 0?!1:K;return i.getMenuProps.called=!0,i.getMenuProps.refKey=E,i.getMenuProps.suppressRefError=q,he((I={},I[E]=Dr(A,i.menuRef),I.role="listbox",I["aria-labelledby"]=R&&R["aria-label"]?void 0:i.labelId,I.id=i.menuId,I),R)},i.getItemProps=function(h){var g,I=h===void 0?{}:h,x=I.onMouseMove,T=I.onMouseDown,E=I.onClick;I.onPress;var A=I.index,R=I.item,P=R===void 0?process.env.NODE_ENV==="production"?void 0:PI("getItemProps","item"):R,K=xn(I,qI);A===void 0?(i.items.push(P),A=i.items.indexOf(P)):i.items[A]=P;var q="onClick",j=E,$=(g={onMouseMove:We(x,function(){A!==i.getState().highlightedIndex&&(i.setHighlightedIndex(A,{type:Rd}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:We(T,function(oe){oe.preventDefault()})},g[q]=We(j,function(){i.selectItemAtIndex(A,{type:kd})}),g),ae=K.disabled?{onMouseDown:$.onMouseDown}:$;return he({id:i.getItemId(A),role:"option","aria-selected":i.getState().highlightedIndex===A},ae,K)},i.clearItems=function(){i.items=[]},i.reset=function(h,g){h===void 0&&(h={}),h=ao(h),i.internalSetState(function(I){var x=I.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(x)},h)},g)},i.toggleMenu=function(h,g){h===void 0&&(h={}),h=ao(h),i.internalSetState(function(I){var x=I.isOpen;return he({isOpen:!x},x&&{highlightedIndex:i.props.defaultHighlightedIndex},h)},function(){var I=i.getState(),x=I.isOpen,T=I.highlightedIndex;x&&i.getItemCount()>0&&typeof T=="number"&&i.setHighlightedIndex(T,h),su(g)()})},i.openMenu=function(h){i.internalSetState({isOpen:!0},h)},i.closeMenu=function(h){i.internalSetState({isOpen:!1},h)},i.updateStatus=Ta(function(){var h;if((h=i.props)!=null&&(h=h.environment)!=null&&h.document){var g=i.getState(),I=i.items[g.highlightedIndex],x=i.getItemCount(),T=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:x,highlightedItem:I},g));i.previousResultCount=x,Nd(T,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,f=c===void 0?a:c,d=s.defaultIsOpen,l=s.initialIsOpen,m=l===void 0?d:l,y=s.initialInputValue,w=y===void 0?"":y,v=s.initialSelectedItem,p=v===void 0?null:v,S=i.getState({highlightedIndex:f,isOpen:m,inputValue:w,selectedItem:p});return S.selectedItem!=null&&i.props.initialInputValue===void 0&&(S.inputValue=i.props.itemToString(S.selectedItem)),i.state=S,i}gI(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),_o(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(),f=c.highlightedIndex;if(a>0){var d=fr(f,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,f=i.isOpen,d=this.props.itemToString,l=this.id,m=this.getRootProps,y=this.getToggleButtonProps,w=this.getLabelProps,v=this.getMenuProps,p=this.getInputProps,S=this.getItemProps,h=this.openMenu,g=this.closeMenu,I=this.toggleMenu,x=this.selectItem,T=this.selectItemAtIndex,E=this.selectHighlightedItem,A=this.setHighlightedIndex,R=this.clearSelection,P=this.clearItems,K=this.reset,q=this.setItemCount,j=this.unsetItemCount,$=this.internalSetState;return{getRootProps:m,getToggleButtonProps:y,getLabelProps:w,getMenuProps:v,getInputProps:p,getItemProps:S,reset:K,openMenu:h,closeMenu:g,toggleMenu:I,selectItem:x,selectItemAtIndex:T,selectHighlightedItem:E,setHighlightedIndex:A,clearSelection:R,clearItems:P,setItemCount:q,unsetItemCount:j,setState:$,itemToString:d,id:l,highlightedIndex:s,inputValue:a,isOpen:f,selectedItem:c}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&uu(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(y){i.isMouseDown=!1;var w=To(y.target,[i._rootNode,i._menuNode],i.props.environment);!w&&i.getState().isOpen&&i.reset({type:Ad},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},f=function(){i.isTouchMove=!0},d=function(y){var w=To(y.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!w&&i.getState().isOpen&&i.reset({type:qd},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},l=this.props.environment;l.addEventListener("mousedown",s),l.addEventListener("mouseup",a),l.addEventListener("touchstart",c),l.addEventListener("touchmove",f),l.addEventListener("touchend",d),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),l.removeEventListener("mousedown",s),l.removeEventListener("mouseup",a),l.removeEventListener("touchstart",c),l.removeEventListener("touchmove",f),l.removeEventListener("touchend",d)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,f=s.highlightedIndex===void 0?i:s,d=f.highlightedIndex,l=c&&this.getState().isOpen&&!i.isOpen,m=c!==d;return l||m},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(Aa(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&uu(this._menuNode,this.getMenuProps)),No(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Ud,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=cu(this.props.children,_t);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=cu(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&&HI(s,this.getRootProps),s;if(Od(s))return b.cloneElement(s,this.getRootProps(Ed(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}(b.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:RI,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&DI(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:_t,onInputValueChange:_t,onUserAction:_t,onChange:_t,onSelect:_t,onOuterClick:_t,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Sd},e.stateChangeTypes=LI,e}();process.env.NODE_ENV!=="production"&&(VI.propTypes={children:H.func,defaultHighlightedIndex:H.number,defaultIsOpen:H.bool,initialHighlightedIndex:H.number,initialSelectedItem:H.any,initialInputValue:H.string,initialIsOpen:H.bool,getA11yStatusMessage:H.func,itemToString:H.func,onChange:H.func,onSelect:H.func,onStateChange:H.func,onInputValueChange:H.func,onUserAction:H.func,onOuterClick:H.func,selectedItemChanged:H.func,stateReducer:H.func,itemCount:H.number,id:H.string,environment:H.shape({addEventListener:H.func.isRequired,removeEventListener:H.func.isRequired,document:H.shape({createElement:H.func.isRequired,getElementById:H.func.isRequired,activeElement:H.any.isRequired,body:H.any.isRequired}).isRequired,Node:H.func.isRequired}),suppressRefError:H.bool,scrollIntoView:H.func,selectedItem:H.any,isOpen:H.bool,inputValue:H.string,highlightedIndex:H.number,labelId:H.string,inputId:H.string,menuId:H.string,getItemId:H.func});function uu(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 HI(e,t){var n=t.refKey,r=n!=="ref",o=!Od(e);o&&!r&&!ru.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+'"'),!ru.isForwardRef(e)&&!Ed(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Vd={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function BI(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){JI(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 JI(e,t,n,r){var o=t.props,i=t.type,s="on"+Ra(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function WI(e,t){return t.changes}var lu=Ta(function(e,t){Nd(e,t)},200),zI=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?b.useLayoutEffect:b.useEffect,GI="useId"in b?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+b.useId();n||(n=c);var f=b.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 f.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+xd():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,f=b.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 f.current};function QI(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 Ra(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Hd(e){var t=b.useRef(e);return t.current=e,t}function XI(e,t,n,r){var o=b.useRef(),i=b.useRef(),s=b.useCallback(function(y,w){i.current=w,y=_o(y,w.props);var v=e(y,w),p=w.props.stateReducer(y,he({},w,{changes:v}));return p},[e]),a=b.useReducer(s,t,n),c=a[0],f=a[1],d=Hd(t),l=b.useCallback(function(y){return f(he({props:d.current},y))},[d]),m=i.current;return b.useEffect(function(){var y=_o(o.current,m==null?void 0:m.props),w=m&&o.current&&!r(y,c);w&&BI(m,y,c),o.current=c},[c,m,r]),[c,l]}var Ii={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:WI,scrollIntoView:Sd,environment:typeof window>"u"?void 0:window};function Gn(e,t,n){n===void 0&&(n=Vd);var r=e["default"+Ra(t)];return r!==void 0?r:n[t]}function Ci(e,t,n){n===void 0&&(n=Vd);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Ra(t)];return o!==void 0?o:Gn(e,t,n)}function YI(e){var t=Ci(e,"selectedItem"),n=Ci(e,"isOpen"),r=rC(e),o=Ci(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 Si(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,f=t.highlightedIndex;return r.length===0?-1:o!==void 0&&f===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 ZI(e,t,n){var r=b.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return b.useEffect(function(){if(!e)return _t;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,To(d.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function f(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!To(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",f),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",f)}},[n,e,t]),r.current}var Bd=function(){return _t};process.env.NODE_ENV!=="production"&&(Bd=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=b.useRef(n.reduce(function(s,a){return s[a]={},s},{}));b.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,f=a.refKey,d=a.elementRef;c||d!=null&&d.current||console.error('downshift: The ref prop "'+f+'" from '+s+" was not applied correctly on your element.")})},[]);var i=b.useCallback(function(s,a,c,f){o.current[s]={suppressRefError:a,refKey:c,elementRef:f}},[]);return i});function eC(e,t,n,r){r===void 0&&(r={});var o=r.document,i=Bo();b.useEffect(function(){if(!(!e||i||!o)){var s=e(t);lu(s,o)}},n),b.useEffect(function(){return function(){lu.cancel(),kI(o)}},[o])}function tC(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=b.useRef(!0);return zI(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Jd=_t;process.env.NODE_ENV!=="production"&&(Jd=function(t){var n=t.props,r=t.state,o=b.useRef(n),i=Bo();b.useEffect(function(){i||(Aa(r,o.current,n),o.current=n)},[r,n,i])});function du(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:Gn(e,"isOpen"),highlightedIndex:Gn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function nC(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Bo(){var e=b.useRef(!0);return b.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Zs(e){var t=Gn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function rC(e){var t=Ci(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var go={environment:H.shape({addEventListener:H.func.isRequired,removeEventListener:H.func.isRequired,document:H.shape({createElement:H.func.isRequired,getElementById:H.func.isRequired,activeElement:H.any.isRequired,body:H.any.isRequired}).isRequired,Node:H.func.isRequired}),itemToString:H.func,itemToKey:H.func,stateReducer:H.func},Wd=he({},go,{getA11yStatusMessage:H.func,highlightedIndex:H.number,defaultHighlightedIndex:H.number,initialHighlightedIndex:H.number,isOpen:H.bool,defaultIsOpen:H.bool,initialIsOpen:H.bool,selectedItem:H.any,initialSelectedItem:H.any,defaultSelectedItem:H.any,id:H.string,labelId:H.string,menuId:H.string,getItemId:H.func,toggleButtonId:H.string,onSelectedItemChange:H.func,onHighlightedIndexChange:H.func,onStateChange:H.func,onIsOpenChange:H.func,scrollIntoView:H.func});function iC(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:Si(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:Si(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:Zs(o),isOpen:Gn(o,"isOpen"),selectedItem:Gn(o,"selectedItem"),inputValue:Gn(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}ei(ei({},Wd),{items:H.array.isRequired,isItemDisabled:H.func});ei(ei({},Ii),{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 Pa=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Fa=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Da=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Ma=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,ka=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,La=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,ja=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Ka=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,$a=process.env.NODE_ENV!=="production"?"__input_change__":8,Ao=process.env.NODE_ENV!=="production"?"__input_blur__":9,Ua=process.env.NODE_ENV!=="production"?"__input_click__":10,zd=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Gd=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,qa=process.env.NODE_ENV!=="production"?"__item_click__":13,Qd=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Xd=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Yd=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Zd=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,ef=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,Va=process.env.NODE_ENV!=="production"?"__function_select_item__":19,tf=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,nf=process.env.NODE_ENV!=="production"?"__function_reset__":21,Ha=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,rf=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:Ha,FunctionCloseMenu:Zd,FunctionOpenMenu:Yd,FunctionReset:nf,FunctionSelectItem:Va,FunctionSetHighlightedIndex:ef,FunctionSetInputValue:tf,FunctionToggleMenu:Xd,InputBlur:Ao,InputChange:$a,InputClick:Ua,InputKeyDownArrowDown:Pa,InputKeyDownArrowUp:Fa,InputKeyDownEnd:ka,InputKeyDownEnter:Ka,InputKeyDownEscape:Da,InputKeyDownHome:Ma,InputKeyDownPageDown:ja,InputKeyDownPageUp:La,ItemClick:qa,ItemMouseMove:Gd,MenuMouseLeave:zd,ToggleButtonClick:Qd});function oC(e){var t=YI(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 sC=he({},Wd,{items:H.array.isRequired,isItemDisabled:H.func,inputValue:H.string,defaultInputValue:H.string,initialInputValue:H.string,inputId:H.string,onInputValueChange:H.func});function aC(e,t,n,r){var o=b.useRef(),i=XI(e,t,n,r),s=i[0],a=i[1],c=Bo();return b.useEffect(function(){if(No(t,"selectedItem")){if(!c){var f=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);f&&a({type:Ha,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[_o(s,t),a]}var of=_t;process.env.NODE_ENV!=="production"&&(of=function(t,n){H.checkPropTypes(sC,t,"prop",n.name)});var cC=he({},Ii,{isItemDisabled:function(){return!1}});function uC(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case qa:s={isOpen:Gn(o,"isOpen"),highlightedIndex:Zs(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Pa:e.isOpen?s={highlightedIndex:fr(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:Si(o,e,1),isOpen:o.items.length>=0};break;case Fa:e.isOpen?i?s=du(o,e.highlightedIndex):s={highlightedIndex:fr(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:Si(o,e,-1),isOpen:o.items.length>=0};break;case Ka:s=du(o,e.highlightedIndex);break;case Da:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case La:s={highlightedIndex:fr(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case ja:s={highlightedIndex:fr(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case Ma:s={highlightedIndex:ti(0,!1,o.items,o.isItemDisabled)};break;case ka:s={highlightedIndex:ti(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case Ao: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 $a:s={isOpen:!0,highlightedIndex:Zs(o),inputValue:t.inputValue};break;case Ua:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Si(o,e,0)};break;case Va:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case Ha:s={inputValue:t.inputValue};break;default:return iC(e,t,rf)}return he({},e,s)}var lC=["onMouseLeave","refKey","ref"],dC=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],fC=["onClick","onPress","refKey","ref"],pC=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Ba.stateChangeTypes=rf;function Ba(e){e===void 0&&(e={}),of(e,Ba);var t=he({},cC,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=aC(uC,t,oC,nC),a=s[0],c=s[1],f=a.isOpen,d=a.highlightedIndex,l=a.selectedItem,m=a.inputValue,y=b.useRef(null),w=b.useRef({}),v=b.useRef(null),p=b.useRef(null),S=Bo(),h=GI(t),g=b.useRef(),I=Hd({state:a,props:t}),x=b.useCallback(function(J){return w.current[h.getItemId(J)]},[h]);eC(i,a,[f,d,l,m],o);var T=tC({menuElement:y.current,highlightedIndex:d,isOpen:f,itemRefs:w,scrollIntoView:r,getItemNodeFromIndex:x});Jd({props:t,state:a}),b.useEffect(function(){var J=Ci(t,"isOpen");J&&v.current&&v.current.focus()},[]),b.useEffect(function(){S||(g.current=n.length)});var E=ZI(o,b.useCallback(function(){I.current.state.isOpen&&c({type:Ao,selectItem:!1})},[c,I]),b.useMemo(function(){return[y,p,v]},[y.current,p.current,v.current])),A=Bd("getInputProps","getMenuProps");b.useEffect(function(){f||(w.current={})},[f]),b.useEffect(function(){var J;!f||!(o!=null&&o.document)||!(v!=null&&(J=v.current)!=null&&J.focus)||o.document.activeElement!==v.current&&v.current.focus()},[f,o]);var R=b.useMemo(function(){return{ArrowDown:function(B){B.preventDefault(),c({type:Pa,altKey:B.altKey})},ArrowUp:function(B){B.preventDefault(),c({type:Fa,altKey:B.altKey})},Home:function(B){I.current.state.isOpen&&(B.preventDefault(),c({type:Ma}))},End:function(B){I.current.state.isOpen&&(B.preventDefault(),c({type:ka}))},Escape:function(B){var V=I.current.state;(V.isOpen||V.inputValue||V.selectedItem||V.highlightedIndex>-1)&&(B.preventDefault(),c({type:Da}))},Enter:function(B){var V=I.current.state;!V.isOpen||B.which===229||(B.preventDefault(),c({type:Ka}))},PageUp:function(B){I.current.state.isOpen&&(B.preventDefault(),c({type:La}))},PageDown:function(B){I.current.state.isOpen&&(B.preventDefault(),c({type:ja}))}}},[c,I]),P=b.useCallback(function(J){return he({id:h.labelId,htmlFor:h.inputId},J)},[h]),K=b.useCallback(function(J,B){var V,M=J===void 0?{}:J,Q=M.onMouseLeave,Z=M.refKey,Y=Z===void 0?"ref":Z,ee=M.ref,te=xn(M,lC),le=B===void 0?{}:B,k=le.suppressRefError,we=k===void 0?!1:k;return A("getMenuProps",we,Y,y),he((V={},V[Y]=Dr(ee,function(W){y.current=W}),V.id=h.menuId,V.role="listbox",V["aria-labelledby"]=te&&te["aria-label"]?void 0:""+h.labelId,V.onMouseLeave=We(Q,function(){c({type:zd})}),V),te)},[c,A,h]),q=b.useCallback(function(J){var B,V,M=J===void 0?{}:J,Q=M.item,Z=M.index,Y=M.refKey,ee=Y===void 0?"ref":Y,te=M.ref,le=M.onMouseMove,k=M.onMouseDown,we=M.onClick;M.onPress;var W=M.disabled,ot=xn(M,dC);W!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var _e=I.current,mt=_e.props,Je=_e.state,gt=QI(Q,Z,mt.items,"Pass either item or index to getItemProps!"),Ee=gt[0],et=gt[1],xt=mt.isItemDisabled(Ee,et),qt="onClick",Pt=we,lt=function(){E.isTouchEnd||et===Je.highlightedIndex||(T.current=!1,c({type:Gd,index:et,disabled:xt}))},st=function(){c({type:qa,index:et})},Me=function(Ft){return Ft.preventDefault()};return he((B={},B[ee]=Dr(te,function(Ue){Ue&&(w.current[h.getItemId(et)]=Ue)}),B["aria-disabled"]=xt,B["aria-selected"]=et===Je.highlightedIndex,B.id=h.getItemId(et),B.role="option",B),!xt&&(V={},V[qt]=We(Pt,st),V),{onMouseMove:We(le,lt),onMouseDown:We(k,Me)},ot)},[c,h,I,E,T]),j=b.useCallback(function(J){var B,V=J===void 0?{}:J,M=V.onClick;V.onPress;var Q=V.refKey,Z=Q===void 0?"ref":Q,Y=V.ref,ee=xn(V,fC),te=I.current.state,le=function(){c({type:Qd})};return he((B={},B[Z]=Dr(Y,function(k){p.current=k}),B["aria-controls"]=h.menuId,B["aria-expanded"]=te.isOpen,B.id=h.toggleButtonId,B.tabIndex=-1,B),!ee.disabled&&he({},{onClick:We(M,le)}),ee)},[c,I,h]),$=b.useCallback(function(J,B){var V,M=J===void 0?{}:J,Q=M.onKeyDown,Z=M.onChange,Y=M.onInput,ee=M.onBlur;M.onChangeText;var te=M.onClick,le=M.refKey,k=le===void 0?"ref":le,we=M.ref,W=xn(M,pC),ot=B===void 0?{}:B,_e=ot.suppressRefError,mt=_e===void 0?!1:_e;A("getInputProps",mt,k,v);var Je=I.current.state,gt=function(Me){var Ue=Xs(Me);Ue&&R[Ue]&&R[Ue](Me)},Ee=function(Me){c({type:$a,inputValue:Me.target.value})},et=function(Me){if(o!=null&&o.document&&Je.isOpen&&!E.isMouseDown){var Ue=Me.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:Ao,selectItem:!Ue})}},xt=function(){c({type:Ua})},qt="onChange",Pt={};if(!W.disabled){var lt;Pt=(lt={},lt[qt]=We(Z,Y,Ee),lt.onKeyDown=We(Q,gt),lt.onBlur=We(ee,et),lt.onClick=We(te,xt),lt)}return he((V={},V[k]=Dr(we,function(st){v.current=st}),V["aria-activedescendant"]=Je.isOpen&&Je.highlightedIndex>-1?h.getItemId(Je.highlightedIndex):"",V["aria-autocomplete"]="list",V["aria-controls"]=h.menuId,V["aria-expanded"]=Je.isOpen,V["aria-labelledby"]=W&&W["aria-label"]?void 0:h.labelId,V.autoComplete="off",V.id=h.inputId,V.role="combobox",V.value=Je.inputValue,V),Pt,W)},[c,h,o,R,I,E,A]),ae=b.useCallback(function(){c({type:Xd})},[c]),oe=b.useCallback(function(){c({type:Zd})},[c]),ge=b.useCallback(function(){c({type:Yd})},[c]),me=b.useCallback(function(J){c({type:ef,highlightedIndex:J})},[c]),Oe=b.useCallback(function(J){c({type:Va,selectedItem:J})},[c]),F=b.useCallback(function(J){c({type:tf,inputValue:J})},[c]),U=b.useCallback(function(){c({type:nf})},[c]);return{getItemProps:q,getLabelProps:P,getMenuProps:K,getInputProps:$,getToggleButtonProps:j,toggleMenu:ae,openMenu:ge,closeMenu:oe,setHighlightedIndex:me,setInputValue:F,selectItem:Oe,reset:U,highlightedIndex:d,isOpen:f,selectedItem:l,inputValue:m}}go.stateReducer,go.itemToKey,go.environment,H.array,H.array,H.array,H.func,H.number,H.number,H.number,H.func,H.func,H.string,H.string;Ii.itemToKey,Ii.stateReducer,Ii.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 hC="_comboboxContainer_1lcc8_1",mC="_inputContainer_1lcc8_12",gC="_input_1lcc8_12",yC="_toggleButton_1lcc8_33",vC="_menu_1lcc8_39",wC="_menuBottom_1lcc8_55",bC="_menuTop_1lcc8_61",IC="_menuItem_1lcc8_66",CC="_highlighted_1lcc8_73",SC="_selected_1lcc8_77",xC="_hidden_1lcc8_81",Jt={comboboxContainer:hC,inputContainer:mC,input:gC,toggleButton:yC,menu:vC,menuBottom:wC,menuTop:bC,menuItem:IC,highlighted:CC,selected:SC,hidden:xC};function OC(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function sf({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,c]=b.useState(e),f=b.useRef(null);b.useEffect(()=>c(e),[e]);const d=b.useCallback(E=>{(E==null?void 0:E.length)>0?c(e.filter(OC(E))):c(e)},[e]),{isOpen:l,getToggleButtonProps:m,getMenuProps:y,getInputProps:w,highlightedIndex:v,getItemProps:p,setInputValue:S,selectedItem:h}=Ba({items:a,selectedItem:t?e.find(E=>E.value===t):null,itemToString:E=>(E==null?void 0:E.label)||"",onInputValueChange:({inputValue:E})=>d(E),onSelectedItemChange:({selectedItem:E})=>{var A;n(E),(A=f.current)==null||A.blur()}}),g=()=>{S(""),c(e)},I=()=>g(),x=b.useMemo(()=>{var E;return(E=e.find(A=>A.value===t))==null?void 0:E.label},[e,t]),T=()=>{t&&x&&t!==(h==null?void 0:h.value)&&S(x||"")};return u.jsxs("div",{style:{position:"relative",...i},children:[u.jsx("div",{className:Jt.comboboxContainer,children:u.jsxs("div",{className:Jt.inputContainer,children:[u.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:Jt.input,...w({onFocus:I,onBlur:T,ref:f})}),u.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:Jt.toggleButton,type:"button",...m(),children:l?u.jsx(u.Fragment,{children:"↑"}):u.jsx(u.Fragment,{children:"↓"})})]})}),u.jsx("ul",{className:`${Jt.menu} ${l&&e.length?"":Jt.hidden} ${s==="top"?Jt.menuTop:Jt.menuBottom}`,...y(),children:l&&a.map((E,A)=>u.jsx("li",{className:`${Jt.menuItem} ${v===A?Jt.highlighted:""} ${t===(E==null?void 0:E.value)?Jt.selected:""}`,...p({item:E,index:A}),children:u.jsx("span",{children:E.label})},E.id))})]})}const ni=Math.min,Ir=Math.max,Ro=Math.round,co=Math.floor,Xn=e=>({x:e,y:e}),EC={left:"right",right:"left",bottom:"top",top:"bottom"},_C={start:"end",end:"start"};function ea(e,t,n){return Ir(e,ni(t,n))}function Ki(e,t){return typeof e=="function"?e(t):e}function _r(e){return e.split("-")[0]}function $i(e){return e.split("-")[1]}function af(e){return e==="x"?"y":"x"}function Ja(e){return e==="y"?"height":"width"}function ri(e){return["top","bottom"].includes(_r(e))?"y":"x"}function Wa(e){return af(ri(e))}function NC(e,t,n){n===void 0&&(n=!1);const r=$i(e),o=Wa(e),i=Ja(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Po(s)),[s,Po(s)]}function TC(e){const t=Po(e);return[ta(e),t,ta(t)]}function ta(e){return e.replace(/start|end/g,t=>_C[t])}function AC(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 RC(e,t,n,r){const o=$i(e);let i=AC(_r(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(ta)))),i}function Po(e){return e.replace(/left|right|bottom|top/g,t=>EC[t])}function PC(e){return{top:0,right:0,bottom:0,left:0,...e}}function cf(e){return typeof e!="number"?PC(e):{top:e,right:e,bottom:e,left:e}}function Fo(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 fu(e,t,n){let{reference:r,floating:o}=e;const i=ri(t),s=Wa(t),a=Ja(s),c=_r(t),f=i==="y",d=r.x+r.width/2-o.width/2,l=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let y;switch(c){case"top":y={x:d,y:r.y-o.height};break;case"bottom":y={x:d,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:l};break;case"left":y={x:r.x-o.width,y:l};break;default:y={x:r.x,y:r.y}}switch($i(t)){case"start":y[s]-=m*(n&&f?-1:1);break;case"end":y[s]+=m*(n&&f?-1:1);break}return y}const FC=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 f=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:l}=fu(f,r,c),m=r,y={},w=0;for(let v=0;v<a.length;v++){const{name:p,fn:S}=a[v],{x:h,y:g,data:I,reset:x}=await S({x:d,y:l,initialPlacement:r,placement:m,strategy:o,middlewareData:y,rects:f,platform:s,elements:{reference:e,floating:t}});d=h??d,l=g??l,y={...y,[p]:{...y[p],...I}},x&&w<=50&&(w++,typeof x=="object"&&(x.placement&&(m=x.placement),x.rects&&(f=x.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):x.rects),{x:d,y:l}=fu(f,m,c)),v=-1)}return{x:d,y:l,placement:m,strategy:o,middlewareData:y}};async function uf(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:f="clippingAncestors",rootBoundary:d="viewport",elementContext:l="floating",altBoundary:m=!1,padding:y=0}=Ki(t,e),w=cf(y),p=a[m?l==="floating"?"reference":"floating":l],S=Fo(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:f,rootBoundary:d,strategy:c})),h=l==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,g=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),I=await(i.isElement==null?void 0:i.isElement(g))?await(i.getScale==null?void 0:i.getScale(g))||{x:1,y:1}:{x:1,y:1},x=Fo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:h,offsetParent:g,strategy:c}):h);return{top:(S.top-x.top+w.top)/I.y,bottom:(x.bottom-S.bottom+w.bottom)/I.y,left:(S.left-x.left+w.left)/I.x,right:(x.right-S.right+w.right)/I.x}}const DC=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:f,padding:d=0}=Ki(e,t)||{};if(f==null)return{};const l=cf(d),m={x:n,y:r},y=Wa(o),w=Ja(y),v=await s.getDimensions(f),p=y==="y",S=p?"top":"left",h=p?"bottom":"right",g=p?"clientHeight":"clientWidth",I=i.reference[w]+i.reference[y]-m[y]-i.floating[w],x=m[y]-i.reference[y],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let E=T?T[g]:0;(!E||!await(s.isElement==null?void 0:s.isElement(T)))&&(E=a.floating[g]||i.floating[w]);const A=I/2-x/2,R=E/2-v[w]/2-1,P=ni(l[S],R),K=ni(l[h],R),q=P,j=E-v[w]-K,$=E/2-v[w]/2+A,ae=ea(q,$,j),oe=!c.arrow&&$i(o)!=null&&$!==ae&&i.reference[w]/2-($<q?P:K)-v[w]/2<0,ge=oe?$<q?$-q:$-j:0;return{[y]:m[y]+ge,data:{[y]:ae,centerOffset:$-ae-ge,...oe&&{alignmentOffset:ge}},reset:oe}}}),MC=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:f}=t,{mainAxis:d=!0,crossAxis:l=!0,fallbackPlacements:m,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:v=!0,...p}=Ki(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const S=_r(o),h=ri(a),g=_r(a)===a,I=await(c.isRTL==null?void 0:c.isRTL(f.floating)),x=m||(g||!v?[Po(a)]:TC(a)),T=w!=="none";!m&&T&&x.push(...RC(a,v,w,I));const E=[a,...x],A=await uf(t,p),R=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&R.push(A[S]),l){const $=NC(o,s,I);R.push(A[$[0]],A[$[1]])}if(P=[...P,{placement:o,overflows:R}],!R.every($=>$<=0)){var K,q;const $=(((K=i.flip)==null?void 0:K.index)||0)+1,ae=E[$];if(ae)return{data:{index:$,overflows:P},reset:{placement:ae}};let oe=(q=P.filter(ge=>ge.overflows[0]<=0).sort((ge,me)=>ge.overflows[1]-me.overflows[1])[0])==null?void 0:q.placement;if(!oe)switch(y){case"bestFit":{var j;const ge=(j=P.filter(me=>{if(T){const Oe=ri(me.placement);return Oe===h||Oe==="y"}return!0}).map(me=>[me.placement,me.overflows.filter(Oe=>Oe>0).reduce((Oe,F)=>Oe+F,0)]).sort((me,Oe)=>me[1]-Oe[1])[0])==null?void 0:j[0];ge&&(oe=ge);break}case"initialPlacement":oe=a;break}if(o!==oe)return{reset:{placement:oe}}}return{}}}};async function kC(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=_r(n),a=$i(n),c=ri(n)==="y",f=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,l=Ki(t,e);let{mainAxis:m,crossAxis:y,alignmentAxis:w}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return a&&typeof w=="number"&&(y=a==="end"?w*-1:w),c?{x:y*d,y:m*f}:{x:m*f,y:y*d}}const LC=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 kC(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}}}}},jC=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:S,y:h}=p;return{x:S,y:h}}},...c}=Ki(e,t),f={x:n,y:r},d=await uf(t,c),l=ri(_r(o)),m=af(l);let y=f[m],w=f[l];if(i){const p=m==="y"?"top":"left",S=m==="y"?"bottom":"right",h=y+d[p],g=y-d[S];y=ea(h,y,g)}if(s){const p=l==="y"?"top":"left",S=l==="y"?"bottom":"right",h=w+d[p],g=w-d[S];w=ea(h,w,g)}const v=a.fn({...t,[m]:y,[l]:w});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:i,[l]:s}}}}}};function Jo(){return typeof window<"u"}function fi(e){return lf(e)?(e.nodeName||"").toLowerCase():"#document"}function Nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fn(e){var t;return(t=(lf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lf(e){return Jo()?e instanceof Node||e instanceof Nt(e).Node:!1}function Yt(e){return Jo()?e instanceof Element||e instanceof Nt(e).Element:!1}function ln(e){return Jo()?e instanceof HTMLElement||e instanceof Nt(e).HTMLElement:!1}function pu(e){return!Jo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Nt(e).ShadowRoot}function Ui(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Zt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function KC(e){return["table","td","th"].includes(fi(e))}function Wo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function za(e){const t=Ga(),n=Yt(e)?Zt(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 $C(e){let t=Yn(e);for(;ln(t)&&!ii(t);){if(za(t))return t;if(Wo(t))return null;t=Yn(t)}return null}function Ga(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ii(e){return["html","body","#document"].includes(fi(e))}function Zt(e){return Nt(e).getComputedStyle(e)}function zo(e){return Yt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yn(e){if(fi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||pu(e)&&e.host||fn(e);return pu(t)?t.host:t}function df(e){const t=Yn(e);return ii(t)?e.ownerDocument?e.ownerDocument.body:e.body:ln(t)&&Ui(t)?t:df(t)}function Ti(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=df(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Nt(o);if(i){const a=na(s);return t.concat(s,s.visualViewport||[],Ui(o)?o:[],a&&n?Ti(a):[])}return t.concat(o,Ti(o,[],n))}function na(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ff(e){const t=Zt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ln(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Ro(n)!==i||Ro(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Qa(e){return Yt(e)?e:e.contextElement}function kr(e){const t=Qa(e);if(!ln(t))return Xn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ff(t);let s=(i?Ro(n.width):n.width)/r,a=(i?Ro(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const UC=Xn(0);function pf(e){const t=Nt(e);return!Ga()||!t.visualViewport?UC:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qC(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Nt(e)?!1:t}function Nr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Qa(e);let s=Xn(1);t&&(r?Yt(r)&&(s=kr(r)):s=kr(e));const a=qC(i,n,r)?pf(i):Xn(0);let c=(o.left+a.x)/s.x,f=(o.top+a.y)/s.y,d=o.width/s.x,l=o.height/s.y;if(i){const m=Nt(i),y=r&&Yt(r)?Nt(r):r;let w=m,v=na(w);for(;v&&r&&y!==w;){const p=kr(v),S=v.getBoundingClientRect(),h=Zt(v),g=S.left+(v.clientLeft+parseFloat(h.paddingLeft))*p.x,I=S.top+(v.clientTop+parseFloat(h.paddingTop))*p.y;c*=p.x,f*=p.y,d*=p.x,l*=p.y,c+=g,f+=I,w=Nt(v),v=na(w)}}return Fo({width:d,height:l,x:c,y:f})}function VC(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=fn(r),a=t?Wo(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},f=Xn(1);const d=Xn(0),l=ln(r);if((l||!l&&!i)&&((fi(r)!=="body"||Ui(s))&&(c=zo(r)),ln(r))){const m=Nr(r);f=kr(r),d.x=m.x+r.clientLeft,d.y=m.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+d.x,y:n.y*f.y-c.scrollTop*f.y+d.y}}function HC(e){return Array.from(e.getClientRects())}function ra(e,t){const n=zo(e).scrollLeft;return t?t.left+n:Nr(fn(e)).left+n}function BC(e){const t=fn(e),n=zo(e),r=e.ownerDocument.body,o=Ir(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Ir(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+ra(e);const a=-n.scrollTop;return Zt(r).direction==="rtl"&&(s+=Ir(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function JC(e,t){const n=Nt(e),r=fn(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const f=Ga();(!f||f&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function WC(e,t){const n=Nr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=ln(e)?kr(e):Xn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,f=r*i.y;return{width:s,height:a,x:c,y:f}}function hu(e,t,n){let r;if(t==="viewport")r=JC(e,n);else if(t==="document")r=BC(fn(e));else if(Yt(t))r=WC(t,n);else{const o=pf(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Fo(r)}function hf(e,t){const n=Yn(e);return n===t||!Yt(n)||ii(n)?!1:Zt(n).position==="fixed"||hf(n,t)}function zC(e,t){const n=t.get(e);if(n)return n;let r=Ti(e,[],!1).filter(a=>Yt(a)&&fi(a)!=="body"),o=null;const i=Zt(e).position==="fixed";let s=i?Yn(e):e;for(;Yt(s)&&!ii(s);){const a=Zt(s),c=za(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Ui(s)&&!c&&hf(e,s))?r=r.filter(d=>d!==s):o=a,s=Yn(s)}return t.set(e,r),r}function GC(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Wo(t)?[]:zC(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((f,d)=>{const l=hu(t,d,o);return f.top=Ir(l.top,f.top),f.right=ni(l.right,f.right),f.bottom=ni(l.bottom,f.bottom),f.left=Ir(l.left,f.left),f},hu(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function QC(e){const{width:t,height:n}=ff(e);return{width:t,height:n}}function XC(e,t,n){const r=ln(t),o=fn(t),i=n==="fixed",s=Nr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Xn(0);if(r||!r&&!i)if((fi(t)!=="body"||Ui(o))&&(a=zo(t)),r){const y=Nr(t,!0,i,t);c.x=y.x+t.clientLeft,c.y=y.y+t.clientTop}else o&&(c.x=ra(o));let f=0,d=0;if(o&&!r&&!i){const y=o.getBoundingClientRect();d=y.top+a.scrollTop,f=y.left+a.scrollLeft-ra(o,y)}const l=s.left+a.scrollLeft-c.x-f,m=s.top+a.scrollTop-c.y-d;return{x:l,y:m,width:s.width,height:s.height}}function ws(e){return Zt(e).position==="static"}function mu(e,t){if(!ln(e)||Zt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return fn(e)===n&&(n=n.ownerDocument.body),n}function mf(e,t){const n=Nt(e);if(Wo(e))return n;if(!ln(e)){let o=Yn(e);for(;o&&!ii(o);){if(Yt(o)&&!ws(o))return o;o=Yn(o)}return n}let r=mu(e,t);for(;r&&KC(r)&&ws(r);)r=mu(r,t);return r&&ii(r)&&ws(r)&&!za(r)?n:r||$C(e)||n}const YC=async function(e){const t=this.getOffsetParent||mf,n=this.getDimensions,r=await n(e.floating);return{reference:XC(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ZC(e){return Zt(e).direction==="rtl"}const eS={convertOffsetParentRelativeRectToViewportRelativeRect:VC,getDocumentElement:fn,getClippingRect:GC,getOffsetParent:mf,getElementRects:YC,getClientRects:HC,getDimensions:QC,getScale:kr,isElement:Yt,isRTL:ZC};function tS(e,t){let n=null,r;const o=fn(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:f,top:d,width:l,height:m}=e.getBoundingClientRect();if(a||t(),!l||!m)return;const y=co(d),w=co(o.clientWidth-(f+l)),v=co(o.clientHeight-(d+m)),p=co(f),h={rootMargin:-y+"px "+-w+"px "+-v+"px "+-p+"px",threshold:Ir(0,ni(1,c))||1};let g=!0;function I(x){const T=x[0].intersectionRatio;if(T!==c){if(!g)return s();T?s(!1,T):r=setTimeout(()=>{s(!1,1e-7)},1e3)}g=!1}try{n=new IntersectionObserver(I,{...h,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,h)}n.observe(e)}return s(!0),i}function nS(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,f=Qa(e),d=o||i?[...f?Ti(f):[],...Ti(t)]:[];d.forEach(S=>{o&&S.addEventListener("scroll",n,{passive:!0}),i&&S.addEventListener("resize",n)});const l=f&&a?tS(f,n):null;let m=-1,y=null;s&&(y=new ResizeObserver(S=>{let[h]=S;h&&h.target===f&&y&&(y.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var g;(g=y)==null||g.observe(t)})),n()}),f&&!c&&y.observe(f),y.observe(t));let w,v=c?Nr(e):null;c&&p();function p(){const S=Nr(e);v&&(S.x!==v.x||S.y!==v.y||S.width!==v.width||S.height!==v.height)&&n(),v=S,w=requestAnimationFrame(p)}return n(),()=>{var S;d.forEach(h=>{o&&h.removeEventListener("scroll",n),i&&h.removeEventListener("resize",n)}),l==null||l(),(S=y)==null||S.disconnect(),y=null,c&&cancelAnimationFrame(w)}}const rS=LC,iS=jC,oS=MC,sS=DC,gu=(e,t,n)=>{const r=new Map,o={platform:eS,...n},i={...o.platform,_c:r};return FC(e,t,{...o,platform:i})};/*
45
+ */var ru;function _I(){return ru||(ru=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"),f=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),l=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),w=!1,v=!1,m=!1,S=!1,p=!1,y;y=Symbol.for("react.module.reference");function I(W){return!!(typeof W=="string"||typeof W=="function"||W===n||W===o||p||W===r||W===f||W===d||S||W===g||w||v||m||typeof W=="object"&&W!==null&&(W.$$typeof===h||W.$$typeof===l||W.$$typeof===i||W.$$typeof===s||W.$$typeof===c||W.$$typeof===y||W.getModuleId!==void 0))}function x(W){if(typeof W=="object"&&W!==null){var ot=W.$$typeof;switch(ot){case e:var _e=W.type;switch(_e){case n:case o:case r:case f:case d:return _e;default:var mt=_e&&_e.$$typeof;switch(mt){case a:case s:case c:case h:case l:case i:return mt;default:return ot}}case t:return ot}}}var T=s,A=i,E=e,R=c,P=n,M=h,q=l,k=t,L=o,ae=r,oe=f,ge=d,me=!1,Oe=!1;function F(W){return me||(me=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function U(W){return Oe||(Oe=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function J(W){return x(W)===s}function B(W){return x(W)===i}function V(W){return typeof W=="object"&&W!==null&&W.$$typeof===e}function j(W){return x(W)===c}function Q(W){return x(W)===n}function Z(W){return x(W)===h}function Y(W){return x(W)===l}function ee(W){return x(W)===t}function te(W){return x(W)===o}function le(W){return x(W)===r}function K(W){return x(W)===f}function we(W){return x(W)===d}Se.ContextConsumer=T,Se.ContextProvider=A,Se.Element=E,Se.ForwardRef=R,Se.Fragment=P,Se.Lazy=M,Se.Memo=q,Se.Portal=k,Se.Profiler=L,Se.StrictMode=ae,Se.Suspense=oe,Se.SuspenseList=ge,Se.isAsyncMode=F,Se.isConcurrentMode=U,Se.isContextConsumer=J,Se.isContextProvider=B,Se.isElement=V,Se.isForwardRef=j,Se.isFragment=Q,Se.isLazy=Z,Se.isMemo=Y,Se.isPortal=ee,Se.isProfiler=te,Se.isStrictMode=le,Se.isSuspense=K,Se.isSuspenseList=we,Se.isValidElementType=I,Se.typeOf=x}()),Se}process.env.NODE_ENV==="production"?Qs.exports=EI():Qs.exports=_I();var iu=Qs.exports;const ou=e=>typeof e=="object"&&e!=null&&e.nodeType===1,su=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",vs=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return su(n.overflowY,t)||su(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},ao=(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,NI=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},TI=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{inline:s,boundary:a,skipOverflowHiddenElements:c}=t,f=typeof a=="function"?a:k=>k!==a;if(!ou(e))throw new TypeError("Invalid target");const d=document.scrollingElement||document.documentElement,l=[];let h=e;for(;ou(h)&&f(h);){if(h=NI(h),h===d){l.push(h);break}h!=null&&h===document.body&&vs(h)&&!vs(document.documentElement)||h!=null&&vs(h,c)&&l.push(h)}const g=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,w=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:v,scrollY:m}=window,{height:S,width:p,top:y,right:I,bottom:x,left:T}=e.getBoundingClientRect(),{top:A,right:E,left:R}=(k=>{const L=window.getComputedStyle(k);return{top:parseFloat(L.scrollMarginTop)||0,right:parseFloat(L.scrollMarginRight)||0,bottom:parseFloat(L.scrollMarginBottom)||0,left:parseFloat(L.scrollMarginLeft)||0}})(e);let P=y-A,M=s==="center"?T+p/2-R+E:s==="end"?I+E:T-R;const q=[];for(let k=0;k<l.length;k++){const L=l[k],{height:ae,width:oe,top:ge,right:me,bottom:Oe,left:F}=L.getBoundingClientRect();if(y>=0&&T>=0&&x<=w&&I<=g&&y>=ge&&x<=Oe&&T>=F&&I<=me)return q;const U=getComputedStyle(L),J=parseInt(U.borderLeftWidth,10),B=parseInt(U.borderTopWidth,10),V=parseInt(U.borderRightWidth,10),j=parseInt(U.borderBottomWidth,10);let Q=0,Z=0;const Y="offsetWidth"in L?L.offsetWidth-L.clientWidth-J-V:0,ee="offsetHeight"in L?L.offsetHeight-L.clientHeight-B-j:0,te="offsetWidth"in L?L.offsetWidth===0?0:oe/L.offsetWidth:0,le="offsetHeight"in L?L.offsetHeight===0?0:ae/L.offsetHeight:0;if(d===L)Q=ao(m,m+w,w,B,j,m+P,m+P+S,S),Z=s==="start"?M:s==="center"?M-g/2:s==="end"?M-g:ao(v,v+g,g,J,V,v+M,v+M+p,p),Q=Math.max(0,Q+m),Z=Math.max(0,Z+v);else{Q=ao(ge,Oe,ae,B,j+ee,P,P+S,S),Z=s==="start"?M-F-J:s==="center"?M-(F+oe/2)+Y/2:s==="end"?M-me+V+Y:ao(F,me,oe,J,V+Y,M,M+p,p);const{scrollLeft:K,scrollTop:we}=L;Q=le===0?0:Math.max(0,Math.min(we+Q/le,L.scrollHeight-ae/le+ee)),Z=te===0?0:Math.max(0,Math.min(K+Z/te,L.scrollWidth-oe/te+Y)),P+=we-Q,M+=K-Z}q.push({el:L,top:Q,left:Z})}return q};var Zr=function(){return Zr=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},Zr.apply(this,arguments)};var AI=0;function au(e){return typeof e=="function"?e:_t}function _t(){}function Sd(e,t){if(e){var n=TI(e,{boundary:t});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function cu(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Aa(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 We(){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 xd(){return String(AI++)}function RI(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 uu(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Od(e){return typeof e.type=="string"}function Ed(e){return e.props}function PI(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var FI=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function co(e){e===void 0&&(e={});var t={};return FI.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function No(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=To(t,r)?t[r]:e[r],n},{})}function To(e,t){return e[t]!==void 0}function Xs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function DI(e){return Object.prototype.toString.call(e)==="[object Object]"}function dr(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=ei(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function ei(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?ei(t?i-1:0,t,n,r):-1}function Ao(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(cu(o,e,n)||r&&cu(o,n.document.activeElement,n))})}var Ra=_t;process.env.NODE_ENV!=="production"&&(Ra=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 MI=Aa(function(e){_d(e).textContent=""},500);function _d(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 Nd(e,t){if(!(!e||!t)){var n=_d(t);n.textContent=e,MI(t)}}function kI(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Td=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Ad=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Rd=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,mo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,go=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Pd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Fd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Dd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Md=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,kd=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Ld=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,jd=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Kd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Ys=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,$d=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Ud=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,qd=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,LI=Object.freeze({__proto__:null,blurButton:$d,blurInput:Ld,changeInput:jd,clickButton:Ys,clickItem:kd,controlledPropUpdatedSelectedItem:Ud,itemMouseEnter:Rd,keyDownArrowDown:go,keyDownArrowUp:mo,keyDownEnd:Md,keyDownEnter:Fd,keyDownEscape:Pd,keyDownHome:Dd,keyDownSpaceButton:Kd,mouseUp:Ad,touchEnd:qd,unknown:Td}),jI=["refKey","ref"],KI=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],$I=["onKeyDown","onBlur","onChange","onInput","onChangeText"],UI=["refKey","ref"],qI=["onMouseMove","onMouseDown","onClick","onPress","index","item"],VI=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+xd(),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(p){return i.id+"-item-"+p},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(p,y){var I=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(x){return x!==I}),p()},y);i.timeoutIds.push(I)},i.setItemCount=function(p){i.itemCount=p},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(p,y){var I=i.getItemNodeFromIndex(y);return I&&I.hasAttribute("disabled")},i.setHighlightedIndex=function(p,y){p===void 0&&(p=i.props.defaultHighlightedIndex),y===void 0&&(y={}),y=co(y),i.internalSetState(he({highlightedIndex:p},y))},i.clearSelection=function(p){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},p)},i.selectItem=function(p,y,I){y=co(y),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:p,inputValue:i.props.itemToString(p)},y),I)},i.selectItemAtIndex=function(p,y,I){var x=i.items[p];x!=null&&i.selectItem(x,y,I)},i.selectHighlightedItem=function(p,y){return i.selectItemAtIndex(i.getState().highlightedIndex,p,y)},i.internalSetState=function(p,y){var I,x,T={},A=typeof p=="function";return!A&&p.hasOwnProperty("inputValue")&&i.props.onInputValueChange(p.inputValue,he({},i.getStateAndHelpers(),p)),i.setState(function(E){var R;E=i.getState(E);var P=A?p(E):p;P=i.props.stateReducer(E,P),I=P.hasOwnProperty("selectedItem");var M={};return I&&P.selectedItem!==E.selectedItem&&(x=P.selectedItem),(R=P).type||(R.type=Td),Object.keys(P).forEach(function(q){E[q]!==P[q]&&(T[q]=P[q]),q!=="type"&&(P[q],To(i.props,q)||(M[q]=P[q]))}),A&&P.hasOwnProperty("inputValue")&&i.props.onInputValueChange(P.inputValue,he({},i.getStateAndHelpers(),P)),M},function(){au(y)();var E=Object.keys(T).length>1;E&&i.props.onStateChange(T,i.getStateAndHelpers()),I&&i.props.onSelect(p.selectedItem,i.getStateAndHelpers()),x!==void 0&&i.props.onChange(x,i.getStateAndHelpers()),i.props.onUserAction(T,i.getStateAndHelpers())})},i.rootRef=function(p){return i._rootNode=p},i.getRootProps=function(p,y){var I,x=p===void 0?{}:p,T=x.refKey,A=T===void 0?"ref":T,E=x.ref,R=Sn(x,jI),P=y===void 0?{}:y,M=P.suppressRefError,q=M===void 0?!1:M;i.getRootProps.called=!0,i.getRootProps.refKey=A,i.getRootProps.suppressRefError=q;var k=i.getState(),L=k.isOpen;return he((I={},I[A]=Fr(E,i.rootRef),I.role="combobox",I["aria-expanded"]=L,I["aria-haspopup"]="listbox",I["aria-owns"]=L?i.menuId:void 0,I["aria-labelledby"]=i.labelId,I),R)},i.keyDownHandlers={ArrowDown:function(y){var I=this;if(y.preventDefault(),this.getState().isOpen){var x=y.shiftKey?5:1;this.moveHighlightedIndex(x,{type:go})}else this.internalSetState({isOpen:!0,type:go},function(){var T=I.getItemCount();if(T>0){var A=I.getState(),E=A.highlightedIndex,R=dr(E,1,{length:T},I.isItemDisabled,!0);I.setHighlightedIndex(R,{type:go})}})},ArrowUp:function(y){var I=this;if(y.preventDefault(),this.getState().isOpen){var x=y.shiftKey?-5:-1;this.moveHighlightedIndex(x,{type:mo})}else this.internalSetState({isOpen:!0,type:mo},function(){var T=I.getItemCount();if(T>0){var A=I.getState(),E=A.highlightedIndex,R=dr(E,-1,{length:T},I.isItemDisabled,!0);I.setHighlightedIndex(R,{type:mo})}})},Enter:function(y){if(y.which!==229){var I=this.getState(),x=I.isOpen,T=I.highlightedIndex;if(x&&T!=null){y.preventDefault();var A=this.items[T],E=this.getItemNodeFromIndex(T);if(A==null||E&&E.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Fd})}}},Escape:function(y){y.preventDefault(),this.reset(he({type:Pd},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(y){y.preventDefault(),this.toggleMenu({type:Kd})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(y){var I=this.getState(),x=I.isOpen;if(x){y.preventDefault();var T=this.getItemCount();if(!(T<=0||!x)){var A=ei(0,!1,{length:T},this.isItemDisabled);this.setHighlightedIndex(A,{type:Dd})}}},End:function(y){var I=this.getState(),x=I.isOpen;if(x){y.preventDefault();var T=this.getItemCount();if(!(T<=0||!x)){var A=ei(T-1,!0,{length:T},this.isItemDisabled);this.setHighlightedIndex(A,{type:Md})}}}}),i.getToggleButtonProps=function(p){var y=p===void 0?{}:p,I=y.onClick;y.onPress;var x=y.onKeyDown,T=y.onKeyUp,A=y.onBlur,E=Sn(y,KI),R=i.getState(),P=R.isOpen,M={onClick:We(I,i.buttonHandleClick),onKeyDown:We(x,i.buttonHandleKeyDown),onKeyUp:We(T,i.buttonHandleKeyUp),onBlur:We(A,i.buttonHandleBlur)},q=E.disabled?{}:M;return he({type:"button",role:"button","aria-label":P?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},q,E)},i.buttonHandleKeyUp=function(p){p.preventDefault()},i.buttonHandleKeyDown=function(p){var y=Xs(p);i.buttonKeyDownHandlers[y]&&i.buttonKeyDownHandlers[y].call(i,p)},i.buttonHandleClick=function(p){if(p.preventDefault(),i.props.environment){var y=i.props.environment.document,I=y.body,x=y.activeElement;I&&I===x&&p.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:Ys}):i.internalSetTimeout(function(){return i.toggleMenu({type:Ys})})},i.buttonHandleBlur=function(p){var y=p.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var I=i.props.environment.document.activeElement;(I==null||I.id!==i.inputId)&&I!==y&&i.reset({type:$d})}})},i.getLabelProps=function(p){return he({htmlFor:i.inputId,id:i.labelId},p)},i.getInputProps=function(p){var y=p===void 0?{}:p,I=y.onKeyDown,x=y.onBlur,T=y.onChange,A=y.onInput;y.onChangeText;var E=Sn(y,$I),R,P={};R="onChange";var M=i.getState(),q=M.inputValue,k=M.isOpen,L=M.highlightedIndex;if(!E.disabled){var ae;P=(ae={},ae[R]=We(T,A,i.inputHandleChange),ae.onKeyDown=We(I,i.inputHandleKeyDown),ae.onBlur=We(x,i.inputHandleBlur),ae)}return he({"aria-autocomplete":"list","aria-activedescendant":k&&typeof L=="number"&&L>=0?i.getItemId(L):void 0,"aria-controls":k?i.menuId:void 0,"aria-labelledby":E&&E["aria-label"]?void 0:i.labelId,autoComplete:"off",value:q,id:i.inputId},P,E)},i.inputHandleKeyDown=function(p){var y=Xs(p);y&&i.inputKeyDownHandlers[y]&&i.inputKeyDownHandlers[y].call(i,p)},i.inputHandleChange=function(p){i.internalSetState({type:jd,isOpen:!0,inputValue:p.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var p;if(!(i.isMouseDown||!i.props.environment)){var y=i.props.environment.document.activeElement,I=(y==null||(p=y.dataset)==null?void 0:p.toggle)&&i._rootNode&&i._rootNode.contains(y);I||i.reset({type:Ld})}})},i.menuRef=function(p){i._menuNode=p},i.getMenuProps=function(p,y){var I,x=p===void 0?{}:p,T=x.refKey,A=T===void 0?"ref":T,E=x.ref,R=Sn(x,UI),P=y===void 0?{}:y,M=P.suppressRefError,q=M===void 0?!1:M;return i.getMenuProps.called=!0,i.getMenuProps.refKey=A,i.getMenuProps.suppressRefError=q,he((I={},I[A]=Fr(E,i.menuRef),I.role="listbox",I["aria-labelledby"]=R&&R["aria-label"]?void 0:i.labelId,I.id=i.menuId,I),R)},i.getItemProps=function(p){var y,I=p===void 0?{}:p,x=I.onMouseMove,T=I.onMouseDown,A=I.onClick;I.onPress;var E=I.index,R=I.item,P=R===void 0?process.env.NODE_ENV==="production"?void 0:PI("getItemProps","item"):R,M=Sn(I,qI);E===void 0?(i.items.push(P),E=i.items.indexOf(P)):i.items[E]=P;var q="onClick",k=A,L=(y={onMouseMove:We(x,function(){E!==i.getState().highlightedIndex&&(i.setHighlightedIndex(E,{type:Rd}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:We(T,function(oe){oe.preventDefault()})},y[q]=We(k,function(){i.selectItemAtIndex(E,{type:kd})}),y),ae=M.disabled?{onMouseDown:L.onMouseDown}:L;return he({id:i.getItemId(E),role:"option","aria-selected":i.getState().highlightedIndex===E},ae,M)},i.clearItems=function(){i.items=[]},i.reset=function(p,y){p===void 0&&(p={}),p=co(p),i.internalSetState(function(I){var x=I.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(x)},p)},y)},i.toggleMenu=function(p,y){p===void 0&&(p={}),p=co(p),i.internalSetState(function(I){var x=I.isOpen;return he({isOpen:!x},x&&{highlightedIndex:i.props.defaultHighlightedIndex},p)},function(){var I=i.getState(),x=I.isOpen,T=I.highlightedIndex;x&&i.getItemCount()>0&&typeof T=="number"&&i.setHighlightedIndex(T,p),au(y)()})},i.openMenu=function(p){i.internalSetState({isOpen:!0},p)},i.closeMenu=function(p){i.internalSetState({isOpen:!1},p)},i.updateStatus=Aa(function(){var p;if((p=i.props)!=null&&(p=p.environment)!=null&&p.document){var y=i.getState(),I=i.items[y.highlightedIndex],x=i.getItemCount(),T=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:x,highlightedItem:I},y));i.previousResultCount=x,Nd(T,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,f=c===void 0?a:c,d=s.defaultIsOpen,l=s.initialIsOpen,h=l===void 0?d:l,g=s.initialInputValue,w=g===void 0?"":g,v=s.initialSelectedItem,m=v===void 0?null:v,S=i.getState({highlightedIndex:f,isOpen:h,inputValue:w,selectedItem:m});return S.selectedItem!=null&&i.props.initialInputValue===void 0&&(S.inputValue=i.props.itemToString(S.selectedItem)),i.state=S,i}gI(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),No(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(),f=c.highlightedIndex;if(a>0){var d=dr(f,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,f=i.isOpen,d=this.props.itemToString,l=this.id,h=this.getRootProps,g=this.getToggleButtonProps,w=this.getLabelProps,v=this.getMenuProps,m=this.getInputProps,S=this.getItemProps,p=this.openMenu,y=this.closeMenu,I=this.toggleMenu,x=this.selectItem,T=this.selectItemAtIndex,A=this.selectHighlightedItem,E=this.setHighlightedIndex,R=this.clearSelection,P=this.clearItems,M=this.reset,q=this.setItemCount,k=this.unsetItemCount,L=this.internalSetState;return{getRootProps:h,getToggleButtonProps:g,getLabelProps:w,getMenuProps:v,getInputProps:m,getItemProps:S,reset:M,openMenu:p,closeMenu:y,toggleMenu:I,selectItem:x,selectItemAtIndex:T,selectHighlightedItem:A,setHighlightedIndex:E,clearSelection:R,clearItems:P,setItemCount:q,unsetItemCount:k,setState:L,itemToString:d,id:l,highlightedIndex:s,inputValue:a,isOpen:f,selectedItem:c}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&lu(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(g){i.isMouseDown=!1;var w=Ao(g.target,[i._rootNode,i._menuNode],i.props.environment);!w&&i.getState().isOpen&&i.reset({type:Ad},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},f=function(){i.isTouchMove=!0},d=function(g){var w=Ao(g.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!w&&i.getState().isOpen&&i.reset({type:qd},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},l=this.props.environment;l.addEventListener("mousedown",s),l.addEventListener("mouseup",a),l.addEventListener("touchstart",c),l.addEventListener("touchmove",f),l.addEventListener("touchend",d),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),l.removeEventListener("mousedown",s),l.removeEventListener("mouseup",a),l.removeEventListener("touchstart",c),l.removeEventListener("touchmove",f),l.removeEventListener("touchend",d)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,f=s.highlightedIndex===void 0?i:s,d=f.highlightedIndex,l=c&&this.getState().isOpen&&!i.isOpen,h=c!==d;return l||h},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(Ra(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&lu(this._menuNode,this.getMenuProps)),To(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Ud,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=uu(this.props.children,_t);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=uu(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&&HI(s,this.getRootProps),s;if(Od(s))return b.cloneElement(s,this.getRootProps(Ed(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}(b.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:RI,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&DI(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:_t,onInputValueChange:_t,onUserAction:_t,onChange:_t,onSelect:_t,onOuterClick:_t,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Sd},e.stateChangeTypes=LI,e}();process.env.NODE_ENV!=="production"&&(VI.propTypes={children:H.func,defaultHighlightedIndex:H.number,defaultIsOpen:H.bool,initialHighlightedIndex:H.number,initialSelectedItem:H.any,initialInputValue:H.string,initialIsOpen:H.bool,getA11yStatusMessage:H.func,itemToString:H.func,onChange:H.func,onSelect:H.func,onStateChange:H.func,onInputValueChange:H.func,onUserAction:H.func,onOuterClick:H.func,selectedItemChanged:H.func,stateReducer:H.func,itemCount:H.number,id:H.string,environment:H.shape({addEventListener:H.func.isRequired,removeEventListener:H.func.isRequired,document:H.shape({createElement:H.func.isRequired,getElementById:H.func.isRequired,activeElement:H.any.isRequired,body:H.any.isRequired}).isRequired,Node:H.func.isRequired}),suppressRefError:H.bool,scrollIntoView:H.func,selectedItem:H.any,isOpen:H.bool,inputValue:H.string,highlightedIndex:H.number,labelId:H.string,inputId:H.string,menuId:H.string,getItemId:H.func});function lu(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 HI(e,t){var n=t.refKey,r=n!=="ref",o=!Od(e);o&&!r&&!iu.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+'"'),!iu.isForwardRef(e)&&!Ed(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Vd={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function BI(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){JI(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 JI(e,t,n,r){var o=t.props,i=t.type,s="on"+Pa(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function WI(e,t){return t.changes}var du=Aa(function(e,t){Nd(e,t)},200),zI=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?b.useLayoutEffect:b.useEffect,GI="useId"in b?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+b.useId();n||(n=c);var f=b.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 f.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+xd():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,f=b.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 f.current};function QI(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 Pa(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Hd(e){var t=b.useRef(e);return t.current=e,t}function XI(e,t,n,r){var o=b.useRef(),i=b.useRef(),s=b.useCallback(function(g,w){i.current=w,g=No(g,w.props);var v=e(g,w),m=w.props.stateReducer(g,he({},w,{changes:v}));return m},[e]),a=b.useReducer(s,t,n),c=a[0],f=a[1],d=Hd(t),l=b.useCallback(function(g){return f(he({props:d.current},g))},[d]),h=i.current;return b.useEffect(function(){var g=No(o.current,h==null?void 0:h.props),w=h&&o.current&&!r(g,c);w&&BI(h,g,c),o.current=c},[c,h,r]),[c,l]}var bi={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:WI,scrollIntoView:Sd,environment:typeof window>"u"?void 0:window};function zn(e,t,n){n===void 0&&(n=Vd);var r=e["default"+Pa(t)];return r!==void 0?r:n[t]}function Ii(e,t,n){n===void 0&&(n=Vd);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Pa(t)];return o!==void 0?o:zn(e,t,n)}function YI(e){var t=Ii(e,"selectedItem"),n=Ii(e,"isOpen"),r=rC(e),o=Ii(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 Ci(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,f=t.highlightedIndex;return r.length===0?-1:o!==void 0&&f===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 ZI(e,t,n){var r=b.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return b.useEffect(function(){if(!e)return _t;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,Ao(d.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function f(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!Ao(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",f),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",f)}},[n,e,t]),r.current}var Bd=function(){return _t};process.env.NODE_ENV!=="production"&&(Bd=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=b.useRef(n.reduce(function(s,a){return s[a]={},s},{}));b.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,f=a.refKey,d=a.elementRef;c||d!=null&&d.current||console.error('downshift: The ref prop "'+f+'" from '+s+" was not applied correctly on your element.")})},[]);var i=b.useCallback(function(s,a,c,f){o.current[s]={suppressRefError:a,refKey:c,elementRef:f}},[]);return i});function eC(e,t,n,r){r===void 0&&(r={});var o=r.document,i=Bo();b.useEffect(function(){if(!(!e||i||!o)){var s=e(t);du(s,o)}},n),b.useEffect(function(){return function(){du.cancel(),kI(o)}},[o])}function tC(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=b.useRef(!0);return zI(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Jd=_t;process.env.NODE_ENV!=="production"&&(Jd=function(t){var n=t.props,r=t.state,o=b.useRef(n),i=Bo();b.useEffect(function(){i||(Ra(r,o.current,n),o.current=n)},[r,n,i])});function fu(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:zn(e,"isOpen"),highlightedIndex:zn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function nC(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Bo(){var e=b.useRef(!0);return b.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Zs(e){var t=zn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function rC(e){var t=Ii(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var yo={environment:H.shape({addEventListener:H.func.isRequired,removeEventListener:H.func.isRequired,document:H.shape({createElement:H.func.isRequired,getElementById:H.func.isRequired,activeElement:H.any.isRequired,body:H.any.isRequired}).isRequired,Node:H.func.isRequired}),itemToString:H.func,itemToKey:H.func,stateReducer:H.func},Wd=he({},yo,{getA11yStatusMessage:H.func,highlightedIndex:H.number,defaultHighlightedIndex:H.number,initialHighlightedIndex:H.number,isOpen:H.bool,defaultIsOpen:H.bool,initialIsOpen:H.bool,selectedItem:H.any,initialSelectedItem:H.any,defaultSelectedItem:H.any,id:H.string,labelId:H.string,menuId:H.string,getItemId:H.func,toggleButtonId:H.string,onSelectedItemChange:H.func,onHighlightedIndexChange:H.func,onStateChange:H.func,onIsOpenChange:H.func,scrollIntoView:H.func});function iC(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:Ci(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:Ci(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:Zs(o),isOpen:zn(o,"isOpen"),selectedItem:zn(o,"selectedItem"),inputValue:zn(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}Zr(Zr({},Wd),{items:H.array.isRequired,isItemDisabled:H.func});Zr(Zr({},bi),{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 Fa=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Da=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ma=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,ka=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,La=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,ja=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Ka=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,$a=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Ua=process.env.NODE_ENV!=="production"?"__input_change__":8,Ro=process.env.NODE_ENV!=="production"?"__input_blur__":9,qa=process.env.NODE_ENV!=="production"?"__input_click__":10,zd=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Gd=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,Va=process.env.NODE_ENV!=="production"?"__item_click__":13,Qd=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Xd=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Yd=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Zd=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,ef=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,Ha=process.env.NODE_ENV!=="production"?"__function_select_item__":19,tf=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,nf=process.env.NODE_ENV!=="production"?"__function_reset__":21,Ba=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,rf=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:Ba,FunctionCloseMenu:Zd,FunctionOpenMenu:Yd,FunctionReset:nf,FunctionSelectItem:Ha,FunctionSetHighlightedIndex:ef,FunctionSetInputValue:tf,FunctionToggleMenu:Xd,InputBlur:Ro,InputChange:Ua,InputClick:qa,InputKeyDownArrowDown:Fa,InputKeyDownArrowUp:Da,InputKeyDownEnd:La,InputKeyDownEnter:$a,InputKeyDownEscape:Ma,InputKeyDownHome:ka,InputKeyDownPageDown:Ka,InputKeyDownPageUp:ja,ItemClick:Va,ItemMouseMove:Gd,MenuMouseLeave:zd,ToggleButtonClick:Qd});function oC(e){var t=YI(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 sC=he({},Wd,{items:H.array.isRequired,isItemDisabled:H.func,inputValue:H.string,defaultInputValue:H.string,initialInputValue:H.string,inputId:H.string,onInputValueChange:H.func});function aC(e,t,n,r){var o=b.useRef(),i=XI(e,t,n,r),s=i[0],a=i[1],c=Bo();return b.useEffect(function(){if(To(t,"selectedItem")){if(!c){var f=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);f&&a({type:Ba,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[No(s,t),a]}var of=_t;process.env.NODE_ENV!=="production"&&(of=function(t,n){H.checkPropTypes(sC,t,"prop",n.name)});var cC=he({},bi,{isItemDisabled:function(){return!1}});function uC(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case Va:s={isOpen:zn(o,"isOpen"),highlightedIndex:Zs(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Fa:e.isOpen?s={highlightedIndex:dr(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:Ci(o,e,1),isOpen:o.items.length>=0};break;case Da:e.isOpen?i?s=fu(o,e.highlightedIndex):s={highlightedIndex:dr(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:Ci(o,e,-1),isOpen:o.items.length>=0};break;case $a:s=fu(o,e.highlightedIndex);break;case Ma:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case ja:s={highlightedIndex:dr(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Ka:s={highlightedIndex:dr(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case ka:s={highlightedIndex:ei(0,!1,o.items,o.isItemDisabled)};break;case La:s={highlightedIndex:ei(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case Ro: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 Ua:s={isOpen:!0,highlightedIndex:Zs(o),inputValue:t.inputValue};break;case qa:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ci(o,e,0)};break;case Ha:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case Ba:s={inputValue:t.inputValue};break;default:return iC(e,t,rf)}return he({},e,s)}var lC=["onMouseLeave","refKey","ref"],dC=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],fC=["onClick","onPress","refKey","ref"],pC=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Ja.stateChangeTypes=rf;function Ja(e){e===void 0&&(e={}),of(e,Ja);var t=he({},cC,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=aC(uC,t,oC,nC),a=s[0],c=s[1],f=a.isOpen,d=a.highlightedIndex,l=a.selectedItem,h=a.inputValue,g=b.useRef(null),w=b.useRef({}),v=b.useRef(null),m=b.useRef(null),S=Bo(),p=GI(t),y=b.useRef(),I=Hd({state:a,props:t}),x=b.useCallback(function(J){return w.current[p.getItemId(J)]},[p]);eC(i,a,[f,d,l,h],o);var T=tC({menuElement:g.current,highlightedIndex:d,isOpen:f,itemRefs:w,scrollIntoView:r,getItemNodeFromIndex:x});Jd({props:t,state:a}),b.useEffect(function(){var J=Ii(t,"isOpen");J&&v.current&&v.current.focus()},[]),b.useEffect(function(){S||(y.current=n.length)});var A=ZI(o,b.useCallback(function(){I.current.state.isOpen&&c({type:Ro,selectItem:!1})},[c,I]),b.useMemo(function(){return[g,m,v]},[g.current,m.current,v.current])),E=Bd("getInputProps","getMenuProps");b.useEffect(function(){f||(w.current={})},[f]),b.useEffect(function(){var J;!f||!(o!=null&&o.document)||!(v!=null&&(J=v.current)!=null&&J.focus)||o.document.activeElement!==v.current&&v.current.focus()},[f,o]);var R=b.useMemo(function(){return{ArrowDown:function(B){B.preventDefault(),c({type:Fa,altKey:B.altKey})},ArrowUp:function(B){B.preventDefault(),c({type:Da,altKey:B.altKey})},Home:function(B){I.current.state.isOpen&&(B.preventDefault(),c({type:ka}))},End:function(B){I.current.state.isOpen&&(B.preventDefault(),c({type:La}))},Escape:function(B){var V=I.current.state;(V.isOpen||V.inputValue||V.selectedItem||V.highlightedIndex>-1)&&(B.preventDefault(),c({type:Ma}))},Enter:function(B){var V=I.current.state;!V.isOpen||B.which===229||(B.preventDefault(),c({type:$a}))},PageUp:function(B){I.current.state.isOpen&&(B.preventDefault(),c({type:ja}))},PageDown:function(B){I.current.state.isOpen&&(B.preventDefault(),c({type:Ka}))}}},[c,I]),P=b.useCallback(function(J){return he({id:p.labelId,htmlFor:p.inputId},J)},[p]),M=b.useCallback(function(J,B){var V,j=J===void 0?{}:J,Q=j.onMouseLeave,Z=j.refKey,Y=Z===void 0?"ref":Z,ee=j.ref,te=Sn(j,lC),le=B===void 0?{}:B,K=le.suppressRefError,we=K===void 0?!1:K;return E("getMenuProps",we,Y,g),he((V={},V[Y]=Fr(ee,function(W){g.current=W}),V.id=p.menuId,V.role="listbox",V["aria-labelledby"]=te&&te["aria-label"]?void 0:""+p.labelId,V.onMouseLeave=We(Q,function(){c({type:zd})}),V),te)},[c,E,p]),q=b.useCallback(function(J){var B,V,j=J===void 0?{}:J,Q=j.item,Z=j.index,Y=j.refKey,ee=Y===void 0?"ref":Y,te=j.ref,le=j.onMouseMove,K=j.onMouseDown,we=j.onClick;j.onPress;var W=j.disabled,ot=Sn(j,dC);W!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var _e=I.current,mt=_e.props,Je=_e.state,gt=QI(Q,Z,mt.items,"Pass either item or index to getItemProps!"),Ee=gt[0],et=gt[1],xt=mt.isItemDisabled(Ee,et),Ut="onClick",Rt=we,lt=function(){A.isTouchEnd||et===Je.highlightedIndex||(T.current=!1,c({type:Gd,index:et,disabled:xt}))},st=function(){c({type:Va,index:et})},Me=function(Pt){return Pt.preventDefault()};return he((B={},B[ee]=Fr(te,function(Ue){Ue&&(w.current[p.getItemId(et)]=Ue)}),B["aria-disabled"]=xt,B["aria-selected"]=et===Je.highlightedIndex,B.id=p.getItemId(et),B.role="option",B),!xt&&(V={},V[Ut]=We(Rt,st),V),{onMouseMove:We(le,lt),onMouseDown:We(K,Me)},ot)},[c,p,I,A,T]),k=b.useCallback(function(J){var B,V=J===void 0?{}:J,j=V.onClick;V.onPress;var Q=V.refKey,Z=Q===void 0?"ref":Q,Y=V.ref,ee=Sn(V,fC),te=I.current.state,le=function(){c({type:Qd})};return he((B={},B[Z]=Fr(Y,function(K){m.current=K}),B["aria-controls"]=p.menuId,B["aria-expanded"]=te.isOpen,B.id=p.toggleButtonId,B.tabIndex=-1,B),!ee.disabled&&he({},{onClick:We(j,le)}),ee)},[c,I,p]),L=b.useCallback(function(J,B){var V,j=J===void 0?{}:J,Q=j.onKeyDown,Z=j.onChange,Y=j.onInput,ee=j.onBlur;j.onChangeText;var te=j.onClick,le=j.refKey,K=le===void 0?"ref":le,we=j.ref,W=Sn(j,pC),ot=B===void 0?{}:B,_e=ot.suppressRefError,mt=_e===void 0?!1:_e;E("getInputProps",mt,K,v);var Je=I.current.state,gt=function(Me){var Ue=Xs(Me);Ue&&R[Ue]&&R[Ue](Me)},Ee=function(Me){c({type:Ua,inputValue:Me.target.value})},et=function(Me){if(o!=null&&o.document&&Je.isOpen&&!A.isMouseDown){var Ue=Me.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:Ro,selectItem:!Ue})}},xt=function(){c({type:qa})},Ut="onChange",Rt={};if(!W.disabled){var lt;Rt=(lt={},lt[Ut]=We(Z,Y,Ee),lt.onKeyDown=We(Q,gt),lt.onBlur=We(ee,et),lt.onClick=We(te,xt),lt)}return he((V={},V[K]=Fr(we,function(st){v.current=st}),V["aria-activedescendant"]=Je.isOpen&&Je.highlightedIndex>-1?p.getItemId(Je.highlightedIndex):"",V["aria-autocomplete"]="list",V["aria-controls"]=p.menuId,V["aria-expanded"]=Je.isOpen,V["aria-labelledby"]=W&&W["aria-label"]?void 0:p.labelId,V.autoComplete="off",V.id=p.inputId,V.role="combobox",V.value=Je.inputValue,V),Rt,W)},[c,p,o,R,I,A,E]),ae=b.useCallback(function(){c({type:Xd})},[c]),oe=b.useCallback(function(){c({type:Zd})},[c]),ge=b.useCallback(function(){c({type:Yd})},[c]),me=b.useCallback(function(J){c({type:ef,highlightedIndex:J})},[c]),Oe=b.useCallback(function(J){c({type:Ha,selectedItem:J})},[c]),F=b.useCallback(function(J){c({type:tf,inputValue:J})},[c]),U=b.useCallback(function(){c({type:nf})},[c]);return{getItemProps:q,getLabelProps:P,getMenuProps:M,getInputProps:L,getToggleButtonProps:k,toggleMenu:ae,openMenu:ge,closeMenu:oe,setHighlightedIndex:me,setInputValue:F,selectItem:Oe,reset:U,highlightedIndex:d,isOpen:f,selectedItem:l,inputValue:h}}yo.stateReducer,yo.itemToKey,yo.environment,H.array,H.array,H.array,H.func,H.number,H.number,H.number,H.func,H.func,H.string,H.string;bi.itemToKey,bi.stateReducer,bi.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 hC="_comboboxContainer_1lcc8_1",mC="_inputContainer_1lcc8_12",gC="_input_1lcc8_12",yC="_toggleButton_1lcc8_33",vC="_menu_1lcc8_39",wC="_menuBottom_1lcc8_55",bC="_menuTop_1lcc8_61",IC="_menuItem_1lcc8_66",CC="_highlighted_1lcc8_73",SC="_selected_1lcc8_77",xC="_hidden_1lcc8_81",Bt={comboboxContainer:hC,inputContainer:mC,input:gC,toggleButton:yC,menu:vC,menuBottom:wC,menuTop:bC,menuItem:IC,highlighted:CC,selected:SC,hidden:xC};function OC(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function sf({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,c]=b.useState(e),f=b.useRef(null);b.useEffect(()=>c(e),[e]);const d=b.useCallback(A=>{(A==null?void 0:A.length)>0?c(e.filter(OC(A))):c(e)},[e]),{isOpen:l,getToggleButtonProps:h,getMenuProps:g,getInputProps:w,highlightedIndex:v,getItemProps:m,setInputValue:S,selectedItem:p}=Ja({items:a,selectedItem:t?e.find(A=>A.value===t):null,itemToString:A=>(A==null?void 0:A.label)||"",onInputValueChange:({inputValue:A})=>d(A),onSelectedItemChange:({selectedItem:A})=>{var E;n(A),(E=f.current)==null||E.blur()}}),y=()=>{S(""),c(e)},I=()=>y(),x=b.useMemo(()=>{var A;return(A=e.find(E=>E.value===t))==null?void 0:A.label},[e,t]),T=()=>{t&&x&&t!==(p==null?void 0:p.value)&&S(x||"")};return u.jsxs("div",{style:{position:"relative",...i},children:[u.jsx("div",{className:Bt.comboboxContainer,children:u.jsxs("div",{className:Bt.inputContainer,children:[u.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:Bt.input,...w({onFocus:I,onBlur:T,ref:f})}),u.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:Bt.toggleButton,type:"button",...h(),children:l?u.jsx(u.Fragment,{children:"↑"}):u.jsx(u.Fragment,{children:"↓"})})]})}),u.jsx("ul",{className:`${Bt.menu} ${l&&e.length?"":Bt.hidden} ${s==="top"?Bt.menuTop:Bt.menuBottom}`,...g(),children:l&&a.map((A,E)=>u.jsx("li",{className:`${Bt.menuItem} ${v===E?Bt.highlighted:""} ${t===(A==null?void 0:A.value)?Bt.selected:""}`,...m({item:A,index:E}),children:u.jsx("span",{children:A.label})},A.id))})]})}const ti=Math.min,br=Math.max,Po=Math.round,uo=Math.floor,Qn=e=>({x:e,y:e}),EC={left:"right",right:"left",bottom:"top",top:"bottom"},_C={start:"end",end:"start"};function ea(e,t,n){return br(e,ti(t,n))}function Ki(e,t){return typeof e=="function"?e(t):e}function Er(e){return e.split("-")[0]}function $i(e){return e.split("-")[1]}function af(e){return e==="x"?"y":"x"}function Wa(e){return e==="y"?"height":"width"}function ni(e){return["top","bottom"].includes(Er(e))?"y":"x"}function za(e){return af(ni(e))}function NC(e,t,n){n===void 0&&(n=!1);const r=$i(e),o=za(e),i=Wa(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Fo(s)),[s,Fo(s)]}function TC(e){const t=Fo(e);return[ta(e),t,ta(t)]}function ta(e){return e.replace(/start|end/g,t=>_C[t])}function AC(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 RC(e,t,n,r){const o=$i(e);let i=AC(Er(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(ta)))),i}function Fo(e){return e.replace(/left|right|bottom|top/g,t=>EC[t])}function PC(e){return{top:0,right:0,bottom:0,left:0,...e}}function cf(e){return typeof e!="number"?PC(e):{top:e,right:e,bottom:e,left:e}}function Do(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 pu(e,t,n){let{reference:r,floating:o}=e;const i=ni(t),s=za(t),a=Wa(s),c=Er(t),f=i==="y",d=r.x+r.width/2-o.width/2,l=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let g;switch(c){case"top":g={x:d,y:r.y-o.height};break;case"bottom":g={x:d,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:l};break;case"left":g={x:r.x-o.width,y:l};break;default:g={x:r.x,y:r.y}}switch($i(t)){case"start":g[s]-=h*(n&&f?-1:1);break;case"end":g[s]+=h*(n&&f?-1:1);break}return g}const FC=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 f=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:l}=pu(f,r,c),h=r,g={},w=0;for(let v=0;v<a.length;v++){const{name:m,fn:S}=a[v],{x:p,y,data:I,reset:x}=await S({x:d,y:l,initialPlacement:r,placement:h,strategy:o,middlewareData:g,rects:f,platform:s,elements:{reference:e,floating:t}});d=p??d,l=y??l,g={...g,[m]:{...g[m],...I}},x&&w<=50&&(w++,typeof x=="object"&&(x.placement&&(h=x.placement),x.rects&&(f=x.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):x.rects),{x:d,y:l}=pu(f,h,c)),v=-1)}return{x:d,y:l,placement:h,strategy:o,middlewareData:g}};async function uf(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:f="clippingAncestors",rootBoundary:d="viewport",elementContext:l="floating",altBoundary:h=!1,padding:g=0}=Ki(t,e),w=cf(g),m=a[h?l==="floating"?"reference":"floating":l],S=Do(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(m)))==null||n?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:f,rootBoundary:d,strategy:c})),p=l==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),I=await(i.isElement==null?void 0:i.isElement(y))?await(i.getScale==null?void 0:i.getScale(y))||{x:1,y:1}:{x:1,y:1},x=Do(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:p,offsetParent:y,strategy:c}):p);return{top:(S.top-x.top+w.top)/I.y,bottom:(x.bottom-S.bottom+w.bottom)/I.y,left:(S.left-x.left+w.left)/I.x,right:(x.right-S.right+w.right)/I.x}}const DC=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:f,padding:d=0}=Ki(e,t)||{};if(f==null)return{};const l=cf(d),h={x:n,y:r},g=za(o),w=Wa(g),v=await s.getDimensions(f),m=g==="y",S=m?"top":"left",p=m?"bottom":"right",y=m?"clientHeight":"clientWidth",I=i.reference[w]+i.reference[g]-h[g]-i.floating[w],x=h[g]-i.reference[g],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let A=T?T[y]:0;(!A||!await(s.isElement==null?void 0:s.isElement(T)))&&(A=a.floating[y]||i.floating[w]);const E=I/2-x/2,R=A/2-v[w]/2-1,P=ti(l[S],R),M=ti(l[p],R),q=P,k=A-v[w]-M,L=A/2-v[w]/2+E,ae=ea(q,L,k),oe=!c.arrow&&$i(o)!=null&&L!==ae&&i.reference[w]/2-(L<q?P:M)-v[w]/2<0,ge=oe?L<q?L-q:L-k:0;return{[g]:h[g]+ge,data:{[g]:ae,centerOffset:L-ae-ge,...oe&&{alignmentOffset:ge}},reset:oe}}}),MC=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:f}=t,{mainAxis:d=!0,crossAxis:l=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:v=!0,...m}=Ki(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const S=Er(o),p=ni(a),y=Er(a)===a,I=await(c.isRTL==null?void 0:c.isRTL(f.floating)),x=h||(y||!v?[Fo(a)]:TC(a)),T=w!=="none";!h&&T&&x.push(...RC(a,v,w,I));const A=[a,...x],E=await uf(t,m),R=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&R.push(E[S]),l){const L=NC(o,s,I);R.push(E[L[0]],E[L[1]])}if(P=[...P,{placement:o,overflows:R}],!R.every(L=>L<=0)){var M,q;const L=(((M=i.flip)==null?void 0:M.index)||0)+1,ae=A[L];if(ae)return{data:{index:L,overflows:P},reset:{placement:ae}};let oe=(q=P.filter(ge=>ge.overflows[0]<=0).sort((ge,me)=>ge.overflows[1]-me.overflows[1])[0])==null?void 0:q.placement;if(!oe)switch(g){case"bestFit":{var k;const ge=(k=P.filter(me=>{if(T){const Oe=ni(me.placement);return Oe===p||Oe==="y"}return!0}).map(me=>[me.placement,me.overflows.filter(Oe=>Oe>0).reduce((Oe,F)=>Oe+F,0)]).sort((me,Oe)=>me[1]-Oe[1])[0])==null?void 0:k[0];ge&&(oe=ge);break}case"initialPlacement":oe=a;break}if(o!==oe)return{reset:{placement:oe}}}return{}}}};async function kC(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Er(n),a=$i(n),c=ni(n)==="y",f=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,l=Ki(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:w}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return a&&typeof w=="number"&&(g=a==="end"?w*-1:w),c?{x:g*d,y:h*f}:{x:h*f,y:g*d}}const LC=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 kC(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}}}}},jC=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:m=>{let{x:S,y:p}=m;return{x:S,y:p}}},...c}=Ki(e,t),f={x:n,y:r},d=await uf(t,c),l=ni(Er(o)),h=af(l);let g=f[h],w=f[l];if(i){const m=h==="y"?"top":"left",S=h==="y"?"bottom":"right",p=g+d[m],y=g-d[S];g=ea(p,g,y)}if(s){const m=l==="y"?"top":"left",S=l==="y"?"bottom":"right",p=w+d[m],y=w-d[S];w=ea(p,w,y)}const v=a.fn({...t,[h]:g,[l]:w});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[l]:s}}}}}};function Jo(){return typeof window<"u"}function di(e){return lf(e)?(e.nodeName||"").toLowerCase():"#document"}function Nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dn(e){var t;return(t=(lf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lf(e){return Jo()?e instanceof Node||e instanceof Nt(e).Node:!1}function Xt(e){return Jo()?e instanceof Element||e instanceof Nt(e).Element:!1}function un(e){return Jo()?e instanceof HTMLElement||e instanceof Nt(e).HTMLElement:!1}function hu(e){return!Jo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Nt(e).ShadowRoot}function Ui(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Yt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function KC(e){return["table","td","th"].includes(di(e))}function Wo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Ga(e){const t=Qa(),n=Xt(e)?Yt(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 $C(e){let t=Xn(e);for(;un(t)&&!ri(t);){if(Ga(t))return t;if(Wo(t))return null;t=Xn(t)}return null}function Qa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ri(e){return["html","body","#document"].includes(di(e))}function Yt(e){return Nt(e).getComputedStyle(e)}function zo(e){return Xt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xn(e){if(di(e)==="html")return e;const t=e.assignedSlot||e.parentNode||hu(e)&&e.host||dn(e);return hu(t)?t.host:t}function df(e){const t=Xn(e);return ri(t)?e.ownerDocument?e.ownerDocument.body:e.body:un(t)&&Ui(t)?t:df(t)}function Ni(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=df(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Nt(o);if(i){const a=na(s);return t.concat(s,s.visualViewport||[],Ui(o)?o:[],a&&n?Ni(a):[])}return t.concat(o,Ni(o,[],n))}function na(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ff(e){const t=Yt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=un(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Po(n)!==i||Po(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Xa(e){return Xt(e)?e:e.contextElement}function Mr(e){const t=Xa(e);if(!un(t))return Qn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ff(t);let s=(i?Po(n.width):n.width)/r,a=(i?Po(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const UC=Qn(0);function pf(e){const t=Nt(e);return!Qa()||!t.visualViewport?UC:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qC(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Nt(e)?!1:t}function _r(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Xa(e);let s=Qn(1);t&&(r?Xt(r)&&(s=Mr(r)):s=Mr(e));const a=qC(i,n,r)?pf(i):Qn(0);let c=(o.left+a.x)/s.x,f=(o.top+a.y)/s.y,d=o.width/s.x,l=o.height/s.y;if(i){const h=Nt(i),g=r&&Xt(r)?Nt(r):r;let w=h,v=na(w);for(;v&&r&&g!==w;){const m=Mr(v),S=v.getBoundingClientRect(),p=Yt(v),y=S.left+(v.clientLeft+parseFloat(p.paddingLeft))*m.x,I=S.top+(v.clientTop+parseFloat(p.paddingTop))*m.y;c*=m.x,f*=m.y,d*=m.x,l*=m.y,c+=y,f+=I,w=Nt(v),v=na(w)}}return Do({width:d,height:l,x:c,y:f})}function VC(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=dn(r),a=t?Wo(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},f=Qn(1);const d=Qn(0),l=un(r);if((l||!l&&!i)&&((di(r)!=="body"||Ui(s))&&(c=zo(r)),un(r))){const h=_r(r);f=Mr(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+d.x,y:n.y*f.y-c.scrollTop*f.y+d.y}}function HC(e){return Array.from(e.getClientRects())}function ra(e,t){const n=zo(e).scrollLeft;return t?t.left+n:_r(dn(e)).left+n}function BC(e){const t=dn(e),n=zo(e),r=e.ownerDocument.body,o=br(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=br(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+ra(e);const a=-n.scrollTop;return Yt(r).direction==="rtl"&&(s+=br(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function JC(e,t){const n=Nt(e),r=dn(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const f=Qa();(!f||f&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function WC(e,t){const n=_r(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=un(e)?Mr(e):Qn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,f=r*i.y;return{width:s,height:a,x:c,y:f}}function mu(e,t,n){let r;if(t==="viewport")r=JC(e,n);else if(t==="document")r=BC(dn(e));else if(Xt(t))r=WC(t,n);else{const o=pf(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Do(r)}function hf(e,t){const n=Xn(e);return n===t||!Xt(n)||ri(n)?!1:Yt(n).position==="fixed"||hf(n,t)}function zC(e,t){const n=t.get(e);if(n)return n;let r=Ni(e,[],!1).filter(a=>Xt(a)&&di(a)!=="body"),o=null;const i=Yt(e).position==="fixed";let s=i?Xn(e):e;for(;Xt(s)&&!ri(s);){const a=Yt(s),c=Ga(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Ui(s)&&!c&&hf(e,s))?r=r.filter(d=>d!==s):o=a,s=Xn(s)}return t.set(e,r),r}function GC(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Wo(t)?[]:zC(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((f,d)=>{const l=mu(t,d,o);return f.top=br(l.top,f.top),f.right=ti(l.right,f.right),f.bottom=ti(l.bottom,f.bottom),f.left=br(l.left,f.left),f},mu(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function QC(e){const{width:t,height:n}=ff(e);return{width:t,height:n}}function XC(e,t,n){const r=un(t),o=dn(t),i=n==="fixed",s=_r(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Qn(0);if(r||!r&&!i)if((di(t)!=="body"||Ui(o))&&(a=zo(t)),r){const g=_r(t,!0,i,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}else o&&(c.x=ra(o));let f=0,d=0;if(o&&!r&&!i){const g=o.getBoundingClientRect();d=g.top+a.scrollTop,f=g.left+a.scrollLeft-ra(o,g)}const l=s.left+a.scrollLeft-c.x-f,h=s.top+a.scrollTop-c.y-d;return{x:l,y:h,width:s.width,height:s.height}}function ws(e){return Yt(e).position==="static"}function gu(e,t){if(!un(e)||Yt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return dn(e)===n&&(n=n.ownerDocument.body),n}function mf(e,t){const n=Nt(e);if(Wo(e))return n;if(!un(e)){let o=Xn(e);for(;o&&!ri(o);){if(Xt(o)&&!ws(o))return o;o=Xn(o)}return n}let r=gu(e,t);for(;r&&KC(r)&&ws(r);)r=gu(r,t);return r&&ri(r)&&ws(r)&&!Ga(r)?n:r||$C(e)||n}const YC=async function(e){const t=this.getOffsetParent||mf,n=this.getDimensions,r=await n(e.floating);return{reference:XC(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ZC(e){return Yt(e).direction==="rtl"}const eS={convertOffsetParentRelativeRectToViewportRelativeRect:VC,getDocumentElement:dn,getClippingRect:GC,getOffsetParent:mf,getElementRects:YC,getClientRects:HC,getDimensions:QC,getScale:Mr,isElement:Xt,isRTL:ZC};function tS(e,t){let n=null,r;const o=dn(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:f,top:d,width:l,height:h}=e.getBoundingClientRect();if(a||t(),!l||!h)return;const g=uo(d),w=uo(o.clientWidth-(f+l)),v=uo(o.clientHeight-(d+h)),m=uo(f),p={rootMargin:-g+"px "+-w+"px "+-v+"px "+-m+"px",threshold:br(0,ti(1,c))||1};let y=!0;function I(x){const T=x[0].intersectionRatio;if(T!==c){if(!y)return s();T?s(!1,T):r=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{n=new IntersectionObserver(I,{...p,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,p)}n.observe(e)}return s(!0),i}function nS(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,f=Xa(e),d=o||i?[...f?Ni(f):[],...Ni(t)]:[];d.forEach(S=>{o&&S.addEventListener("scroll",n,{passive:!0}),i&&S.addEventListener("resize",n)});const l=f&&a?tS(f,n):null;let h=-1,g=null;s&&(g=new ResizeObserver(S=>{let[p]=S;p&&p.target===f&&g&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=g)==null||y.observe(t)})),n()}),f&&!c&&g.observe(f),g.observe(t));let w,v=c?_r(e):null;c&&m();function m(){const S=_r(e);v&&(S.x!==v.x||S.y!==v.y||S.width!==v.width||S.height!==v.height)&&n(),v=S,w=requestAnimationFrame(m)}return n(),()=>{var S;d.forEach(p=>{o&&p.removeEventListener("scroll",n),i&&p.removeEventListener("resize",n)}),l==null||l(),(S=g)==null||S.disconnect(),g=null,c&&cancelAnimationFrame(w)}}const rS=LC,iS=jC,oS=MC,sS=DC,yu=(e,t,n)=>{const r=new Map,o={platform:eS,...n},i={...o.platform,_c:r};return FC(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 aS="react-tooltip-core-styles",cS="react-tooltip-base-styles",yu={core:!1,base:!1};function vu({css:e,id:t=cS,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||yu[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=aS),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)),yu[n]=!0}const wu=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[rS(Number(o)),oS({fallbackAxisSideDirection:"start"}),iS({padding:5})],border:a,arrowSize:c=8})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const f=s;return n?(f.push(sS({element:n,padding:5})),gu(e,t,{placement:r,strategy:i,middleware:f}).then(({x:d,y:l,placement:m,middlewareData:y})=>{var w,v;const p={left:`${d}px`,top:`${l}px`,border:a},{x:S,y:h}=(w=y.arrow)!==null&&w!==void 0?w:{x:0,y:0},g=(v={top:"bottom",right:"left",bottom:"top",left:"right"}[m.split("-")[0]])!==null&&v!==void 0?v:"bottom",I=a&&{borderBottom:a,borderRight:a};let x=0;if(a){const T=`${a}`.match(/(\d+)px/);x=T!=null&&T[1]?Number(T[1]):1}return{tooltipStyles:p,tooltipArrowStyles:{left:S!=null?`${S}px`:"",top:h!=null?`${h}px`:"",right:"",bottom:"",...I,[g]:`-${c/2+x}px`},place:m}})):gu(e,t,{placement:"bottom",strategy:i,middleware:f}).then(({x:d,y:l,placement:m})=>({tooltipStyles:{left:`${d}px`,top:`${l}px`},tooltipArrowStyles:{},place:m}))},bu=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Iu=(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},Cu=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",ia=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>ia(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Cu(e)||!Cu(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>ia(e[o],t[o]))},uS=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"})},Su=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(uS(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},lS=typeof window<"u"?b.useLayoutEffect:b.useEffect,Lt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},dS="DEFAULT_TOOLTIP_ID",fS={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},pS=b.createContext({getTooltipData:()=>fS});function gf(e=dS){return b.useContext(pS).getTooltipData(e)}var Pr={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"},bs={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 hS=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:c=10,events:f=["hover"],openOnClick:d=!1,positionStrategy:l="absolute",middlewares:m,wrapper:y,delayShow:w=0,delayHide:v=0,float:p=!1,hidden:S=!1,noArrow:h=!1,clickable:g=!1,closeOnEsc:I=!1,closeOnScroll:x=!1,closeOnResize:T=!1,openEvents:E,closeEvents:A,globalCloseEvents:R,imperativeModeOnly:P,style:K,position:q,afterShow:j,afterHide:$,disableTooltip:ae,content:oe,contentWrapperRef:ge,isOpen:me,defaultIsOpen:Oe=!1,setIsOpen:F,activeAnchor:U,setActiveAnchor:J,border:B,opacity:V,arrowColor:M,arrowSize:Q=8,role:Z="tooltip"})=>{var Y;const ee=b.useRef(null),te=b.useRef(null),le=b.useRef(null),k=b.useRef(null),we=b.useRef(null),[W,ot]=b.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[_e,mt]=b.useState(!1),[Je,gt]=b.useState(!1),[Ee,et]=b.useState(null),xt=b.useRef(!1),qt=b.useRef(null),{anchorRefs:Pt,setActiveAnchor:lt}=gf(t),st=b.useRef(!1),[Me,Ue]=b.useState([]),Ft=b.useRef(!1),tt=d||f.includes("click"),Ar=tt||(E==null?void 0:E.click)||(E==null?void 0:E.dblclick)||(E==null?void 0:E.mousedown),pn=E?{...E}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!E&&tt&&Object.assign(pn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const hn=A?{...A}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!A&&tt&&Object.assign(hn,{mouseleave:!1,blur:!1,mouseout:!1});const yt=R?{...R}:{escape:I||!1,scroll:x||!1,resize:T||!1,clickOutsideAnchor:Ar||!1};P&&(Object.assign(pn,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(hn,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(yt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),lS(()=>(Ft.current=!0,()=>{Ft.current=!1}),[]);const Te=z=>{Ft.current&&(z&&gt(!0),setTimeout(()=>{Ft.current&&(F==null||F(z),me===void 0&&mt(z))},10))};b.useEffect(()=>{if(me===void 0)return()=>null;me&&gt(!0);const z=setTimeout(()=>{mt(me)},10);return()=>{clearTimeout(z)}},[me]),b.useEffect(()=>{if(_e!==xt.current)if(Lt(we),xt.current=_e,_e)j==null||j();else{const z=(se=>{const ce=se.match(/^([\d.]+)(ms|s)$/);if(!ce)return 0;const[,Le,Ve]=ce;return Number(Le)*(Ve==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));we.current=setTimeout(()=>{gt(!1),et(null),$==null||$()},z+25)}},[_e]);const or=z=>{ot(se=>ia(se,z)?se:z)},Tn=(z=w)=>{Lt(le),Je?Te(!0):le.current=setTimeout(()=>{Te(!0)},z)},An=(z=v)=>{Lt(k),k.current=setTimeout(()=>{st.current||Te(!1)},z)},Ot=z=>{var se;if(!z)return;const ce=(se=z.currentTarget)!==null&&se!==void 0?se:z.target;if(!(ce!=null&&ce.isConnected))return J(null),void lt({current:null});w?Tn():Te(!0),J(ce),lt({current:ce}),Lt(k)},mn=()=>{g?An(v||100):v?An():Te(!1),Lt(le)},Rn=({x:z,y:se})=>{var ce;const Le={getBoundingClientRect:()=>({x:z,y:se,width:0,height:0,top:se,left:z,right:z,bottom:se})};wu({place:(ce=Ee==null?void 0:Ee.place)!==null&&ce!==void 0?ce:a,offset:c,elementReference:Le,tooltipReference:ee.current,tooltipArrowReference:te.current,strategy:l,middlewares:m,border:B,arrowSize:Q}).then(Ve=>{or(Ve)})},Pn=z=>{if(!z)return;const se=z,ce={x:se.clientX,y:se.clientY};Rn(ce),qt.current=ce},gn=z=>{var se;if(!_e)return;const ce=z.target;ce.isConnected&&(!((se=ee.current)===null||se===void 0)&&se.contains(ce)||[document.querySelector(`[id='${i}']`),...Me].some(Le=>Le==null?void 0:Le.contains(ce))||(Te(!1),Lt(le)))},nn=Iu(Ot,50),ke=Iu(mn,50),at=z=>{ke.cancel(),nn(z)},re=()=>{nn.cancel(),ke()},fe=b.useCallback(()=>{var z,se;const ce=(z=Ee==null?void 0:Ee.position)!==null&&z!==void 0?z:q;ce?Rn(ce):p?qt.current&&Rn(qt.current):U!=null&&U.isConnected&&wu({place:(se=Ee==null?void 0:Ee.place)!==null&&se!==void 0?se:a,offset:c,elementReference:U,tooltipReference:ee.current,tooltipArrowReference:te.current,strategy:l,middlewares:m,border:B,arrowSize:Q}).then(Le=>{Ft.current&&or(Le)})},[_e,U,oe,K,a,Ee==null?void 0:Ee.place,c,l,q,Ee==null?void 0:Ee.position,p,Q]);b.useEffect(()=>{var z,se;const ce=new Set(Pt);Me.forEach(ve=>{ae!=null&&ae(ve)||ce.add({current:ve})});const Le=document.querySelector(`[id='${i}']`);Le&&!(ae!=null&&ae(Le))&&ce.add({current:Le});const Ve=()=>{Te(!1)},Ge=Su(U),Dt=Su(ee.current);yt.scroll&&(window.addEventListener("scroll",Ve),Ge==null||Ge.addEventListener("scroll",Ve),Dt==null||Dt.addEventListener("scroll",Ve));let nt=null;yt.resize?window.addEventListener("resize",Ve):U&&ee.current&&(nt=nS(U,ee.current,fe,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const vt=ve=>{ve.key==="Escape"&&Te(!1)};yt.escape&&window.addEventListener("keydown",vt),yt.clickOutsideAnchor&&window.addEventListener("click",gn);const Ne=[],Fn=ve=>!!(ve!=null&&ve.target&&(U!=null&&U.contains(ve.target))),Vt=ve=>{_e&&Fn(ve)||Ot(ve)},Zo=ve=>{_e&&Fn(ve)&&mn()},Hi=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Bi=["click","dblclick","mousedown","mouseup"];Object.entries(pn).forEach(([ve,Ht])=>{Ht&&(Hi.includes(ve)?Ne.push({event:ve,listener:at}):Bi.includes(ve)&&Ne.push({event:ve,listener:Vt}))}),Object.entries(hn).forEach(([ve,Ht])=>{Ht&&(Hi.includes(ve)?Ne.push({event:ve,listener:re}):Bi.includes(ve)&&Ne.push({event:ve,listener:Zo}))}),p&&Ne.push({event:"pointermove",listener:Pn});const Ji=()=>{st.current=!0},Wi=()=>{st.current=!1,mn()},rn=g&&(hn.mouseout||hn.mouseleave);return rn&&((z=ee.current)===null||z===void 0||z.addEventListener("mouseover",Ji),(se=ee.current)===null||se===void 0||se.addEventListener("mouseout",Wi)),Ne.forEach(({event:ve,listener:Ht})=>{ce.forEach(pi=>{var sr;(sr=pi.current)===null||sr===void 0||sr.addEventListener(ve,Ht)})}),()=>{var ve,Ht;yt.scroll&&(window.removeEventListener("scroll",Ve),Ge==null||Ge.removeEventListener("scroll",Ve),Dt==null||Dt.removeEventListener("scroll",Ve)),yt.resize?window.removeEventListener("resize",Ve):nt==null||nt(),yt.clickOutsideAnchor&&window.removeEventListener("click",gn),yt.escape&&window.removeEventListener("keydown",vt),rn&&((ve=ee.current)===null||ve===void 0||ve.removeEventListener("mouseover",Ji),(Ht=ee.current)===null||Ht===void 0||Ht.removeEventListener("mouseout",Wi)),Ne.forEach(({event:pi,listener:sr})=>{ce.forEach(es=>{var Dn;(Dn=es.current)===null||Dn===void 0||Dn.removeEventListener(pi,sr)})})}},[U,fe,Je,Pt,Me,E,A,R,tt,w,v]),b.useEffect(()=>{var z,se;let ce=(se=(z=Ee==null?void 0:Ee.anchorSelect)!==null&&z!==void 0?z:s)!==null&&se!==void 0?se:"";!ce&&t&&(ce=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Le=new MutationObserver(Ve=>{const Ge=[],Dt=[];Ve.forEach(nt=>{if(nt.type==="attributes"&&nt.attributeName==="data-tooltip-id"&&(nt.target.getAttribute("data-tooltip-id")===t?Ge.push(nt.target):nt.oldValue===t&&Dt.push(nt.target)),nt.type==="childList"){if(U){const vt=[...nt.removedNodes].filter(Ne=>Ne.nodeType===1);if(ce)try{Dt.push(...vt.filter(Ne=>Ne.matches(ce))),Dt.push(...vt.flatMap(Ne=>[...Ne.querySelectorAll(ce)]))}catch{}vt.some(Ne=>{var Fn;return!!(!((Fn=Ne==null?void 0:Ne.contains)===null||Fn===void 0)&&Fn.call(Ne,U))&&(gt(!1),Te(!1),J(null),Lt(le),Lt(k),!0)})}if(ce)try{const vt=[...nt.addedNodes].filter(Ne=>Ne.nodeType===1);Ge.push(...vt.filter(Ne=>Ne.matches(ce))),Ge.push(...vt.flatMap(Ne=>[...Ne.querySelectorAll(ce)]))}catch{}}}),(Ge.length||Dt.length)&&Ue(nt=>[...nt.filter(vt=>!Dt.includes(vt)),...Ge])});return Le.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Le.disconnect()}},[t,s,Ee==null?void 0:Ee.anchorSelect,U]),b.useEffect(()=>{fe()},[fe]),b.useEffect(()=>{if(!(ge!=null&&ge.current))return()=>null;const z=new ResizeObserver(()=>{setTimeout(()=>fe())});return z.observe(ge.current),()=>{z.disconnect()}},[oe,ge==null?void 0:ge.current]),b.useEffect(()=>{var z;const se=document.querySelector(`[id='${i}']`),ce=[...Me,se];U&&ce.includes(U)||J((z=Me[0])!==null&&z!==void 0?z:se)},[i,Me,U]),b.useEffect(()=>(Oe&&Te(!0),()=>{Lt(le),Lt(k)}),[]),b.useEffect(()=>{var z;let se=(z=Ee==null?void 0:Ee.anchorSelect)!==null&&z!==void 0?z:s;if(!se&&t&&(se=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),se)try{const ce=Array.from(document.querySelectorAll(se));Ue(ce)}catch{Ue([])}},[t,s,Ee==null?void 0:Ee.anchorSelect]),b.useEffect(()=>{le.current&&(Lt(le),Tn(w))},[w]);const dt=(Y=Ee==null?void 0:Ee.content)!==null&&Y!==void 0?Y:oe,yn=_e&&Object.keys(W.tooltipStyles).length>0;return b.useImperativeHandle(e,()=>({open:z=>{if(z!=null&&z.anchorSelect)try{document.querySelector(z.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${z.anchorSelect}" is not a valid CSS selector`)}et(z??null),z!=null&&z.delay?Tn(z.delay):Te(!0)},close:z=>{z!=null&&z.delay?An(z.delay):Te(!1)},activeAnchor:U,place:W.place,isOpen:!!(Je&&!S&&dt&&yn)})),Je&&!S&&dt?b.createElement(y,{id:t,role:Z,className:$t("react-tooltip",Pr.tooltip,bs.tooltip,bs[o],n,`react-tooltip__place-${W.place}`,Pr[yn?"show":"closing"],yn?"react-tooltip__show":"react-tooltip__closing",l==="fixed"&&Pr.fixed,g&&Pr.clickable),onTransitionEnd:z=>{Lt(we),_e||z.propertyName!=="opacity"||(gt(!1),et(null),$==null||$())},style:{...K,...W.tooltipStyles,opacity:V!==void 0&&yn?V:void 0},ref:ee},dt,b.createElement(y,{className:$t("react-tooltip-arrow",Pr.arrow,bs.arrow,r,h&&Pr.noArrow),style:{...W.tooltipArrowStyles,background:M?`linear-gradient(to right bottom, transparent 50%, ${M} 50%)`:void 0,"--rt-arrow-size":`${Q}px`},ref:te})):null},mS=({content:e})=>b.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),gS=b.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:f="top",offset:d=10,wrapper:l="div",children:m=null,events:y=["hover"],openOnClick:w=!1,positionStrategy:v="absolute",middlewares:p,delayShow:S=0,delayHide:h=0,float:g=!1,hidden:I=!1,noArrow:x=!1,clickable:T=!1,closeOnEsc:E=!1,closeOnScroll:A=!1,closeOnResize:R=!1,openEvents:P,closeEvents:K,globalCloseEvents:q,imperativeModeOnly:j=!1,style:$,position:ae,isOpen:oe,defaultIsOpen:ge=!1,disableStyleInjection:me=!1,border:Oe,opacity:F,arrowColor:U,arrowSize:J,setIsOpen:B,afterShow:V,afterHide:M,disableTooltip:Q,role:Z="tooltip"},Y)=>{const[ee,te]=b.useState(r),[le,k]=b.useState(o),[we,W]=b.useState(f),[ot,_e]=b.useState(c),[mt,Je]=b.useState(d),[gt,Ee]=b.useState(S),[et,xt]=b.useState(h),[qt,Pt]=b.useState(g),[lt,st]=b.useState(I),[Me,Ue]=b.useState(l),[Ft,tt]=b.useState(y),[Ar,pn]=b.useState(v),[hn,yt]=b.useState(null),[Te,or]=b.useState(null),Tn=b.useRef(me),{anchorRefs:An,activeAnchor:Ot}=gf(e),mn=ke=>ke==null?void 0:ke.getAttributeNames().reduce((at,re)=>{var fe;return re.startsWith("data-tooltip-")&&(at[re.replace(/^data-tooltip-/,"")]=(fe=ke==null?void 0:ke.getAttribute(re))!==null&&fe!==void 0?fe:null),at},{}),Rn=ke=>{const at={place:re=>{var fe;W((fe=re)!==null&&fe!==void 0?fe:f)},content:re=>{te(re??r)},html:re=>{k(re??o)},variant:re=>{var fe;_e((fe=re)!==null&&fe!==void 0?fe:c)},offset:re=>{Je(re===null?d:Number(re))},wrapper:re=>{var fe;Ue((fe=re)!==null&&fe!==void 0?fe:l)},events:re=>{const fe=re==null?void 0:re.split(" ");tt(fe??y)},"position-strategy":re=>{var fe;pn((fe=re)!==null&&fe!==void 0?fe:v)},"delay-show":re=>{Ee(re===null?S:Number(re))},"delay-hide":re=>{xt(re===null?h:Number(re))},float:re=>{Pt(re===null?g:re==="true")},hidden:re=>{st(re===null?I:re==="true")},"class-name":re=>{yt(re)}};Object.values(at).forEach(re=>re(null)),Object.entries(ke).forEach(([re,fe])=>{var dt;(dt=at[re])===null||dt===void 0||dt.call(at,fe)})};b.useEffect(()=>{te(r)},[r]),b.useEffect(()=>{k(o)},[o]),b.useEffect(()=>{W(f)},[f]),b.useEffect(()=>{_e(c)},[c]),b.useEffect(()=>{Je(d)},[d]),b.useEffect(()=>{Ee(S)},[S]),b.useEffect(()=>{xt(h)},[h]),b.useEffect(()=>{Pt(g)},[g]),b.useEffect(()=>{st(I)},[I]),b.useEffect(()=>{pn(v)},[v]),b.useEffect(()=>{Tn.current!==me&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[me]),b.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:me==="core",disableBase:me}}))},[]),b.useEffect(()=>{var ke;const at=new Set(An);let re=n;if(!re&&e&&(re=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),re)try{document.querySelectorAll(re).forEach(se=>{at.add({current:se})})}catch{console.warn(`[react-tooltip] "${re}" is not a valid CSS selector`)}const fe=document.querySelector(`[id='${t}']`);if(fe&&at.add({current:fe}),!at.size)return()=>null;const dt=(ke=Te??fe)!==null&&ke!==void 0?ke:Ot.current,yn=new MutationObserver(se=>{se.forEach(ce=>{var Le;if(!dt||ce.type!=="attributes"||!(!((Le=ce.attributeName)===null||Le===void 0)&&Le.startsWith("data-tooltip-")))return;const Ve=mn(dt);Rn(Ve)})}),z={attributes:!0,childList:!1,subtree:!1};if(dt){const se=mn(dt);Rn(se),yn.observe(dt,z)}return()=>{yn.disconnect()}},[An,Ot,Te,t,n]),b.useEffect(()=>{$!=null&&$.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),Oe&&!bu("border",`${Oe}`)&&console.warn(`[react-tooltip] "${Oe}" is not a valid \`border\`.`),$!=null&&$.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),F&&!bu("opacity",`${F}`)&&console.warn(`[react-tooltip] "${F}" is not a valid \`opacity\`.`)},[]);let Pn=m;const gn=b.useRef(null);if(i){const ke=i({content:(Te==null?void 0:Te.getAttribute("data-tooltip-content"))||ee||null,activeAnchor:Te});Pn=ke?b.createElement("div",{ref:gn,className:"react-tooltip-content-wrapper"},ke):null}else ee&&(Pn=ee);le&&(Pn=b.createElement(mS,{content:le}));const nn={forwardRef:Y,id:e,anchorId:t,anchorSelect:n,className:$t(s,hn),classNameArrow:a,content:Pn,contentWrapperRef:gn,place:we,variant:ot,offset:mt,wrapper:Me,events:Ft,openOnClick:w,positionStrategy:Ar,middlewares:p,delayShow:gt,delayHide:et,float:qt,hidden:lt,noArrow:x,clickable:T,closeOnEsc:E,closeOnScroll:A,closeOnResize:R,openEvents:P,closeEvents:K,globalCloseEvents:q,imperativeModeOnly:j,style:$,position:ae,isOpen:oe,defaultIsOpen:ge,border:Oe,opacity:F,arrowColor:U,arrowSize:J,setIsOpen:B,afterShow:V,afterHide:M,disableTooltip:Q,activeAnchor:Te,setActiveAnchor:ke=>or(ke),role:Z};return b.createElement(hS,{...nn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||vu({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s;--rt-arrow-size:8px}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit;z-index:-1}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||vu({css:`
51
- .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:var(--rt-arrow-size);height:var(--rt-arrow-size)}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function yS(){return u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[u.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[u.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),u.jsx("defs",{children:u.jsx("clipPath",{id:"clip0_2896_16290",children:u.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function yf({id:e,tooltipText:t}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:yS()}),u.jsx(gS,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function vS(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=!td(o,n);e.read.isRequiredMapFieldsModified=s}}function Ai(e,t,n){t(e,r=>vS(r,n))}const wS="Each field must be mapped to a unique value";function Xa({field:e,onSelectChange:t,allFields:n}){var h;const{configureState:r,selectedObjectName:o,setConfigureState:i}=tn(),[s,a]=b.useState(!0),{isError:c,removeError:f,getError:d}=Ut(),l=(h=r==null?void 0:r.read)==null?void 0:h.selectedFieldMappings,m=l==null?void 0:l[e.mapToName];b.useEffect(()=>{e._default&&!m&&o&&r&&Ai(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,m,r]);const y=b.useMemo(()=>n.map(g=>({id:g.fieldName,label:g.displayName,value:g.fieldName})),[n]),w=u.jsx(sf,{disabled:s,items:y,selectedValue:m||null,onSelectedItemChange:g=>{t({target:{name:e.mapToName,value:g==null?void 0:g.value}})},placeholder:"Please select one",style:{width:"100%"}}),v=b.useCallback(()=>{o&&(Ai(o,i,[{field:e.mapToName,value:null}]),c(ue.MAPPING,o)&&f(ue.MAPPING,o))},[e.mapToName,o,i,c,f]),{hasDuplicationError:p,errorMessage:S}=b.useMemo(()=>{const g=d(ue.MAPPING,o),I=Array.isArray(g)&&g.length>0&&g.includes(e.mapToName);return{hasDuplicationError:I,errorMessage:I?wS:""}},[o,d,e.mapToName]);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[u.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),u.jsx("span",{children:(e==null?void 0:e.prompt)&&u.jsx(yf,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[w,u.jsx(Be,{type:"button",variant:"ghost",onClick:v,children:"Clear"})]})]},e.mapToName),p&&u.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",S," "]},e.mapToName)]})}const bS="_formControl_9qd8d_1",IS="_formLabel_9qd8d_5",CS="_formLabelRequired_9qd8d_11",SS="_formInput_9qd8d_16",xS="_formInputInvalid_9qd8d_20",OS="_formError_9qd8d_24",ES="_disabled_9qd8d_30",ur={formControl:bS,formLabel:IS,formLabelRequired:CS,formInput:SS,formInputInvalid:xS,formError:OS,disabled:ES};function Go({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return u.jsxs("div",{className:$t(ur.formControl,{[ur.disabled]:r}),children:[t&&u.jsx("label",{htmlFor:e,className:$t(ur.formLabel,{[ur.formLabelRequired]:n}),children:t}),u.jsx("div",{id:e,className:$t(ur.formInput,{[ur.formInputInvalid]:o}),children:s}),o&&i&&u.jsx("div",{className:ur.formError,role:"alert",children:i})]})}function vf({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 _S({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>u.jsx(Go,{id:r.mapToName,children:u.jsx(Xa,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function NS(){var w,v;const{selectedObjectName:e,configureState:t,setConfigureState:n}=tn(),{isError:r,removeError:o,setError:i}=Ut(),s=((w=t==null?void 0:t.read)==null?void 0:w.allFields)||[],{fieldMapping:a}=Ze(),c=(v=t==null?void 0:t.read)==null?void 0:v.selectedFieldMappings,f=p=>{const{value:S,name:h}=p.target;!S||vf({selectedFieldMappings:c,selectedObjectName:e,fieldName:h,fieldValue:S,setError:i})||(e&&Ai(e,n,[{field:h,value:S}]),r(ue.MAPPING,h)&&o(ue.MAPPING,h),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},d=b.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(p=>!p.fieldName),[a,e]),l=b.useMemo(()=>{var h;return(((h=t==null?void 0:t.read)==null?void 0:h.optionalMapFields)||[]).filter(g=>!d.some(I=>I.mapToName===g.mapToName))},[t,d]),m=d.length>0;return l.length>0||m?u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Map the following optional fields"}),u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[l==null?void 0:l.map(p=>u.jsx(Go,{id:p.mapToName,children:u.jsx(Xa,{allFields:s,field:p,onSelectChange:f})},p.mapToName)),m&&u.jsx(_S,{dynamicFieldMappings:d,onSelectChange:f,allFields:s})]})]}):null}function TS(){var f;const{selectedObjectName:e,configureState:t,setConfigureState:n}=tn(),{isError:r,removeError:o,setError:i}=Ut(),s=(f=t==null?void 0:t.read)==null?void 0:f.selectedFieldMappings,a=d=>{const{value:l,name:m}=d.target;!l||vf({selectedFieldMappings:s,selectedObjectName:e,fieldName:m,fieldValue:l,setError:i})||(e&&Ai(e,n,[{field:m,value:l}]),r(ue.MAPPING,m)&&o(ue.MAPPING,m),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},c=b.useMemo(()=>{var d;return((d=t==null?void 0:t.read)==null?void 0:d.requiredMapFields)||[]},[t]);return c!=null&&c.length?u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Map the following fields"}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(d=>{var l;return u.jsx(Go,{id:d.mapToName,isInvalid:r(ue.MAPPING,d.mapToName),errorMessage:"* required",children:u.jsx(Xa,{allFields:((l=t==null?void 0:t.read)==null?void 0:l.allFields)||[],field:d,onSelectChange:a})},d.mapToName)})})]}):null}const AS=(e,t)=>e.filter(n=>!t.has(n));function RS(){var m,y,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=tn(),{fieldMapping:r}=Ze(),o=((m=t==null?void 0:t.read)==null?void 0:m.selectedFieldMappings)||{},i=Object.keys(o),s=((y=t==null?void 0:t.read)==null?void 0:y.requiredMapFields)||[],a=((w=t==null?void 0:t.read)==null?void 0:w.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(v=>!v.fieldName):[],f=s.concat(c,a).map(v=>v.mapToName),d=new Set(f),l=AS(i,d);b.useEffect(()=>{e&&l.length&&Ai(e,n,l.map(v=>({field:v,value:null})))},[e,n,l])}const PS={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function FS({children:e,style:t}){return u.jsx(_n,{style:{...PS,...t},children:e})}function DS(){var f,d,l;const{data:e}=tr(),{hydratedRevision:t}=di(),{selectedObjectName:n}=tn(),{providerName:r}=ut(),o=e==null?void 0:e.appName,i=(l=(d=(f=t==null?void 0:t.content)==null?void 0:f.read)==null?void 0:d.objects)==null?void 0:l.find(m=>m.objectName===n),s=(i==null?void 0:i.displayName)||n&&un(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&un(a);return c&&o&&r?u.jsx(FS,{style:{marginTop:"1rem"},children:u.jsxs("p",{style:{margin:"1rem 0"},children:[u.jsx("b",{children:c})," in ",o," is mapped to"," ",u.jsx("b",{children:s})," in ",r,"."]})}):null}function xu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wf(...e){return t=>{let n=!1;const r=e.map(o=>{const i=xu(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():xu(e[o],null)}}}}function oi(...e){return L.useCallback(wf(...e),e)}function Qo(e,t=[]){let n=[];function r(i,s){const a=L.createContext(s),c=n.length;n=[...n,s];const f=l=>{var S;const{scope:m,children:y,...w}=l,v=((S=m==null?void 0:m[e])==null?void 0:S[c])||a,p=L.useMemo(()=>w,Object.values(w));return u.jsx(v.Provider,{value:p,children:y})};f.displayName=i+"Provider";function d(l,m){var v;const y=((v=m==null?void 0:m[e])==null?void 0:v[c])||a,w=L.useContext(y);if(w)return w;if(s!==void 0)return s;throw new Error(`\`${l}\` must be used within \`${i}\``)}return[f,d]}const o=()=>{const i=n.map(s=>L.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return L.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,MS(o,...t)]}function MS(...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:f})=>{const l=c(i)[`__scope${f}`];return{...a,...l}},{});return L.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Xt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var Ri=globalThis!=null&&globalThis.document?L.useLayoutEffect:()=>{},kS=L[" useInsertionEffect ".trim().toString()]||Ri;function Ya({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=LS({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const d=L.useRef(e!==void 0);L.useEffect(()=>{const l=d.current;l!==a&&console.warn(`${r} is changing from ${l?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const f=L.useCallback(d=>{var l;if(a){const m=jS(d)?d(e):d;m!==e&&((l=s.current)==null||l.call(s,m))}else i(d)},[a,e,i,s]);return[c,f]}function LS({defaultProp:e,onChange:t}){const[n,r]=L.useState(e),o=L.useRef(n),i=L.useRef(t);return kS(()=>{i.current=t},[t]),L.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function jS(e){return typeof e=="function"}function KS(e){const t=L.useRef({value:e,previous:e});return L.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function $S(e){const[t,n]=L.useState(void 0);return Ri(()=>{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,f=Array.isArray(c)?c[0]:c;s=f.inlineSize,a=f.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 US(e,t){return L.useReducer((n,r)=>t[n][r]??n,e)}var Za=e=>{const{present:t,children:n}=e,r=qS(t),o=typeof n=="function"?n({present:r.isPresent}):L.Children.only(n),i=oi(r.ref,VS(o));return typeof n=="function"||r.isPresent?L.cloneElement(o,{ref:i}):null};Za.displayName="Presence";function qS(e){const[t,n]=L.useState(),r=L.useRef(null),o=L.useRef(e),i=L.useRef("none"),s=e?"mounted":"unmounted",[a,c]=US(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return L.useEffect(()=>{const f=uo(r.current);i.current=a==="mounted"?f:"none"},[a]),Ri(()=>{const f=r.current,d=o.current;if(d!==e){const m=i.current,y=uo(f);e?c("MOUNT"):y==="none"||(f==null?void 0:f.display)==="none"?c("UNMOUNT"):c(d&&m!==y?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Ri(()=>{if(t){let f;const d=t.ownerDocument.defaultView??window,l=y=>{const v=uo(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&v&&(c("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",f=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},m=y=>{y.target===t&&(i.current=uo(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{d.clearTimeout(f),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:L.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function uo(e){return(e==null?void 0:e.animationName)||"none"}function VS(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 oa(e){const t=HS(e),n=L.forwardRef((r,o)=>{const{children:i,...s}=r,a=L.Children.toArray(i),c=a.find(JS);if(c){const f=c.props.children,d=a.map(l=>l===c?L.Children.count(f)>1?L.Children.only(null):L.isValidElement(f)?f.props.children:null:l);return u.jsx(t,{...s,ref:o,children:L.isValidElement(f)?L.cloneElement(f,void 0,d):null})}return u.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function HS(e){const t=L.forwardRef((n,r)=>{const{children:o,...i}=n;if(L.isValidElement(o)){const s=zS(o),a=WS(i,o.props);return o.type!==L.Fragment&&(a.ref=r?wf(r,s):s),L.cloneElement(o,a)}return L.Children.count(o)>1?L.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var BS=Symbol("radix.slottable");function JS(e){return L.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===BS}function WS(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)=>{const c=i(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function zS(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 GS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Nn=GS.reduce((e,t)=>{const n=oa(`Primitive.${t}`),r=L.forwardRef((o,i)=>{const{asChild:s,...a}=o,c=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Xo="Checkbox",[QS,dO]=Qo(Xo),[XS,ec]=QS(Xo);function YS(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:a,onCheckedChange:c,required:f,value:d="on",internal_do_not_use_render:l}=e,[m,y]=Ya({prop:n,defaultProp:o??!1,onChange:c,caller:Xo}),[w,v]=L.useState(null),[p,S]=L.useState(null),h=L.useRef(!1),g=w?!!s||!!w.closest("form"):!0,I={checked:m,disabled:i,setChecked:y,control:w,setControl:v,name:a,form:s,value:d,hasConsumerStoppedPropagationRef:h,required:f,defaultChecked:Qn(o)?!1:o,isFormControl:g,bubbleInput:p,setBubbleInput:S};return u.jsx(XS,{scope:t,...I,children:ZS(l)?l(I):r})}var bf="CheckboxTrigger",If=L.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:s,disabled:a,checked:c,required:f,setControl:d,setChecked:l,hasConsumerStoppedPropagationRef:m,isFormControl:y,bubbleInput:w}=ec(bf,e),v=oi(o,d),p=L.useRef(c);return L.useEffect(()=>{const S=i==null?void 0:i.form;if(S){const h=()=>l(p.current);return S.addEventListener("reset",h),()=>S.removeEventListener("reset",h)}},[i,l]),u.jsx(Nn.button,{type:"button",role:"checkbox","aria-checked":Qn(c)?"mixed":c,"aria-required":f,"data-state":Of(c),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:v,onKeyDown:Xt(t,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Xt(n,S=>{l(h=>Qn(h)?!0:!h),w&&y&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})})});If.displayName=bf;var tc=L.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c,onCheckedChange:f,form:d,...l}=e;return u.jsx(YS,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:a,required:s,onCheckedChange:f,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>u.jsxs(u.Fragment,{children:[u.jsx(If,{...l,ref:t,__scopeCheckbox:n}),m&&u.jsx(xf,{__scopeCheckbox:n})]})})});tc.displayName=Xo;var Cf="CheckboxIndicator",nc=L.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=ec(Cf,n);return u.jsx(Za,{present:r||Qn(i.checked)||i.checked===!0,children:u.jsx(Nn.span,{"data-state":Of(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});nc.displayName=Cf;var Sf="CheckboxBubbleInput",xf=L.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:s,required:a,disabled:c,name:f,value:d,form:l,bubbleInput:m,setBubbleInput:y}=ec(Sf,e),w=oi(n,y),v=KS(i),p=$S(r);L.useEffect(()=>{const h=m;if(!h)return;const g=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(g,"checked").set,T=!o.current;if(v!==i&&x){const E=new Event("click",{bubbles:T});h.indeterminate=Qn(i),x.call(h,Qn(i)?!1:i),h.dispatchEvent(E)}},[m,v,i,o]);const S=L.useRef(Qn(i)?!1:i);return u.jsx(Nn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??S.current,required:a,disabled:c,name:f,value:d,form:l,...t,tabIndex:-1,ref:w,style:{...t.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});xf.displayName=Sf;function ZS(e){return typeof e=="function"}function Qn(e){return e==="indeterminate"}function Of(e){return Qn(e)?"indeterminate":e?"checked":"unchecked"}function Ef(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 ex=["color"],_f=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Ef(e,ex);return b.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}),b.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"}))}),tx=["color"],nx=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Ef(e,tx);return b.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}),b.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 rx="_checkboxGroupContainer_hqfeu_1",ix="_stack_hqfeu_6",ox="_selectAllContainer_hqfeu_10",sx="_fieldContainer_hqfeu_17",ax="_checkbox_hqfeu_1",si={checkboxGroupContainer:rx,stack:ix,selectAllContainer:ox,fieldContainer:sx,checkbox:ax};function cx({id:e,isChecked:t,label:n,onCheckedChange:r}){return u.jsxs("div",{className:si.fieldContainer,children:[u.jsx(tc,{className:si.checkbox,id:e,onCheckedChange:r,checked:t,children:u.jsx(nc,{children:u.jsx(_f,{})})}),u.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function ux({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return u.jsxs("div",{className:si.selectAllContainer,children:[u.jsx(tc,{className:si.checkbox,id:e,onCheckedChange:r,checked:o?"indeterminate":t,children:u.jsxs(nc,{children:[o&&u.jsx(nx,{}),t===!0&&u.jsx(_f,{})]})}),u.jsx("label",{htmlFor:e,children:n})]})}function lx({children:e}){return u.jsx("div",{className:si.checkboxGroupContainer,children:e})}function dx({children:e}){return u.jsx("div",{className:si.stack,children:e})}const fx="_paginationContainer_1p51x_1",px="_pageInfo_1p51x_7",hx="_searchContainer_1p51x_13",mx="_searchInput_1p51x_17",gx="_noResults_1p51x_21",vi={paginationContainer:fx,pageInfo:px,searchContainer:hx,searchInput:mx,noResults:gx};function Nf({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:o=!0,searchPlaceholder:i="Search fields..."}){const[s,a]=b.useState(1),[c,f]=b.useState(""),d=e.filter(g=>g.label.toLowerCase().includes(c.toLowerCase())),l=Math.ceil(d.length/n),m=(s-1)*n,y=m+n,w=d.slice(m,y),v=g=>{f(g),a(1)},p=g=>{d.forEach(I=>{t(I.id,g)})},S=d.length>0&&d.every(g=>g.isChecked),h=d.some(g=>g.isChecked);return u.jsxs(lx,{children:[o&&u.jsx("div",{className:vi.searchContainer,children:u.jsx(ld,{id:"field-search",type:"text",placeholder:i,value:c,onChange:g=>v(g.target.value),className:vi.searchInput})}),r&&e.length>=2&&u.jsx(ux,{id:"select-all-fields",isChecked:S,label:`Select all ${d.length} ${c?"matching ":""}fields`,onCheckedChange:p,isIndeterminate:h&&!S}),u.jsx(dx,{children:w.map(g=>u.jsx(cx,{id:g.id,isChecked:g.isChecked,label:g.label,onCheckedChange:I=>t(g.id,I===!0)},g.id))}),l>1&&u.jsxs("div",{className:vi.paginationContainer,children:[u.jsx(Be,{type:"button",onClick:()=>a(g=>Math.max(1,g-1)),disabled:s===1,variant:"ghost",children:"<"}),u.jsxs("span",{className:vi.pageInfo,children:[s," of ",l]}),u.jsx(Be,{type:"button",onClick:()=>a(g=>Math.min(l,g+1)),disabled:s===l,variant:"ghost",children:">"})]}),d.length===0&&c&&u.jsxs("div",{className:vi.noResults,children:['No fields found matching "',c,'"']})]})}function yx(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=!td(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function vx(e,t,n,r){t(e,o=>yx(o,n,r))}function wx(){var f,d;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=tn(),o=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,i=(d=t==null?void 0:t.read)==null?void 0:d.optionalFields,s=(l,m)=>{r&&t&&vx(r,n,l,m)},a=b.useMemo(()=>(i==null?void 0:i.filter(l=>!nr(l)&&"fieldName"in l&&"displayName"in l).map(l=>({id:l.fieldName,label:l.displayName,isChecked:!!(o!=null&&o[l.fieldName])})).sort((l,m)=>l.label.localeCompare(m.label)))||[],[i,o]);return!!(i&&i.length>0)&&u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:`${e} reads the following optional fields`}),u.jsx(Nf,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${i==null?void 0:i.length}`)]})}function bx(){return u.jsx(wx,{})}const Ix={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 Cx({children:e,style:t,...n}){return u.jsx("span",{style:{...Ix,...t},...n,children:e})}function Sx(){var n,r,o;const{configureState:e}=tn(),{appName:t}=tr();return u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:`${t} reads the following fields`}),u.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(r=(n=e==null?void 0:e.read)==null?void 0:n.requiredFields)!=null&&r.length?(o=e.read)==null?void 0:o.requiredFields.map(i=>nr(i)?null:u.jsx(Cx,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function xx(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 Tf(e,t,n,r,o){t(e,i=>xx(i,e,n,r,o))}function Ox(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function Ex({string:e,fieldName:t}){return u.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[u.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,u.jsx("b",{children:t})]}),u.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:u.jsx(Ho,{style:{width:"100%",marginLeft:"1rem"}})})]})}function _x({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var x;const{configureState:i,selectedObjectName:s,setConfigureState:a}=tn(),[c,f]=b.useState(!0),{getError:d,setError:l,resetBoundary:m,isError:y,removeError:w}=Ut(),v=b.useMemo(()=>{var T,E;return((E=(T=i==null?void 0:i.read)==null?void 0:T.selectedValueMappings)==null?void 0:E[n])||{}},[(x=i==null?void 0:i.read)==null?void 0:x.selectedValueMappings,n]),p=b.useMemo(()=>v==null?void 0:v[e.mappedValue],[v,e.mappedValue]);b.useEffect(()=>{f(!1)},[e,a,s,p,i]);const S=b.useMemo(()=>r.map(T=>({id:T.value,label:T.displayValue,value:T.value})),[r]),h=b.useCallback(T=>{if(T){if(Object.values(v).some(E=>E===T.value&&E!==p)){const E=[...Object.entries(v).filter(([A,R])=>R===T.value&&R!==p).map(([A])=>A),e.mappedValue];l(ue.VALUE_MAPPING,n,E);return}d(ue.VALUE_MAPPING,n)&&m(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:T.value,fieldName:n}})}},[t,v,p,n,e.mappedValue,m,l,d]),g=b.useMemo(()=>u.jsx(sf,{disabled:c,items:S,selectedValue:p||null,onSelectedItemChange:h,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,c,S,h,o]),I=b.useCallback(()=>{s&&(Tf(s,a,e.mappedValue,"",n),y(ue.VALUE_MAPPING,n)&&w(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,y,w]);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[u.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:u.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[g,u.jsx(Be,{type:"button",variant:"ghost",onClick:I,children:"Clear"})]})]},e.mappedValue)}function Nx(){var y,w,v;const{fieldMapping:e}=Ze(),{selectedObjectName:t,configureState:n,setConfigureState:r}=tn(),{isError:o,removeError:i,getError:s}=Ut(),a=(y=n==null?void 0:n.read)==null?void 0:y.selectedFieldMappings,c=(w=n==null?void 0:n.read)==null?void 0:w.selectedValueMappings,f=(v=n==null?void 0:n.read)==null?void 0:v.isValueMappingsModified,d=b.useRef(!1),l=b.useMemo(()=>{const p=t&&e?Object.values(e[t]||{}).flat().filter(S=>S.mappedValues).map(S=>({...S})):[];if(a)for(let S=0;S<p.length;S+=1){const{mapToName:h}=p[S];a!=null&&a[h]&&(p[S].fieldName=a[h])}return p},[t,e,a]),m=b.useCallback(p=>{const{value:S,name:h,fieldName:g}=p.target;S&&(t&&Tf(t,r,h,S,g),o(ue.VALUE_MAPPING,h)&&i(ue.VALUE_MAPPING,h))},[t,r,o,i]);return b.useEffect(()=>{var p;if(t&&c){const S=((p=e==null?void 0:e[t])==null?void 0:p.filter(g=>g.fieldName&&g.mappedValues.length>0))||[];S.every(g=>{const I=c[g.fieldName]||{};return Object.keys(I).length===Object.keys(g.mappedValues).length})&&S.length>0?!f&&!d.current&&(Ox(t,r,!0),d.current=!0):d.current=!1}},[c,l,t,r,e,f]),l!=null&&l.length?u.jsx(u.Fragment,{children:l.map(p=>{var T,E,A;if(!p.fieldName)return null;const S=(E=(T=n==null?void 0:n.read)==null?void 0:T.allFieldsMetadata)==null?void 0:E[p.fieldName],h=S==null?void 0:S.valueType;if(!["singleSelect","multiSelect"].includes(h))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const g=S==null?void 0:S.values;if(!g)return null;const I=Object.keys(g).length,x=Object.keys((p==null?void 0:p.mappedValues)||[]).length;return I!==x?(console.error("field values and the values to be mapped are not of the same length",p,g),null):u.jsxs(u.Fragment,{children:[u.jsx(Ex,{string:"Map the values for ",fieldName:p.mapToDisplayName||p.mapToName||p.fieldName}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:u.jsx(Go,{id:p.mapToName||p.fieldName,children:(A=p==null?void 0:p.mappedValues)==null?void 0:A.map(R=>{var j,$,ae;const P=s(ue.VALUE_MAPPING,p.fieldName),K=Array.isArray(P)&&P.includes(R.mappedValue),q=((ae=($=(j=n==null?void 0:n.read)==null?void 0:j.allFieldsMetadata)==null?void 0:$[p.fieldName])==null?void 0:ae.values)||[];return u.jsxs(u.Fragment,{children:[u.jsx(_x,{allValueOptions:q,mappedValue:R,onSelectChange:m,fieldName:(p==null?void 0:p.fieldName)||"",hasError:K},`${R.mappedValue}-${p.fieldName}`),K&&u.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${p.mapToName||p.fieldName} must be mapped to a unique value`},R.mappedValue)]})})},p.mapToName||p.fieldName)})]})})}):null}const Tx=!1;function Ax(){return RS(),u.jsxs(u.Fragment,{children:[u.jsx(DS,{}),u.jsx(Sx,{}),u.jsx(TS,{}),u.jsx(NS,{}),u.jsx(Nx,{}),u.jsx(bx,{}),Tx]})}function Rx(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,f=!Ib(a,s);e.write.isWriteModified=f}}}function Px(e,t,n,r){t(e,o=>{Rx(o,n,r)})}function Fx(){var f,d;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=tn(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(d=n==null?void 0:n.write)==null?void 0:d.writeObjects,s=(l,m)=>{t&&n&&Px(t,r,l,m)},a=!!i,c=(i==null?void 0:i.map(l=>({id:l.objectName,label:l.displayName,isChecked:!!(o!=null&&o[l.objectName])})))||[];return a&&u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:`Allow ${e} to write to these objects`}),u.jsx(Nf,{items:c,onItemChange:s,showSelectAll:i.length>=2})]})}function Dx(){return u.jsx(u.Fragment,{children:u.jsx(Fx,{})})}function Af({resetComponent:e,onDisconnectSuccess:t}){return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[u.jsx(Rt,{string:"Remove connection"}),u.jsx("p",{children:"Click to disconnect your connection from the provider."}),u.jsx(md,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const Mx="_authenticationRow_1g2ms_1",kx="_field_1g2ms_8",Lx="_value_1g2ms_12",Is={authenticationRow:Mx,field:kx,value:Lx};function Ou({label:e,value:t}){return u.jsxs("div",{className:Is.authenticationRow,children:[u.jsx("div",{className:Is.field,children:e}),u.jsx("div",{className:Is.value,children:t})]})}function jx(){const{selectedConnection:e}=en(),{providerName:t}=ut(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Connection details"}),u.jsxs("div",{style:{paddingBottom:"1rem"},children:[u.jsx(Ou,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),u.jsx(Ou,{label:"Status",value:un((e==null?void 0:e.status)||"")})]})]})}const Kx=()=>{const e=it(),t=$e();return En({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."),He(n)}})};function Rf({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=De(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=Ze(),[c,f]=b.useState(!1),d=!r||!o||!(i!=null&&i.id)||c,l=Kx(),m=async()=>{d||(f(!0),console.warn("uninstalling installation",{projectIdOrName:r,integrationId:o,installationId:i.id}),l.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:()=>f(!1)}))},y=c?"Uninstalling...":e,w=u.jsx(Be,{type:"button",onClick:m,disabled:d,variant:t,style:n,children:y});return i!=null&&i.id?w:null}function $x(){const{installation:e}=Ze(),{providerName:t}=ut();return e?u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Uninstall entire integration"}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall the entire ",t," ","integration. You will lose any configuration you've set up."]}):u.jsx("p",{children:"You've successfully uninstalled the integration."}),u.jsx(Rf,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function Ux(){const{installation:e,resetComponent:t}=Ze();return u.jsxs(u.Fragment,{children:[u.jsx(jx,{}),u.jsx(Ea,{}),e&&u.jsx($x,{}),!e&&u.jsx(Af,{resetComponent:t})]})}function Pf({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var T,E,A,R;const{installation:i}=Ze(),{hydratedRevision:s,loading:a}=di(),{configureState:c,selectedObjectName:f}=tn(),d=i==null?void 0:i.config,l=d&&f&&!!Xl(d,f)||!1,m=((T=c==null?void 0:c.read)==null?void 0:T.isOptionalFieldsModified)||((E=c==null?void 0:c.read)==null?void 0:E.isRequiredMapFieldsModified)||((A=c==null?void 0:c.read)==null?void 0:A.isValueMappingsModified),y=(R=c==null?void 0:c.write)==null?void 0:R.isWriteModified,S=a||n||!c||!f||!(m||y||r||f!==Er&&!l),h=f===Er,g=f===Oo,I=u.jsx(Be,{type:"submit",disabled:S,children:r?"Install":"Save"}),x=u.jsx(Be,{type:"button",onClick:t,disabled:S,variant:"ghost",children:"Reset"});return n?u.jsx(Ni,{}):u.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[u.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!g&&u.jsxs(u.Fragment,{children:[I,x]})}),u.jsxs(_n,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&u.jsx(ji,{children:typeof o=="string"?o:"Installation Failed."}),a&&u.jsx(Ni,{}),s&&!h&&!g&&u.jsx(Ax,{}),s&&h&&!g&&u.jsx(Dx,{}),!a&&g&&u.jsx(Ux,{})]})]})}const Ff=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=Ze(),{hydratedRevision:s,loading:a}=di(),{selectedObjectName:c}=vd(),{selectedConnection:f}=en(),d=Zu(),{projectIdOrName:l}=De(),{resetBoundary:m,setErrors:y,setError:w,getError:v}=Ut(),{resetConfigureState:p,objectConfigurationsState:S,resetPendingConfigurationState:h}=_a(),g=ad(c||"",S),{onNextIncompleteTab:I}=pI(),x=b.useCallback(()=>{m(ue.INSTALLATION_MUTATION)},[m]),T=b.useCallback(A=>A?R=>{w(ue.INSTALLATION_MUTATION,A,R)}:R=>{console.error("objectName is required to set installation error: ",R)},[w]),E=b.useCallback(A=>A?v(ue.INSTALLATION_MUTATION,A):"",[v]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:f,apiKey:d,projectIdOrName:l,resetBoundary:m,setErrors:y,setMutateInstallationError:T,getMutateInstallationError:E,resetMutateInstallationErrorState:x,resetConfigureState:p,objectConfigurationsState:S,resetPendingConfigurationState:h,configureState:g,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:I}},qx=void 0;function Vx(){const{consumerRef:e,setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,selectedConnection:i,resetBoundary:s,setErrors:a,setMutateInstallationError:c,getMutateInstallationError:f,resetMutateInstallationErrorState:d,resetConfigureState:l,objectConfigurationsState:m,resetPendingConfigurationState:y,configureState:w,onInstallSuccess:v,onNextIncompleteTab:p}=Ff(),[S,h]=b.useState(!1),{createInstallation:g}=Wl(),I=o===Er,x=f(o),T=b.useCallback(()=>{s(ue.MAPPING),n!=null&&n.content&&!r&&o&&rd(n,qx,o,l)},[s,n,r,o,l]);b.useEffect(()=>{!w&&(n!=null&&n.content)&&!r&&T()},[w,m,n,r,T]);const E=()=>{d();const{requiredMapFields:P,selectedFieldMappings:K}=(w==null?void 0:w.read)||{},{errorList:q}=ed(P,K,a);if(!(q.length>0))if(o&&(i!=null&&i.id)&&e&&n){h(!0);const j=Eb(w,o,n,e);if(!j){console.error("Error when generating createConfig from configureState"),h(!1);return}g({config:j.content,onSuccess:$=>{t($),v==null||v($.id,$.config),h(!1),y(o),p()},onError:$=>{c(o)($.message),h(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},A=()=>{if(d(),o&&(i!=null&&i.id)&&e&&n){h(!0);const P=Nb(w,n,e);if(!P){console.error("Error when generating createConfig from configureState"),h(!1);return}g({config:P.content,onSuccess:K=>{t(K),v==null||v(K.id,K.config),h(!1),y(o),p()},onError:K=>{c(o)(K.message),h(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},R=P=>{P.preventDefault(),I?A():E()};return u.jsx(Pf,{errorMsg:x,isCreateMode:!0,isLoading:S,onSave:R,onReset:T})}const Hx=(e,t,n,r)=>{const o=id(e),i=od(e),s=sd(e),a={content:{read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:r}}}}};return Li(n)&&(a.content||(a.content={}),a.content.proxy={enabled:!0}),a},Bx=(e,t)=>{const r={content:{write:{objects:cd(e)}}};return Li(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r};function Jx({installation:e}){const{setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,resetBoundary:i,setErrors:s,setMutateInstallationError:a,getMutateInstallationError:c,resetConfigureState:f,resetPendingConfigurationState:d,configureState:l,onUpdateSuccess:m,onNextIncompleteTab:y}=Ff(),{updateInstallation:w}=zl(),[v,p]=b.useState(!1),S=o===Er,h=c(o),{config:g}=e,I=b.useCallback(()=>{i(ue.MAPPING),n!=null&&n.content&&!r&&o&&rd(n,g,o,f)},[i,n,r,o,g,f]);b.useEffect(()=>{l||I()},[l,I]);const x=b.useMemo(()=>{var P,K,q;return(q=(K=(P=n==null?void 0:n.content)==null?void 0:P.read)==null?void 0:K.objects)==null?void 0:q.find(j=>(j==null?void 0:j.objectName)===o)},[n,o]),T=()=>{const{requiredMapFields:R,selectedFieldMappings:P}=(l==null?void 0:l.read)||{},{errorList:K}=ed(R,P,s);if(!(K.length>0))if(n&&l&&o&&x){p(!0);const q=Hx(l,o,n,x.backfill);if(!q){console.error("Error when generating updateConfig from configureState"),p(!1);return}w({config:q.content,onSuccess:j=>{t(j),m==null||m(j.id,j.config),p(!1),d(o),y()},onError:j=>{a(o)(j.message),p(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},E=()=>{if(l&&n){p(!0);const R=Bx(l,n);if(!R){console.error("Error when generating write updateConfig from configureState"),p(!1);return}w({config:R.content,onSuccess:P=>{t(P),m==null||m(P.id,P.config),p(!1),d(o),y()},onError:P=>{a(o)(P.message),p(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},A=R=>{R.preventDefault(),S?E():T()};return u.jsx(Pf,{errorMsg:h,onSave:A,onReset:I,isLoading:v})}function Wx(){const{integrationObj:e,installation:t}=Ze();return e?t&&e?u.jsx(Jx,{installation:t}):u.jsx(Vx,{}):u.jsx(Ul,{message:"We can't load the integration"})}function zx(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),u.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function rc({text:e,children:t}){return u.jsx(ui,{children:u.jsxs(_n,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[u.jsx(zx,{}),u.jsx("p",{children:e}),t]})})}function Gx({provider:e}){const{providerName:t}=ut(e),n=`You have successfully installed your ${t} integration.`;return u.jsx(rc,{text:n,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(Rf,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Qx=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function Xx({children:e}){var x;const t=b.useRef(!1),{projectIdOrName:n}=De(),{hydratedRevision:r,loading:o}=di(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,onInstallSuccess:f,isIntegrationDeleted:d}=Ze(),{mutate:l,isIdle:m,isPending:y,error:w,errorMsg:v}=Jl(),{selectedConnection:p,isConnectionsLoading:S}=en(),h=o||y||S,g=(x=r==null?void 0:r.content)==null?void 0:x.provider,I=Qx(r);return b.useEffect(()=>{var T;if(!h&&!S&&r&&I&&!s&&p&&(i!=null&&i.id)&&!d&&g){const E={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:p==null?void 0:p.id,config:{content:{provider:g}}}};Li(r)===!0&&(E.installation.config.content.proxy=(T=r==null?void 0:r.content)==null?void 0:T.proxy),m&&!t.current&&(l(E,{onSuccess:A=>{f==null||f(A==null?void 0:A.id,A.config)}}),t.current=!0)}},[r,I,s,p,n,i==null?void 0:i.id,a,c,h,f,d,S,g,l,m]),I&&g&&s?u.jsx(Gx,{provider:g}):w?u.jsx(Qt,{message:v??"Create installation failed"}):i?h?u.jsx(li,{}):u.jsx("div",{children:e}):u.jsx(Qt,{message:"We can't load the integration"})}function qi(){const e=it(),t=$e();return En({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"),He(n)}})}function Yx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=De(),f=qi(),d=b.useCallback(l=>{var v;const{apiKey:m,providerMetadata:y}=l,w={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(v=y==null?void 0:y.workspace)==null?void 0:v.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:m,...y&&{providerMetadata:y}}};f.mutate(w)},[c,i,o,r,n,e,f]);return a===null?u.jsx(Wb,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function Zx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=De(),f=qi(),d=b.useCallback(l=>{var p;const{user:m,pass:y,providerMetadata:w}=l,v={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(p=w==null?void 0:w.workspace)==null?void 0:p.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m,password:y},...w&&{providerMetadata:w}}};f.mutate(v)},[c,i,o,r,n,e,f]);return a===null?u.jsx(Yb,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function Eu({url:e,prompt:t,inputName:n}){return u.jsx("p",{style:{color:"var(--amp-colors-text-muted)",display:"flex",justifyContent:"space-between"},children:u.jsxs("span",{children:[e?u.jsx(xa,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:n})}):u.jsx("span",{children:n})," ",t&&u.jsx(yf,{id:`docs-helper-text-${ob(n||(t==null?void 0:t.slice(0,50)))}`,tooltipText:t})]})})}function e0({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r}){var m,y;const[o,i]=b.useState({}),s=((m=e.metadata)==null?void 0:m.input)||[],a=w=>{const{name:v,value:p}=w.currentTarget;i(S=>({...S,[v]:p.trim()}))},c=Zr(s,o),f=n||!c,d=((y=e.customOpts)==null?void 0:y.inputs)||[],l=()=>{const w=qo(s,o),v=Object.fromEntries(d.map(p=>[p.name,o[p.name]]));t({customAuth:v,providerMetadata:w})};return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[d.map(w=>u.jsxs("div",{children:[u.jsx(Eu,{url:w.docsURL,prompt:w.prompt,inputName:w.displayName}),u.jsx(St.PasswordInput,{id:w.name,name:w.name,onChange:a,placeholder:""})]},w.name)),s.map(w=>u.jsxs("div",{children:[w.docsURL&&u.jsx(Eu,{url:w.docsURL,prompt:w.displayName||w.name,inputName:w.displayName||un(w.name.toLowerCase())}),u.jsx(St.Input,{id:w.name,name:w.name,type:"text",placeholder:"",onChange:a})]},w.name)),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"submit",onClick:l,variant:r,children:"Next"})]})}function t0({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r}){return u.jsxs(rr,{children:[u.jsx(ir,{children:`Set up ${e.displayName} integration`}),u.jsx(dn,{error:n}),u.jsx(e0,{providerInfo:e,handleSubmit:t,isButtonDisabled:r})]})}function n0({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s}){const{projectIdOrName:a}=De(),c=qi(),[f,d]=b.useState(null),l=b.useCallback(m=>{var p;const{customAuth:y,providerMetadata:w}=m;d(null);const v={projectIdOrName:a,generateConnectionParams:{providerWorkspaceRef:(p=w==null?void 0:w.workspace)==null?void 0:p.value,groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:y,...w&&{providerMetadata:w}}};c.mutate(v,{onError:S=>{He(S,d)},onSuccess:()=>{d(null)}})},[a,o,r,n,t,e.name,c]);return s===null?u.jsx(t0,{providerInfo:e,handleSubmit:l,error:f}):i}function r0({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 u.jsxs(rr,{children:[u.jsx(ir,{children:i||`Set up ${r} integration`}),u.jsx(dn,{error:t}),o,u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function i0({...e}){return u.jsx(r0,{...e})}function o0({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=De(),f=qi(),d=b.useCallback(()=>{const l={projectIdOrName:c,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};f.mutate(l)},[c,o,r,n,t,e,f]);return s===null?u.jsx(i0,{handleSubmit:d,error:null,providerName:a}):i}const s0=()=>{const e=it(),t=$e();return En({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function a0({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs(rr,{children:[u.jsx(ir,{children:`Set up ${r} integration`}),u.jsx(Vb,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),u.jsx(dn,{error:t}),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const c0="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function u0({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return u.jsxs(rr,{children:[u.jsx(ir,{children:"Enter your Salesforce subdomain"}),u.jsx(xa,{href:c0,newTab:!0,children:"What is my Salesforce subdomain?"}),u.jsx(dn,{error:n}),u.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[u.jsx(St.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),u.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function l0({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return u.jsxs(rr,{children:[u.jsxs(ir,{children:["Enter your ",o," workspace"]}),u.jsx(dn,{error:n}),u.jsx("br",{}),i.map(s=>u.jsx(St.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),u.jsx("br",{}),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const _u=600,Nu=600,Tu="salesforce";function d0({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var K;const{projectId:s}=tr(),a=$e(),c=b.useRef(null),[f,d]=b.useState(null),[l,m]=b.useState(""),[y,w]=b.useState({}),[v,p]=b.useState({}),{data:S}=Uo(e),h=((K=S==null?void 0:S.metadata)==null?void 0:K.input)||[],{mutateAsync:g,isPending:I}=s0(),{isFetching:x,refetch:T}=Ca({groupRef:r,provider:e});b.useEffect(()=>{const q=j=>{var $,ae,oe;j.origin===jl&&((($=j.data)==null?void 0:$.eventType)==="AUTHORIZATION_SUCCEEDED"?(d(null),console.debug("New connection:",j.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((ae=j.data)==null?void 0:ae.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",j.data.data.error),a.invalidateQueries({queryKey:["amp","connections"]}),d(j.data.data.error||"An error occurred. Please try again.")),(oe=c.current)==null||oe.close())};return window.addEventListener("message",q),()=>window.removeEventListener("message",q)},[a]);const E=q=>{m(q),w(j=>({...j,workspace:q})),p(j=>({...j,workspace:{value:q,source:"input"}}))},A=(q,j)=>{w($=>({...$,[q]:j})),p($=>({...$,[q]:{value:j,source:"input"}}))},R=async()=>{var q;d(null);try{const{data:j}=await T();if(j&&j.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(h.length>0&&!Zr(h,y)){d("Please fill in all required fields");return}try{const j=await g({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s||"",consumerName:n,groupName:o,providerWorkspaceRef:e===Tu?l:(q=v==null?void 0:v.workspace)==null?void 0:q.value,providerMetadata:v}});if(j){const $=window.screenX+(window.outerWidth-_u)/2,ae=window.screenY+(window.outerHeight-Nu)/2.5,oe=`width=${_u},height=${Nu},left=${$},top=${ae}`;c.current=window.open(j,"OAuthPopup",oe)}}catch(j){console.error(j),d(j instanceof Error?j.message:String(j)||"An error occurred. Please try again.")}},P=e===Tu?u.jsx(u0,{handleSubmit:R,setWorkspace:E,error:f,isButtonDisabled:l.length===0||I||x}):h.length>0?u.jsx(l0,{handleSubmit:R,setFormData:A,error:f,isButtonDisabled:!Zr(h,y)||I||x,providerName:i,metadataFields:h}):u.jsx(a0,{handleSubmit:R,error:f,providerName:i,isButtonDisabled:I||x});return u.jsx("div",{children:P})}function f0({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:c}=De(),f=qi(),[d,l]=b.useState(null),m=b.useCallback(y=>{var v,p;l(null);const w={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(p=(v=y.providerMetadata)==null?void 0:v.workspace)==null?void 0:p.value,oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret,scopes:y.scopes},...y.providerMetadata&&{providerMetadata:y.providerMetadata}}};f.mutate(w,{onError:()=>l("Error loading provider info")})},[c,i,o,r,n,e,f]);return a===null?u.jsx(eI,{provider:e,providerName:t,handleSubmit:m,error:d,explicitScopesRequired:s}):u.jsx(Ni,{})}function p0({...e}){return u.jsx(f0,{...e})}const h0="authorizationCode",m0="authorizationCodePKCE",g0="clientCredentials";function y0({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=ut(e);if(t.oauth2Opts===void 0)return u.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:f,explicitScopesRequired:d}=t.oauth2Opts,l={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return f===h0||f===m0?u.jsx(d0,{...l}):f===g0?u.jsx(p0,{...l,explicitScopesRequired:d,selectedConnection:s,setSelectedConnection:a}):f==="password"?u.jsx("em",{children:"Password flow not supported yet"}):u.jsxs("em",{children:["Unsupported grant type: ",f]})}function v0(e){const{selectedConnection:t}=en();b.useEffect(()=>{e&&t&&e(t)},[e,t])}function w0({onSuccess:e}){v0(e)}function Df({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:f,isLoading:d,isError:l,error:m,providerName:y,selectedProvider:w}=ut(e),{provider:v,isIntegrationDeleted:p}=Ze(),{selectedConnection:S,setSelectedConnection:h}=en();w0({onSuccess:s});const g=$e(),I=f;b.useEffect(()=>{l&&(console.error("Error loading provider info."),He(m))},[l,m]);const x=b.useCallback(()=>{g.clear(),c()},[c,g]);if(!e&&!v)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return u.jsx(rc,{text:"Integration successfully uninstalled.",children:u.jsx(Be,{type:"button",onClick:x,style:{width:"100%"},children:"Reinstall Integration"})});if(S)return i;if(d)return u.jsx(li,{});if(I==null)return u.jsx(Qt,{message:"Provider info was not found."});const T={provider:w,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:S,setSelectedConnection:h,providerName:y,providerInfo:I,onDisconnectSuccess:a};return I.authType==="none"?u.jsx(o0,{...T,children:i}):I.authType==="basic"?u.jsx(Zx,{...T,children:i}):I.authType==="apiKey"?u.jsx(Yx,{...T,children:i}):I.authType==="custom"?u.jsx(n0,{...T,children:i}):u.jsx(y0,{...T})}function b0(e){const t=e+"CollectionProvider",[n,r]=Qo(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:p,children:S}=v,h=b.useRef(null),g=b.useRef(new Map).current;return u.jsx(o,{scope:p,itemMap:g,collectionRef:h,children:S})};s.displayName=t;const a=e+"CollectionSlot",c=oa(a),f=b.forwardRef((v,p)=>{const{scope:S,children:h}=v,g=i(a,S),I=oi(p,g.collectionRef);return u.jsx(c,{ref:I,children:h})});f.displayName=a;const d=e+"CollectionItemSlot",l="data-radix-collection-item",m=oa(d),y=b.forwardRef((v,p)=>{const{scope:S,children:h,...g}=v,I=b.useRef(null),x=oi(p,I),T=i(d,S);return b.useEffect(()=>(T.itemMap.set(I,{ref:I,...g}),()=>void T.itemMap.delete(I))),u.jsx(m,{[l]:"",ref:x,children:h})});y.displayName=d;function w(v){const p=i(e+"CollectionConsumer",v);return b.useCallback(()=>{const h=p.collectionRef.current;if(!h)return[];const g=Array.from(h.querySelectorAll(`[${l}]`));return Array.from(p.itemMap.values()).sort((T,E)=>g.indexOf(T.ref.current)-g.indexOf(E.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:s,Slot:f,ItemSlot:y},w,r]}var I0=L[" useId ".trim().toString()]||(()=>{}),C0=0;function Mf(e){const[t,n]=L.useState(I0());return Ri(()=>{n(r=>r??String(C0++))},[e]),e||(t?`radix-${t}`:"")}function S0(e){const t=L.useRef(e);return L.useEffect(()=>{t.current=e}),L.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var x0=L.createContext(void 0);function kf(e){const t=L.useContext(x0);return e||t||"ltr"}var Cs="rovingFocusGroup.onEntryFocus",O0={bubbles:!1,cancelable:!0},Vi="RovingFocusGroup",[sa,Lf,E0]=b0(Vi),[_0,jf]=Qo(Vi,[E0]),[N0,T0]=_0(Vi),Kf=L.forwardRef((e,t)=>u.jsx(sa.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(sa.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(A0,{...e,ref:t})})}));Kf.displayName=Vi;var A0=L.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:d=!1,...l}=e,m=L.useRef(null),y=oi(t,m),w=kf(i),[v,p]=Ya({prop:s,defaultProp:a??null,onChange:c,caller:Vi}),[S,h]=L.useState(!1),g=S0(f),I=Lf(n),x=L.useRef(!1),[T,E]=L.useState(0);return L.useEffect(()=>{const A=m.current;if(A)return A.addEventListener(Cs,g),()=>A.removeEventListener(Cs,g)},[g]),u.jsx(N0,{scope:n,orientation:r,dir:w,loop:o,currentTabStopId:v,onItemFocus:L.useCallback(A=>p(A),[p]),onItemShiftTab:L.useCallback(()=>h(!0),[]),onFocusableItemAdd:L.useCallback(()=>E(A=>A+1),[]),onFocusableItemRemove:L.useCallback(()=>E(A=>A-1),[]),children:u.jsx(Nn.div,{tabIndex:S||T===0?-1:0,"data-orientation":r,...l,ref:y,style:{outline:"none",...e.style},onMouseDown:Xt(e.onMouseDown,()=>{x.current=!0}),onFocus:Xt(e.onFocus,A=>{const R=!x.current;if(A.target===A.currentTarget&&R&&!S){const P=new CustomEvent(Cs,O0);if(A.currentTarget.dispatchEvent(P),!P.defaultPrevented){const K=I().filter(oe=>oe.focusable),q=K.find(oe=>oe.active),j=K.find(oe=>oe.id===v),ae=[q,j,...K].filter(Boolean).map(oe=>oe.ref.current);qf(ae,d)}}x.current=!1}),onBlur:Xt(e.onBlur,()=>h(!1))})})}),$f="RovingFocusGroupItem",Uf=L.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=Mf(),f=i||c,d=T0($f,n),l=d.currentTabStopId===f,m=Lf(n),{onFocusableItemAdd:y,onFocusableItemRemove:w,currentTabStopId:v}=d;return L.useEffect(()=>{if(r)return y(),()=>w()},[r,y,w]),u.jsx(sa.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:u.jsx(Nn.span,{tabIndex:l?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:Xt(e.onMouseDown,p=>{r?d.onItemFocus(f):p.preventDefault()}),onFocus:Xt(e.onFocus,()=>d.onItemFocus(f)),onKeyDown:Xt(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){d.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const S=F0(p,d.orientation,d.dir);if(S!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let g=m().filter(I=>I.focusable).map(I=>I.ref.current);if(S==="last")g.reverse();else if(S==="prev"||S==="next"){S==="prev"&&g.reverse();const I=g.indexOf(p.currentTarget);g=d.loop?D0(g,I+1):g.slice(I+1)}setTimeout(()=>qf(g))}}),children:typeof s=="function"?s({isCurrentTabStop:l,hasTabStop:v!=null}):s})})});Uf.displayName=$f;var R0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function P0(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function F0(e,t,n){const r=P0(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return R0[r]}function qf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function D0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var M0=Kf,k0=Uf,Yo="Tabs",[L0,fO]=Qo(Yo,[jf]),Vf=jf(),[j0,ic]=L0(Yo),Hf=L.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...f}=e,d=kf(a),[l,m]=Ya({prop:r,onChange:o,defaultProp:i??"",caller:Yo});return u.jsx(j0,{scope:n,baseId:Mf(),value:l,onValueChange:m,orientation:s,dir:d,activationMode:c,children:u.jsx(Nn.div,{dir:d,"data-orientation":s,...f,ref:t})})});Hf.displayName=Yo;var Bf="TabsList",Jf=L.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=ic(Bf,n),s=Vf(n);return u.jsx(M0,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:u.jsx(Nn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Jf.displayName=Bf;var Wf="TabsTrigger",zf=L.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=ic(Wf,n),a=Vf(n),c=Qf(s.baseId,r),f=Xf(s.baseId,r),d=r===s.value;return u.jsx(k0,{asChild:!0,...a,focusable:!o,active:d,children:u.jsx(Nn.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":f,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:Xt(e.onMouseDown,l=>{!o&&l.button===0&&l.ctrlKey===!1?s.onValueChange(r):l.preventDefault()}),onKeyDown:Xt(e.onKeyDown,l=>{[" ","Enter"].includes(l.key)&&s.onValueChange(r)}),onFocus:Xt(e.onFocus,()=>{const l=s.activationMode!=="manual";!d&&!o&&l&&s.onValueChange(r)})})})});zf.displayName=Wf;var Gf="TabsContent",K0=L.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=ic(Gf,n),c=Qf(a.baseId,r),f=Xf(a.baseId,r),d=r===a.value,l=L.useRef(d);return L.useEffect(()=>{const m=requestAnimationFrame(()=>l.current=!1);return()=>cancelAnimationFrame(m)},[]),u.jsx(Za,{present:o||d,children:({present:m})=>u.jsx(Nn.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:f,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:l.current?"0s":void 0},children:m&&i})})});K0.displayName=Gf;function Qf(e,t){return`${e}-trigger-${t}`}function Xf(e,t){return`${e}-content-${t}`}var $0=Hf,U0=Jf,Yf=zf;const q0=u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[u.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),u.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function V0(e,t){return t?b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},b.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?q0:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:u.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function H0(){return u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M8 11C9.65685 11 11 9.65685 11 8C11 6.34315 9.65685 5 8 5C6.34315 5 5 6.34315 5 8C5 9.65685 6.34315 11 8 11Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M12.3378 5.04365C12.4882 5.25907 12.62 5.48699 12.7315 5.7249L14.3503 6.6249C14.5524 7.5302 14.5545 8.4687 14.3565 9.3749L12.7315 10.2749C12.62 10.5128 12.4882 10.7407 12.3378 10.9562L12.369 12.8124C11.683 13.4375 10.871 13.9085 9.98776 14.1937L8.39401 13.2374C8.13185 13.2562 7.86868 13.2562 7.60651 13.2374L6.01901 14.1874C5.13295 13.9075 4.31832 13.4383 3.63151 12.8124L3.66276 10.9624C3.51356 10.744 3.38189 10.5141 3.26901 10.2749L1.65026 9.3749C1.44814 8.46961 1.446 7.53111 1.64401 6.6249L3.26901 5.7249C3.38056 5.48699 3.5123 5.25907 3.66276 5.04365L3.63151 3.1874C4.31754 2.56226 5.1295 2.09128 6.01276 1.80615L7.60651 2.7624C7.86868 2.74365 8.13185 2.74365 8.39401 2.7624L9.98151 1.8124C10.8676 2.09234 11.6822 2.5615 12.369 3.1874L12.3378 5.04365Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const B0="_tabsRoot_ktpr0_1",J0="_tabsList_ktpr0_6",W0="_tabTrigger_ktpr0_12",Do={tabsRoot:B0,tabsList:J0,tabTrigger:W0};function z0(){return u.jsxs(u.Fragment,{children:[u.jsx(Ho,{style:{margin:"1rem 0"}}),u.jsx(Yf,{value:Oo,className:Do.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[u.jsx(H0,{}),u.jsx("span",{children:"Manage"})]})})]})}function Zf({objectName:e,completed:t,pending:n,displayName:r}){return u.jsx(Yf,{value:e,className:Do.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[V0(t,n),u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsx("span",{children:r||e}),n&&u.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function G0({completed:e,pending:t,displayName:n}){return u.jsxs(u.Fragment,{children:[u.jsx(Ho,{style:{margin:"1rem 0"}}),u.jsx(Zf,{objectName:Er,completed:e,pending:t,displayName:n},"other-write")]})}function Q0({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var i,s;return u.jsx($0,{value:e,className:Do.tabsRoot,onValueChange:n,children:u.jsxs(U0,{className:Do.tabsList,children:[t.map(a=>{var c,f,d,l,m,y;return u.jsx(Zf,{objectName:a.name,displayName:a.displayName,completed:a.completed,pending:((f=(c=r==null?void 0:r[a.name])==null?void 0:c.read)==null?void 0:f.isOptionalFieldsModified)||((l=(d=r==null?void 0:r[a.name])==null?void 0:d.read)==null?void 0:l.isRequiredMapFieldsModified)||((y=(m=r==null?void 0:r[a.name])==null?void 0:m.read)==null?void 0:y.isValueMappingsModified)||!1},a.name)}),o&&u.jsx(G0,{completed:o.completed,pending:((s=(i=r==null?void 0:r.other)==null?void 0:i.write)==null?void 0:s.isWriteModified)||!1,displayName:"Write"}),u.jsx(z0,{})]})})}function X0(e,t){return t===Oo?{name:Oo,completed:!1}:e.find(n=>n.name===t)}function Y0({children:e}){var S;const{data:t}=tr(),{installation:n}=Ze(),{providerName:r}=ut(),{hydratedRevision:o}=di(),{objectConfigurationsState:i}=_a(),[s,a]=b.useState(""),c=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,d=o&&Yl(f,o),l=d!==null,m=!!((S=o==null?void 0:o.content)!=null&&S.write),y=m?Zl(f):void 0,w=b.useMemo(()=>{const h=[...d||[]];return y&&m&&h.push(y),h},[d,y,m]),v=X0(w,s),p=b.useCallback(()=>{const h=w.find(g=>v!==g&&!g.completed);h&&a(h.name)},[w,v]);return b.useEffect(()=>{!s&&w.length>0&&a(w[0].name)},[w,s,p]),u.jsx(wd.Provider,{value:p,children:u.jsx(yd.Provider,{value:v==null?void 0:v.name,children:u.jsxs(ui,{style:{maxWidth:"55rem"},children:[u.jsxs(_n,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[u.jsxs("div",{style:{width:"20rem"},children:[u.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),u.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),l&&u.jsx(Q0,{value:s,readNavObjects:d,onValueChange:h=>a(h),objectConfigurationsState:i,writeNavObject:y})]}),e]}),u.jsx(dd,{})]})})})}function Z0({...e}){return u.jsx(Y0,{...e})}const eO="_resetContainer_lkwv9_4",ep={resetContainer:eO},tO=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c})=>{var p;const{projectIdOrName:f,isLoading:d}=tr(),{isLoading:l}=$o(),{isError:m,errorState:y}=Ut(),{seed:w,reset:v}=Gl();return d||l?u.jsx(li,{}):m(ue.PROJECT,f)?u.jsx(Qt,{message:`Error loading project ${f}`}):m(ue.INTEGRATION_LIST,f)?u.jsx(Qt,{message:"Error retrieving integrations for the project, double check the API key"}):(p=y[ue.INTEGRATION_LIST])!=null&&p.apiError?u.jsx(Qt,{message:"Something went wrong, couldn't find integration information"}):u.jsx("div",{className:ep.resetContainer,children:u.jsx(ab,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,resetComponent:v,children:u.jsx(Bl,{children:u.jsx(Df,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:v,children:u.jsx(fI,{resetComponent:v,children:u.jsx(Xx,{children:u.jsx(mI,{children:u.jsx(Z0,{children:u.jsx(Wx,{})})})})})})})},w)})};function nO({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){const f={integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c};return u.jsx(Ia,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:u.jsx(tO,{...f})})}function rO(){return u.jsxs(ui,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[u.jsx(Ni,{}),u.jsx("p",{children:"Redirecting"})]})}function iO({redirectURL:e,children:t}){return b.useEffect(()=>{e&&window.location.replace(e)},[e]),e?u.jsx(rO,{}):t}function oO({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=b.useState(!1);return u.jsxs(u.Fragment,{children:[r===!1&&u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Manage connection"}),u.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[u.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),u.jsx(Be,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&u.jsxs(u.Fragment,{children:[u.jsx(Ea,{provider:n}),u.jsx(Af,{resetComponent:e,onDisconnectSuccess:t})]})]})}function sO({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=tr(),{providerName:o}=ut(e),i=`You have successfully connected your ${o} account to ${r}.`;return u.jsx(rc,{text:i,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:u.jsx(oO,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function aO({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:f,reset:d}=Gl(),l=b.useCallback(m=>{s?s(m.id):c&&c(m)},[s,c]);return u.jsx("div",{className:ep.resetContainer,children:u.jsx(Ia,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:u.jsx(Bl,{groupRef:r,provider:e,children:u.jsx(Df,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:l,onDisconnectSuccess:a,children:u.jsx(iO,{redirectURL:i,children:u.jsx(sO,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})})},f)}const cO=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=va(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,c=n==null?void 0:n[0],f=c==null?void 0:c.config;return b.useEffect(()=>{o&&He(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:f}};exports.AmpersandContext=pa;exports.AmpersandProvider=Xh;exports.ConnectProvider=aO;exports.FieldSettingWriteOnCreateEnum=Lm;exports.FieldSettingWriteOnUpdateEnum=jm;exports.InstallIntegration=nO;exports.InstallationProvider=Ia;exports.useAmpersandProviderProps=De;exports.useConfig=$w;exports.useConnection=wa;exports.useCreateInstallation=Wl;exports.useDeleteInstallation=fb;exports.useInstallation=ki;exports.useIsIntegrationInstalled=cO;exports.useLocalConfig=Kw;exports.useManifest=Dl;exports.useUpdateInstallation=zl;
50
+ */const aS="react-tooltip-core-styles",cS="react-tooltip-base-styles",vu={core:!1,base:!1};function wu({css:e,id:t=cS,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||vu[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=aS),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)),vu[n]=!0}const bu=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[rS(Number(o)),oS({fallbackAxisSideDirection:"start"}),iS({padding:5})],border:a,arrowSize:c=8})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const f=s;return n?(f.push(sS({element:n,padding:5})),yu(e,t,{placement:r,strategy:i,middleware:f}).then(({x:d,y:l,placement:h,middlewareData:g})=>{var w,v;const m={left:`${d}px`,top:`${l}px`,border:a},{x:S,y:p}=(w=g.arrow)!==null&&w!==void 0?w:{x:0,y:0},y=(v={top:"bottom",right:"left",bottom:"top",left:"right"}[h.split("-")[0]])!==null&&v!==void 0?v:"bottom",I=a&&{borderBottom:a,borderRight:a};let x=0;if(a){const T=`${a}`.match(/(\d+)px/);x=T!=null&&T[1]?Number(T[1]):1}return{tooltipStyles:m,tooltipArrowStyles:{left:S!=null?`${S}px`:"",top:p!=null?`${p}px`:"",right:"",bottom:"",...I,[y]:`-${c/2+x}px`},place:h}})):yu(e,t,{placement:"bottom",strategy:i,middleware:f}).then(({x:d,y:l,placement:h})=>({tooltipStyles:{left:`${d}px`,top:`${l}px`},tooltipArrowStyles:{},place:h}))},Iu=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Cu=(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},Su=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",ia=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>ia(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Su(e)||!Su(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>ia(e[o],t[o]))},uS=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"})},xu=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(uS(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},lS=typeof window<"u"?b.useLayoutEffect:b.useEffect,kt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},dS="DEFAULT_TOOLTIP_ID",fS={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},pS=b.createContext({getTooltipData:()=>fS});function gf(e=dS){return b.useContext(pS).getTooltipData(e)}var Rr={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"},bs={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 hS=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:c=10,events:f=["hover"],openOnClick:d=!1,positionStrategy:l="absolute",middlewares:h,wrapper:g,delayShow:w=0,delayHide:v=0,float:m=!1,hidden:S=!1,noArrow:p=!1,clickable:y=!1,closeOnEsc:I=!1,closeOnScroll:x=!1,closeOnResize:T=!1,openEvents:A,closeEvents:E,globalCloseEvents:R,imperativeModeOnly:P,style:M,position:q,afterShow:k,afterHide:L,disableTooltip:ae,content:oe,contentWrapperRef:ge,isOpen:me,defaultIsOpen:Oe=!1,setIsOpen:F,activeAnchor:U,setActiveAnchor:J,border:B,opacity:V,arrowColor:j,arrowSize:Q=8,role:Z="tooltip"})=>{var Y;const ee=b.useRef(null),te=b.useRef(null),le=b.useRef(null),K=b.useRef(null),we=b.useRef(null),[W,ot]=b.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[_e,mt]=b.useState(!1),[Je,gt]=b.useState(!1),[Ee,et]=b.useState(null),xt=b.useRef(!1),Ut=b.useRef(null),{anchorRefs:Rt,setActiveAnchor:lt}=gf(t),st=b.useRef(!1),[Me,Ue]=b.useState([]),Pt=b.useRef(!1),tt=d||f.includes("click"),Tr=tt||(A==null?void 0:A.click)||(A==null?void 0:A.dblclick)||(A==null?void 0:A.mousedown),fn=A?{...A}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!A&&tt&&Object.assign(fn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const pn=E?{...E}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!E&&tt&&Object.assign(pn,{mouseleave:!1,blur:!1,mouseout:!1});const yt=R?{...R}:{escape:I||!1,scroll:x||!1,resize:T||!1,clickOutsideAnchor:Tr||!1};P&&(Object.assign(fn,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(pn,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(yt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),lS(()=>(Pt.current=!0,()=>{Pt.current=!1}),[]);const Te=z=>{Pt.current&&(z&&gt(!0),setTimeout(()=>{Pt.current&&(F==null||F(z),me===void 0&&mt(z))},10))};b.useEffect(()=>{if(me===void 0)return()=>null;me&&gt(!0);const z=setTimeout(()=>{mt(me)},10);return()=>{clearTimeout(z)}},[me]),b.useEffect(()=>{if(_e!==xt.current)if(kt(we),xt.current=_e,_e)k==null||k();else{const z=(se=>{const ce=se.match(/^([\d.]+)(ms|s)$/);if(!ce)return 0;const[,Le,Ve]=ce;return Number(Le)*(Ve==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));we.current=setTimeout(()=>{gt(!1),et(null),L==null||L()},z+25)}},[_e]);const ir=z=>{ot(se=>ia(se,z)?se:z)},Nn=(z=w)=>{kt(le),Je?Te(!0):le.current=setTimeout(()=>{Te(!0)},z)},Tn=(z=v)=>{kt(K),K.current=setTimeout(()=>{st.current||Te(!1)},z)},Ot=z=>{var se;if(!z)return;const ce=(se=z.currentTarget)!==null&&se!==void 0?se:z.target;if(!(ce!=null&&ce.isConnected))return J(null),void lt({current:null});w?Nn():Te(!0),J(ce),lt({current:ce}),kt(K)},hn=()=>{y?Tn(v||100):v?Tn():Te(!1),kt(le)},An=({x:z,y:se})=>{var ce;const Le={getBoundingClientRect:()=>({x:z,y:se,width:0,height:0,top:se,left:z,right:z,bottom:se})};bu({place:(ce=Ee==null?void 0:Ee.place)!==null&&ce!==void 0?ce:a,offset:c,elementReference:Le,tooltipReference:ee.current,tooltipArrowReference:te.current,strategy:l,middlewares:h,border:B,arrowSize:Q}).then(Ve=>{ir(Ve)})},Rn=z=>{if(!z)return;const se=z,ce={x:se.clientX,y:se.clientY};An(ce),Ut.current=ce},mn=z=>{var se;if(!_e)return;const ce=z.target;ce.isConnected&&(!((se=ee.current)===null||se===void 0)&&se.contains(ce)||[document.querySelector(`[id='${i}']`),...Me].some(Le=>Le==null?void 0:Le.contains(ce))||(Te(!1),kt(le)))},tn=Cu(Ot,50),ke=Cu(hn,50),at=z=>{ke.cancel(),tn(z)},re=()=>{tn.cancel(),ke()},fe=b.useCallback(()=>{var z,se;const ce=(z=Ee==null?void 0:Ee.position)!==null&&z!==void 0?z:q;ce?An(ce):m?Ut.current&&An(Ut.current):U!=null&&U.isConnected&&bu({place:(se=Ee==null?void 0:Ee.place)!==null&&se!==void 0?se:a,offset:c,elementReference:U,tooltipReference:ee.current,tooltipArrowReference:te.current,strategy:l,middlewares:h,border:B,arrowSize:Q}).then(Le=>{Pt.current&&ir(Le)})},[_e,U,oe,M,a,Ee==null?void 0:Ee.place,c,l,q,Ee==null?void 0:Ee.position,m,Q]);b.useEffect(()=>{var z,se;const ce=new Set(Rt);Me.forEach(ve=>{ae!=null&&ae(ve)||ce.add({current:ve})});const Le=document.querySelector(`[id='${i}']`);Le&&!(ae!=null&&ae(Le))&&ce.add({current:Le});const Ve=()=>{Te(!1)},Ge=xu(U),Ft=xu(ee.current);yt.scroll&&(window.addEventListener("scroll",Ve),Ge==null||Ge.addEventListener("scroll",Ve),Ft==null||Ft.addEventListener("scroll",Ve));let nt=null;yt.resize?window.addEventListener("resize",Ve):U&&ee.current&&(nt=nS(U,ee.current,fe,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const vt=ve=>{ve.key==="Escape"&&Te(!1)};yt.escape&&window.addEventListener("keydown",vt),yt.clickOutsideAnchor&&window.addEventListener("click",mn);const Ne=[],Pn=ve=>!!(ve!=null&&ve.target&&(U!=null&&U.contains(ve.target))),qt=ve=>{_e&&Pn(ve)||Ot(ve)},Zo=ve=>{_e&&Pn(ve)&&hn()},Hi=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Bi=["click","dblclick","mousedown","mouseup"];Object.entries(fn).forEach(([ve,Vt])=>{Vt&&(Hi.includes(ve)?Ne.push({event:ve,listener:at}):Bi.includes(ve)&&Ne.push({event:ve,listener:qt}))}),Object.entries(pn).forEach(([ve,Vt])=>{Vt&&(Hi.includes(ve)?Ne.push({event:ve,listener:re}):Bi.includes(ve)&&Ne.push({event:ve,listener:Zo}))}),m&&Ne.push({event:"pointermove",listener:Rn});const Ji=()=>{st.current=!0},Wi=()=>{st.current=!1,hn()},nn=y&&(pn.mouseout||pn.mouseleave);return nn&&((z=ee.current)===null||z===void 0||z.addEventListener("mouseover",Ji),(se=ee.current)===null||se===void 0||se.addEventListener("mouseout",Wi)),Ne.forEach(({event:ve,listener:Vt})=>{ce.forEach(fi=>{var or;(or=fi.current)===null||or===void 0||or.addEventListener(ve,Vt)})}),()=>{var ve,Vt;yt.scroll&&(window.removeEventListener("scroll",Ve),Ge==null||Ge.removeEventListener("scroll",Ve),Ft==null||Ft.removeEventListener("scroll",Ve)),yt.resize?window.removeEventListener("resize",Ve):nt==null||nt(),yt.clickOutsideAnchor&&window.removeEventListener("click",mn),yt.escape&&window.removeEventListener("keydown",vt),nn&&((ve=ee.current)===null||ve===void 0||ve.removeEventListener("mouseover",Ji),(Vt=ee.current)===null||Vt===void 0||Vt.removeEventListener("mouseout",Wi)),Ne.forEach(({event:fi,listener:or})=>{ce.forEach(es=>{var Fn;(Fn=es.current)===null||Fn===void 0||Fn.removeEventListener(fi,or)})})}},[U,fe,Je,Rt,Me,A,E,R,tt,w,v]),b.useEffect(()=>{var z,se;let ce=(se=(z=Ee==null?void 0:Ee.anchorSelect)!==null&&z!==void 0?z:s)!==null&&se!==void 0?se:"";!ce&&t&&(ce=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Le=new MutationObserver(Ve=>{const Ge=[],Ft=[];Ve.forEach(nt=>{if(nt.type==="attributes"&&nt.attributeName==="data-tooltip-id"&&(nt.target.getAttribute("data-tooltip-id")===t?Ge.push(nt.target):nt.oldValue===t&&Ft.push(nt.target)),nt.type==="childList"){if(U){const vt=[...nt.removedNodes].filter(Ne=>Ne.nodeType===1);if(ce)try{Ft.push(...vt.filter(Ne=>Ne.matches(ce))),Ft.push(...vt.flatMap(Ne=>[...Ne.querySelectorAll(ce)]))}catch{}vt.some(Ne=>{var Pn;return!!(!((Pn=Ne==null?void 0:Ne.contains)===null||Pn===void 0)&&Pn.call(Ne,U))&&(gt(!1),Te(!1),J(null),kt(le),kt(K),!0)})}if(ce)try{const vt=[...nt.addedNodes].filter(Ne=>Ne.nodeType===1);Ge.push(...vt.filter(Ne=>Ne.matches(ce))),Ge.push(...vt.flatMap(Ne=>[...Ne.querySelectorAll(ce)]))}catch{}}}),(Ge.length||Ft.length)&&Ue(nt=>[...nt.filter(vt=>!Ft.includes(vt)),...Ge])});return Le.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Le.disconnect()}},[t,s,Ee==null?void 0:Ee.anchorSelect,U]),b.useEffect(()=>{fe()},[fe]),b.useEffect(()=>{if(!(ge!=null&&ge.current))return()=>null;const z=new ResizeObserver(()=>{setTimeout(()=>fe())});return z.observe(ge.current),()=>{z.disconnect()}},[oe,ge==null?void 0:ge.current]),b.useEffect(()=>{var z;const se=document.querySelector(`[id='${i}']`),ce=[...Me,se];U&&ce.includes(U)||J((z=Me[0])!==null&&z!==void 0?z:se)},[i,Me,U]),b.useEffect(()=>(Oe&&Te(!0),()=>{kt(le),kt(K)}),[]),b.useEffect(()=>{var z;let se=(z=Ee==null?void 0:Ee.anchorSelect)!==null&&z!==void 0?z:s;if(!se&&t&&(se=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),se)try{const ce=Array.from(document.querySelectorAll(se));Ue(ce)}catch{Ue([])}},[t,s,Ee==null?void 0:Ee.anchorSelect]),b.useEffect(()=>{le.current&&(kt(le),Nn(w))},[w]);const dt=(Y=Ee==null?void 0:Ee.content)!==null&&Y!==void 0?Y:oe,gn=_e&&Object.keys(W.tooltipStyles).length>0;return b.useImperativeHandle(e,()=>({open:z=>{if(z!=null&&z.anchorSelect)try{document.querySelector(z.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${z.anchorSelect}" is not a valid CSS selector`)}et(z??null),z!=null&&z.delay?Nn(z.delay):Te(!0)},close:z=>{z!=null&&z.delay?Tn(z.delay):Te(!1)},activeAnchor:U,place:W.place,isOpen:!!(Je&&!S&&dt&&gn)})),Je&&!S&&dt?b.createElement(g,{id:t,role:Z,className:Kt("react-tooltip",Rr.tooltip,bs.tooltip,bs[o],n,`react-tooltip__place-${W.place}`,Rr[gn?"show":"closing"],gn?"react-tooltip__show":"react-tooltip__closing",l==="fixed"&&Rr.fixed,y&&Rr.clickable),onTransitionEnd:z=>{kt(we),_e||z.propertyName!=="opacity"||(gt(!1),et(null),L==null||L())},style:{...M,...W.tooltipStyles,opacity:V!==void 0&&gn?V:void 0},ref:ee},dt,b.createElement(g,{className:Kt("react-tooltip-arrow",Rr.arrow,bs.arrow,r,p&&Rr.noArrow),style:{...W.tooltipArrowStyles,background:j?`linear-gradient(to right bottom, transparent 50%, ${j} 50%)`:void 0,"--rt-arrow-size":`${Q}px`},ref:te})):null},mS=({content:e})=>b.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),gS=b.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:f="top",offset:d=10,wrapper:l="div",children:h=null,events:g=["hover"],openOnClick:w=!1,positionStrategy:v="absolute",middlewares:m,delayShow:S=0,delayHide:p=0,float:y=!1,hidden:I=!1,noArrow:x=!1,clickable:T=!1,closeOnEsc:A=!1,closeOnScroll:E=!1,closeOnResize:R=!1,openEvents:P,closeEvents:M,globalCloseEvents:q,imperativeModeOnly:k=!1,style:L,position:ae,isOpen:oe,defaultIsOpen:ge=!1,disableStyleInjection:me=!1,border:Oe,opacity:F,arrowColor:U,arrowSize:J,setIsOpen:B,afterShow:V,afterHide:j,disableTooltip:Q,role:Z="tooltip"},Y)=>{const[ee,te]=b.useState(r),[le,K]=b.useState(o),[we,W]=b.useState(f),[ot,_e]=b.useState(c),[mt,Je]=b.useState(d),[gt,Ee]=b.useState(S),[et,xt]=b.useState(p),[Ut,Rt]=b.useState(y),[lt,st]=b.useState(I),[Me,Ue]=b.useState(l),[Pt,tt]=b.useState(g),[Tr,fn]=b.useState(v),[pn,yt]=b.useState(null),[Te,ir]=b.useState(null),Nn=b.useRef(me),{anchorRefs:Tn,activeAnchor:Ot}=gf(e),hn=ke=>ke==null?void 0:ke.getAttributeNames().reduce((at,re)=>{var fe;return re.startsWith("data-tooltip-")&&(at[re.replace(/^data-tooltip-/,"")]=(fe=ke==null?void 0:ke.getAttribute(re))!==null&&fe!==void 0?fe:null),at},{}),An=ke=>{const at={place:re=>{var fe;W((fe=re)!==null&&fe!==void 0?fe:f)},content:re=>{te(re??r)},html:re=>{K(re??o)},variant:re=>{var fe;_e((fe=re)!==null&&fe!==void 0?fe:c)},offset:re=>{Je(re===null?d:Number(re))},wrapper:re=>{var fe;Ue((fe=re)!==null&&fe!==void 0?fe:l)},events:re=>{const fe=re==null?void 0:re.split(" ");tt(fe??g)},"position-strategy":re=>{var fe;fn((fe=re)!==null&&fe!==void 0?fe:v)},"delay-show":re=>{Ee(re===null?S:Number(re))},"delay-hide":re=>{xt(re===null?p:Number(re))},float:re=>{Rt(re===null?y:re==="true")},hidden:re=>{st(re===null?I:re==="true")},"class-name":re=>{yt(re)}};Object.values(at).forEach(re=>re(null)),Object.entries(ke).forEach(([re,fe])=>{var dt;(dt=at[re])===null||dt===void 0||dt.call(at,fe)})};b.useEffect(()=>{te(r)},[r]),b.useEffect(()=>{K(o)},[o]),b.useEffect(()=>{W(f)},[f]),b.useEffect(()=>{_e(c)},[c]),b.useEffect(()=>{Je(d)},[d]),b.useEffect(()=>{Ee(S)},[S]),b.useEffect(()=>{xt(p)},[p]),b.useEffect(()=>{Rt(y)},[y]),b.useEffect(()=>{st(I)},[I]),b.useEffect(()=>{fn(v)},[v]),b.useEffect(()=>{Nn.current!==me&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[me]),b.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:me==="core",disableBase:me}}))},[]),b.useEffect(()=>{var ke;const at=new Set(Tn);let re=n;if(!re&&e&&(re=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),re)try{document.querySelectorAll(re).forEach(se=>{at.add({current:se})})}catch{console.warn(`[react-tooltip] "${re}" is not a valid CSS selector`)}const fe=document.querySelector(`[id='${t}']`);if(fe&&at.add({current:fe}),!at.size)return()=>null;const dt=(ke=Te??fe)!==null&&ke!==void 0?ke:Ot.current,gn=new MutationObserver(se=>{se.forEach(ce=>{var Le;if(!dt||ce.type!=="attributes"||!(!((Le=ce.attributeName)===null||Le===void 0)&&Le.startsWith("data-tooltip-")))return;const Ve=hn(dt);An(Ve)})}),z={attributes:!0,childList:!1,subtree:!1};if(dt){const se=hn(dt);An(se),gn.observe(dt,z)}return()=>{gn.disconnect()}},[Tn,Ot,Te,t,n]),b.useEffect(()=>{L!=null&&L.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),Oe&&!Iu("border",`${Oe}`)&&console.warn(`[react-tooltip] "${Oe}" is not a valid \`border\`.`),L!=null&&L.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),F&&!Iu("opacity",`${F}`)&&console.warn(`[react-tooltip] "${F}" is not a valid \`opacity\`.`)},[]);let Rn=h;const mn=b.useRef(null);if(i){const ke=i({content:(Te==null?void 0:Te.getAttribute("data-tooltip-content"))||ee||null,activeAnchor:Te});Rn=ke?b.createElement("div",{ref:mn,className:"react-tooltip-content-wrapper"},ke):null}else ee&&(Rn=ee);le&&(Rn=b.createElement(mS,{content:le}));const tn={forwardRef:Y,id:e,anchorId:t,anchorSelect:n,className:Kt(s,pn),classNameArrow:a,content:Rn,contentWrapperRef:mn,place:we,variant:ot,offset:mt,wrapper:Me,events:Pt,openOnClick:w,positionStrategy:Tr,middlewares:m,delayShow:gt,delayHide:et,float:Ut,hidden:lt,noArrow:x,clickable:T,closeOnEsc:A,closeOnScroll:E,closeOnResize:R,openEvents:P,closeEvents:M,globalCloseEvents:q,imperativeModeOnly:k,style:L,position:ae,isOpen:oe,defaultIsOpen:ge,border:Oe,opacity:F,arrowColor:U,arrowSize:J,setIsOpen:B,afterShow:V,afterHide:j,disableTooltip:Q,activeAnchor:Te,setActiveAnchor:ke=>ir(ke),role:Z};return b.createElement(hS,{...tn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||wu({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s;--rt-arrow-size:8px}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit;z-index:-1}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||wu({css:`
51
+ .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:var(--rt-arrow-size);height:var(--rt-arrow-size)}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function yS(){return u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[u.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[u.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),u.jsx("defs",{children:u.jsx("clipPath",{id:"clip0_2896_16290",children:u.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function yf({id:e,tooltipText:t}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:yS()}),u.jsx(gS,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function vS(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=!td(o,n);e.read.isRequiredMapFieldsModified=s}}function Ti(e,t,n){t(e,r=>vS(r,n))}const wS="Each field must be mapped to a unique value";function Ya({field:e,onSelectChange:t,allFields:n}){var p;const{configureState:r,selectedObjectName:o,setConfigureState:i}=en(),[s,a]=b.useState(!0),{isError:c,removeError:f,getError:d}=$t(),l=(p=r==null?void 0:r.read)==null?void 0:p.selectedFieldMappings,h=l==null?void 0:l[e.mapToName];b.useEffect(()=>{e._default&&!h&&o&&r&&Ti(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,h,r]);const g=b.useMemo(()=>n.map(y=>({id:y.fieldName,label:y.displayName,value:y.fieldName})),[n]),w=u.jsx(sf,{disabled:s,items:g,selectedValue:h||null,onSelectedItemChange:y=>{t({target:{name:e.mapToName,value:y==null?void 0:y.value}})},placeholder:"Please select one",style:{width:"100%"}}),v=b.useCallback(()=>{o&&(Ti(o,i,[{field:e.mapToName,value:null}]),c(ue.MAPPING,o)&&f(ue.MAPPING,o))},[e.mapToName,o,i,c,f]),{hasDuplicationError:m,errorMessage:S}=b.useMemo(()=>{const y=d(ue.MAPPING,o),I=Array.isArray(y)&&y.length>0&&y.includes(e.mapToName);return{hasDuplicationError:I,errorMessage:I?wS:""}},[o,d,e.mapToName]);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[u.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),u.jsx("span",{children:(e==null?void 0:e.prompt)&&u.jsx(yf,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[w,u.jsx(Be,{type:"button",variant:"ghost",onClick:v,children:"Clear"})]})]},e.mapToName),m&&u.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",S," "]},e.mapToName)]})}const bS="_formControl_9qd8d_1",IS="_formLabel_9qd8d_5",CS="_formLabelRequired_9qd8d_11",SS="_formInput_9qd8d_16",xS="_formInputInvalid_9qd8d_20",OS="_formError_9qd8d_24",ES="_disabled_9qd8d_30",cr={formControl:bS,formLabel:IS,formLabelRequired:CS,formInput:SS,formInputInvalid:xS,formError:OS,disabled:ES};function Go({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return u.jsxs("div",{className:Kt(cr.formControl,{[cr.disabled]:r}),children:[t&&u.jsx("label",{htmlFor:e,className:Kt(cr.formLabel,{[cr.formLabelRequired]:n}),children:t}),u.jsx("div",{id:e,className:Kt(cr.formInput,{[cr.formInputInvalid]:o}),children:s}),o&&i&&u.jsx("div",{className:cr.formError,role:"alert",children:i})]})}function vf({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 _S({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>u.jsx(Go,{id:r.mapToName,children:u.jsx(Ya,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function NS(){var w,v;const{selectedObjectName:e,configureState:t,setConfigureState:n}=en(),{isError:r,removeError:o,setError:i}=$t(),s=((w=t==null?void 0:t.read)==null?void 0:w.allFields)||[],{fieldMapping:a}=Ze(),c=(v=t==null?void 0:t.read)==null?void 0:v.selectedFieldMappings,f=m=>{const{value:S,name:p}=m.target;!S||vf({selectedFieldMappings:c,selectedObjectName:e,fieldName:p,fieldValue:S,setError:i})||(e&&Ti(e,n,[{field:p,value:S}]),r(ue.MAPPING,p)&&o(ue.MAPPING,p),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},d=b.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(m=>!m.fieldName),[a,e]),l=b.useMemo(()=>{var p;return(((p=t==null?void 0:t.read)==null?void 0:p.optionalMapFields)||[]).filter(y=>!d.some(I=>I.mapToName===y.mapToName))},[t,d]),h=d.length>0;return l.length>0||h?u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Map the following optional fields"}),u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[l==null?void 0:l.map(m=>u.jsx(Go,{id:m.mapToName,children:u.jsx(Ya,{allFields:s,field:m,onSelectChange:f})},m.mapToName)),h&&u.jsx(_S,{dynamicFieldMappings:d,onSelectChange:f,allFields:s})]})]}):null}function TS(){var f;const{selectedObjectName:e,configureState:t,setConfigureState:n}=en(),{isError:r,removeError:o,setError:i}=$t(),s=(f=t==null?void 0:t.read)==null?void 0:f.selectedFieldMappings,a=d=>{const{value:l,name:h}=d.target;!l||vf({selectedFieldMappings:s,selectedObjectName:e,fieldName:h,fieldValue:l,setError:i})||(e&&Ti(e,n,[{field:h,value:l}]),r(ue.MAPPING,h)&&o(ue.MAPPING,h),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},c=b.useMemo(()=>{var d;return((d=t==null?void 0:t.read)==null?void 0:d.requiredMapFields)||[]},[t]);return c!=null&&c.length?u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Map the following fields"}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(d=>{var l;return u.jsx(Go,{id:d.mapToName,isInvalid:r(ue.MAPPING,d.mapToName),errorMessage:"* required",children:u.jsx(Ya,{allFields:((l=t==null?void 0:t.read)==null?void 0:l.allFields)||[],field:d,onSelectChange:a})},d.mapToName)})})]}):null}const AS=(e,t)=>e.filter(n=>!t.has(n));function RS(){var h,g,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=en(),{fieldMapping:r}=Ze(),o=((h=t==null?void 0:t.read)==null?void 0:h.selectedFieldMappings)||{},i=Object.keys(o),s=((g=t==null?void 0:t.read)==null?void 0:g.requiredMapFields)||[],a=((w=t==null?void 0:t.read)==null?void 0:w.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(v=>!v.fieldName):[],f=s.concat(c,a).map(v=>v.mapToName),d=new Set(f),l=AS(i,d);b.useEffect(()=>{e&&l.length&&Ti(e,n,l.map(v=>({field:v,value:null})))},[e,n,l])}const PS={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function FS({children:e,style:t}){return u.jsx(En,{style:{...PS,...t},children:e})}function DS(){var f,d,l;const{data:e}=er(),{hydratedRevision:t}=li(),{selectedObjectName:n}=en(),{providerName:r}=ut(),o=e==null?void 0:e.appName,i=(l=(d=(f=t==null?void 0:t.content)==null?void 0:f.read)==null?void 0:d.objects)==null?void 0:l.find(h=>h.objectName===n),s=(i==null?void 0:i.displayName)||n&&cn(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&cn(a);return c&&o&&r?u.jsx(FS,{style:{marginTop:"1rem"},children:u.jsxs("p",{style:{margin:"1rem 0"},children:[u.jsx("b",{children:c})," in ",o," is mapped to"," ",u.jsx("b",{children:s})," in ",r,"."]})}):null}function Ou(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wf(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Ou(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():Ou(e[o],null)}}}}function ii(...e){return $.useCallback(wf(...e),e)}function Qo(e,t=[]){let n=[];function r(i,s){const a=$.createContext(s),c=n.length;n=[...n,s];const f=l=>{var S;const{scope:h,children:g,...w}=l,v=((S=h==null?void 0:h[e])==null?void 0:S[c])||a,m=$.useMemo(()=>w,Object.values(w));return u.jsx(v.Provider,{value:m,children:g})};f.displayName=i+"Provider";function d(l,h){var v;const g=((v=h==null?void 0:h[e])==null?void 0:v[c])||a,w=$.useContext(g);if(w)return w;if(s!==void 0)return s;throw new Error(`\`${l}\` must be used within \`${i}\``)}return[f,d]}const o=()=>{const i=n.map(s=>$.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return $.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,MS(o,...t)]}function MS(...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:f})=>{const l=c(i)[`__scope${f}`];return{...a,...l}},{});return $.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Qt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var Ai=globalThis!=null&&globalThis.document?$.useLayoutEffect:()=>{},kS=$[" useInsertionEffect ".trim().toString()]||Ai;function Za({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=LS({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const d=$.useRef(e!==void 0);$.useEffect(()=>{const l=d.current;l!==a&&console.warn(`${r} is changing from ${l?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const f=$.useCallback(d=>{var l;if(a){const h=jS(d)?d(e):d;h!==e&&((l=s.current)==null||l.call(s,h))}else i(d)},[a,e,i,s]);return[c,f]}function LS({defaultProp:e,onChange:t}){const[n,r]=$.useState(e),o=$.useRef(n),i=$.useRef(t);return kS(()=>{i.current=t},[t]),$.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function jS(e){return typeof e=="function"}function KS(e){const t=$.useRef({value:e,previous:e});return $.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function $S(e){const[t,n]=$.useState(void 0);return Ai(()=>{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,f=Array.isArray(c)?c[0]:c;s=f.inlineSize,a=f.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 US(e,t){return $.useReducer((n,r)=>t[n][r]??n,e)}var ec=e=>{const{present:t,children:n}=e,r=qS(t),o=typeof n=="function"?n({present:r.isPresent}):$.Children.only(n),i=ii(r.ref,VS(o));return typeof n=="function"||r.isPresent?$.cloneElement(o,{ref:i}):null};ec.displayName="Presence";function qS(e){const[t,n]=$.useState(),r=$.useRef(null),o=$.useRef(e),i=$.useRef("none"),s=e?"mounted":"unmounted",[a,c]=US(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return $.useEffect(()=>{const f=lo(r.current);i.current=a==="mounted"?f:"none"},[a]),Ai(()=>{const f=r.current,d=o.current;if(d!==e){const h=i.current,g=lo(f);e?c("MOUNT"):g==="none"||(f==null?void 0:f.display)==="none"?c("UNMOUNT"):c(d&&h!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Ai(()=>{if(t){let f;const d=t.ownerDocument.defaultView??window,l=g=>{const v=lo(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&v&&(c("ANIMATION_END"),!o.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",f=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},h=g=>{g.target===t&&(i.current=lo(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{d.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:$.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function lo(e){return(e==null?void 0:e.animationName)||"none"}function VS(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 oa(e){const t=HS(e),n=$.forwardRef((r,o)=>{const{children:i,...s}=r,a=$.Children.toArray(i),c=a.find(JS);if(c){const f=c.props.children,d=a.map(l=>l===c?$.Children.count(f)>1?$.Children.only(null):$.isValidElement(f)?f.props.children:null:l);return u.jsx(t,{...s,ref:o,children:$.isValidElement(f)?$.cloneElement(f,void 0,d):null})}return u.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function HS(e){const t=$.forwardRef((n,r)=>{const{children:o,...i}=n;if($.isValidElement(o)){const s=zS(o),a=WS(i,o.props);return o.type!==$.Fragment&&(a.ref=r?wf(r,s):s),$.cloneElement(o,a)}return $.Children.count(o)>1?$.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var BS=Symbol("radix.slottable");function JS(e){return $.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===BS}function WS(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)=>{const c=i(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function zS(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 GS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_n=GS.reduce((e,t)=>{const n=oa(`Primitive.${t}`),r=$.forwardRef((o,i)=>{const{asChild:s,...a}=o,c=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Xo="Checkbox",[QS,dO]=Qo(Xo),[XS,tc]=QS(Xo);function YS(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:a,onCheckedChange:c,required:f,value:d="on",internal_do_not_use_render:l}=e,[h,g]=Za({prop:n,defaultProp:o??!1,onChange:c,caller:Xo}),[w,v]=$.useState(null),[m,S]=$.useState(null),p=$.useRef(!1),y=w?!!s||!!w.closest("form"):!0,I={checked:h,disabled:i,setChecked:g,control:w,setControl:v,name:a,form:s,value:d,hasConsumerStoppedPropagationRef:p,required:f,defaultChecked:Gn(o)?!1:o,isFormControl:y,bubbleInput:m,setBubbleInput:S};return u.jsx(XS,{scope:t,...I,children:ZS(l)?l(I):r})}var bf="CheckboxTrigger",If=$.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:s,disabled:a,checked:c,required:f,setControl:d,setChecked:l,hasConsumerStoppedPropagationRef:h,isFormControl:g,bubbleInput:w}=tc(bf,e),v=ii(o,d),m=$.useRef(c);return $.useEffect(()=>{const S=i==null?void 0:i.form;if(S){const p=()=>l(m.current);return S.addEventListener("reset",p),()=>S.removeEventListener("reset",p)}},[i,l]),u.jsx(_n.button,{type:"button",role:"checkbox","aria-checked":Gn(c)?"mixed":c,"aria-required":f,"data-state":Of(c),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:v,onKeyDown:Qt(t,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Qt(n,S=>{l(p=>Gn(p)?!0:!p),w&&g&&(h.current=S.isPropagationStopped(),h.current||S.stopPropagation())})})});If.displayName=bf;var nc=$.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c,onCheckedChange:f,form:d,...l}=e;return u.jsx(YS,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:a,required:s,onCheckedChange:f,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:h})=>u.jsxs(u.Fragment,{children:[u.jsx(If,{...l,ref:t,__scopeCheckbox:n}),h&&u.jsx(xf,{__scopeCheckbox:n})]})})});nc.displayName=Xo;var Cf="CheckboxIndicator",rc=$.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=tc(Cf,n);return u.jsx(ec,{present:r||Gn(i.checked)||i.checked===!0,children:u.jsx(_n.span,{"data-state":Of(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});rc.displayName=Cf;var Sf="CheckboxBubbleInput",xf=$.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:s,required:a,disabled:c,name:f,value:d,form:l,bubbleInput:h,setBubbleInput:g}=tc(Sf,e),w=ii(n,g),v=KS(i),m=$S(r);$.useEffect(()=>{const p=h;if(!p)return;const y=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(y,"checked").set,T=!o.current;if(v!==i&&x){const A=new Event("click",{bubbles:T});p.indeterminate=Gn(i),x.call(p,Gn(i)?!1:i),p.dispatchEvent(A)}},[h,v,i,o]);const S=$.useRef(Gn(i)?!1:i);return u.jsx(_n.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??S.current,required:a,disabled:c,name:f,value:d,form:l,...t,tabIndex:-1,ref:w,style:{...t.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});xf.displayName=Sf;function ZS(e){return typeof e=="function"}function Gn(e){return e==="indeterminate"}function Of(e){return Gn(e)?"indeterminate":e?"checked":"unchecked"}function Ef(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 ex=["color"],_f=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Ef(e,ex);return b.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}),b.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"}))}),tx=["color"],nx=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Ef(e,tx);return b.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}),b.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 rx="_checkboxGroupContainer_hqfeu_1",ix="_stack_hqfeu_6",ox="_selectAllContainer_hqfeu_10",sx="_fieldContainer_hqfeu_17",ax="_checkbox_hqfeu_1",oi={checkboxGroupContainer:rx,stack:ix,selectAllContainer:ox,fieldContainer:sx,checkbox:ax};function cx({id:e,isChecked:t,label:n,onCheckedChange:r}){return u.jsxs("div",{className:oi.fieldContainer,children:[u.jsx(nc,{className:oi.checkbox,id:e,onCheckedChange:r,checked:t,children:u.jsx(rc,{children:u.jsx(_f,{})})}),u.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function ux({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return u.jsxs("div",{className:oi.selectAllContainer,children:[u.jsx(nc,{className:oi.checkbox,id:e,onCheckedChange:r,checked:o?"indeterminate":t,children:u.jsxs(rc,{children:[o&&u.jsx(nx,{}),t===!0&&u.jsx(_f,{})]})}),u.jsx("label",{htmlFor:e,children:n})]})}function lx({children:e}){return u.jsx("div",{className:oi.checkboxGroupContainer,children:e})}function dx({children:e}){return u.jsx("div",{className:oi.stack,children:e})}const fx="_paginationContainer_1p51x_1",px="_pageInfo_1p51x_7",hx="_searchContainer_1p51x_13",mx="_searchInput_1p51x_17",gx="_noResults_1p51x_21",yi={paginationContainer:fx,pageInfo:px,searchContainer:hx,searchInput:mx,noResults:gx};function Nf({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:o=!0,searchPlaceholder:i="Search fields..."}){const[s,a]=b.useState(1),[c,f]=b.useState(""),d=e.filter(y=>y.label.toLowerCase().includes(c.toLowerCase())),l=Math.ceil(d.length/n),h=(s-1)*n,g=h+n,w=d.slice(h,g),v=y=>{f(y),a(1)},m=y=>{d.forEach(I=>{t(I.id,y)})},S=d.length>0&&d.every(y=>y.isChecked),p=d.some(y=>y.isChecked);return u.jsxs(lx,{children:[o&&u.jsx("div",{className:yi.searchContainer,children:u.jsx(ld,{id:"field-search",type:"text",placeholder:i,value:c,onChange:y=>v(y.target.value),className:yi.searchInput})}),r&&e.length>=2&&u.jsx(ux,{id:"select-all-fields",isChecked:S,label:`Select all ${d.length} ${c?"matching ":""}fields`,onCheckedChange:m,isIndeterminate:p&&!S}),u.jsx(dx,{children:w.map(y=>u.jsx(cx,{id:y.id,isChecked:y.isChecked,label:y.label,onCheckedChange:I=>t(y.id,I===!0)},y.id))}),l>1&&u.jsxs("div",{className:yi.paginationContainer,children:[u.jsx(Be,{type:"button",onClick:()=>a(y=>Math.max(1,y-1)),disabled:s===1,variant:"ghost",children:"<"}),u.jsxs("span",{className:yi.pageInfo,children:[s," of ",l]}),u.jsx(Be,{type:"button",onClick:()=>a(y=>Math.min(l,y+1)),disabled:s===l,variant:"ghost",children:">"})]}),d.length===0&&c&&u.jsxs("div",{className:yi.noResults,children:['No fields found matching "',c,'"']})]})}function yx(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=!td(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function vx(e,t,n,r){t(e,o=>yx(o,n,r))}function wx(){var f,d;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=en(),o=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,i=(d=t==null?void 0:t.read)==null?void 0:d.optionalFields,s=(l,h)=>{r&&t&&vx(r,n,l,h)},a=b.useMemo(()=>(i==null?void 0:i.filter(l=>!tr(l)&&"fieldName"in l&&"displayName"in l).map(l=>({id:l.fieldName,label:l.displayName,isChecked:!!(o!=null&&o[l.fieldName])})).sort((l,h)=>l.label.localeCompare(h.label)))||[],[i,o]);return!!(i&&i.length>0)&&u.jsxs(u.Fragment,{children:[u.jsx(At,{string:`${e} reads the following optional fields`}),u.jsx(Nf,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${i==null?void 0:i.length}`)]})}function bx(){return u.jsx(wx,{})}const Ix={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 Cx({children:e,style:t,...n}){return u.jsx("span",{style:{...Ix,...t},...n,children:e})}function Sx(){var n,r,o;const{configureState:e}=en(),{appName:t}=er();return u.jsxs(u.Fragment,{children:[u.jsx(At,{string:`${t} reads the following fields`}),u.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(r=(n=e==null?void 0:e.read)==null?void 0:n.requiredFields)!=null&&r.length?(o=e.read)==null?void 0:o.requiredFields.map(i=>tr(i)?null:u.jsx(Cx,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function xx(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 Tf(e,t,n,r,o){t(e,i=>xx(i,e,n,r,o))}function Ox(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function Ex({string:e,fieldName:t}){return u.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[u.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,u.jsx("b",{children:t})]}),u.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:u.jsx(Ho,{style:{width:"100%",marginLeft:"1rem"}})})]})}function _x({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var x;const{configureState:i,selectedObjectName:s,setConfigureState:a}=en(),[c,f]=b.useState(!0),{getError:d,setError:l,resetBoundary:h,isError:g,removeError:w}=$t(),v=b.useMemo(()=>{var T,A;return((A=(T=i==null?void 0:i.read)==null?void 0:T.selectedValueMappings)==null?void 0:A[n])||{}},[(x=i==null?void 0:i.read)==null?void 0:x.selectedValueMappings,n]),m=b.useMemo(()=>v==null?void 0:v[e.mappedValue],[v,e.mappedValue]);b.useEffect(()=>{f(!1)},[e,a,s,m,i]);const S=b.useMemo(()=>r.map(T=>({id:T.value,label:T.displayValue,value:T.value})),[r]),p=b.useCallback(T=>{if(T){if(Object.values(v).some(A=>A===T.value&&A!==m)){const A=[...Object.entries(v).filter(([E,R])=>R===T.value&&R!==m).map(([E])=>E),e.mappedValue];l(ue.VALUE_MAPPING,n,A);return}d(ue.VALUE_MAPPING,n)&&h(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:T.value,fieldName:n}})}},[t,v,m,n,e.mappedValue,h,l,d]),y=b.useMemo(()=>u.jsx(sf,{disabled:c,items:S,selectedValue:m||null,onSelectedItemChange:p,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},m),[m,c,S,p,o]),I=b.useCallback(()=>{s&&(Tf(s,a,e.mappedValue,"",n),g(ue.VALUE_MAPPING,n)&&w(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,g,w]);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[u.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:u.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[y,u.jsx(Be,{type:"button",variant:"ghost",onClick:I,children:"Clear"})]})]},e.mappedValue)}function Nx(){var g,w,v;const{fieldMapping:e}=Ze(),{selectedObjectName:t,configureState:n,setConfigureState:r}=en(),{isError:o,removeError:i,getError:s}=$t(),a=(g=n==null?void 0:n.read)==null?void 0:g.selectedFieldMappings,c=(w=n==null?void 0:n.read)==null?void 0:w.selectedValueMappings,f=(v=n==null?void 0:n.read)==null?void 0:v.isValueMappingsModified,d=b.useRef(!1),l=b.useMemo(()=>{const m=t&&e?Object.values(e[t]||{}).flat().filter(S=>S.mappedValues).map(S=>({...S})):[];if(a)for(let S=0;S<m.length;S+=1){const{mapToName:p}=m[S];a!=null&&a[p]&&(m[S].fieldName=a[p])}return m},[t,e,a]),h=b.useCallback(m=>{const{value:S,name:p,fieldName:y}=m.target;S&&(t&&Tf(t,r,p,S,y),o(ue.VALUE_MAPPING,p)&&i(ue.VALUE_MAPPING,p))},[t,r,o,i]);return b.useEffect(()=>{var m;if(t&&c){const S=((m=e==null?void 0:e[t])==null?void 0:m.filter(y=>y.fieldName&&y.mappedValues.length>0))||[];S.every(y=>{const I=c[y.fieldName]||{};return Object.keys(I).length===Object.keys(y.mappedValues).length})&&S.length>0?!f&&!d.current&&(Ox(t,r,!0),d.current=!0):d.current=!1}},[c,l,t,r,e,f]),l!=null&&l.length?u.jsx(u.Fragment,{children:l.map(m=>{var T,A,E;if(!m.fieldName)return null;const S=(A=(T=n==null?void 0:n.read)==null?void 0:T.allFieldsMetadata)==null?void 0:A[m.fieldName],p=S==null?void 0:S.valueType;if(!["singleSelect","multiSelect"].includes(p))return console.error("fieldName is not a singleSelect or multiSelect",m),null;const y=S==null?void 0:S.values;if(!y)return null;const I=Object.keys(y).length,x=Object.keys((m==null?void 0:m.mappedValues)||[]).length;return I!==x?(console.error("field values and the values to be mapped are not of the same length",m,y),null):u.jsxs(u.Fragment,{children:[u.jsx(Ex,{string:"Map the values for ",fieldName:m.mapToDisplayName||m.mapToName||m.fieldName}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:u.jsx(Go,{id:m.mapToName||m.fieldName,children:(E=m==null?void 0:m.mappedValues)==null?void 0:E.map(R=>{var k,L,ae;const P=s(ue.VALUE_MAPPING,m.fieldName),M=Array.isArray(P)&&P.includes(R.mappedValue),q=((ae=(L=(k=n==null?void 0:n.read)==null?void 0:k.allFieldsMetadata)==null?void 0:L[m.fieldName])==null?void 0:ae.values)||[];return u.jsxs(u.Fragment,{children:[u.jsx(_x,{allValueOptions:q,mappedValue:R,onSelectChange:h,fieldName:(m==null?void 0:m.fieldName)||"",hasError:M},`${R.mappedValue}-${m.fieldName}`),M&&u.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${m.mapToName||m.fieldName} must be mapped to a unique value`},R.mappedValue)]})})},m.mapToName||m.fieldName)})]})})}):null}const Tx=!1;function Ax(){return RS(),u.jsxs(u.Fragment,{children:[u.jsx(DS,{}),u.jsx(Sx,{}),u.jsx(TS,{}),u.jsx(NS,{}),u.jsx(Nx,{}),u.jsx(bx,{}),Tx]})}function Rx(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,f=!Ib(a,s);e.write.isWriteModified=f}}}function Px(e,t,n,r){t(e,o=>{Rx(o,n,r)})}function Fx(){var f,d;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=en(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(d=n==null?void 0:n.write)==null?void 0:d.writeObjects,s=(l,h)=>{t&&n&&Px(t,r,l,h)},a=!!i,c=(i==null?void 0:i.map(l=>({id:l.objectName,label:l.displayName,isChecked:!!(o!=null&&o[l.objectName])})))||[];return a&&u.jsxs(u.Fragment,{children:[u.jsx(At,{string:`Allow ${e} to write to these objects`}),u.jsx(Nf,{items:c,onItemChange:s,showSelectAll:i.length>=2})]})}function Dx(){return u.jsx(u.Fragment,{children:u.jsx(Fx,{})})}function Af({resetComponent:e,onDisconnectSuccess:t}){return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[u.jsx(At,{string:"Remove connection"}),u.jsx("p",{children:"Click to disconnect your connection from the provider."}),u.jsx(md,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const Mx="_authenticationRow_1g2ms_1",kx="_field_1g2ms_8",Lx="_value_1g2ms_12",Is={authenticationRow:Mx,field:kx,value:Lx};function Eu({label:e,value:t}){return u.jsxs("div",{className:Is.authenticationRow,children:[u.jsx("div",{className:Is.field,children:e}),u.jsx("div",{className:Is.value,children:t})]})}function jx(){const{selectedConnection:e}=Zt(),{providerName:t}=ut(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Connection details"}),u.jsxs("div",{style:{paddingBottom:"1rem"},children:[u.jsx(Eu,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),u.jsx(Eu,{label:"Status",value:cn((e==null?void 0:e.status)||"")})]})]})}const Kx=()=>{const e=it(),t=$e();return On({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."),He(n)}})};function Rf({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=De(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=Ze(),[c,f]=b.useState(!1),d=!r||!o||!(i!=null&&i.id)||c,l=Kx(),h=async()=>{d||(f(!0),console.warn("uninstalling installation",{projectIdOrName:r,integrationId:o,installationId:i.id}),l.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:()=>f(!1)}))},g=c?"Uninstalling...":e,w=u.jsx(Be,{type:"button",onClick:h,disabled:d,variant:t,style:n,children:g});return i!=null&&i.id?w:null}function $x(){const{installation:e}=Ze(),{providerName:t}=ut();return e?u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Uninstall entire integration"}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall the entire ",t," ","integration. You will lose any configuration you've set up."]}):u.jsx("p",{children:"You've successfully uninstalled the integration."}),u.jsx(Rf,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function Ux(){const{installation:e,resetComponent:t}=Ze();return u.jsxs(u.Fragment,{children:[u.jsx(jx,{}),u.jsx(_a,{}),e&&u.jsx($x,{}),!e&&u.jsx(Af,{resetComponent:t})]})}function Pf({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var T,A,E,R;const{installation:i}=Ze(),{hydratedRevision:s,loading:a}=li(),{configureState:c,selectedObjectName:f}=en(),d=i==null?void 0:i.config,l=d&&f&&!!Xl(d,f)||!1,h=((T=c==null?void 0:c.read)==null?void 0:T.isOptionalFieldsModified)||((A=c==null?void 0:c.read)==null?void 0:A.isRequiredMapFieldsModified)||((E=c==null?void 0:c.read)==null?void 0:E.isValueMappingsModified),g=(R=c==null?void 0:c.write)==null?void 0:R.isWriteModified,S=a||n||!c||!f||!(h||g||r||f!==Or&&!l),p=f===Or,y=f===Eo,I=u.jsx(Be,{type:"submit",disabled:S,children:r?"Install":"Save"}),x=u.jsx(Be,{type:"button",onClick:t,disabled:S,variant:"ghost",children:"Reset"});return n?u.jsx(_i,{}):u.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[u.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!y&&u.jsxs(u.Fragment,{children:[I,x]})}),u.jsxs(En,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&u.jsx(ji,{children:typeof o=="string"?o:"Installation Failed."}),a&&u.jsx(_i,{}),s&&!p&&!y&&u.jsx(Ax,{}),s&&p&&!y&&u.jsx(Dx,{}),!a&&y&&u.jsx(Ux,{})]})]})}const Ff=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=Ze(),{hydratedRevision:s,loading:a}=li(),{selectedObjectName:c}=vd(),{selectedConnection:f}=Zt(),d=el(),{projectIdOrName:l}=De(),{resetBoundary:h,setErrors:g,setError:w,getError:v}=$t(),{resetConfigureState:m,objectConfigurationsState:S,resetPendingConfigurationState:p}=Na(),y=ad(c||"",S),{onNextIncompleteTab:I}=pI(),x=b.useCallback(()=>{h(ue.INSTALLATION_MUTATION)},[h]),T=b.useCallback(E=>E?R=>{w(ue.INSTALLATION_MUTATION,E,R)}:R=>{console.error("objectName is required to set installation error: ",R)},[w]),A=b.useCallback(E=>E?v(ue.INSTALLATION_MUTATION,E):"",[v]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:f,apiKey:d,projectIdOrName:l,resetBoundary:h,setErrors:g,setMutateInstallationError:T,getMutateInstallationError:A,resetMutateInstallationErrorState:x,resetConfigureState:m,objectConfigurationsState:S,resetPendingConfigurationState:p,configureState:y,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:I}},qx=void 0;function Vx(){const{consumerRef:e,setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,selectedConnection:i,resetBoundary:s,setErrors:a,setMutateInstallationError:c,getMutateInstallationError:f,resetMutateInstallationErrorState:d,resetConfigureState:l,objectConfigurationsState:h,resetPendingConfigurationState:g,configureState:w,onInstallSuccess:v,onNextIncompleteTab:m}=Ff(),[S,p]=b.useState(!1),{createInstallation:y}=zl(),I=o===Or,x=f(o),T=b.useCallback(()=>{s(ue.MAPPING),n!=null&&n.content&&!r&&o&&rd(n,qx,o,l)},[s,n,r,o,l]);b.useEffect(()=>{!w&&(n!=null&&n.content)&&!r&&T()},[w,h,n,r,T]);const A=()=>{d();const{requiredMapFields:P,selectedFieldMappings:M}=(w==null?void 0:w.read)||{},{errorList:q}=ed(P,M,a);if(!(q.length>0))if(o&&(i!=null&&i.id)&&e&&n){p(!0);const k=Eb(w,o,n,e);if(!k){console.error("Error when generating createConfig from configureState"),p(!1);return}y({config:k.content,onSuccess:L=>{t(L),v==null||v(L.id,L.config),p(!1),g(o),m()},onError:L=>{c(o)(L.message),p(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},E=()=>{if(d(),o&&(i!=null&&i.id)&&e&&n){p(!0);const P=Nb(w,n,e);if(!P){console.error("Error when generating createConfig from configureState"),p(!1);return}y({config:P.content,onSuccess:M=>{t(M),v==null||v(M.id,M.config),p(!1),g(o),m()},onError:M=>{c(o)(M.message),p(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},R=P=>{P.preventDefault(),I?E():A()};return u.jsx(Pf,{errorMsg:x,isCreateMode:!0,isLoading:S,onSave:R,onReset:T})}const Hx=(e,t,n,r)=>{const o=id(e),i=od(e),s=sd(e),a={content:{read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:r}}}}};return Li(n)&&(a.content||(a.content={}),a.content.proxy={enabled:!0}),a},Bx=(e,t)=>{const r={content:{write:{objects:cd(e)}}};return Li(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r};function Jx({installation:e}){const{setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,resetBoundary:i,setErrors:s,setMutateInstallationError:a,getMutateInstallationError:c,resetConfigureState:f,resetPendingConfigurationState:d,configureState:l,onUpdateSuccess:h,onNextIncompleteTab:g}=Ff(),{updateInstallation:w}=Gl(),[v,m]=b.useState(!1),S=o===Or,p=c(o),{config:y}=e,I=b.useCallback(()=>{i(ue.MAPPING),n!=null&&n.content&&!r&&o&&rd(n,y,o,f)},[i,n,r,o,y,f]);b.useEffect(()=>{l||I()},[l,I]);const x=b.useMemo(()=>{var P,M,q;return(q=(M=(P=n==null?void 0:n.content)==null?void 0:P.read)==null?void 0:M.objects)==null?void 0:q.find(k=>(k==null?void 0:k.objectName)===o)},[n,o]),T=()=>{const{requiredMapFields:R,selectedFieldMappings:P}=(l==null?void 0:l.read)||{},{errorList:M}=ed(R,P,s);if(!(M.length>0))if(n&&l&&o&&x){m(!0);const q=Hx(l,o,n,x.backfill);if(!q){console.error("Error when generating updateConfig from configureState"),m(!1);return}w({config:q.content,onSuccess:k=>{t(k),h==null||h(k.id,k.config),m(!1),d(o),g()},onError:k=>{a(o)(k.message),m(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},A=()=>{if(l&&n){m(!0);const R=Bx(l,n);if(!R){console.error("Error when generating write updateConfig from configureState"),m(!1);return}w({config:R.content,onSuccess:P=>{t(P),h==null||h(P.id,P.config),m(!1),d(o),g()},onError:P=>{a(o)(P.message),m(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},E=R=>{R.preventDefault(),S?A():T()};return u.jsx(Pf,{errorMsg:p,onSave:E,onReset:I,isLoading:v})}function Wx(){const{integrationObj:e,installation:t}=Ze();return e?t&&e?u.jsx(Jx,{installation:t}):u.jsx(Vx,{}):u.jsx(ql,{message:"We can't load the integration"})}function zx(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),u.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function ic({text:e,children:t}){return u.jsx(ci,{children:u.jsxs(En,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[u.jsx(zx,{}),u.jsx("p",{children:e}),t]})})}function Gx({provider:e}){const{providerName:t}=ut(e),n=`You have successfully installed your ${t} integration.`;return u.jsx(ic,{text:n,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(Rf,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Qx=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function Xx({children:e}){var x;const t=b.useRef(!1),{projectIdOrName:n}=De(),{hydratedRevision:r,loading:o}=li(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,onInstallSuccess:f,isIntegrationDeleted:d}=Ze(),{mutate:l,isIdle:h,isPending:g,error:w,errorMsg:v}=Wl(),{selectedConnection:m,isConnectionsLoading:S}=Zt(),p=o||g||S,y=(x=r==null?void 0:r.content)==null?void 0:x.provider,I=Qx(r);return b.useEffect(()=>{var T;if(!p&&!S&&r&&I&&!s&&m&&(i!=null&&i.id)&&!d&&y){const A={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:m==null?void 0:m.id,config:{content:{provider:y}}}};Li(r)===!0&&(A.installation.config.content.proxy=(T=r==null?void 0:r.content)==null?void 0:T.proxy),h&&!t.current&&(l(A,{onSuccess:E=>{f==null||f(E==null?void 0:E.id,E.config)}}),t.current=!0)}},[r,I,s,m,n,i==null?void 0:i.id,a,c,p,f,d,S,y,l,h]),I&&y&&s?u.jsx(Gx,{provider:y}):w?u.jsx(Gt,{message:v??"Create installation failed"}):i?p?u.jsx(ui,{}):u.jsx("div",{children:e}):u.jsx(Gt,{message:"We can't load the integration"})}function qi(){const e=it(),t=$e();return On({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"),He(n)}})}function Yx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=De(),f=qi(),d=b.useCallback(l=>{var v;const{apiKey:h,providerMetadata:g}=l,w={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(v=g==null?void 0:g.workspace)==null?void 0:v.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:h,...g&&{providerMetadata:g}}};f.mutate(w)},[c,i,o,r,n,e,f]);return a===null?u.jsx(Wb,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function Zx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=De(),f=qi(),d=b.useCallback(l=>{var m;const{user:h,pass:g,providerMetadata:w}=l,v={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(m=w==null?void 0:w.workspace)==null?void 0:m.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:h,password:g},...w&&{providerMetadata:w}}};f.mutate(v)},[c,i,o,r,n,e,f]);return a===null?u.jsx(Yb,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function _u({url:e,prompt:t,inputName:n}){return u.jsx("p",{style:{color:"var(--amp-colors-text-muted)",display:"flex",justifyContent:"space-between"},children:u.jsxs("span",{children:[e?u.jsx(Oa,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:n})}):u.jsx("span",{children:n})," ",t&&u.jsx(yf,{id:`docs-helper-text-${sb(n||(t==null?void 0:t.slice(0,50)))}`,tooltipText:t})]})})}function e0({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r}){var h,g;const[o,i]=b.useState({}),s=((h=e.metadata)==null?void 0:h.input)||[],a=w=>{const{name:v,value:m}=w.currentTarget;i(S=>({...S,[v]:m.trim()}))},c=Yr(s,o),f=n||!c,d=((g=e.customOpts)==null?void 0:g.inputs)||[],l=()=>{const w=qo(s,o),v=Object.fromEntries(d.map(m=>[m.name,o[m.name]]));t({customAuth:v,providerMetadata:w})};return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[d.map(w=>u.jsxs("div",{children:[u.jsx(_u,{url:w.docsURL,prompt:w.prompt,inputName:w.displayName}),u.jsx(St.PasswordInput,{id:w.name,name:w.name,onChange:a,placeholder:""})]},w.name)),s.map(w=>u.jsxs("div",{children:[w.docsURL&&u.jsx(_u,{url:w.docsURL,prompt:w.displayName||w.name,inputName:w.displayName||cn(w.name.toLowerCase())}),u.jsx(St.Input,{id:w.name,name:w.name,type:"text",placeholder:"",onChange:a})]},w.name)),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"submit",onClick:l,variant:r,children:"Next"})]})}function t0({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r}){return u.jsxs(nr,{children:[u.jsx(rr,{children:`Set up ${e.displayName} integration`}),u.jsx(ln,{error:n}),u.jsx(e0,{providerInfo:e,handleSubmit:t,isButtonDisabled:r})]})}function n0({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s}){const{projectIdOrName:a}=De(),c=qi(),[f,d]=b.useState(null),l=b.useCallback(h=>{var m;const{customAuth:g,providerMetadata:w}=h;d(null);const v={projectIdOrName:a,generateConnectionParams:{providerWorkspaceRef:(m=w==null?void 0:w.workspace)==null?void 0:m.value,groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:g,...w&&{providerMetadata:w}}};c.mutate(v,{onError:S=>{He(S,d)},onSuccess:()=>{d(null)}})},[a,o,r,n,t,e.name,c]);return s===null?u.jsx(t0,{providerInfo:e,handleSubmit:l,error:f}):i}function r0({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 u.jsxs(nr,{children:[u.jsx(rr,{children:i||`Set up ${r} integration`}),u.jsx(ln,{error:t}),o,u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function i0({...e}){return u.jsx(r0,{...e})}function o0({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=De(),f=qi(),d=b.useCallback(()=>{const l={projectIdOrName:c,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};f.mutate(l)},[c,o,r,n,t,e,f]);return s===null?u.jsx(i0,{handleSubmit:d,error:null,providerName:a}):i}const s0=()=>{const e=it(),t=$e();return On({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function a0({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs(nr,{children:[u.jsx(rr,{children:`Set up ${r} integration`}),u.jsx(Vb,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),u.jsx(ln,{error:t}),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const c0="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function u0({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return u.jsxs(nr,{children:[u.jsx(rr,{children:"Enter your Salesforce subdomain"}),u.jsx(Oa,{href:c0,newTab:!0,children:"What is my Salesforce subdomain?"}),u.jsx(ln,{error:n}),u.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[u.jsx(St.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),u.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function l0({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return u.jsxs(nr,{children:[u.jsxs(rr,{children:["Enter your ",o," workspace"]}),u.jsx(ln,{error:n}),u.jsx("br",{}),i.map(s=>u.jsx(St.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),u.jsx("br",{}),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Nu=600,Tu=600,Au="salesforce";function d0({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var M;const{projectId:s}=er(),a=$e(),c=b.useRef(null),[f,d]=b.useState(null),[l,h]=b.useState(""),[g,w]=b.useState({}),[v,m]=b.useState({}),{data:S}=Uo(e),p=((M=S==null?void 0:S.metadata)==null?void 0:M.input)||[],{mutateAsync:y,isPending:I}=s0(),{isFetching:x,refetch:T}=xa({groupRef:r,provider:e});b.useEffect(()=>{const q=k=>{var L,ae,oe;k.origin===Kl&&(((L=k.data)==null?void 0:L.eventType)==="AUTHORIZATION_SUCCEEDED"?(d(null),console.debug("New connection:",k.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((ae=k.data)==null?void 0:ae.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",k.data.data.error),a.invalidateQueries({queryKey:["amp","connections"]}),d(k.data.data.error||"An error occurred. Please try again.")),(oe=c.current)==null||oe.close())};return window.addEventListener("message",q),()=>window.removeEventListener("message",q)},[a]);const A=q=>{h(q),w(k=>({...k,workspace:q})),m(k=>({...k,workspace:{value:q,source:"input"}}))},E=(q,k)=>{w(L=>({...L,[q]:k})),m(L=>({...L,[q]:{value:k,source:"input"}}))},R=async()=>{var q;d(null);try{const{data:k}=await T();if(k&&k.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(p.length>0&&!Yr(p,g)){d("Please fill in all required fields");return}try{const k=await y({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s||"",consumerName:n,groupName:o,providerWorkspaceRef:e===Au?l:(q=v==null?void 0:v.workspace)==null?void 0:q.value,providerMetadata:v}});if(k){const L=window.screenX+(window.outerWidth-Nu)/2,ae=window.screenY+(window.outerHeight-Tu)/2.5,oe=`width=${Nu},height=${Tu},left=${L},top=${ae}`;c.current=window.open(k,"OAuthPopup",oe)}}catch(k){console.error(k),d(k instanceof Error?k.message:String(k)||"An error occurred. Please try again.")}},P=e===Au?u.jsx(u0,{handleSubmit:R,setWorkspace:A,error:f,isButtonDisabled:l.length===0||I||x}):p.length>0?u.jsx(l0,{handleSubmit:R,setFormData:E,error:f,isButtonDisabled:!Yr(p,g)||I||x,providerName:i,metadataFields:p}):u.jsx(a0,{handleSubmit:R,error:f,providerName:i,isButtonDisabled:I||x});return u.jsx("div",{children:P})}function f0({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:c}=De(),f=qi(),[d,l]=b.useState(null),h=b.useCallback(g=>{var v,m;l(null);const w={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(m=(v=g.providerMetadata)==null?void 0:v.workspace)==null?void 0:m.value,oauth2ClientCredentials:{clientId:g.clientId,clientSecret:g.clientSecret,scopes:g.scopes},...g.providerMetadata&&{providerMetadata:g.providerMetadata}}};f.mutate(w,{onError:()=>l("Error loading provider info")})},[c,i,o,r,n,e,f]);return a===null?u.jsx(eI,{provider:e,providerName:t,handleSubmit:h,error:d,explicitScopesRequired:s}):u.jsx(_i,{})}function p0({...e}){return u.jsx(f0,{...e})}const h0="authorizationCode",m0="authorizationCodePKCE",g0="clientCredentials";function y0({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=ut(e);if(t.oauth2Opts===void 0)return u.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:f,explicitScopesRequired:d}=t.oauth2Opts,l={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return f===h0||f===m0?u.jsx(d0,{...l}):f===g0?u.jsx(p0,{...l,explicitScopesRequired:d,selectedConnection:s,setSelectedConnection:a}):f==="password"?u.jsx("em",{children:"Password flow not supported yet"}):u.jsxs("em",{children:["Unsupported grant type: ",f]})}function v0(e){const{selectedConnection:t}=Zt();b.useEffect(()=>{e&&t&&e(t)},[e,t])}function w0({onSuccess:e}){v0(e)}function Df({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:f,isLoading:d,isError:l,error:h,providerName:g,selectedProvider:w}=ut(e),{provider:v,isIntegrationDeleted:m}=Ze(),{selectedConnection:S,setSelectedConnection:p}=Zt();w0({onSuccess:s});const y=$e(),I=f;b.useEffect(()=>{l&&(console.error("Error loading provider info."),He(h))},[l,h]);const x=b.useCallback(()=>{y.clear(),c()},[c,y]);if(!e&&!v)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(m)return u.jsx(ic,{text:"Integration successfully uninstalled.",children:u.jsx(Be,{type:"button",onClick:x,style:{width:"100%"},children:"Reinstall Integration"})});if(S)return i;if(d)return u.jsx(ui,{});if(I==null)return u.jsx(Gt,{message:"Provider info was not found."});const T={provider:w,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:S,setSelectedConnection:p,providerName:g,providerInfo:I,onDisconnectSuccess:a};return I.authType==="none"?u.jsx(o0,{...T,children:i}):I.authType==="basic"?u.jsx(Zx,{...T,children:i}):I.authType==="apiKey"?u.jsx(Yx,{...T,children:i}):I.authType==="custom"?u.jsx(n0,{...T,children:i}):u.jsx(y0,{...T})}function b0(e){const t=e+"CollectionProvider",[n,r]=Qo(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:m,children:S}=v,p=b.useRef(null),y=b.useRef(new Map).current;return u.jsx(o,{scope:m,itemMap:y,collectionRef:p,children:S})};s.displayName=t;const a=e+"CollectionSlot",c=oa(a),f=b.forwardRef((v,m)=>{const{scope:S,children:p}=v,y=i(a,S),I=ii(m,y.collectionRef);return u.jsx(c,{ref:I,children:p})});f.displayName=a;const d=e+"CollectionItemSlot",l="data-radix-collection-item",h=oa(d),g=b.forwardRef((v,m)=>{const{scope:S,children:p,...y}=v,I=b.useRef(null),x=ii(m,I),T=i(d,S);return b.useEffect(()=>(T.itemMap.set(I,{ref:I,...y}),()=>void T.itemMap.delete(I))),u.jsx(h,{[l]:"",ref:x,children:p})});g.displayName=d;function w(v){const m=i(e+"CollectionConsumer",v);return b.useCallback(()=>{const p=m.collectionRef.current;if(!p)return[];const y=Array.from(p.querySelectorAll(`[${l}]`));return Array.from(m.itemMap.values()).sort((T,A)=>y.indexOf(T.ref.current)-y.indexOf(A.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:f,ItemSlot:g},w,r]}var I0=$[" useId ".trim().toString()]||(()=>{}),C0=0;function Mf(e){const[t,n]=$.useState(I0());return Ai(()=>{n(r=>r??String(C0++))},[e]),e||(t?`radix-${t}`:"")}function S0(e){const t=$.useRef(e);return $.useEffect(()=>{t.current=e}),$.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var x0=$.createContext(void 0);function kf(e){const t=$.useContext(x0);return e||t||"ltr"}var Cs="rovingFocusGroup.onEntryFocus",O0={bubbles:!1,cancelable:!0},Vi="RovingFocusGroup",[sa,Lf,E0]=b0(Vi),[_0,jf]=Qo(Vi,[E0]),[N0,T0]=_0(Vi),Kf=$.forwardRef((e,t)=>u.jsx(sa.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(sa.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(A0,{...e,ref:t})})}));Kf.displayName=Vi;var A0=$.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:d=!1,...l}=e,h=$.useRef(null),g=ii(t,h),w=kf(i),[v,m]=Za({prop:s,defaultProp:a??null,onChange:c,caller:Vi}),[S,p]=$.useState(!1),y=S0(f),I=Lf(n),x=$.useRef(!1),[T,A]=$.useState(0);return $.useEffect(()=>{const E=h.current;if(E)return E.addEventListener(Cs,y),()=>E.removeEventListener(Cs,y)},[y]),u.jsx(N0,{scope:n,orientation:r,dir:w,loop:o,currentTabStopId:v,onItemFocus:$.useCallback(E=>m(E),[m]),onItemShiftTab:$.useCallback(()=>p(!0),[]),onFocusableItemAdd:$.useCallback(()=>A(E=>E+1),[]),onFocusableItemRemove:$.useCallback(()=>A(E=>E-1),[]),children:u.jsx(_n.div,{tabIndex:S||T===0?-1:0,"data-orientation":r,...l,ref:g,style:{outline:"none",...e.style},onMouseDown:Qt(e.onMouseDown,()=>{x.current=!0}),onFocus:Qt(e.onFocus,E=>{const R=!x.current;if(E.target===E.currentTarget&&R&&!S){const P=new CustomEvent(Cs,O0);if(E.currentTarget.dispatchEvent(P),!P.defaultPrevented){const M=I().filter(oe=>oe.focusable),q=M.find(oe=>oe.active),k=M.find(oe=>oe.id===v),ae=[q,k,...M].filter(Boolean).map(oe=>oe.ref.current);qf(ae,d)}}x.current=!1}),onBlur:Qt(e.onBlur,()=>p(!1))})})}),$f="RovingFocusGroupItem",Uf=$.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=Mf(),f=i||c,d=T0($f,n),l=d.currentTabStopId===f,h=Lf(n),{onFocusableItemAdd:g,onFocusableItemRemove:w,currentTabStopId:v}=d;return $.useEffect(()=>{if(r)return g(),()=>w()},[r,g,w]),u.jsx(sa.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:u.jsx(_n.span,{tabIndex:l?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:Qt(e.onMouseDown,m=>{r?d.onItemFocus(f):m.preventDefault()}),onFocus:Qt(e.onFocus,()=>d.onItemFocus(f)),onKeyDown:Qt(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){d.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const S=F0(m,d.orientation,d.dir);if(S!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let y=h().filter(I=>I.focusable).map(I=>I.ref.current);if(S==="last")y.reverse();else if(S==="prev"||S==="next"){S==="prev"&&y.reverse();const I=y.indexOf(m.currentTarget);y=d.loop?D0(y,I+1):y.slice(I+1)}setTimeout(()=>qf(y))}}),children:typeof s=="function"?s({isCurrentTabStop:l,hasTabStop:v!=null}):s})})});Uf.displayName=$f;var R0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function P0(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function F0(e,t,n){const r=P0(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return R0[r]}function qf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function D0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var M0=Kf,k0=Uf,Yo="Tabs",[L0,fO]=Qo(Yo,[jf]),Vf=jf(),[j0,oc]=L0(Yo),Hf=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...f}=e,d=kf(a),[l,h]=Za({prop:r,onChange:o,defaultProp:i??"",caller:Yo});return u.jsx(j0,{scope:n,baseId:Mf(),value:l,onValueChange:h,orientation:s,dir:d,activationMode:c,children:u.jsx(_n.div,{dir:d,"data-orientation":s,...f,ref:t})})});Hf.displayName=Yo;var Bf="TabsList",Jf=$.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=oc(Bf,n),s=Vf(n);return u.jsx(M0,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:u.jsx(_n.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Jf.displayName=Bf;var Wf="TabsTrigger",zf=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=oc(Wf,n),a=Vf(n),c=Qf(s.baseId,r),f=Xf(s.baseId,r),d=r===s.value;return u.jsx(k0,{asChild:!0,...a,focusable:!o,active:d,children:u.jsx(_n.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":f,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:Qt(e.onMouseDown,l=>{!o&&l.button===0&&l.ctrlKey===!1?s.onValueChange(r):l.preventDefault()}),onKeyDown:Qt(e.onKeyDown,l=>{[" ","Enter"].includes(l.key)&&s.onValueChange(r)}),onFocus:Qt(e.onFocus,()=>{const l=s.activationMode!=="manual";!d&&!o&&l&&s.onValueChange(r)})})})});zf.displayName=Wf;var Gf="TabsContent",K0=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=oc(Gf,n),c=Qf(a.baseId,r),f=Xf(a.baseId,r),d=r===a.value,l=$.useRef(d);return $.useEffect(()=>{const h=requestAnimationFrame(()=>l.current=!1);return()=>cancelAnimationFrame(h)},[]),u.jsx(ec,{present:o||d,children:({present:h})=>u.jsx(_n.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:f,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:l.current?"0s":void 0},children:h&&i})})});K0.displayName=Gf;function Qf(e,t){return`${e}-trigger-${t}`}function Xf(e,t){return`${e}-content-${t}`}var $0=Hf,U0=Jf,Yf=zf;const q0=u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[u.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),u.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function V0(e,t){return t?b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},b.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?q0:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:u.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function H0(){return u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M8 11C9.65685 11 11 9.65685 11 8C11 6.34315 9.65685 5 8 5C6.34315 5 5 6.34315 5 8C5 9.65685 6.34315 11 8 11Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M12.3378 5.04365C12.4882 5.25907 12.62 5.48699 12.7315 5.7249L14.3503 6.6249C14.5524 7.5302 14.5545 8.4687 14.3565 9.3749L12.7315 10.2749C12.62 10.5128 12.4882 10.7407 12.3378 10.9562L12.369 12.8124C11.683 13.4375 10.871 13.9085 9.98776 14.1937L8.39401 13.2374C8.13185 13.2562 7.86868 13.2562 7.60651 13.2374L6.01901 14.1874C5.13295 13.9075 4.31832 13.4383 3.63151 12.8124L3.66276 10.9624C3.51356 10.744 3.38189 10.5141 3.26901 10.2749L1.65026 9.3749C1.44814 8.46961 1.446 7.53111 1.64401 6.6249L3.26901 5.7249C3.38056 5.48699 3.5123 5.25907 3.66276 5.04365L3.63151 3.1874C4.31754 2.56226 5.1295 2.09128 6.01276 1.80615L7.60651 2.7624C7.86868 2.74365 8.13185 2.74365 8.39401 2.7624L9.98151 1.8124C10.8676 2.09234 11.6822 2.5615 12.369 3.1874L12.3378 5.04365Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const B0="_tabsRoot_ktpr0_1",J0="_tabsList_ktpr0_6",W0="_tabTrigger_ktpr0_12",Mo={tabsRoot:B0,tabsList:J0,tabTrigger:W0};function z0(){return u.jsxs(u.Fragment,{children:[u.jsx(Ho,{style:{margin:"1rem 0"}}),u.jsx(Yf,{value:Eo,className:Mo.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[u.jsx(H0,{}),u.jsx("span",{children:"Manage"})]})})]})}function Zf({objectName:e,completed:t,pending:n,displayName:r}){return u.jsx(Yf,{value:e,className:Mo.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[V0(t,n),u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsx("span",{children:r||e}),n&&u.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function G0({completed:e,pending:t,displayName:n}){return u.jsxs(u.Fragment,{children:[u.jsx(Ho,{style:{margin:"1rem 0"}}),u.jsx(Zf,{objectName:Or,completed:e,pending:t,displayName:n},"other-write")]})}function Q0({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var i,s;return u.jsx($0,{value:e,className:Mo.tabsRoot,onValueChange:n,children:u.jsxs(U0,{className:Mo.tabsList,children:[t.map(a=>{var c,f,d,l,h,g;return u.jsx(Zf,{objectName:a.name,displayName:a.displayName,completed:a.completed,pending:((f=(c=r==null?void 0:r[a.name])==null?void 0:c.read)==null?void 0:f.isOptionalFieldsModified)||((l=(d=r==null?void 0:r[a.name])==null?void 0:d.read)==null?void 0:l.isRequiredMapFieldsModified)||((g=(h=r==null?void 0:r[a.name])==null?void 0:h.read)==null?void 0:g.isValueMappingsModified)||!1},a.name)}),o&&u.jsx(G0,{completed:o.completed,pending:((s=(i=r==null?void 0:r.other)==null?void 0:i.write)==null?void 0:s.isWriteModified)||!1,displayName:"Write"}),u.jsx(z0,{})]})})}function X0(e,t){return t===Eo?{name:Eo,completed:!1}:e.find(n=>n.name===t)}function Y0({children:e}){var S;const{data:t}=er(),{installation:n}=Ze(),{providerName:r}=ut(),{hydratedRevision:o}=li(),{objectConfigurationsState:i}=Na(),[s,a]=b.useState(""),c=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,d=o&&Yl(f,o),l=d!==null,h=!!((S=o==null?void 0:o.content)!=null&&S.write),g=h?Zl(f):void 0,w=b.useMemo(()=>{const p=[...d||[]];return g&&h&&p.push(g),p},[d,g,h]),v=X0(w,s),m=b.useCallback(()=>{const p=w.find(y=>v!==y&&!y.completed);p&&a(p.name)},[w,v]);return b.useEffect(()=>{!s&&w.length>0&&a(w[0].name)},[w,s,m]),u.jsx(wd.Provider,{value:m,children:u.jsx(yd.Provider,{value:v==null?void 0:v.name,children:u.jsxs(ci,{style:{maxWidth:"55rem"},children:[u.jsxs(En,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[u.jsxs("div",{style:{width:"20rem"},children:[u.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),u.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),l&&u.jsx(Q0,{value:s,readNavObjects:d,onValueChange:p=>a(p),objectConfigurationsState:i,writeNavObject:g})]}),e]}),u.jsx(dd,{})]})})})}function Z0({...e}){return u.jsx(Y0,{...e})}const eO="_resetContainer_lkwv9_4",ep={resetContainer:eO},tO=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c})=>{var m;const{projectIdOrName:f,isLoading:d}=er(),{isLoading:l}=$o(),{isError:h,errorState:g}=$t(),{seed:w,reset:v}=Ql();return d||l?u.jsx(ui,{}):h(ue.PROJECT,f)?u.jsx(Gt,{message:`Error loading project ${f}`}):h(ue.INTEGRATION_LIST,f)?u.jsx(Gt,{message:"Error retrieving integrations for the project, double check the API key"}):(m=g[ue.INTEGRATION_LIST])!=null&&m.apiError?u.jsx(Gt,{message:"Something went wrong, couldn't find integration information"}):u.jsx("div",{className:ep.resetContainer,children:u.jsx(cb,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,resetComponent:v,children:u.jsx(Jl,{children:u.jsx(Df,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:v,children:u.jsx(fI,{resetComponent:v,children:u.jsx(Xx,{children:u.jsx(mI,{children:u.jsx(Z0,{children:u.jsx(Wx,{})})})})})})})},w)})};function nO({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){const f={integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c};return u.jsx(Sa,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:u.jsx(tO,{...f})})}function rO(){return u.jsxs(ci,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[u.jsx(_i,{}),u.jsx("p",{children:"Redirecting"})]})}function iO({redirectURL:e,children:t}){return b.useEffect(()=>{e&&window.location.replace(e)},[e]),e?u.jsx(rO,{}):t}function oO({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=b.useState(!1);return u.jsxs(u.Fragment,{children:[r===!1&&u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Manage connection"}),u.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[u.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),u.jsx(Be,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&u.jsxs(u.Fragment,{children:[u.jsx(_a,{provider:n}),u.jsx(Af,{resetComponent:e,onDisconnectSuccess:t})]})]})}function sO({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=er(),{providerName:o}=ut(e),i=`You have successfully connected your ${o} account to ${r}.`;return u.jsx(ic,{text:i,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:u.jsx(oO,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function aO({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:f,reset:d}=Ql(),l=b.useCallback(h=>{s?s(h.id):c&&c(h)},[s,c]);return u.jsx("div",{className:ep.resetContainer,children:u.jsx(Sa,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:u.jsx(Jl,{groupRef:r,provider:e,children:u.jsx(Df,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:l,onDisconnectSuccess:a,children:u.jsx(iO,{redirectURL:i,children:u.jsx(sO,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})})},f)}const cO=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=ba(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,c=n==null?void 0:n[0],f=c==null?void 0:c.config;return b.useEffect(()=>{o&&He(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:f}};exports.AmpersandContext=pa;exports.AmpersandProvider=Xh;exports.ConnectProvider=aO;exports.FieldSettingWriteOnCreateEnum=Lm;exports.FieldSettingWriteOnUpdateEnum=jm;exports.InstallIntegration=nO;exports.InstallationProvider=Sa;exports.useAmpersandProviderProps=De;exports.useConfig=Uw;exports.useConnection=Ia;exports.useCreateInstallation=zl;exports.useDeleteInstallation=pb;exports.useInstallation=ki;exports.useIsIntegrationInstalled=cO;exports.useLocalConfig=$w;exports.useManifest=Ml;exports.useUpdateInstallation=Gl;
52
52
  //# sourceMappingURL=amp-react.cjs.js.map