@amp-labs/react 2.9.7 → 2.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/amp-react.cjs.js +13 -13
- package/build/amp-react.cjs.js.map +1 -1
- package/build/amp-react.es.js +4579 -4591
- package/build/amp-react.es.js.map +1 -1
- package/build/index.d.ts +19 -19
- package/build/style.css +1 -1
- package/package.json +2 -2
package/build/amp-react.cjs.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";var Op=Object.defineProperty;var dc=e=>{throw TypeError(e)};var _p=(e,t,n)=>t in e?Op(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pi=(e,t,n)=>_p(e,typeof t!="symbol"?t+"":t,n),Yo=(e,t,n)=>t.has(e)||dc("Cannot "+n);var _=(e,t,n)=>(Yo(e,t,"read from private field"),n?n.call(e):t.get(e)),oe=(e,t,n)=>t.has(e)?dc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Q=(e,t,n,r)=>(Yo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),me=(e,t,n)=>(Yo(e,t,"access private method"),n);var Xi=(e,t,n,r)=>({set _(o){Q(e,t,o,n)},get _(){return _(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),b=require("react");require("react-dom");function Sp(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 B=Sp(b);var ii=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(){}},Ep={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Zt,dr,_u,Np=(_u=class{constructor(){oe(this,Zt,Ep);oe(this,dr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&_(this,dr)&&e!==_(this,Zt)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:_(this,Zt),provider:e}),Q(this,Zt,e),process.env.NODE_ENV!=="production"&&Q(this,dr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Q(this,dr,!0),_(this,Zt).setTimeout(e,t)}clearTimeout(e){_(this,Zt).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Q(this,dr,!0),_(this,Zt).setInterval(e,t)}clearInterval(e){_(this,Zt).clearInterval(e)}},Zt=new WeakMap,dr=new WeakMap,_u),ur=new Np;function Tp(e){setTimeout(e,0)}var Cr=typeof window>"u"||"Deno"in globalThis;function gt(){}function Rp(e,t){return typeof e=="function"?e(t):e}function ws(e){return typeof e=="number"&&e>=0&&e!==1/0}function ku(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Wn(e,t){return typeof e=="function"?e(t):e}function Lt(e,t){return typeof e=="function"?e(t):e}function fc(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==ra(s,t.options))return!1}else if(!Ci(t.queryKey,s))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function pc(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(xr(t.options.mutationKey)!==xr(i))return!1}else if(!Ci(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function ra(e,t){return((t==null?void 0:t.queryKeyHashFn)||xr)(e)}function xr(e){return JSON.stringify(e,(t,n)=>Is(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Ci(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ci(e[n],t[n])):!1}var Ap=Object.prototype.hasOwnProperty;function bs(e,t){if(e===t)return e;const n=hc(e)&&hc(t);if(!n&&!(Is(e)&&Is(t)))return t;const o=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),s=i.length,a=n?new Array(s):{};let u=0;for(let f=0;f<s;f++){const l=n?f:i[f],d=e[l],h=t[l];if(d===h){a[l]=d,(n?f<o:Ap.call(e,l))&&u++;continue}if(d===null||h===null||typeof d!="object"||typeof h!="object"){a[l]=h;continue}const m=bs(d,h);a[l]=m,m===d&&u++}return o===s&&u===o?e:a}function po(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function hc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Is(e){if(!mc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!mc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function mc(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fp(e){return new Promise(t=>{ur.setTimeout(t,e)})}function Cs(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 bs(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 bs(e,t)}return t}function Pp(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Dp(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ho=Symbol();function ju(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===ho&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ho?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Lu(e,t){return typeof e=="function"?e(...t):!!e}var fr,Ln,Dr,Su,Mp=(Su=class extends ii{constructor(){super();oe(this,fr);oe(this,Ln);oe(this,Dr);Q(this,Dr,t=>{if(!Cr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,Ln)||this.setEventListener(_(this,Dr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Ln))==null||t.call(this),Q(this,Ln,void 0))}setEventListener(t){var n;Q(this,Dr,t),(n=_(this,Ln))==null||n.call(this),Q(this,Ln,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,fr)!==t&&(Q(this,fr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,fr)=="boolean"?_(this,fr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},fr=new WeakMap,Ln=new WeakMap,Dr=new WeakMap,Su),ia=new Mp;function xs(){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}var kp=Tp;function jp(){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(u=>{n(u)})})})};return{batch:a=>{let u;t++;try{u=a()}finally{t--,t||s()}return u},batchCalls:a=>(...u)=>{i(()=>{a(...u)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Ge=jp(),Mr,Vn,kr,Eu,Lp=(Eu=class extends ii{constructor(){super();oe(this,Mr,!0);oe(this,Vn);oe(this,kr);Q(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(){_(this,Vn)||this.setEventListener(_(this,kr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Vn))==null||t.call(this),Q(this,Vn,void 0))}setEventListener(t){var n;Q(this,kr,t),(n=_(this,Vn))==null||n.call(this),Q(this,Vn,t(this.setOnline.bind(this)))}setOnline(t){_(this,Mr)!==t&&(Q(this,Mr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,Mr)}},Mr=new WeakMap,Vn=new WeakMap,kr=new WeakMap,Eu),mo=new Lp;function Vp(e){return Math.min(1e3*2**e,3e4)}function Vu(e){return(e??"online")==="online"?mo.isOnline():!0}var Os=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function $u(e){let t=!1,n=0,r;const o=xs(),i=()=>o.status!=="pending",s=w=>{var g;if(!i()){const O=new Os(w);h(O),(g=e.onCancel)==null||g.call(e,O)}},a=()=>{t=!0},u=()=>{t=!1},f=()=>ia.isFocused()&&(e.networkMode==="always"||mo.isOnline())&&e.canRun(),l=()=>Vu(e.networkMode)&&e.canRun(),d=w=>{i()||(r==null||r(),o.resolve(w))},h=w=>{i()||(r==null||r(),o.reject(w))},m=()=>new Promise(w=>{var g;r=O=>{(i()||f())&&w(O)},(g=e.onPause)==null||g.call(e)}).then(()=>{var w;r=void 0,i()||(w=e.onContinue)==null||w.call(e)}),y=()=>{if(i())return;let w;const g=n===0?e.initialPromise:void 0;try{w=g??e.fn()}catch(O){w=Promise.reject(O)}Promise.resolve(w).then(d).catch(O=>{var E;if(i())return;const p=e.retry??(Cr?0:3),v=e.retryDelay??Vp,I=typeof v=="function"?v(n,O):v,x=p===!0||typeof p=="number"&&n<p||typeof p=="function"&&p(n,O);if(t||!x){h(O);return}n++,(E=e.onFail)==null||E.call(e,n,O),Fp(I).then(()=>f()?void 0:m()).then(()=>{t?h(O):y()})})};return{promise:o,status:()=>o.status,cancel:s,continue:()=>(r==null||r(),o),cancelRetry:a,continueRetry:u,canStart:l,start:()=>(l()?y():m().then(y),o)}}var pr,Nu,Ku=(Nu=class{constructor(){oe(this,pr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ws(this.gcTime)&&Q(this,pr,ur.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Cr?1/0:5*60*1e3))}clearGcTimeout(){_(this,pr)&&(ur.clearTimeout(_(this,pr)),Q(this,pr,void 0))}},pr=new WeakMap,Nu),hr,jr,jt,mr,nt,Ti,gr,Bt,yn,Tu,$p=(Tu=class extends Ku{constructor(t){super();oe(this,Bt);oe(this,hr);oe(this,jr);oe(this,jt);oe(this,mr);oe(this,nt);oe(this,Ti);oe(this,gr);Q(this,gr,!1),Q(this,Ti,t.defaultOptions),this.setOptions(t.options),this.observers=[],Q(this,mr,t.client),Q(this,jt,_(this,mr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Q(this,hr,gc(this.options)),this.state=t.state??_(this,hr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=_(this,nt))==null?void 0:t.promise}setOptions(t){if(this.options={..._(this,Ti),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=gc(this.options);n.data!==void 0&&(this.setData(n.data,{updatedAt:n.dataUpdatedAt,manual:!0}),Q(this,hr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,jt).remove(this)}setData(t,n){const r=Cs(this.state.data,t,this.options);return me(this,Bt,yn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){me(this,Bt,yn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=_(this,nt))==null?void 0:r.promise;return(o=_(this,nt))==null||o.cancel(t),n?n.then(gt).catch(gt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,hr))}isActive(){return this.observers.some(t=>Lt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ho||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(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:!ku(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,nt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,nt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(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||(_(this,nt)&&(_(this,gr)?_(this,nt).cancel({revert:!0}):_(this,nt).cancelRetry()),this.scheduleGc()),_(this,jt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||me(this,Bt,yn).call(this,{type:"invalidate"})}async fetch(t,n){var u,f,l,d,h,m,y,w,g,O,p,v;if(this.state.fetchStatus!=="idle"&&((u=_(this,nt))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,nt))return _(this,nt).continueRetry(),_(this,nt).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:()=>(Q(this,gr,!0),r.signal)})},i=()=>{const I=ju(this.options,n),E=(()=>{const A={client:_(this,mr),queryKey:this.queryKey,meta:this.meta};return o(A),A})();return Q(this,gr,!1),this.options.persister?this.options.persister(I,E,this):I(E)},a=(()=>{const I={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:_(this,mr),state:this.state,fetchFn:i};return o(I),I})();(f=this.options.behavior)==null||f.onFetch(a,this),Q(this,jr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((l=a.fetchOptions)==null?void 0:l.meta))&&me(this,Bt,yn).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),Q(this,nt,$u({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:I=>{I instanceof Os&&I.revert&&this.setState({..._(this,jr),fetchStatus:"idle"}),r.abort()},onFail:(I,x)=>{me(this,Bt,yn).call(this,{type:"failed",failureCount:I,error:x})},onPause:()=>{me(this,Bt,yn).call(this,{type:"pause"})},onContinue:()=>{me(this,Bt,yn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const I=await _(this,nt).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),(m=(h=_(this,jt).config).onSuccess)==null||m.call(h,I,this),(w=(y=_(this,jt).config).onSettled)==null||w.call(y,I,this.state.error,this),I}catch(I){if(I instanceof Os){if(I.silent)return _(this,nt).promise;if(I.revert){if(this.state.data===void 0)throw I;return this.state.data}}throw me(this,Bt,yn).call(this,{type:"error",error:I}),(O=(g=_(this,jt).config).onError)==null||O.call(g,I,this),(v=(p=_(this,jt).config).onSettled)==null||v.call(p,this.state.data,I,this),I}finally{this.scheduleGc()}}},hr=new WeakMap,jr=new WeakMap,jt=new WeakMap,mr=new WeakMap,nt=new WeakMap,Ti=new WeakMap,gr=new WeakMap,Bt=new WeakSet,yn=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,...Uu(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 Q(this,jr,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),Ge.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,jt).notify({query:this,type:"updated",action:t})})},Tu);function Uu(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function gc(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 It,Ie,Ri,ht,yr,Lr,vn,$n,Ai,Vr,$r,vr,wr,Kn,Kr,Re,yi,_s,Ss,Es,Ns,Ts,Rs,As,qu,Ru,Kp=(Ru=class extends ii{constructor(t,n){super();oe(this,Re);oe(this,It);oe(this,Ie);oe(this,Ri);oe(this,ht);oe(this,yr);oe(this,Lr);oe(this,vn);oe(this,$n);oe(this,Ai);oe(this,Vr);oe(this,$r);oe(this,vr);oe(this,wr);oe(this,Kn);oe(this,Kr,new Set);this.options=n,Q(this,It,t),Q(this,$n,null),Q(this,vn,xs()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,Ie).addObserver(this),yc(_(this,Ie),this.options)?me(this,Re,yi).call(this):this.updateResult(),me(this,Re,Ns).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Fs(_(this,Ie),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Fs(_(this,Ie),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,me(this,Re,Ts).call(this),me(this,Re,Rs).call(this),_(this,Ie).removeObserver(this)}setOptions(t){const n=this.options,r=_(this,Ie);if(this.options=_(this,It).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Lt(this.options.enabled,_(this,Ie))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");me(this,Re,As).call(this),_(this,Ie).setOptions(this.options),n._defaulted&&!po(this.options,n)&&_(this,It).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,Ie),observer:this});const o=this.hasListeners();o&&vc(_(this,Ie),r,this.options,n)&&me(this,Re,yi).call(this),this.updateResult(),o&&(_(this,Ie)!==r||Lt(this.options.enabled,_(this,Ie))!==Lt(n.enabled,_(this,Ie))||Wn(this.options.staleTime,_(this,Ie))!==Wn(n.staleTime,_(this,Ie)))&&me(this,Re,_s).call(this);const i=me(this,Re,Ss).call(this);o&&(_(this,Ie)!==r||Lt(this.options.enabled,_(this,Ie))!==Lt(n.enabled,_(this,Ie))||i!==_(this,Kn))&&me(this,Re,Es).call(this,i)}getOptimisticResult(t){const n=_(this,It).getQueryCache().build(_(this,It),t),r=this.createResult(n,t);return qp(this,r)&&(Q(this,ht,r),Q(this,Lr,this.options),Q(this,yr,_(this,Ie).state)),r}getCurrentResult(){return _(this,ht)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&_(this,vn).status==="pending"&&_(this,vn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,o))})}trackProp(t){_(this,Kr).add(t)}getCurrentQuery(){return _(this,Ie)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=_(this,It).defaultQueryOptions(t),r=_(this,It).getQueryCache().build(_(this,It),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return me(this,Re,yi).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,ht)))}createResult(t,n){var F;const r=_(this,Ie),o=this.options,i=_(this,ht),s=_(this,yr),a=_(this,Lr),f=t!==r?t.state:_(this,Ri),{state:l}=t;let d={...l},h=!1,m;if(n._optimisticResults){const R=this.hasListeners(),D=!R&&yc(t,n),K=R&&vc(t,r,n,o);(D||K)&&(d={...d,...Uu(l.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:y,errorUpdatedAt:w,status:g}=d;m=d.data;let O=!1;if(n.placeholderData!==void 0&&m===void 0&&g==="pending"){let R;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(R=i.data,O=!0):R=typeof n.placeholderData=="function"?n.placeholderData((F=_(this,$r))==null?void 0:F.state.data,_(this,$r)):n.placeholderData,R!==void 0&&(g="success",m=Cs(i==null?void 0:i.data,R,n),h=!0)}if(n.select&&m!==void 0&&!O)if(i&&m===(s==null?void 0:s.data)&&n.select===_(this,Ai))m=_(this,Vr);else try{Q(this,Ai,n.select),m=n.select(m),m=Cs(i==null?void 0:i.data,m,n),Q(this,Vr,m),Q(this,$n,null)}catch(R){Q(this,$n,R)}_(this,$n)&&(y=_(this,$n),m=_(this,Vr),w=Date.now(),g="error");const p=d.fetchStatus==="fetching",v=g==="pending",I=g==="error",x=v&&p,E=m!==void 0,S={status:g,fetchStatus:d.fetchStatus,isPending:v,isSuccess:g==="success",isError:I,isInitialLoading:x,isLoading:x,data:m,dataUpdatedAt:d.dataUpdatedAt,error:y,errorUpdatedAt:w,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>f.dataUpdateCount||d.errorUpdateCount>f.errorUpdateCount,isFetching:p,isRefetching:p&&!v,isLoadingError:I&&!E,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:I&&E,isStale:oa(t,n),refetch:this.refetch,promise:_(this,vn),isEnabled:Lt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=j=>{S.status==="error"?j.reject(S.error):S.data!==void 0&&j.resolve(S.data)},D=()=>{const j=Q(this,vn,S.promise=xs());R(j)},K=_(this,vn);switch(K.status){case"pending":t.queryHash===r.queryHash&&R(K);break;case"fulfilled":(S.status==="error"||S.data!==K.value)&&D();break;case"rejected":(S.status!=="error"||S.error!==K.reason)&&D();break}}return S}updateResult(){const t=_(this,ht),n=this.createResult(_(this,Ie),this.options);if(Q(this,yr,_(this,Ie).state),Q(this,Lr,this.options),_(this,yr).data!==void 0&&Q(this,$r,_(this,Ie)),po(n,t))return;Q(this,ht,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!_(this,Kr).size)return!0;const s=new Set(i??_(this,Kr));return this.options.throwOnError&&s.add("error"),Object.keys(_(this,ht)).some(a=>{const u=a;return _(this,ht)[u]!==t[u]&&s.has(u)})};me(this,Re,qu).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&me(this,Re,Ns).call(this)}},It=new WeakMap,Ie=new WeakMap,Ri=new WeakMap,ht=new WeakMap,yr=new WeakMap,Lr=new WeakMap,vn=new WeakMap,$n=new WeakMap,Ai=new WeakMap,Vr=new WeakMap,$r=new WeakMap,vr=new WeakMap,wr=new WeakMap,Kn=new WeakMap,Kr=new WeakMap,Re=new WeakSet,yi=function(t){me(this,Re,As).call(this);let n=_(this,Ie).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(gt)),n},_s=function(){me(this,Re,Ts).call(this);const t=Wn(this.options.staleTime,_(this,Ie));if(Cr||_(this,ht).isStale||!ws(t))return;const r=ku(_(this,ht).dataUpdatedAt,t)+1;Q(this,vr,ur.setTimeout(()=>{_(this,ht).isStale||this.updateResult()},r))},Ss=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,Ie)):this.options.refetchInterval)??!1},Es=function(t){me(this,Re,Rs).call(this),Q(this,Kn,t),!(Cr||Lt(this.options.enabled,_(this,Ie))===!1||!ws(_(this,Kn))||_(this,Kn)===0)&&Q(this,wr,ur.setInterval(()=>{(this.options.refetchIntervalInBackground||ia.isFocused())&&me(this,Re,yi).call(this)},_(this,Kn)))},Ns=function(){me(this,Re,_s).call(this),me(this,Re,Es).call(this,me(this,Re,Ss).call(this))},Ts=function(){_(this,vr)&&(ur.clearTimeout(_(this,vr)),Q(this,vr,void 0))},Rs=function(){_(this,wr)&&(ur.clearInterval(_(this,wr)),Q(this,wr,void 0))},As=function(){const t=_(this,It).getQueryCache().build(_(this,It),this.options);if(t===_(this,Ie))return;const n=_(this,Ie);Q(this,Ie,t),Q(this,Ri,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},qu=function(t){Ge.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(_(this,ht))}),_(this,It).getQueryCache().notify({query:_(this,Ie),type:"observerResultsUpdated"})})},Ru);function Up(e,t){return Lt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function yc(e,t){return Up(e,t)||e.state.data!==void 0&&Fs(e,t,t.refetchOnMount)}function Fs(e,t,n){if(Lt(t.enabled,e)!==!1&&Wn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&oa(e,t)}return!1}function vc(e,t,n,r){return(e!==t||Lt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&oa(e,n)}function oa(e,t){return Lt(t.enabled,e)!==!1&&e.isStaleByTime(Wn(t.staleTime,e))}function qp(e,t){return!po(e.getCurrentResult(),t)}function wc(e){return{onFetch:(t,n)=>{var l,d,h,m,y;const r=t.options,o=(h=(d=(l=t.fetchOptions)==null?void 0:l.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],s=((y=t.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},u=0;const f=async()=>{let w=!1;const g=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},O=ju(t.options,t.fetchOptions),p=async(v,I,x)=>{if(w)return Promise.reject();if(I==null&&v.pages.length)return Promise.resolve(v);const A=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:I,direction:x?"backward":"forward",meta:t.options.meta};return g(D),D})(),S=await O(A),{maxPages:F}=t.options,R=x?Dp:Pp;return{pages:R(v.pages,S,F),pageParams:R(v.pageParams,I,F)}};if(o&&i.length){const v=o==="backward",I=v?Bp:bc,x={pages:i,pageParams:s},E=I(r,x);a=await p(x,E,v)}else{const v=e??i.length;do{const I=u===0?s[0]??r.initialPageParam:bc(r,a);if(u>0&&I==null)break;a=await p(a,I),u++}while(u<v)}return a};t.options.persister?t.fetchFn=()=>{var w,g;return(g=(w=t.options).persister)==null?void 0:g.call(w,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function bc(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 Bp(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 Fi,en,mt,br,tn,kn,Au,Jp=(Au=class extends Ku{constructor(t){super();oe(this,tn);oe(this,Fi);oe(this,en);oe(this,mt);oe(this,br);Q(this,Fi,t.client),this.mutationId=t.mutationId,Q(this,mt,t.mutationCache),Q(this,en,[]),this.state=t.state||Bu(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,en).includes(t)||(_(this,en).push(t),this.clearGcTimeout(),_(this,mt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Q(this,en,_(this,en).filter(n=>n!==t)),this.scheduleGc(),_(this,mt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,en).length||(this.state.status==="pending"?this.scheduleGc():_(this,mt).remove(this))}continue(){var t;return((t=_(this,br))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,a,u,f,l,d,h,m,y,w,g,O,p,v,I,x,E,A,S,F;const n=()=>{me(this,tn,kn).call(this,{type:"continue"})},r={client:_(this,Fi),meta:this.options.meta,mutationKey:this.options.mutationKey};Q(this,br,$u({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,D)=>{me(this,tn,kn).call(this,{type:"failed",failureCount:R,error:D})},onPause:()=>{me(this,tn,kn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,mt).canRun(this)}));const o=this.state.status==="pending",i=!_(this,br).canStart();try{if(o)n();else{me(this,tn,kn).call(this,{type:"pending",variables:t,isPaused:i}),await((a=(s=_(this,mt).config).onMutate)==null?void 0:a.call(s,t,this,r));const D=await((f=(u=this.options).onMutate)==null?void 0:f.call(u,t,r));D!==this.state.context&&me(this,tn,kn).call(this,{type:"pending",context:D,variables:t,isPaused:i})}const R=await _(this,br).start();return await((d=(l=_(this,mt).config).onSuccess)==null?void 0:d.call(l,R,t,this.state.context,this,r)),await((m=(h=this.options).onSuccess)==null?void 0:m.call(h,R,t,this.state.context,r)),await((w=(y=_(this,mt).config).onSettled)==null?void 0:w.call(y,R,null,this.state.variables,this.state.context,this,r)),await((O=(g=this.options).onSettled)==null?void 0:O.call(g,R,null,t,this.state.context,r)),me(this,tn,kn).call(this,{type:"success",data:R}),R}catch(R){try{throw await((v=(p=_(this,mt).config).onError)==null?void 0:v.call(p,R,t,this.state.context,this,r)),await((x=(I=this.options).onError)==null?void 0:x.call(I,R,t,this.state.context,r)),await((A=(E=_(this,mt).config).onSettled)==null?void 0:A.call(E,void 0,R,this.state.variables,this.state.context,this,r)),await((F=(S=this.options).onSettled)==null?void 0:F.call(S,void 0,R,t,this.state.context,r)),R}finally{me(this,tn,kn).call(this,{type:"error",error:R})}}finally{_(this,mt).runNext(this)}}},Fi=new WeakMap,en=new WeakMap,mt=new WeakMap,br=new WeakMap,tn=new WeakSet,kn=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),Ge.batch(()=>{_(this,en).forEach(r=>{r.onMutationUpdate(t)}),_(this,mt).notify({mutation:this,type:"updated",action:t})})},Au);function Bu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wn,Jt,Pi,Fu,Hp=(Fu=class extends ii{constructor(t={}){super();oe(this,wn);oe(this,Jt);oe(this,Pi);this.config=t,Q(this,wn,new Set),Q(this,Jt,new Map),Q(this,Pi,0)}build(t,n,r){const o=new Jp({client:t,mutationCache:this,mutationId:++Xi(this,Pi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){_(this,wn).add(t);const n=Yi(t);if(typeof n=="string"){const r=_(this,Jt).get(n);r?r.push(t):_(this,Jt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(_(this,wn).delete(t)){const n=Yi(t);if(typeof n=="string"){const r=_(this,Jt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&_(this,Jt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Yi(t);if(typeof n=="string"){const r=_(this,Jt).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=Yi(t);if(typeof n=="string"){const o=(r=_(this,Jt).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(){Ge.batch(()=>{_(this,wn).forEach(t=>{this.notify({type:"removed",mutation:t})}),_(this,wn).clear(),_(this,Jt).clear()})}getAll(){return Array.from(_(this,wn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>pc(n,r))}findAll(t={}){return this.getAll().filter(n=>pc(t,n))}notify(t){Ge.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ge.batch(()=>Promise.all(t.map(n=>n.continue().catch(gt))))}},wn=new WeakMap,Jt=new WeakMap,Pi=new WeakMap,Fu);function Yi(e){var t;return(t=e.options.scope)==null?void 0:t.id}var bn,Un,Ct,In,xn,ao,Ps,Pu,Wp=(Pu=class extends ii{constructor(n,r){super();oe(this,xn);oe(this,bn);oe(this,Un);oe(this,Ct);oe(this,In);Q(this,bn,n),this.setOptions(r),this.bindMethods(),me(this,xn,ao).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=_(this,bn).defaultMutationOptions(n),po(this.options,r)||_(this,bn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,Ct),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&xr(r.mutationKey)!==xr(this.options.mutationKey)?this.reset():((o=_(this,Ct))==null?void 0:o.state.status)==="pending"&&_(this,Ct).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=_(this,Ct))==null||n.removeObserver(this)}onMutationUpdate(n){me(this,xn,ao).call(this),me(this,xn,Ps).call(this,n)}getCurrentResult(){return _(this,Un)}reset(){var n;(n=_(this,Ct))==null||n.removeObserver(this),Q(this,Ct,void 0),me(this,xn,ao).call(this),me(this,xn,Ps).call(this)}mutate(n,r){var o;return Q(this,In,r),(o=_(this,Ct))==null||o.removeObserver(this),Q(this,Ct,_(this,bn).getMutationCache().build(_(this,bn),this.options)),_(this,Ct).addObserver(this),_(this,Ct).execute(n)}},bn=new WeakMap,Un=new WeakMap,Ct=new WeakMap,In=new WeakMap,xn=new WeakSet,ao=function(){var r;const n=((r=_(this,Ct))==null?void 0:r.state)??Bu();Q(this,Un,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Ps=function(n){Ge.batch(()=>{var r,o,i,s,a,u,f,l;if(_(this,In)&&this.hasListeners()){const d=_(this,Un).variables,h=_(this,Un).context,m={client:_(this,bn),meta:this.options.meta,mutationKey:this.options.mutationKey};(n==null?void 0:n.type)==="success"?((o=(r=_(this,In)).onSuccess)==null||o.call(r,n.data,d,h,m),(s=(i=_(this,In)).onSettled)==null||s.call(i,n.data,null,d,h,m)):(n==null?void 0:n.type)==="error"&&((u=(a=_(this,In)).onError)==null||u.call(a,n.error,d,h,m),(l=(f=_(this,In)).onSettled)==null||l.call(f,void 0,n.error,d,h,m))}this.listeners.forEach(d=>{d(_(this,Un))})})},Pu),nn,Du,zp=(Du=class extends ii{constructor(t={}){super();oe(this,nn);this.config=t,Q(this,nn,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??ra(o,n);let s=this.get(i);return s||(s=new $p({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){_(this,nn).has(t.queryHash)||(_(this,nn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,nn).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,nn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ge.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,nn).get(t)}getAll(){return[..._(this,nn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>fc(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>fc(t,r)):n}notify(t){Ge.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ge.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ge.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},nn=new WeakMap,Du),Ke,qn,Bn,Ur,qr,Jn,Br,Jr,Mu,Qp=(Mu=class{constructor(e={}){oe(this,Ke);oe(this,qn);oe(this,Bn);oe(this,Ur);oe(this,qr);oe(this,Jn);oe(this,Br);oe(this,Jr);Q(this,Ke,e.queryCache||new zp),Q(this,qn,e.mutationCache||new Hp),Q(this,Bn,e.defaultOptions||{}),Q(this,Ur,new Map),Q(this,qr,new Map),Q(this,Jn,0)}mount(){Xi(this,Jn)._++,_(this,Jn)===1&&(Q(this,Br,ia.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,Ke).onFocus())})),Q(this,Jr,mo.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,Ke).onOnline())})))}unmount(){var e,t;Xi(this,Jn)._--,_(this,Jn)===0&&((e=_(this,Br))==null||e.call(this),Q(this,Br,void 0),(t=_(this,Jr))==null||t.call(this),Q(this,Jr,void 0))}isFetching(e){return _(this,Ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,qn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,Ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=_(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 _(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=_(this,Ke).get(r.queryHash),i=o==null?void 0:o.state.data,s=Rp(t,i);if(s!==void 0)return _(this,Ke).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Ge.batch(()=>_(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=_(this,Ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,Ke);Ge.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(this,Ke);return Ge.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ge.batch(()=>_(this,Ke).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(gt).catch(gt)}invalidateQueries(e,t={}){return Ge.batch(()=>(_(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=Ge.batch(()=>_(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(gt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(gt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(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(gt).catch(gt)}fetchInfiniteQuery(e){return e.behavior=wc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(gt).catch(gt)}ensureInfiniteQueryData(e){return e.behavior=wc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return mo.isOnline()?_(this,qn).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,Ke)}getMutationCache(){return _(this,qn)}getDefaultOptions(){return _(this,Bn)}setDefaultOptions(e){Q(this,Bn,e)}setQueryDefaults(e,t){_(this,Ur).set(xr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,Ur).values()],n={};return t.forEach(r=>{Ci(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){_(this,qr).set(xr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,qr).values()],n={};return t.forEach(r=>{Ci(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,Bn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ra(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ho&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Bn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,Ke).clear(),_(this,qn).clear()}},Ke=new WeakMap,qn=new WeakMap,Bn=new WeakMap,Ur=new WeakMap,qr=new WeakMap,Jn=new WeakMap,Br=new WeakMap,Jr=new WeakMap,Mu),Ju=B.createContext(void 0),Ue=e=>{const t=B.useContext(Ju);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Gp=({client:e,children:t})=>(B.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(Ju.Provider,{value:e,children:t})),Hu=B.createContext(!1),Xp=()=>B.useContext(Hu);Hu.Provider;function Yp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Zp=B.createContext(Yp()),eh=()=>B.useContext(Zp),th=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},nh=e=>{B.useEffect(()=>{e.clearReset()},[e])},rh=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||Lu(n,[e.error,r])),ih=e=>{if(e.suspense){const n=o=>o==="static"?o:Math.max(o??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...o)=>n(r(...o)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},oh=(e,t)=>e.isLoading&&e.isFetching&&!t,sh=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ic=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ah(e,t,n){var d,h,m,y,w;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=Xp(),o=eh(),i=Ue(),s=i.defaultQueryOptions(e);(h=(d=i.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||h.call(d,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",ih(s),th(s,o),nh(o);const a=!i.getQueryCache().get(s.queryHash),[u]=B.useState(()=>new t(i,s)),f=u.getOptimisticResult(s),l=!r&&e.subscribed!==!1;if(B.useSyncExternalStore(B.useCallback(g=>{const O=l?u.subscribe(Ge.batchCalls(g)):gt;return u.updateResult(),O},[u,l]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),B.useEffect(()=>{u.setOptions(s)},[s,u]),sh(s,f))throw Ic(s,u,o);if(rh({result:f,errorResetBoundary:o,throwOnError:s.throwOnError,query:i.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((y=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||y.call(m,s,f),s.experimental_prefetchInRender&&!Cr&&oh(f,r)){const g=a?Ic(s,u,o):(w=i.getQueryCache().get(s.queryHash))==null?void 0:w.promise;g==null||g.catch(gt).finally(()=>{u.updateResult()})}return s.notifyOnChangeProps?f:u.trackResult(f)}function Yn(e,t){return ah(e,Kp)}function On(e,t){const n=Ue(),[r]=B.useState(()=>new Wp(n,e));B.useEffect(()=>{r.setOptions(e)},[r,e]);const o=B.useSyncExternalStore(B.useCallback(s=>r.subscribe(Ge.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=B.useCallback((s,a)=>{r.mutate(s,a).catch(gt)},[r]);if(o.error&&Lu(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const Wu=b.createContext(null),ch=Wu.Provider,zu=()=>b.useContext(Wu);var we=(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))(we||{});const Qu=b.createContext(void 0);function an(){const e=b.useContext(Qu);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const uh=(()=>{const e={};return Object.values(we).forEach(t=>{e[t]={}}),e})();function lh({children:e}){const[t,n]=b.useState(uh),r=b.useCallback((l,d,h=!0)=>{n(m=>{const y={...m};return y[l]=y[l]||{},y[l][d]=h,y})},[n]),o=b.useCallback((l,d)=>{var h;return!!((h=t[l])!=null&&h[d])},[t]),i=b.useCallback((l,d)=>{var h;return(h=t[l])==null?void 0:h[d]},[t]),s=b.useCallback((l,d)=>{n(h=>{var y;const m={...h};return(y=m[l])==null||delete y[d],m})},[n]),a=b.useCallback(l=>{n(d=>{const h={...d};return h[l]={},h})},[n]),u=b.useCallback((l,d)=>{n(h=>{const m={...h};return m[l]=m[l]||{},d.forEach(y=>{m[l][y]=!0}),m})},[n]),f=b.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:u,getError:i}),[t,n,r,o,s,a,u,i]);return c.jsx(Qu.Provider,{value:f,children:e})}new TextEncoder;const Ds=new TextDecoder;function dh(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 fh(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:Ds.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=Ds.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return dh(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class Gu extends Error{constructor(n,r){var o;super(n,r);pi(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(o=Error.captureStackTrace)==null||o.call(Error,this,this.constructor)}}pi(Gu,"code","ERR_JOSE_GENERIC");class jn extends Gu{constructor(){super(...arguments);pi(this,"code","ERR_JWT_INVALID")}}pi(jn,"code","ERR_JWT_INVALID");function ph(e){return typeof e=="object"&&e!==null}const hh=e=>{if(!ph(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t};function mh(e){if(typeof e!="string")throw new jn("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new jn("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new jn("Invalid JWT");if(!t)throw new jn("JWTs must contain a payload");let r;try{r=fh(t)}catch{throw new jn("Failed to base64url decode the payload")}let o;try{o=JSON.parse(Ds.decode(r))}catch{throw new jn("Failed to parse the decoded payload as JSON")}if(!hh(o))throw new jn("Invalid JWT Claims Set");return o}const Ms="amp-labs_jwt_",gh=10*60*1e3,Cc=(e,t)=>`${e}:${t}`,xc=e=>`${Ms}${e}`,Xu=b.createContext(null),yh=e=>{try{const t=mh(e);return t.exp&&typeof t.exp=="number"?t.exp*1e3:null}catch(t){return console.warn("Failed to decode JWT token:",t),null}};function vh({getTokenCallback:e,children:t}){const[n,r]=b.useState(new Map);b.useEffect(()=>{try{const u=new Map,f=Date.now();Object.keys(sessionStorage).forEach(l=>{if(l.startsWith(Ms)){const d=l.replace(Ms,""),h=sessionStorage.getItem(l);if(h)try{const m=JSON.parse(h);m.expiresAt>f?u.set(d,m):sessionStorage.removeItem(l)}catch{sessionStorage.removeItem(l)}}}),u.size>0&&r(u)}catch{console.warn("Failed to load JWT tokens from sessionStorage")}},[]);const o=b.useCallback((u,f)=>{const l=Cc(u,f),d=Date.now(),h=n.get(l);if(h&&h.expiresAt>d)return h.token;n.delete(l);const m=xc(l),y=sessionStorage.getItem(m);if(y)try{const w=JSON.parse(y);if(w.expiresAt>d)return r(g=>new Map(g).set(l,w)),w.token;sessionStorage.removeItem(m)}catch{sessionStorage.removeItem(m)}return null},[n]),i=b.useCallback(async(u,f,l)=>{const d=Cc(u,f),m=await yh(l)||Date.now()+gh,y={token:l,expiresAt:m};r(w=>new Map(w).set(d,y));try{sessionStorage.setItem(xc(d),JSON.stringify(y))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=b.useCallback(async({consumerRef:u,groupRef:f})=>{const l=o(u,f);if(l)return l;if(!e)throw new Error("JWT token callback not provided");try{const d=await e({consumerRef:u,groupRef:f});return await i(u,f,d),d}catch(d){throw console.error("Failed to get JWT token:",d),new Error("Failed to get JWT token")}},[e,o,i]),a={getToken:e?s:void 0};return c.jsx(Xu.Provider,{value:a,children:t})}const wh=()=>{const e=b.useContext(Xu);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},sa=b.createContext(null);function je(){const e=b.useContext(sa);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
2
|
-
component is wrapped with AmpersandProvider`);return e}const bh=new Qp;function Ih(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 c.jsx(Gp,{client:bh,children:c.jsx(sa.Provider,{value:a,children:c.jsx(lh,{children:c.jsx(vh,{getTokenCallback:o||null,children:c.jsx(ch,{value:t||null,children:i})})})})})}const Ch="https://api.withampersand.com/v1".replace(/\/+$/,"");class aa{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ch}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Zu}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 xh=new aa,Ao=class Ao{constructor(t=xh){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 Sh(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?Ao.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 Yu(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})},u={...a,body:_h(a.body)||a.body instanceof URLSearchParams||Oh(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:u}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Ao.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let rn=Ao;function Oh(e){return typeof Blob<"u"&&e instanceof Blob}function _h(e){return typeof FormData<"u"&&e instanceof FormData}class Yu extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Sh extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function N(e,t){const n=e[t];return n!=null}function Zu(e,t=""){return Object.keys(e).map(n=>el(n,e[n],t)).filter(n=>n.length>0).join("&")}function el(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 el(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Zu(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Be(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Me{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Hr{constructor(t){this.raw=t}async value(){}}class Oc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Eh(e){return Nh(e)}function Nh(e,t){return e==null?e:{fieldUsed:N(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:N(e,"keyFormat")?e.keyFormat:void 0}}function Th(e){return Rh(e)}function Rh(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function Ah(e){return Fh(e)}function Fh(e,t){return e==null?e:{name:e.name}}function Ph(e){return Dh(e)}function Dh(e,t){return e==null?e:{attachmentType:e.attachmentType,query:N(e,"query")?Ah(e.query):void 0,header:N(e,"header")?Th(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Mh(e){return kh(e)}function kh(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,includeFullRecords:N(e,"includeFullRecords")?e.includeFullRecords:void 0}}function jh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function Lh(e){return Vh(e)}function Vh(e,t){return e==null?e:{url:e.url,method:N(e,"method")?e.method:void 0,successStatusCodes:N(e,"successStatusCodes")?e.successStatusCodes:void 0}}const _c={ApiKey:"apiKey",Basic:"basic"};function $h(e){return Kh(e)}function Kh(e,t){return e}function Uh(e){return qh(e)}function qh(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function Bh(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function tl(e){return Jh(e)}function Jh(e,t){return e==null?e:{defaultPeriod:Uh(e.defaultPeriod)}}function Hh(e){if(e!==void 0)return e===null?null:{defaultPeriod:Bh(e.defaultPeriod)}}function Wh(e){return zh(e)}function zh(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function Qh(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Gh(e){return Xh(e)}function Xh(e,t){return e==null?e:{defaultPeriod:Wh(e.defaultPeriod)}}function nl(e){if(e!==void 0)return e===null?null:{defaultPeriod:Qh(e.defaultPeriod)}}function Yh(e){return Zh(e)}function Zh(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,useModule:N(e,"useModule")?e.useModule:void 0}}function rl(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function em(e){return tm(e)}function tm(e,t){return e==null?e:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function nm(e){if(e!==void 0)return e===null?null:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function rm(e){return im(e)}function im(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,prompt:N(e,"prompt")?e.prompt:void 0,mappedValues:N(e,"mappedValues")?e.mappedValues.map(em):void 0,fieldName:N(e,"fieldName")?e.fieldName:void 0}}function il(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,prompt:e.prompt,mappedValues:e.mappedValues===void 0?void 0:e.mappedValues.map(nm),fieldName:e.fieldName}}function om(e){return sm(e)}function sm(e,t){return e}function am(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,disabled:e.disabled,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(il),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:nl(e.backfill)}}function cm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Be(e.objects,am)}}function um(e){return lm(e)}function lm(e,t){return e==null?e:{stringValue:N(e,"stringValue")?e.stringValue:void 0,integerValue:N(e,"integerValue")?e.integerValue:void 0,booleanValue:N(e,"booleanValue")?e.booleanValue:void 0}}function dm(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const fm={Always:"always",Never:"never"},pm={Always:"always",Never:"never"};function hm(e){return mm(e)}function mm(e,t){return e==null?e:{default:N(e,"default")?um(e.default):void 0,writeOnCreate:N(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:N(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function ol(e){if(e!==void 0)return e===null?null:{default:dm(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function gm(e){let t=!0;return t=t&&"value"in e,t}function ym(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function vm(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 bm(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Im(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Cm(e){let t=!0;return t=t&&"value"in e,t}function xm(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Om(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function _m(e){return Sm(e)}function Sm(e,t){return e==null?e:{...ym(e),...bm(e),...xm(e)}}function sl(e){if(e!==void 0)return e===null?null:gm(e)?vm(e):wm(e)?Im(e):Cm(e)?Om(e):{}}function Em(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Be(e.selectedValueDefaults,sl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Be(e.selectedFieldSettings,ol)}}function Nm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Be(e.objects,Em)}}function Tm(e){return Rm(e)}function Rm(e,t){return e==null?e:{enabled:e.enabled}}function Am(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fm(e){return Pm(e)}function Pm(e,t){return e==null?e:{enabled:e.enabled}}function Dm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Mm(e){return km(e)}function km(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:N(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:N(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function jm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Lm(e){return Vm(e)}function Vm(e,t){return e==null?e:{apiKeyAsBasic:N(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:N(e,"apiKeyAsBasicOpts")?Eh(e.apiKeyAsBasicOpts):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function $m(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Km(e){return Um(e)}function Um(e,t){return e==null?e:{value:e.value}}function qm(e){return Bm(e)}function Bm(e,t){return e==null?e:{brandingRemoval:N(e,"brandingRemoval")?Km(e.brandingRemoval):void 0}}function Zi(e){return Jm(e)}function Jm(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:N(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:N(e,"entitlements")?qm(e.entitlements):void 0}}function Hm(e){return Wm(e)}function Wm(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function zm(e){return Qm(e)}function Qm(e,t){return e==null?e:{objectName:e.objectName,schedule:N(e,"schedule")?e.schedule:void 0,disabled:N(e,"disabled")?e.disabled:void 0,destination:N(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:N(e,"selectedValueMappings")?e.selectedValueMappings:void 0,dynamicMappingsInput:N(e,"dynamicMappingsInput")?e.dynamicMappingsInput.map(rm):void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:N(e,"selectedFieldsAuto")?om(e.selectedFieldsAuto):void 0,backfill:N(e,"backfill")?Gh(e.backfill):void 0}}function Gm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,disabled:e.disabled,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(il),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:nl(e.backfill)}}function Xm(e){return Ym(e)}function Ym(e,t){return e==null?e:{objects:Be(e.objects,zm)}}function Zm(e){if(e!==void 0)return e===null?null:{objects:Be(e.objects,Gm)}}function eg(e){return tg(e)}function tg(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:N(e,"createEvent")?Tm(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?Mm(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?Fm(e.deleteEvent):void 0}}function ng(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:Am(e.createEvent),updateEvent:jm(e.updateEvent),deleteEvent:Dm(e.deleteEvent)}}function rg(e){return ig(e)}function ig(e,t){return e==null?e:{objects:Be(e.objects,eg)}}function og(e){if(e!==void 0)return e===null?null:{objects:Be(e.objects,ng)}}function sg(e){return ag(e)}function ag(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:N(e,"selectedValueDefaults")?Be(e.selectedValueDefaults,_m):void 0,selectedFieldSettings:N(e,"selectedFieldSettings")?Be(e.selectedFieldSettings,hm):void 0}}function cg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Be(e.selectedValueDefaults,sl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Be(e.selectedFieldSettings,ol)}}function ug(e){return lg(e)}function lg(e,t){return e==null?e:{objects:N(e,"objects")?Be(e.objects,sg):void 0}}function dg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Be(e.objects,cg)}}function fg(e){return pg(e)}function pg(e,t){return e==null?e:{provider:e.provider,module:N(e,"module")?e.module:void 0,read:N(e,"read")?Xm(e.read):void 0,write:N(e,"write")?ug(e.write):void 0,proxy:N(e,"proxy")?Yh(e.proxy):void 0,subscribe:N(e,"subscribe")?rg(e.subscribe):void 0}}function hg(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:Zm(e.read),write:dg(e.write),proxy:rl(e.proxy),subscribe:og(e.subscribe)}}function mg(e){return gg(e)}function gg(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:fg(e.content)}}function yg(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:N(e,"updateTime")?new Date(e.updateTime):void 0}}function al(e){return wg(e)}function wg(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function bg(e){return Ig(e)}function Ig(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Cg(e){return xg(e)}function xg(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Og(e){return _g(e)}function _g(e,t){return e==null?e:{accessToken:N(e,"accessToken")?bg(e.accessToken):void 0,refreshToken:N(e,"refreshToken")?Cg(e.refreshToken):void 0,scopes:N(e,"scopes")?e.scopes:void 0}}function co(e){return Sg(e)}function Sg(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:N(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:N(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function Eg(e){return Ng(e)}function Ng(e,t){return e==null?e:{value:e.value,source:e.source,displayName:N(e,"displayName")?e.displayName:void 0}}function ca(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function vi(e){return Tg(e)}function Tg(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:N(e,"providerApp")?co(e.providerApp):void 0,group:al(e.group),consumer:yg(e.consumer),providerWorkspaceRef:N(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:N(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:N(e,"oauth2AuthorizationCode")?Og(e.oauth2AuthorizationCode):void 0,apiKey:N(e,"apiKey")?e.apiKey:void 0,providerMetadata:N(e,"providerMetadata")?Be(e.providerMetadata,Eg):void 0}}function cl(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function ul(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function ll(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 Rg(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 Ag(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 dl(e){if(e!==void 0)return e===null?null:{accessToken:Rg(e.accessToken),refreshToken:Ag(e.refreshToken),scopes:e.scopes}}function Fg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Be(e.providerMetadata,ca),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:cl(e.basicAuth),oauth2ClientCredentials:ul(e.oauth2ClientCredentials),oauth2PasswordCredentials:ll(e.oauth2PasswordCredentials),oauth2AuthorizationCode:dl(e.oauth2AuthorizationCode)}}function Pg(e){return Dg(e)}function Dg(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Mg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function kg(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:hg(e.content)}}function jg(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:kg(e.config)}}function Lg(e){return Vg(e)}function Vg(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,useModule:N(e,"useModule")?e.useModule:void 0}}function $g(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function Kg(e){return Ug(e)}function Ug(e,t){return e==null?e:{mode:N(e,"mode")?e.mode:void 0,pageSize:N(e,"pageSize")?e.pageSize:void 0}}function qg(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Bg(e){let t=!0;return t=t&&"fieldName"in e,t}function Jg(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Hg(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Wg(e){let t=!0;return t=t&&"mapToName"in e,t}function fl(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:N(e,"default")?e.default:void 0,prompt:N(e,"prompt")?e.prompt:void 0}}function zg(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Sc(e){return Qg(e)}function Qg(e,t){return e==null?e:{...Jg(e),...fl(e)}}function Ec(e){if(e!==void 0)return e===null?null:Bg(e)?Hg(e):Wg(e)?zg(e):{}}function pl(e){return Gg(e)}function Gg(e,t){return e}function Xg(e){return Yg(e)}function Yg(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:N(e,"requiredFields")?e.requiredFields.map(Sc):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(Sc):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?pl(e.optionalFieldsAuto):void 0,backfill:N(e,"backfill")?tl(e.backfill):void 0,delivery:N(e,"delivery")?Kg(e.delivery):void 0,enabled:N(e,"enabled")?e.enabled:void 0}}function Zg(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(Ec),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Ec),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Hh(e.backfill),delivery:qg(e.delivery),enabled:e.enabled}}function ey(e){return ty(e)}function ty(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Xg):void 0}}function ny(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Zg)}}function ry(e){return iy(e)}function iy(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function oy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function sy(e){return ay(e)}function ay(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,watchFieldsAuto:N(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:N(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function cy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function uy(e){return ly(e)}function ly(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:N(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:N(e,"createEvent")?Pg(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?sy(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?ry(e.deleteEvent):void 0,associationChangeEvent:N(e,"associationChangeEvent")?Mh(e.associationChangeEvent):void 0,otherEvents:N(e,"otherEvents")?e.otherEvents:void 0}}function dy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:Mg(e.createEvent),updateEvent:cy(e.updateEvent),deleteEvent:oy(e.deleteEvent),associationChangeEvent:jh(e.associationChangeEvent),otherEvents:e.otherEvents}}function fy(e){return py(e)}function py(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(uy):void 0}}function hy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(dy)}}function hl(e){return my(e)}function my(e,t){return e==null?e:{allowAnyFields:N(e,"allowAnyFields")?e.allowAnyFields:void 0}}function gy(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function yy(e){return vy(e)}function vy(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:N(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:N(e,"valueDefaults")?hl(e.valueDefaults):void 0}}function wy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:gy(e.valueDefaults)}}function by(e){return Iy(e)}function Iy(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(yy):void 0}}function Cy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(wy)}}function xy(e){return Oy(e)}function Oy(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:N(e,"displayName")?e.displayName:void 0,module:N(e,"module")?e.module:void 0,read:N(e,"read")?ey(e.read):void 0,write:N(e,"write")?by(e.write):void 0,proxy:N(e,"proxy")?Lg(e.proxy):void 0,subscribe:N(e,"subscribe")?fy(e.subscribe):void 0}}function _y(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:ny(e.read),write:Cy(e.write),proxy:$g(e.proxy),subscribe:hy(e.subscribe)}}function Sy(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:_y(e.content)}}function Ey(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Sy(e.latestRevision)}}function Ny(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Ty(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 Ry(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Ay(e){return Fy(e)}function Fy(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Py(e){return Dy(e)}function Dy(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:N(e,"prompt")?e.prompt:void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function My(e){return ky(e)}function ky(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function jy(e){return Ly(e)}function Ly(e,t){return e==null?e:{headers:N(e,"headers")?e.headers.map(Ay):void 0,queryParams:N(e,"queryParams")?e.queryParams.map(My):void 0,inputs:N(e,"inputs")?e.inputs.map(Py):void 0}}function Vy(e){return $y(e)}function $y(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Ky(e){return Uy(e)}function Uy(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:N(e,"valueType")?e.valueType:void 0,providerType:N(e,"providerType")?e.providerType:void 0,readOnly:N(e,"readOnly")?e.readOnly:void 0,values:N(e,"values")?e.values.map(Vy):void 0}}function qy(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Be(e.providerMetadata,ca),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:cl(e.basicAuth),oauth2ClientCredentials:ul(e.oauth2ClientCredentials),oauth2PasswordCredentials:ll(e.oauth2PasswordCredentials),oauth2AuthorizationCode:dl(e.oauth2AuthorizationCode)}}function By(e){return Jy(e)}function Jy(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,useModule:N(e,"useModule")?e.useModule:void 0}}function Hy(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Zo(e){return Wy(e)}function Wy(e,t){return e==null?e:{...Hy(e),...fl(e)}}function zy(e){return Qy(e)}function Qy(e,t){return e==null?e:{error:N(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:N(e,"requiredFields")?e.requiredFields.map(Zo):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(Zo):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?pl(e.optionalFieldsAuto):void 0,allFieldsMetadata:N(e,"allFieldsMetadata")?Be(e.allFieldsMetadata,Ky):void 0,allFields:N(e,"allFields")?e.allFields.map(Zo):void 0,backfill:N(e,"backfill")?tl(e.backfill):void 0}}function Gy(e){return Xy(e)}function Xy(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(zy):void 0}}function Yy(e){return Zy(e)}function Zy(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:N(e,"valueDefaults")?hl(e.valueDefaults):void 0}}function ev(e){return tv(e)}function tv(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Yy):void 0}}function nv(e){return rv(e)}function rv(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,module:N(e,"module")?e.module:void 0,provider:e.provider,read:N(e,"read")?Gy(e.read):void 0,write:N(e,"write")?ev(e.write):void 0,proxy:N(e,"proxy")?By(e.proxy):void 0}}function iv(e){return ov(e)}function ov(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:nv(e.content)}}function hi(e){return sv(e)}function sv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:N(e,"group")?al(e.group):void 0,healthStatus:e.healthStatus,connection:vi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,config:mg(e.config)}}function av(e){return cv(e)}function cv(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:xy(e.content)}}function es(e){return uv(e)}function uv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:av(e.latestRevision)}}function lv(e){return dv(e)}function dv(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function fv(e){return pv(e)}function pv(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function hv(e){return mv(e)}function mv(e,t){return e==null?e:{regular:N(e,"regular")?fv(e.regular):void 0,darkMode:N(e,"darkMode")?lv(e.darkMode):void 0}}function gv(e){return yv(e)}function yv(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,defaultValue:N(e,"defaultValue")?e.defaultValue:void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function vv(e){return wv(e)}function wv(e,t){return e==null?e:{name:e.name,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function bv(e){return Iv(e)}function Iv(e,t){return e==null?e:{create:N(e,"create")?e.create:void 0,update:N(e,"update")?e.update:void 0,_delete:N(e,"delete")?e.delete:void 0,passThrough:N(e,"passThrough")?e.passThrough:void 0}}function ml(e){return Cv(e)}function Cv(e,t){return e==null?e:{bulkWrite:Hm(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:N(e,"subscribeSupport")?bv(e.subscribeSupport):void 0}}function xv(e){return Ov(e)}function Ov(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:ml(e.support)}}function _v(e){return Sv(e)}function Sv(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:N(e,"capture")?e.capture:void 0}}function Ev(e){return Nv(e)}function Nv(e,t){return e==null?e:{workspaceRefField:N(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:N(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:N(e,"scopesField")?e.scopesField:void 0,otherFields:N(e,"otherFields")?e.otherFields.map(_v):void 0}}const ts={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function Tv(e){return Rv(e)}function Rv(e,t){return e==null?e:{grantType:e.grantType,authURL:N(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:N(e,"audience")?e.audience:void 0,tokenMetadataFields:Ev(e.tokenMetadataFields),docsURL:N(e,"docsURL")?e.docsURL:void 0,authURLParams:N(e,"authURLParams")?e.authURLParams:void 0}}function Av(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:Be(e.providerMetadata,ca),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function Fv(e){return Pv(e)}function Pv(e,t){return e==null?e:{input:N(e,"input")?e.input.map(gv):void 0,postAuthentication:N(e,"postAuthentication")?e.postAuthentication.map(vv):void 0}}function Dv(e){return Mv(e)}function Mv(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Nc(e){return kv(e)}function kv(e,t){return e==null?e:{name:e.name,authType:$h(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:N(e,"oauth2Opts")?Tv(e.oauth2Opts):void 0,apiKeyOpts:N(e,"apiKeyOpts")?Ph(e.apiKeyOpts):void 0,basicOpts:N(e,"basicOpts")?Lm(e.basicOpts):void 0,customOpts:N(e,"customOpts")?jy(e.customOpts):void 0,support:ml(e.support),providerOpts:e.providerOpts,authHealthCheck:N(e,"authHealthCheck")?Lh(e.authHealthCheck):void 0,displayName:N(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:N(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:N(e,"media")?hv(e.media):void 0,labels:N(e,"labels")?e.labels:void 0,subscribeOpts:N(e,"subscribeOpts")?Dv(e.subscribeOpts):void 0,modules:N(e,"modules")?Be(e.modules,xv):void 0,metadata:N(e,"metadata")?Fv(e.metadata):void 0}}function jv(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:Fg(e.connection)}}function Lv(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:cm(e.read),write:Nm(e.write),proxy:rl(e.proxy)}}function Vv(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Lv(e.content)}}function $v(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Vv(e.config)}}function Kv(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:$v(e.installation)}}function Uv(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function qv(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Uv(e.project)}}function Bv(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 Jv(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Bv(e.providerApp)}}class Hv extends rn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("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 Hr(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},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:qy(t.generateConnectionParams)},n);return new Me(i,s=>vi(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};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 Me(i,s=>vi(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const 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 Me(i,s=>s.map(vi))}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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ie("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:jv(t.updateConnectionRequest)},n);return new Me(i,s=>vi(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Wv extends rn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},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:jg(t.installation)},n);return new Me(i,s=>hi(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},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 Hr(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},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 Me(i,s=>hi(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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const 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 Me(i,s=>s.map(hi))}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 ie("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 Me(i,s=>s.map(hi))}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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ie("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},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:Kv(t.installationUpdate)},n);return new Me(i,s=>hi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class zv extends rn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ie("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={};t.destructive!==void 0&&(r.destructive=t.destructive);const 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:$m(t.batchUpsertIntegrationsRequest)},n);return new Me(i,s=>s.map(es))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ie("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},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:Ey(t.integration)},n);return new Hr(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},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 Hr(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new ie("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("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 Me(i,s=>es(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 ie("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 Me(i,s=>s.map(es))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Qv extends rn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},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:Av(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Me(i):new Oc(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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("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 Me(i):new Oc(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Gv extends rn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},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:Ny(t.project)},n);return new Me(i,s=>Zi(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("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 Me(i,s=>Zi(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const 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 Me(o,i=>i.map(Zi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ie("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},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:qv(t.projectUpdate)},n);return new Me(i,s=>Zi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Xv extends rn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},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 Me(i,s=>Nc(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 Me(o,i=>Be(i,Nc))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Yv extends rn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},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:Ty(t.providerApp)},n);return new Me(i,s=>co(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},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 Hr(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},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 Me(i,s=>s.map(co))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ie("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},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:Jv(t.providerAppUpdate)},n);return new Me(i,s=>co(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Zv extends rn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ie("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={};t.destructive!==void 0&&(r.destructive=t.destructive);const 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:Ry(t.revision)},n);return new Hr(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ie("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const 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 Me(i,s=>iv(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var gl=Symbol.for("immer-nothing"),Tc=Symbol.for("immer-draftable"),At=Symbol.for("immer-state"),ew=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 xt(e,...t){if(process.env.NODE_ENV!=="production"){const n=ew[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 Wr=Object.getPrototypeOf;function zr(e){return!!e&&!!e[At]}function Or(e){var t;return e?yl(e)||Array.isArray(e)||!!e[Tc]||!!((t=e.constructor)!=null&&t[Tc])||Di(e)||Po(e):!1}var tw=Object.prototype.constructor.toString();function yl(e){if(!e||typeof e!="object")return!1;const t=Wr(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)===tw}function go(e,t){Fo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Fo(e){const t=e[At];return t?t.type_:Array.isArray(e)?1:Di(e)?2:Po(e)?3:0}function ks(e,t){return Fo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function vl(e,t,n){const r=Fo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function nw(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Di(e){return e instanceof Map}function Po(e){return e instanceof Set}function cr(e){return e.copy_||e.base_}function js(e,t){if(Di(e))return new Map(e);if(Po(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=yl(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[At];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(Wr(e),r)}else{const r=Wr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function ua(e,t=!1){return Do(e)||zr(e)||!Or(e)||(Fo(e)>1&&Object.defineProperties(e,{set:{value:eo},add:{value:eo},clear:{value:eo},delete:{value:eo}}),Object.freeze(e),t&&Object.values(e).forEach(n=>ua(n,!0))),e}function eo(){xt(2)}function Do(e){return Object.isFrozen(e)}var rw={};function _r(e){const t=rw[e];return t||xt(0,e),t}var xi;function wl(){return xi}function iw(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Rc(e,t){t&&(_r("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ls(e){Vs(e),e.drafts_.forEach(ow),e.drafts_=null}function Vs(e){e===xi&&(xi=e.parent_)}function Ac(e){return xi=iw(xi,e)}function ow(e){const t=e[At];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Fc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[At].modified_&&(Ls(t),xt(4)),Or(e)&&(e=yo(t,e),t.parent_||vo(t,e)),t.patches_&&_r("Patches").generateReplacementPatches_(n[At].base_,e,t.patches_,t.inversePatches_)):e=yo(t,n,[]),Ls(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==gl?e:void 0}function yo(e,t,n){if(Do(t))return t;const r=t[At];if(!r)return go(t,(o,i)=>Pc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return vo(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),go(i,(a,u)=>Pc(e,r,o,a,u,n,s)),vo(e,o,!1),n&&e.patches_&&_r("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Pc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&xt(5),zr(o)){const a=i&&t&&t.type_!==3&&!ks(t.assigned_,r)?i.concat(r):void 0,u=yo(e,o,a);if(vl(n,r,u),zr(u))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(Or(o)&&!Do(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;yo(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Di(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&vo(e,o)}}function vo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ua(t,n)}function sw(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:wl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=la;n&&(o=[r],i=Oi);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var la={get(e,t){if(t===At)return e;const n=cr(e);if(!ks(n,t))return aw(e,n,t);const r=n[t];return e.finalized_||!Or(r)?r:r===ns(e.base_,t)?(rs(e),e.copy_[t]=Ks(r,e)):r},has(e,t){return t in cr(e)},ownKeys(e){return Reflect.ownKeys(cr(e))},set(e,t,n){const r=bl(cr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=ns(cr(e),t),i=o==null?void 0:o[At];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(nw(n,o)&&(n!==void 0||ks(e.base_,t)))return!0;rs(e),$s(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 ns(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,rs(e),$s(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=cr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){xt(11)},getPrototypeOf(e){return Wr(e.base_)},setPrototypeOf(){xt(12)}},Oi={};go(la,(e,t)=>{Oi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Oi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&xt(13),Oi.set.call(this,e,t,void 0)};Oi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&xt(14),la.set.call(this,e[0],t,n,e[0])};function ns(e,t){const n=e[At];return(n?cr(n):e)[t]}function aw(e,t,n){var o;const r=bl(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function bl(e,t){if(!(t in e))return;let n=Wr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Wr(n)}}function $s(e){e.modified_||(e.modified_=!0,e.parent_&&$s(e.parent_))}function rs(e){e.copy_||(e.copy_=js(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var cw=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(u=i,...f){return s.produce(u,l=>n.call(this,l,...f))}}typeof n!="function"&&xt(6),r!==void 0&&typeof r!="function"&&xt(7);let o;if(Or(t)){const i=Ac(this),s=Ks(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Ls(i):Vs(i)}return Rc(i,r),Fc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===gl&&(o=void 0),this.autoFreeze_&&ua(o,!0),r){const i=[],s=[];_r("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else xt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,u=>t(u,...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){Or(e)||xt(8),zr(e)&&(e=uw(e));const t=Ac(this),n=Ks(e,void 0);return n[At].isManual_=!0,Vs(t),n}finishDraft(e,t){const n=e&&e[At];(!n||!n.isManual_)&&xt(9);const{scope_:r}=n;return Rc(r,t),Fc(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=_r("Patches").applyPatches_;return zr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Ks(e,t){const n=Di(e)?_r("MapSet").proxyMap_(e,t):Po(e)?_r("MapSet").proxySet_(e,t):sw(e,t);return(t?t.scope_:wl()).drafts_.push(n),n}function uw(e){return zr(e)||xt(10,e),Il(e)}function Il(e){if(!Or(e)||Do(e))return e;const t=e[At];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=js(e,t.scope_.immer_.useStrictShallowCopy_)}else n=js(e,!0);return go(n,(r,o)=>{vl(n,r,Il(o))}),t&&(t.finalized_=!1),n}var lw=new cw,Et=lw.produce,Hn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wo={exports:{}};wo.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",u="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",d="[object Date]",h="[object Error]",m="[object Function]",y="[object GeneratorFunction]",w="[object Map]",g="[object Number]",O="[object Null]",p="[object Object]",v="[object Promise]",I="[object Proxy]",x="[object RegExp]",E="[object Set]",A="[object String]",S="[object Symbol]",F="[object Undefined]",R="[object WeakMap]",D="[object ArrayBuffer]",K="[object DataView]",j="[object Float32Array]",L="[object Float64Array]",se="[object Int8Array]",re="[object Int16Array]",ge="[object Int32Array]",de="[object Uint8Array]",be="[object Uint8ClampedArray]",P="[object Uint16Array]",$="[object Uint32Array]",H=/[\\^$.*+?()[\]{}|]/g,U=/^\[object .+?Constructor\]$/,q=/^(?:0|[1-9]\d*)$/,V={};V[j]=V[L]=V[se]=V[re]=V[ge]=V[de]=V[be]=V[P]=V[$]=!0,V[a]=V[u]=V[D]=V[l]=V[K]=V[d]=V[h]=V[m]=V[w]=V[g]=V[p]=V[x]=V[E]=V[A]=V[R]=!1;var G=typeof Hn=="object"&&Hn&&Hn.Object===Object&&Hn,Z=typeof self=="object"&&self&&self.Object===Object&&self,Y=G||Z||Function("return this")(),ee=t&&!t.nodeType&&t,ne=ee&&!0&&e&&!e.nodeType&&e,ce=ne&&ne.exports===ee,k=ce&&G.process,ve=function(){try{return k&&k.binding&&k.binding("util")}catch{}}(),z=ve&&ve.isTypedArray;function Xe(C,T){for(var M=-1,te=C==null?0:C.length,Pe=0,fe=[];++M<te;){var $e=C[M];T($e,M,C)&&(fe[Pe++]=$e)}return fe}function Ce(C,T){for(var M=-1,te=T.length,Pe=C.length;++M<te;)C[Pe+M]=T[M];return C}function ct(C,T){for(var M=-1,te=C==null?0:C.length;++M<te;)if(T(C[M],M,C))return!0;return!1}function qe(C,T){for(var M=-1,te=Array(C);++M<C;)te[M]=T(M);return te}function rt(C){return function(T){return C(T)}}function xe(C,T){return C.has(T)}function ze(C,T){return C==null?void 0:C[T]}function ft(C){var T=-1,M=Array(C.size);return C.forEach(function(te,Pe){M[++T]=[Pe,te]}),M}function yt(C,T){return function(M){return C(T(M))}}function vt(C){var T=-1,M=Array(C.size);return C.forEach(function(te){M[++T]=te}),M}var Ye=Array.prototype,Ze=Function.prototype,De=Object.prototype,J=Y["__core-js_shared__"],pe=Ze.toString,_e=De.hasOwnProperty,ln=function(){var C=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),dn=De.toString,fn=RegExp("^"+pe.call(_e).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),wt=ce?Y.Buffer:void 0,Fe=Y.Symbol,rr=Y.Uint8Array,En=De.propertyIsEnumerable,Nn=Ye.splice,_t=Fe?Fe.toStringTag:void 0,pn=Object.getOwnPropertySymbols,Tn=wt?wt.isBuffer:void 0,Rn=yt(Object.keys,Object),hn=Rr(Y,"DataView"),Xt=Rr(Y,"Map"),Le=Rr(Y,"Promise"),ut=Rr(Y,"Set"),ae=Rr(Y,"WeakMap"),he=Rr(Object,"create"),pt=or(hn),mn=or(Xt),X=or(Le),ue=or(ut),le=or(ae),Ve=Fe?Fe.prototype:void 0,Je=Ve?Ve.valueOf:void 0;function et(C){var T=-1,M=C==null?0:C.length;for(this.clear();++T<M;){var te=C[T];this.set(te[0],te[1])}}function Pt(){this.__data__=he?he(null):{},this.size=0}function it(C){var T=this.has(C)&&delete this.__data__[C];return this.size-=T?1:0,T}function bt(C){var T=this.__data__;if(he){var M=T[C];return M===r?void 0:M}return _e.call(T,C)?T[C]:void 0}function Ae(C){var T=this.__data__;return he?T[C]!==void 0:_e.call(T,C)}function An(C,T){var M=this.__data__;return this.size+=this.has(C)?0:1,M[C]=he&&T===void 0?r:T,this}et.prototype.clear=Pt,et.prototype.delete=it,et.prototype.get=bt,et.prototype.has=Ae,et.prototype.set=An;function $t(C){var T=-1,M=C==null?0:C.length;for(this.clear();++T<M;){var te=C[T];this.set(te[0],te[1])}}function Qo(){this.__data__=[],this.size=0}function Ui(C){var T=this.__data__,M=Hi(T,C);if(M<0)return!1;var te=T.length-1;return M==te?T.pop():Nn.call(T,M,1),--this.size,!0}function qi(C){var T=this.__data__,M=Hi(T,C);return M<0?void 0:T[M][1]}function Bi(C){return Hi(this.__data__,C)>-1}function Ji(C,T){var M=this.__data__,te=Hi(M,C);return te<0?(++this.size,M.push([C,T])):M[te][1]=T,this}$t.prototype.clear=Qo,$t.prototype.delete=Ui,$t.prototype.get=qi,$t.prototype.has=Bi,$t.prototype.set=Ji;function Yt(C){var T=-1,M=C==null?0:C.length;for(this.clear();++T<M;){var te=C[T];this.set(te[0],te[1])}}function Oe(){this.size=0,this.__data__={hash:new et,map:new(Xt||$t),string:new et}}function Kt(C){var T=Wi(this,C).delete(C);return this.size-=T?1:0,T}function li(C){return Wi(this,C).get(C)}function ir(C){return Wi(this,C).has(C)}function Go(C,T){var M=Wi(this,C),te=M.size;return M.set(C,T),this.size+=M.size==te?0:1,this}Yt.prototype.clear=Oe,Yt.prototype.delete=Kt,Yt.prototype.get=li,Yt.prototype.has=ir,Yt.prototype.set=Go;function Fn(C){var T=-1,M=C==null?0:C.length;for(this.__data__=new Yt;++T<M;)this.add(C[T])}function Gf(C){return this.__data__.set(C,r),this}function Xf(C){return this.__data__.has(C)}Fn.prototype.add=Fn.prototype.push=Gf,Fn.prototype.has=Xf;function Pn(C){var T=this.__data__=new $t(C);this.size=T.size}function Yf(){this.__data__=new $t,this.size=0}function Zf(C){var T=this.__data__,M=T.delete(C);return this.size=T.size,M}function ep(C){return this.__data__.get(C)}function tp(C){return this.__data__.has(C)}function np(C,T){var M=this.__data__;if(M instanceof $t){var te=M.__data__;if(!Xt||te.length<n-1)return te.push([C,T]),this.size=++M.size,this;M=this.__data__=new Yt(te)}return M.set(C,T),this.size=M.size,this}Pn.prototype.clear=Yf,Pn.prototype.delete=Zf,Pn.prototype.get=ep,Pn.prototype.has=tp,Pn.prototype.set=np;function rp(C,T){var M=zi(C),te=!M&&vp(C),Pe=!M&&!te&&Xo(C),fe=!M&&!te&&!Pe&&uc(C),$e=M||te||Pe||fe,tt=$e?qe(C.length,String):[],ot=tt.length;for(var ke in C)_e.call(C,ke)&&!($e&&(ke=="length"||Pe&&(ke=="offset"||ke=="parent")||fe&&(ke=="buffer"||ke=="byteLength"||ke=="byteOffset")||pp(ke,ot)))&&tt.push(ke);return tt}function Hi(C,T){for(var M=C.length;M--;)if(oc(C[M][0],T))return M;return-1}function ip(C,T,M){var te=T(C);return zi(C)?te:Ce(te,M(C))}function di(C){return C==null?C===void 0?F:O:_t&&_t in Object(C)?dp(C):yp(C)}function tc(C){return fi(C)&&di(C)==a}function nc(C,T,M,te,Pe){return C===T?!0:C==null||T==null||!fi(C)&&!fi(T)?C!==C&&T!==T:op(C,T,M,te,nc,Pe)}function op(C,T,M,te,Pe,fe){var $e=zi(C),tt=zi(T),ot=$e?u:Dn(C),ke=tt?u:Dn(T);ot=ot==a?p:ot,ke=ke==a?p:ke;var St=ot==p,Ut=ke==p,lt=ot==ke;if(lt&&Xo(C)){if(!Xo(T))return!1;$e=!0,St=!1}if(lt&&!St)return fe||(fe=new Pn),$e||uc(C)?rc(C,T,M,te,Pe,fe):up(C,T,ot,M,te,Pe,fe);if(!(M&o)){var Dt=St&&_e.call(C,"__wrapped__"),Mt=Ut&&_e.call(T,"__wrapped__");if(Dt||Mt){var Mn=Dt?C.value():C,gn=Mt?T.value():T;return fe||(fe=new Pn),Pe(Mn,gn,M,te,fe)}}return lt?(fe||(fe=new Pn),lp(C,T,M,te,Pe,fe)):!1}function sp(C){if(!cc(C)||mp(C))return!1;var T=sc(C)?fn:U;return T.test(or(C))}function ap(C){return fi(C)&&ac(C.length)&&!!V[di(C)]}function cp(C){if(!gp(C))return Rn(C);var T=[];for(var M in Object(C))_e.call(C,M)&&M!="constructor"&&T.push(M);return T}function rc(C,T,M,te,Pe,fe){var $e=M&o,tt=C.length,ot=T.length;if(tt!=ot&&!($e&&ot>tt))return!1;var ke=fe.get(C);if(ke&&fe.get(T))return ke==T;var St=-1,Ut=!0,lt=M&i?new Fn:void 0;for(fe.set(C,T),fe.set(T,C);++St<tt;){var Dt=C[St],Mt=T[St];if(te)var Mn=$e?te(Mt,Dt,St,T,C,fe):te(Dt,Mt,St,C,T,fe);if(Mn!==void 0){if(Mn)continue;Ut=!1;break}if(lt){if(!ct(T,function(gn,sr){if(!xe(lt,sr)&&(Dt===gn||Pe(Dt,gn,M,te,fe)))return lt.push(sr)})){Ut=!1;break}}else if(!(Dt===Mt||Pe(Dt,Mt,M,te,fe))){Ut=!1;break}}return fe.delete(C),fe.delete(T),Ut}function up(C,T,M,te,Pe,fe,$e){switch(M){case K:if(C.byteLength!=T.byteLength||C.byteOffset!=T.byteOffset)return!1;C=C.buffer,T=T.buffer;case D:return!(C.byteLength!=T.byteLength||!fe(new rr(C),new rr(T)));case l:case d:case g:return oc(+C,+T);case h:return C.name==T.name&&C.message==T.message;case x:case A:return C==T+"";case w:var tt=ft;case E:var ot=te&o;if(tt||(tt=vt),C.size!=T.size&&!ot)return!1;var ke=$e.get(C);if(ke)return ke==T;te|=i,$e.set(C,T);var St=rc(tt(C),tt(T),te,Pe,fe,$e);return $e.delete(C),St;case S:if(Je)return Je.call(C)==Je.call(T)}return!1}function lp(C,T,M,te,Pe,fe){var $e=M&o,tt=ic(C),ot=tt.length,ke=ic(T),St=ke.length;if(ot!=St&&!$e)return!1;for(var Ut=ot;Ut--;){var lt=tt[Ut];if(!($e?lt in T:_e.call(T,lt)))return!1}var Dt=fe.get(C);if(Dt&&fe.get(T))return Dt==T;var Mt=!0;fe.set(C,T),fe.set(T,C);for(var Mn=$e;++Ut<ot;){lt=tt[Ut];var gn=C[lt],sr=T[lt];if(te)var lc=$e?te(sr,gn,lt,T,C,fe):te(gn,sr,lt,C,T,fe);if(!(lc===void 0?gn===sr||Pe(gn,sr,M,te,fe):lc)){Mt=!1;break}Mn||(Mn=lt=="constructor")}if(Mt&&!Mn){var Qi=C.constructor,Gi=T.constructor;Qi!=Gi&&"constructor"in C&&"constructor"in T&&!(typeof Qi=="function"&&Qi instanceof Qi&&typeof Gi=="function"&&Gi instanceof Gi)&&(Mt=!1)}return fe.delete(C),fe.delete(T),Mt}function ic(C){return ip(C,Ip,fp)}function Wi(C,T){var M=C.__data__;return hp(T)?M[typeof T=="string"?"string":"hash"]:M.map}function Rr(C,T){var M=ze(C,T);return sp(M)?M:void 0}function dp(C){var T=_e.call(C,_t),M=C[_t];try{C[_t]=void 0;var te=!0}catch{}var Pe=dn.call(C);return te&&(T?C[_t]=M:delete C[_t]),Pe}var fp=pn?function(C){return C==null?[]:(C=Object(C),Xe(pn(C),function(T){return En.call(C,T)}))}:Cp,Dn=di;(hn&&Dn(new hn(new ArrayBuffer(1)))!=K||Xt&&Dn(new Xt)!=w||Le&&Dn(Le.resolve())!=v||ut&&Dn(new ut)!=E||ae&&Dn(new ae)!=R)&&(Dn=function(C){var T=di(C),M=T==p?C.constructor:void 0,te=M?or(M):"";if(te)switch(te){case pt:return K;case mn:return w;case X:return v;case ue:return E;case le:return R}return T});function pp(C,T){return T=T??s,!!T&&(typeof C=="number"||q.test(C))&&C>-1&&C%1==0&&C<T}function hp(C){var T=typeof C;return T=="string"||T=="number"||T=="symbol"||T=="boolean"?C!=="__proto__":C===null}function mp(C){return!!ln&&ln in C}function gp(C){var T=C&&C.constructor,M=typeof T=="function"&&T.prototype||De;return C===M}function yp(C){return dn.call(C)}function or(C){if(C!=null){try{return pe.call(C)}catch{}try{return C+""}catch{}}return""}function oc(C,T){return C===T||C!==C&&T!==T}var vp=tc(function(){return arguments}())?tc:function(C){return fi(C)&&_e.call(C,"callee")&&!En.call(C,"callee")},zi=Array.isArray;function wp(C){return C!=null&&ac(C.length)&&!sc(C)}var Xo=Tn||xp;function bp(C,T){return nc(C,T)}function sc(C){if(!cc(C))return!1;var T=di(C);return T==m||T==y||T==f||T==I}function ac(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=s}function cc(C){var T=typeof C;return C!=null&&(T=="object"||T=="function")}function fi(C){return C!=null&&typeof C=="object"}var uc=z?rt(z):ap;function Ip(C){return wp(C)?rp(C):cp(C)}function Cp(){return[]}function xp(){return!1}e.exports=bp})(wo,wo.exports);var dw=wo.exports;const Cl=Mo(dw),He=async(e,t)=>{var n;if(e instanceof Yu){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 Op=Object.defineProperty;var fc=e=>{throw TypeError(e)};var _p=(e,t,n)=>t in e?Op(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pi=(e,t,n)=>_p(e,typeof t!="symbol"?t+"":t,n),es=(e,t,n)=>t.has(e)||fc("Cannot "+n);var _=(e,t,n)=>(es(e,t,"read from private field"),n?n.call(e):t.get(e)),oe=(e,t,n)=>t.has(e)?fc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Q=(e,t,n,r)=>(es(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),me=(e,t,n)=>(es(e,t,"access private method"),n);var Xi=(e,t,n,r)=>({set _(i){Q(e,t,i,n)},get _(){return _(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),I=require("react");require("react-dom");function Sp(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 B=Sp(I);var ii=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(){}},Ep={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Yt,lr,Su,Np=(Su=class{constructor(){oe(this,Yt,Ep);oe(this,lr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&_(this,lr)&&e!==_(this,Yt)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:_(this,Yt),provider:e}),Q(this,Yt,e),process.env.NODE_ENV!=="production"&&Q(this,lr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Q(this,lr,!0),_(this,Yt).setTimeout(e,t)}clearTimeout(e){_(this,Yt).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Q(this,lr,!0),_(this,Yt).setInterval(e,t)}clearInterval(e){_(this,Yt).clearInterval(e)}},Yt=new WeakMap,lr=new WeakMap,Su),cr=new Np;function Tp(e){setTimeout(e,0)}var Ir=typeof window>"u"||"Deno"in globalThis;function gt(){}function Rp(e,t){return typeof e=="function"?e(t):e}function Is(e){return typeof e=="number"&&e>=0&&e!==1/0}function ju(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Wn(e,t){return typeof e=="function"?e(t):e}function Lt(e,t){return typeof e=="function"?e(t):e}function pc(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==ia(s,t.options))return!1}else if(!Ci(t.queryKey,s))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||o&&!o(t))}function hc(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Cr(t.options.mutationKey)!==Cr(o))return!1}else if(!Ci(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ia(e,t){return((t==null?void 0:t.queryKeyHashFn)||Cr)(e)}function Cr(e){return JSON.stringify(e,(t,n)=>xs(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Ci(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ci(e[n],t[n])):!1}var Ap=Object.prototype.hasOwnProperty;function Cs(e,t){if(e===t)return e;const n=mc(e)&&mc(t);if(!n&&!(xs(e)&&xs(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),s=o.length,a=n?new Array(s):{};let u=0;for(let f=0;f<s;f++){const l=n?f:o[f],d=e[l],h=t[l];if(d===h){a[l]=d,(n?f<i:Ap.call(e,l))&&u++;continue}if(d===null||h===null||typeof d!="object"||typeof h!="object"){a[l]=h;continue}const m=Cs(d,h);a[l]=m,m===d&&u++}return i===s&&u===i?e:a}function ho(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 mc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function xs(e){if(!gc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!gc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function gc(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fp(e){return new Promise(t=>{cr.setTimeout(t,e)})}function Os(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 Cs(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 Cs(e,t)}return t}function Pp(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Dp(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var mo=Symbol();function Lu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===mo&&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===mo?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Vu(e,t){return typeof e=="function"?e(...t):!!e}var dr,Ln,Dr,Eu,Mp=(Eu=class extends ii{constructor(){super();oe(this,dr);oe(this,Ln);oe(this,Dr);Q(this,Dr,t=>{if(!Ir&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,Ln)||this.setEventListener(_(this,Dr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Ln))==null||t.call(this),Q(this,Ln,void 0))}setEventListener(t){var n;Q(this,Dr,t),(n=_(this,Ln))==null||n.call(this),Q(this,Ln,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,dr)!==t&&(Q(this,dr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,dr)=="boolean"?_(this,dr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},dr=new WeakMap,Ln=new WeakMap,Dr=new WeakMap,Eu),oa=new Mp;function _s(){let e,t;const n=new Promise((i,o)=>{e=i,t=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var kp=Tp;function jp(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=kp;const o=a=>{t?e.push(a):i(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(u=>{n(u)})})})};return{batch:a=>{let u;t++;try{u=a()}finally{t--,t||s()}return u},batchCalls:a=>(...u)=>{o(()=>{a(...u)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Ge=jp(),Mr,Vn,kr,Nu,Lp=(Nu=class extends ii{constructor(){super();oe(this,Mr,!0);oe(this,Vn);oe(this,kr);Q(this,kr,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(){_(this,Vn)||this.setEventListener(_(this,kr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Vn))==null||t.call(this),Q(this,Vn,void 0))}setEventListener(t){var n;Q(this,kr,t),(n=_(this,Vn))==null||n.call(this),Q(this,Vn,t(this.setOnline.bind(this)))}setOnline(t){_(this,Mr)!==t&&(Q(this,Mr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,Mr)}},Mr=new WeakMap,Vn=new WeakMap,kr=new WeakMap,Nu),go=new Lp;function Vp(e){return Math.min(1e3*2**e,3e4)}function $u(e){return(e??"online")==="online"?go.isOnline():!0}var Ss=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ku(e){let t=!1,n=0,r;const i=_s(),o=()=>i.status!=="pending",s=w=>{var g;if(!o()){const O=new Ss(w);h(O),(g=e.onCancel)==null||g.call(e,O)}},a=()=>{t=!0},u=()=>{t=!1},f=()=>oa.isFocused()&&(e.networkMode==="always"||go.isOnline())&&e.canRun(),l=()=>$u(e.networkMode)&&e.canRun(),d=w=>{o()||(r==null||r(),i.resolve(w))},h=w=>{o()||(r==null||r(),i.reject(w))},m=()=>new Promise(w=>{var g;r=O=>{(o()||f())&&w(O)},(g=e.onPause)==null||g.call(e)}).then(()=>{var w;r=void 0,o()||(w=e.onContinue)==null||w.call(e)}),y=()=>{if(o())return;let w;const g=n===0?e.initialPromise:void 0;try{w=g??e.fn()}catch(O){w=Promise.reject(O)}Promise.resolve(w).then(d).catch(O=>{var S;if(o())return;const p=e.retry??(Ir?0:3),b=e.retryDelay??Vp,v=typeof b=="function"?b(n,O):b,x=p===!0||typeof p=="number"&&n<p||typeof p=="function"&&p(n,O);if(t||!x){h(O);return}n++,(S=e.onFail)==null||S.call(e,n,O),Fp(v).then(()=>f()?void 0:m()).then(()=>{t?h(O):y()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:u,canStart:l,start:()=>(l()?y():m().then(y),i)}}var fr,Tu,Uu=(Tu=class{constructor(){oe(this,fr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Is(this.gcTime)&&Q(this,fr,cr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ir?1/0:5*60*1e3))}clearGcTimeout(){_(this,fr)&&(cr.clearTimeout(_(this,fr)),Q(this,fr,void 0))}},fr=new WeakMap,Tu),pr,jr,jt,hr,nt,Ti,mr,Bt,yn,Ru,$p=(Ru=class extends Uu{constructor(t){super();oe(this,Bt);oe(this,pr);oe(this,jr);oe(this,jt);oe(this,hr);oe(this,nt);oe(this,Ti);oe(this,mr);Q(this,mr,!1),Q(this,Ti,t.defaultOptions),this.setOptions(t.options),this.observers=[],Q(this,hr,t.client),Q(this,jt,_(this,hr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Q(this,pr,yc(this.options)),this.state=t.state??_(this,pr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=_(this,nt))==null?void 0:t.promise}setOptions(t){if(this.options={..._(this,Ti),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=yc(this.options);n.data!==void 0&&(this.setData(n.data,{updatedAt:n.dataUpdatedAt,manual:!0}),Q(this,pr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,jt).remove(this)}setData(t,n){const r=Os(this.state.data,t,this.options);return me(this,Bt,yn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){me(this,Bt,yn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=_(this,nt))==null?void 0:r.promise;return(i=_(this,nt))==null||i.cancel(t),n?n.then(gt).catch(gt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,pr))}isActive(){return this.observers.some(t=>Lt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===mo||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:!ju(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,nt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,nt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(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||(_(this,nt)&&(_(this,mr)?_(this,nt).cancel({revert:!0}):_(this,nt).cancelRetry()),this.scheduleGc()),_(this,jt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||me(this,Bt,yn).call(this,{type:"invalidate"})}async fetch(t,n){var u,f,l,d,h,m,y,w,g,O,p,b;if(this.state.fetchStatus!=="idle"&&((u=_(this,nt))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,nt))return _(this,nt).continueRetry(),_(this,nt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const v=this.observers.find(x=>x.options.queryFn);v&&this.setOptions(v.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,i=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(Q(this,mr,!0),r.signal)})},o=()=>{const v=Lu(this.options,n),S=(()=>{const A={client:_(this,hr),queryKey:this.queryKey,meta:this.meta};return i(A),A})();return Q(this,mr,!1),this.options.persister?this.options.persister(v,S,this):v(S)},a=(()=>{const v={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:_(this,hr),state:this.state,fetchFn:o};return i(v),v})();(f=this.options.behavior)==null||f.onFetch(a,this),Q(this,jr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((l=a.fetchOptions)==null?void 0:l.meta))&&me(this,Bt,yn).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),Q(this,nt,Ku({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:v=>{v instanceof Ss&&v.revert&&this.setState({..._(this,jr),fetchStatus:"idle"}),r.abort()},onFail:(v,x)=>{me(this,Bt,yn).call(this,{type:"failed",failureCount:v,error:x})},onPause:()=>{me(this,Bt,yn).call(this,{type:"pause"})},onContinue:()=>{me(this,Bt,yn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const v=await _(this,nt).start();if(v===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(v),(m=(h=_(this,jt).config).onSuccess)==null||m.call(h,v,this),(w=(y=_(this,jt).config).onSettled)==null||w.call(y,v,this.state.error,this),v}catch(v){if(v instanceof Ss){if(v.silent)return _(this,nt).promise;if(v.revert){if(this.state.data===void 0)throw v;return this.state.data}}throw me(this,Bt,yn).call(this,{type:"error",error:v}),(O=(g=_(this,jt).config).onError)==null||O.call(g,v,this),(b=(p=_(this,jt).config).onSettled)==null||b.call(p,this.state.data,v,this),v}finally{this.scheduleGc()}}},pr=new WeakMap,jr=new WeakMap,jt=new WeakMap,hr=new WeakMap,nt=new WeakMap,Ti=new WeakMap,mr=new WeakMap,Bt=new WeakSet,yn=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,...qu(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...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 Q(this,jr,t.manual?i:void 0),i;case"error":const o=t.error;return{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Ge.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,jt).notify({query:this,type:"updated",action:t})})},Ru);function qu(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$u(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function yc(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 It,Ie,Ri,ht,gr,Lr,vn,$n,Ai,Vr,$r,yr,vr,Kn,Kr,Re,yi,Es,Ns,Ts,Rs,As,Fs,Ps,Bu,Au,Kp=(Au=class extends ii{constructor(t,n){super();oe(this,Re);oe(this,It);oe(this,Ie);oe(this,Ri);oe(this,ht);oe(this,gr);oe(this,Lr);oe(this,vn);oe(this,$n);oe(this,Ai);oe(this,Vr);oe(this,$r);oe(this,yr);oe(this,vr);oe(this,Kn);oe(this,Kr,new Set);this.options=n,Q(this,It,t),Q(this,$n,null),Q(this,vn,_s()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,Ie).addObserver(this),vc(_(this,Ie),this.options)?me(this,Re,yi).call(this):this.updateResult(),me(this,Re,Rs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ds(_(this,Ie),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ds(_(this,Ie),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,me(this,Re,As).call(this),me(this,Re,Fs).call(this),_(this,Ie).removeObserver(this)}setOptions(t){const n=this.options,r=_(this,Ie);if(this.options=_(this,It).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Lt(this.options.enabled,_(this,Ie))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");me(this,Re,Ps).call(this),_(this,Ie).setOptions(this.options),n._defaulted&&!ho(this.options,n)&&_(this,It).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,Ie),observer:this});const i=this.hasListeners();i&&wc(_(this,Ie),r,this.options,n)&&me(this,Re,yi).call(this),this.updateResult(),i&&(_(this,Ie)!==r||Lt(this.options.enabled,_(this,Ie))!==Lt(n.enabled,_(this,Ie))||Wn(this.options.staleTime,_(this,Ie))!==Wn(n.staleTime,_(this,Ie)))&&me(this,Re,Es).call(this);const o=me(this,Re,Ns).call(this);i&&(_(this,Ie)!==r||Lt(this.options.enabled,_(this,Ie))!==Lt(n.enabled,_(this,Ie))||o!==_(this,Kn))&&me(this,Re,Ts).call(this,o)}getOptimisticResult(t){const n=_(this,It).getQueryCache().build(_(this,It),t),r=this.createResult(n,t);return qp(this,r)&&(Q(this,ht,r),Q(this,Lr,this.options),Q(this,gr,_(this,Ie).state)),r}getCurrentResult(){return _(this,ht)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&_(this,vn).status==="pending"&&_(this,vn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){_(this,Kr).add(t)}getCurrentQuery(){return _(this,Ie)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=_(this,It).defaultQueryOptions(t),r=_(this,It).getQueryCache().build(_(this,It),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return me(this,Re,yi).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,ht)))}createResult(t,n){var F;const r=_(this,Ie),i=this.options,o=_(this,ht),s=_(this,gr),a=_(this,Lr),f=t!==r?t.state:_(this,Ri),{state:l}=t;let d={...l},h=!1,m;if(n._optimisticResults){const R=this.hasListeners(),D=!R&&vc(t,n),K=R&&wc(t,r,n,i);(D||K)&&(d={...d,...qu(l.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:y,errorUpdatedAt:w,status:g}=d;m=d.data;let O=!1;if(n.placeholderData!==void 0&&m===void 0&&g==="pending"){let R;o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(R=o.data,O=!0):R=typeof n.placeholderData=="function"?n.placeholderData((F=_(this,$r))==null?void 0:F.state.data,_(this,$r)):n.placeholderData,R!==void 0&&(g="success",m=Os(o==null?void 0:o.data,R,n),h=!0)}if(n.select&&m!==void 0&&!O)if(o&&m===(s==null?void 0:s.data)&&n.select===_(this,Ai))m=_(this,Vr);else try{Q(this,Ai,n.select),m=n.select(m),m=Os(o==null?void 0:o.data,m,n),Q(this,Vr,m),Q(this,$n,null)}catch(R){Q(this,$n,R)}_(this,$n)&&(y=_(this,$n),m=_(this,Vr),w=Date.now(),g="error");const p=d.fetchStatus==="fetching",b=g==="pending",v=g==="error",x=b&&p,S=m!==void 0,N={status:g,fetchStatus:d.fetchStatus,isPending:b,isSuccess:g==="success",isError:v,isInitialLoading:x,isLoading:x,data:m,dataUpdatedAt:d.dataUpdatedAt,error:y,errorUpdatedAt:w,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>f.dataUpdateCount||d.errorUpdateCount>f.errorUpdateCount,isFetching:p,isRefetching:p&&!b,isLoadingError:v&&!S,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:v&&S,isStale:sa(t,n),refetch:this.refetch,promise:_(this,vn),isEnabled:Lt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=j=>{N.status==="error"?j.reject(N.error):N.data!==void 0&&j.resolve(N.data)},D=()=>{const j=Q(this,vn,N.promise=_s());R(j)},K=_(this,vn);switch(K.status){case"pending":t.queryHash===r.queryHash&&R(K);break;case"fulfilled":(N.status==="error"||N.data!==K.value)&&D();break;case"rejected":(N.status!=="error"||N.error!==K.reason)&&D();break}}return N}updateResult(){const t=_(this,ht),n=this.createResult(_(this,Ie),this.options);if(Q(this,gr,_(this,Ie).state),Q(this,Lr,this.options),_(this,gr).data!==void 0&&Q(this,$r,_(this,Ie)),ho(n,t))return;Q(this,ht,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!_(this,Kr).size)return!0;const s=new Set(o??_(this,Kr));return this.options.throwOnError&&s.add("error"),Object.keys(_(this,ht)).some(a=>{const u=a;return _(this,ht)[u]!==t[u]&&s.has(u)})};me(this,Re,Bu).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&me(this,Re,Rs).call(this)}},It=new WeakMap,Ie=new WeakMap,Ri=new WeakMap,ht=new WeakMap,gr=new WeakMap,Lr=new WeakMap,vn=new WeakMap,$n=new WeakMap,Ai=new WeakMap,Vr=new WeakMap,$r=new WeakMap,yr=new WeakMap,vr=new WeakMap,Kn=new WeakMap,Kr=new WeakMap,Re=new WeakSet,yi=function(t){me(this,Re,Ps).call(this);let n=_(this,Ie).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(gt)),n},Es=function(){me(this,Re,As).call(this);const t=Wn(this.options.staleTime,_(this,Ie));if(Ir||_(this,ht).isStale||!Is(t))return;const r=ju(_(this,ht).dataUpdatedAt,t)+1;Q(this,yr,cr.setTimeout(()=>{_(this,ht).isStale||this.updateResult()},r))},Ns=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,Ie)):this.options.refetchInterval)??!1},Ts=function(t){me(this,Re,Fs).call(this),Q(this,Kn,t),!(Ir||Lt(this.options.enabled,_(this,Ie))===!1||!Is(_(this,Kn))||_(this,Kn)===0)&&Q(this,vr,cr.setInterval(()=>{(this.options.refetchIntervalInBackground||oa.isFocused())&&me(this,Re,yi).call(this)},_(this,Kn)))},Rs=function(){me(this,Re,Es).call(this),me(this,Re,Ts).call(this,me(this,Re,Ns).call(this))},As=function(){_(this,yr)&&(cr.clearTimeout(_(this,yr)),Q(this,yr,void 0))},Fs=function(){_(this,vr)&&(cr.clearInterval(_(this,vr)),Q(this,vr,void 0))},Ps=function(){const t=_(this,It).getQueryCache().build(_(this,It),this.options);if(t===_(this,Ie))return;const n=_(this,Ie);Q(this,Ie,t),Q(this,Ri,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Bu=function(t){Ge.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(_(this,ht))}),_(this,It).getQueryCache().notify({query:_(this,Ie),type:"observerResultsUpdated"})})},Au);function Up(e,t){return Lt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function vc(e,t){return Up(e,t)||e.state.data!==void 0&&Ds(e,t,t.refetchOnMount)}function Ds(e,t,n){if(Lt(t.enabled,e)!==!1&&Wn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&sa(e,t)}return!1}function wc(e,t,n,r){return(e!==t||Lt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&sa(e,n)}function sa(e,t){return Lt(t.enabled,e)!==!1&&e.isStaleByTime(Wn(t.staleTime,e))}function qp(e,t){return!ho(e.getCurrentResult(),t)}function bc(e){return{onFetch:(t,n)=>{var l,d,h,m,y;const r=t.options,i=(h=(d=(l=t.fetchOptions)==null?void 0:l.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,o=((m=t.state.data)==null?void 0:m.pages)||[],s=((y=t.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},u=0;const f=async()=>{let w=!1;const g=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},O=Lu(t.options,t.fetchOptions),p=async(b,v,x)=>{if(w)return Promise.reject();if(v==null&&b.pages.length)return Promise.resolve(b);const A=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:v,direction:x?"backward":"forward",meta:t.options.meta};return g(D),D})(),N=await O(A),{maxPages:F}=t.options,R=x?Dp:Pp;return{pages:R(b.pages,N,F),pageParams:R(b.pageParams,v,F)}};if(i&&o.length){const b=i==="backward",v=b?Bp:Ic,x={pages:o,pageParams:s},S=v(r,x);a=await p(x,S,b)}else{const b=e??o.length;do{const v=u===0?s[0]??r.initialPageParam:Ic(r,a);if(u>0&&v==null)break;a=await p(a,v),u++}while(u<b)}return a};t.options.persister?t.fetchFn=()=>{var w,g;return(g=(w=t.options).persister)==null?void 0:g.call(w,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 Bp(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 Fi,Zt,mt,wr,en,kn,Fu,Jp=(Fu=class extends Uu{constructor(t){super();oe(this,en);oe(this,Fi);oe(this,Zt);oe(this,mt);oe(this,wr);Q(this,Fi,t.client),this.mutationId=t.mutationId,Q(this,mt,t.mutationCache),Q(this,Zt,[]),this.state=t.state||Ju(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,Zt).includes(t)||(_(this,Zt).push(t),this.clearGcTimeout(),_(this,mt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Q(this,Zt,_(this,Zt).filter(n=>n!==t)),this.scheduleGc(),_(this,mt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,Zt).length||(this.state.status==="pending"?this.scheduleGc():_(this,mt).remove(this))}continue(){var t;return((t=_(this,wr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,a,u,f,l,d,h,m,y,w,g,O,p,b,v,x,S,A,N,F;const n=()=>{me(this,en,kn).call(this,{type:"continue"})},r={client:_(this,Fi),meta:this.options.meta,mutationKey:this.options.mutationKey};Q(this,wr,Ku({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,D)=>{me(this,en,kn).call(this,{type:"failed",failureCount:R,error:D})},onPause:()=>{me(this,en,kn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,mt).canRun(this)}));const i=this.state.status==="pending",o=!_(this,wr).canStart();try{if(i)n();else{me(this,en,kn).call(this,{type:"pending",variables:t,isPaused:o}),await((a=(s=_(this,mt).config).onMutate)==null?void 0:a.call(s,t,this,r));const D=await((f=(u=this.options).onMutate)==null?void 0:f.call(u,t,r));D!==this.state.context&&me(this,en,kn).call(this,{type:"pending",context:D,variables:t,isPaused:o})}const R=await _(this,wr).start();return await((d=(l=_(this,mt).config).onSuccess)==null?void 0:d.call(l,R,t,this.state.context,this,r)),await((m=(h=this.options).onSuccess)==null?void 0:m.call(h,R,t,this.state.context,r)),await((w=(y=_(this,mt).config).onSettled)==null?void 0:w.call(y,R,null,this.state.variables,this.state.context,this,r)),await((O=(g=this.options).onSettled)==null?void 0:O.call(g,R,null,t,this.state.context,r)),me(this,en,kn).call(this,{type:"success",data:R}),R}catch(R){try{throw await((b=(p=_(this,mt).config).onError)==null?void 0:b.call(p,R,t,this.state.context,this,r)),await((x=(v=this.options).onError)==null?void 0:x.call(v,R,t,this.state.context,r)),await((A=(S=_(this,mt).config).onSettled)==null?void 0:A.call(S,void 0,R,this.state.variables,this.state.context,this,r)),await((F=(N=this.options).onSettled)==null?void 0:F.call(N,void 0,R,t,this.state.context,r)),R}finally{me(this,en,kn).call(this,{type:"error",error:R})}}finally{_(this,mt).runNext(this)}}},Fi=new WeakMap,Zt=new WeakMap,mt=new WeakMap,wr=new WeakMap,en=new WeakSet,kn=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),Ge.batch(()=>{_(this,Zt).forEach(r=>{r.onMutationUpdate(t)}),_(this,mt).notify({mutation:this,type:"updated",action:t})})},Fu);function Ju(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wn,Jt,Pi,Pu,Hp=(Pu=class extends ii{constructor(t={}){super();oe(this,wn);oe(this,Jt);oe(this,Pi);this.config=t,Q(this,wn,new Set),Q(this,Jt,new Map),Q(this,Pi,0)}build(t,n,r){const i=new Jp({client:t,mutationCache:this,mutationId:++Xi(this,Pi)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){_(this,wn).add(t);const n=Yi(t);if(typeof n=="string"){const r=_(this,Jt).get(n);r?r.push(t):_(this,Jt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(_(this,wn).delete(t)){const n=Yi(t);if(typeof n=="string"){const r=_(this,Jt).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&_(this,Jt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Yi(t);if(typeof n=="string"){const r=_(this,Jt).get(n),i=r==null?void 0:r.find(o=>o.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=Yi(t);if(typeof n=="string"){const i=(r=_(this,Jt).get(n))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ge.batch(()=>{_(this,wn).forEach(t=>{this.notify({type:"removed",mutation:t})}),_(this,wn).clear(),_(this,Jt).clear()})}getAll(){return Array.from(_(this,wn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>hc(n,r))}findAll(t={}){return this.getAll().filter(n=>hc(t,n))}notify(t){Ge.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ge.batch(()=>Promise.all(t.map(n=>n.continue().catch(gt))))}},wn=new WeakMap,Jt=new WeakMap,Pi=new WeakMap,Pu);function Yi(e){var t;return(t=e.options.scope)==null?void 0:t.id}var bn,Un,Ct,In,xn,ao,Ms,Du,Wp=(Du=class extends ii{constructor(n,r){super();oe(this,xn);oe(this,bn);oe(this,Un);oe(this,Ct);oe(this,In);Q(this,bn,n),this.setOptions(r),this.bindMethods(),me(this,xn,ao).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=_(this,bn).defaultMutationOptions(n),ho(this.options,r)||_(this,bn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,Ct),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Cr(r.mutationKey)!==Cr(this.options.mutationKey)?this.reset():((i=_(this,Ct))==null?void 0:i.state.status)==="pending"&&_(this,Ct).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=_(this,Ct))==null||n.removeObserver(this)}onMutationUpdate(n){me(this,xn,ao).call(this),me(this,xn,Ms).call(this,n)}getCurrentResult(){return _(this,Un)}reset(){var n;(n=_(this,Ct))==null||n.removeObserver(this),Q(this,Ct,void 0),me(this,xn,ao).call(this),me(this,xn,Ms).call(this)}mutate(n,r){var i;return Q(this,In,r),(i=_(this,Ct))==null||i.removeObserver(this),Q(this,Ct,_(this,bn).getMutationCache().build(_(this,bn),this.options)),_(this,Ct).addObserver(this),_(this,Ct).execute(n)}},bn=new WeakMap,Un=new WeakMap,Ct=new WeakMap,In=new WeakMap,xn=new WeakSet,ao=function(){var r;const n=((r=_(this,Ct))==null?void 0:r.state)??Ju();Q(this,Un,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Ms=function(n){Ge.batch(()=>{var r,i,o,s,a,u,f,l;if(_(this,In)&&this.hasListeners()){const d=_(this,Un).variables,h=_(this,Un).context,m={client:_(this,bn),meta:this.options.meta,mutationKey:this.options.mutationKey};(n==null?void 0:n.type)==="success"?((i=(r=_(this,In)).onSuccess)==null||i.call(r,n.data,d,h,m),(s=(o=_(this,In)).onSettled)==null||s.call(o,n.data,null,d,h,m)):(n==null?void 0:n.type)==="error"&&((u=(a=_(this,In)).onError)==null||u.call(a,n.error,d,h,m),(l=(f=_(this,In)).onSettled)==null||l.call(f,void 0,n.error,d,h,m))}this.listeners.forEach(d=>{d(_(this,Un))})})},Du),tn,Mu,zp=(Mu=class extends ii{constructor(t={}){super();oe(this,tn);this.config=t,Q(this,tn,new Map)}build(t,n,r){const i=n.queryKey,o=n.queryHash??ia(i,n);let s=this.get(o);return s||(s=new $p({client:t,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){_(this,tn).has(t.queryHash)||(_(this,tn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,tn).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,tn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ge.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,tn).get(t)}getAll(){return[..._(this,tn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>pc(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>pc(t,r)):n}notify(t){Ge.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ge.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ge.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},tn=new WeakMap,Mu),$e,qn,Bn,Ur,qr,Jn,Br,Jr,ku,Qp=(ku=class{constructor(e={}){oe(this,$e);oe(this,qn);oe(this,Bn);oe(this,Ur);oe(this,qr);oe(this,Jn);oe(this,Br);oe(this,Jr);Q(this,$e,e.queryCache||new zp),Q(this,qn,e.mutationCache||new Hp),Q(this,Bn,e.defaultOptions||{}),Q(this,Ur,new Map),Q(this,qr,new Map),Q(this,Jn,0)}mount(){Xi(this,Jn)._++,_(this,Jn)===1&&(Q(this,Br,oa.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,$e).onFocus())})),Q(this,Jr,go.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,$e).onOnline())})))}unmount(){var e,t;Xi(this,Jn)._--,_(this,Jn)===0&&((e=_(this,Br))==null||e.call(this),Q(this,Br,void 0),(t=_(this,Jr))==null||t.call(this),Q(this,Jr,void 0))}isFetching(e){return _(this,$e).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,qn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,$e).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=_(this,$e).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Wn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return _(this,$e).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=_(this,$e).get(r.queryHash),o=i==null?void 0:i.state.data,s=Rp(t,o);if(s!==void 0)return _(this,$e).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Ge.batch(()=>_(this,$e).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,$e).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,$e);Ge.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(this,$e);return Ge.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ge.batch(()=>_(this,$e).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(gt).catch(gt)}invalidateQueries(e,t={}){return Ge.batch(()=>(_(this,$e).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=Ge.batch(()=>_(this,$e).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(gt)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(gt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(this,$e).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(gt).catch(gt)}fetchInfiniteQuery(e){return e.behavior=bc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(gt).catch(gt)}ensureInfiniteQueryData(e){return e.behavior=bc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return go.isOnline()?_(this,qn).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,$e)}getMutationCache(){return _(this,qn)}getDefaultOptions(){return _(this,Bn)}setDefaultOptions(e){Q(this,Bn,e)}setQueryDefaults(e,t){_(this,Ur).set(Cr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,Ur).values()],n={};return t.forEach(r=>{Ci(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){_(this,qr).set(Cr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,qr).values()],n={};return t.forEach(r=>{Ci(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,Bn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ia(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===mo&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Bn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,$e).clear(),_(this,qn).clear()}},$e=new WeakMap,qn=new WeakMap,Bn=new WeakMap,Ur=new WeakMap,qr=new WeakMap,Jn=new WeakMap,Br=new WeakMap,Jr=new WeakMap,ku),Hu=B.createContext(void 0),We=e=>{const t=B.useContext(Hu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Gp=({client:e,children:t})=>(B.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(Hu.Provider,{value:e,children:t})),Wu=B.createContext(!1),Xp=()=>B.useContext(Wu);Wu.Provider;function Yp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Zp=B.createContext(Yp()),eh=()=>B.useContext(Zp),th=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},nh=e=>{B.useEffect(()=>{e.clearReset()},[e])},rh=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Vu(n,[e.error,r])),ih=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},oh=(e,t)=>e.isLoading&&e.isFetching&&!t,sh=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Cc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ah(e,t,n){var d,h,m,y,w;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=Xp(),i=eh(),o=We(),s=o.defaultQueryOptions(e);(h=(d=o.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||h.call(d,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",ih(s),th(s,i),nh(i);const a=!o.getQueryCache().get(s.queryHash),[u]=B.useState(()=>new t(o,s)),f=u.getOptimisticResult(s),l=!r&&e.subscribed!==!1;if(B.useSyncExternalStore(B.useCallback(g=>{const O=l?u.subscribe(Ge.batchCalls(g)):gt;return u.updateResult(),O},[u,l]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),B.useEffect(()=>{u.setOptions(s)},[s,u]),sh(s,f))throw Cc(s,u,i);if(rh({result:f,errorResetBoundary:i,throwOnError:s.throwOnError,query:o.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((y=(m=o.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||y.call(m,s,f),s.experimental_prefetchInRender&&!Ir&&oh(f,r)){const g=a?Cc(s,u,i):(w=o.getQueryCache().get(s.queryHash))==null?void 0:w.promise;g==null||g.catch(gt).finally(()=>{u.updateResult()})}return s.notifyOnChangeProps?f:u.trackResult(f)}function Er(e,t){return ah(e,Kp)}function On(e,t){const n=We(),[r]=B.useState(()=>new Wp(n,e));B.useEffect(()=>{r.setOptions(e)},[r,e]);const i=B.useSyncExternalStore(B.useCallback(s=>r.subscribe(Ge.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=B.useCallback((s,a)=>{r.mutate(s,a).catch(gt)},[r]);if(i.error&&Vu(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}const zu=I.createContext(null),ch=zu.Provider,Qu=()=>I.useContext(zu);var we=(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))(we||{});const Gu=I.createContext(void 0);function sn(){const e=I.useContext(Gu);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const uh=(()=>{const e={};return Object.values(we).forEach(t=>{e[t]={}}),e})();function lh({children:e}){const[t,n]=I.useState(uh),r=I.useCallback((l,d,h=!0)=>{n(m=>{const y={...m};return y[l]=y[l]||{},y[l][d]=h,y})},[n]),i=I.useCallback((l,d)=>{var h;return!!((h=t[l])!=null&&h[d])},[t]),o=I.useCallback((l,d)=>{var h;return(h=t[l])==null?void 0:h[d]},[t]),s=I.useCallback((l,d)=>{n(h=>{var y;const m={...h};return(y=m[l])==null||delete y[d],m})},[n]),a=I.useCallback(l=>{n(d=>{const h={...d};return h[l]={},h})},[n]),u=I.useCallback((l,d)=>{n(h=>{const m={...h};return m[l]=m[l]||{},d.forEach(y=>{m[l][y]=!0}),m})},[n]),f=I.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:a,setErrors:u,getError:o}),[t,n,r,i,s,a,u,o]);return c.jsx(Gu.Provider,{value:f,children:e})}new TextEncoder;const ks=new TextDecoder;function dh(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 fh(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:ks.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=ks.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return dh(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class Xu extends Error{constructor(n,r){var i;super(n,r);pi(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(i=Error.captureStackTrace)==null||i.call(Error,this,this.constructor)}}pi(Xu,"code","ERR_JOSE_GENERIC");class jn extends Xu{constructor(){super(...arguments);pi(this,"code","ERR_JWT_INVALID")}}pi(jn,"code","ERR_JWT_INVALID");function ph(e){return typeof e=="object"&&e!==null}const hh=e=>{if(!ph(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t};function mh(e){if(typeof e!="string")throw new jn("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new jn("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new jn("Invalid JWT");if(!t)throw new jn("JWTs must contain a payload");let r;try{r=fh(t)}catch{throw new jn("Failed to base64url decode the payload")}let i;try{i=JSON.parse(ks.decode(r))}catch{throw new jn("Failed to parse the decoded payload as JSON")}if(!hh(i))throw new jn("Invalid JWT Claims Set");return i}const js="amp-labs_jwt_",gh=10*60*1e3,xc=(e,t)=>`${e}:${t}`,Oc=e=>`${js}${e}`,Yu=I.createContext(null),yh=e=>{try{const t=mh(e);return t.exp&&typeof t.exp=="number"?t.exp*1e3:null}catch(t){return console.warn("Failed to decode JWT token:",t),null}};function vh({getTokenCallback:e,children:t}){const[n,r]=I.useState(new Map);I.useEffect(()=>{try{const u=new Map,f=Date.now();Object.keys(sessionStorage).forEach(l=>{if(l.startsWith(js)){const d=l.replace(js,""),h=sessionStorage.getItem(l);if(h)try{const m=JSON.parse(h);m.expiresAt>f?u.set(d,m):sessionStorage.removeItem(l)}catch{sessionStorage.removeItem(l)}}}),u.size>0&&r(u)}catch{console.warn("Failed to load JWT tokens from sessionStorage")}},[]);const i=I.useCallback((u,f)=>{const l=xc(u,f),d=Date.now(),h=n.get(l);if(h&&h.expiresAt>d)return h.token;n.delete(l);const m=Oc(l),y=sessionStorage.getItem(m);if(y)try{const w=JSON.parse(y);if(w.expiresAt>d)return r(g=>new Map(g).set(l,w)),w.token;sessionStorage.removeItem(m)}catch{sessionStorage.removeItem(m)}return null},[n]),o=I.useCallback(async(u,f,l)=>{const d=xc(u,f),m=await yh(l)||Date.now()+gh,y={token:l,expiresAt:m};r(w=>new Map(w).set(d,y));try{sessionStorage.setItem(Oc(d),JSON.stringify(y))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=I.useCallback(async({consumerRef:u,groupRef:f})=>{const l=i(u,f);if(l)return l;if(!e)throw new Error("JWT token callback not provided");try{const d=await e({consumerRef:u,groupRef:f});return await o(u,f,d),d}catch(d){throw console.error("Failed to get JWT token:",d),new Error("Failed to get JWT token")}},[e,i,o]),a={getToken:e?s:void 0};return c.jsx(Yu.Provider,{value:a,children:t})}const wh=()=>{const e=I.useContext(Yu);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},aa=I.createContext(null);function Ke(){const e=I.useContext(aa);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
2
|
+
component is wrapped with AmpersandProvider`);return e}const bh=new Qp;function Ih(e){const{options:{apiKey:t,projectId:n,project:r,getToken:i},children:o}=e,s=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!s)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t&&!i)throw new Error("Cannot use AmpersandProvider without an apiKey or getToken.");if(t&&i)throw new Error("Cannot use AmpersandProvider with both apiKey and getToken.");const a={options:e.options,projectIdOrName:s};return c.jsx(Gp,{client:bh,children:c.jsx(aa.Provider,{value:a,children:c.jsx(lh,{children:c.jsx(vh,{getTokenCallback:i||null,children:c.jsx(ch,{value:t||null,children:o})})})})})}const Ch="https://api.withampersand.com/v1".replace(/\/+$/,"");class ca{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ch}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||el}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 xh=new ca,Fo=class Fo{constructor(t=xh){this.configuration=t,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let o;try{o=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const a of this.middleware)a.onError&&(o=await a.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new Sh(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?Fo.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:i}=await this.createFetchParams(t,n),o=await this.fetchApi(r,i);if(o&&o.status>=200&&o.status<300)return o;throw new Zu(o,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(f=>i[f]===void 0?delete i[f]:{});const o=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},a={...s,...await o({init:s,context:t})},u={...a,body:_h(a.body)||a.body instanceof URLSearchParams||Oh(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:u}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Fo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let nn=Fo;function Oh(e){return typeof Blob<"u"&&e instanceof Blob}function _h(e){return typeof FormData<"u"&&e instanceof FormData}class Zu extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Sh extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function E(e,t){const n=e[t];return n!=null}function el(e,t=""){return Object.keys(e).map(n=>tl(n,e[n],t)).filter(n=>n.length>0).join("&")}function tl(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${i}`}if(t instanceof Set){const i=Array.from(t);return tl(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?el(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function qe(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Me{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Hr{constructor(t){this.raw=t}async value(){}}class _c{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Eh(e){return Nh(e)}function Nh(e,t){return e==null?e:{fieldUsed:E(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:E(e,"keyFormat")?e.keyFormat:void 0}}function Th(e){return Rh(e)}function Rh(e,t){return e==null?e:{name:e.name,valuePrefix:E(e,"valuePrefix")?e.valuePrefix:void 0}}function Ah(e){return Fh(e)}function Fh(e,t){return e==null?e:{name:e.name}}function Ph(e){return Dh(e)}function Dh(e,t){return e==null?e:{attachmentType:e.attachmentType,query:E(e,"query")?Ah(e.query):void 0,header:E(e,"header")?Th(e.header):void 0,docsURL:E(e,"docsURL")?e.docsURL:void 0}}function Mh(e){return kh(e)}function kh(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,includeFullRecords:E(e,"includeFullRecords")?e.includeFullRecords:void 0}}function jh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function Lh(e){return Vh(e)}function Vh(e,t){return e==null?e:{url:e.url,method:E(e,"method")?e.method:void 0,successStatusCodes:E(e,"successStatusCodes")?e.successStatusCodes:void 0}}const Sc={ApiKey:"apiKey",Basic:"basic"};function $h(e){return Kh(e)}function Kh(e,t){return e}function Uh(e){return qh(e)}function qh(e,t){return e==null?e:{days:E(e,"days")?e.days:void 0,fullHistory:E(e,"fullHistory")?e.fullHistory:void 0}}function Bh(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function nl(e){return Jh(e)}function Jh(e,t){return e==null?e:{defaultPeriod:Uh(e.defaultPeriod)}}function Hh(e){if(e!==void 0)return e===null?null:{defaultPeriod:Bh(e.defaultPeriod)}}function Wh(e){return zh(e)}function zh(e,t){return e==null?e:{days:E(e,"days")?e.days:void 0,fullHistory:E(e,"fullHistory")?e.fullHistory:void 0}}function Qh(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Gh(e){return Xh(e)}function Xh(e,t){return e==null?e:{defaultPeriod:Wh(e.defaultPeriod)}}function rl(e){if(e!==void 0)return e===null?null:{defaultPeriod:Qh(e.defaultPeriod)}}function Yh(e){return Zh(e)}function Zh(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,useModule:E(e,"useModule")?e.useModule:void 0}}function il(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function em(e){return tm(e)}function tm(e,t){return e==null?e:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function nm(e){if(e!==void 0)return e===null?null:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function rm(e){return im(e)}function im(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0,prompt:E(e,"prompt")?e.prompt:void 0,mappedValues:E(e,"mappedValues")?e.mappedValues.map(em):void 0,fieldName:E(e,"fieldName")?e.fieldName:void 0}}function ol(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,prompt:e.prompt,mappedValues:e.mappedValues===void 0?void 0:e.mappedValues.map(nm),fieldName:e.fieldName}}function om(e){return sm(e)}function sm(e,t){return e}function am(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,disabled:e.disabled,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(ol),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:rl(e.backfill)}}function cm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,am)}}function um(e){return lm(e)}function lm(e,t){return e==null?e:{stringValue:E(e,"stringValue")?e.stringValue:void 0,integerValue:E(e,"integerValue")?e.integerValue:void 0,booleanValue:E(e,"booleanValue")?e.booleanValue:void 0}}function dm(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const fm={Always:"always",Never:"never"},pm={Always:"always",Never:"never"};function hm(e){return mm(e)}function mm(e,t){return e==null?e:{default:E(e,"default")?um(e.default):void 0,writeOnCreate:E(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:E(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function sl(e){if(e!==void 0)return e===null?null:{default:dm(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function gm(e){let t=!0;return t=t&&"value"in e,t}function ym(e,t){return e==null?e:{value:e.value,applyOnUpdate:E(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function vm(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 bm(e,t){return e==null?e:{value:e.value,applyOnUpdate:E(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Im(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Cm(e){let t=!0;return t=t&&"value"in e,t}function xm(e,t){return e==null?e:{value:e.value,applyOnUpdate:E(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Om(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function _m(e){return Sm(e)}function Sm(e,t){return e==null?e:{...ym(e),...bm(e),...xm(e)}}function al(e){if(e!==void 0)return e===null?null:gm(e)?vm(e):wm(e)?Im(e):Cm(e)?Om(e):{}}function Em(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:qe(e.selectedValueDefaults,al),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:qe(e.selectedFieldSettings,sl)}}function Nm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,Em)}}function Tm(e){return Rm(e)}function Rm(e,t){return e==null?e:{enabled:e.enabled}}function Am(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fm(e){return Pm(e)}function Pm(e,t){return e==null?e:{enabled:e.enabled}}function Dm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Mm(e){return km(e)}function km(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:E(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:E(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function jm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Lm(e){return Vm(e)}function Vm(e,t){return e==null?e:{apiKeyAsBasic:E(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:E(e,"apiKeyAsBasicOpts")?Eh(e.apiKeyAsBasicOpts):void 0,docsURL:E(e,"docsURL")?e.docsURL:void 0}}function $m(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Km(e){return Um(e)}function Um(e,t){return e==null?e:{value:e.value}}function qm(e){return Bm(e)}function Bm(e,t){return e==null?e:{brandingRemoval:E(e,"brandingRemoval")?Km(e.brandingRemoval):void 0}}function Zi(e){return Jm(e)}function Jm(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:E(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:E(e,"entitlements")?qm(e.entitlements):void 0}}function Hm(e){return Wm(e)}function Wm(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function zm(e){return Qm(e)}function Qm(e,t){return e==null?e:{objectName:e.objectName,schedule:E(e,"schedule")?e.schedule:void 0,disabled:E(e,"disabled")?e.disabled:void 0,destination:E(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:E(e,"selectedValueMappings")?e.selectedValueMappings:void 0,dynamicMappingsInput:E(e,"dynamicMappingsInput")?e.dynamicMappingsInput.map(rm):void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:E(e,"selectedFieldsAuto")?om(e.selectedFieldsAuto):void 0,backfill:E(e,"backfill")?Gh(e.backfill):void 0}}function Gm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,disabled:e.disabled,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(ol),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:rl(e.backfill)}}function Xm(e){return Ym(e)}function Ym(e,t){return e==null?e:{objects:qe(e.objects,zm)}}function Zm(e){if(e!==void 0)return e===null?null:{objects:qe(e.objects,Gm)}}function eg(e){return tg(e)}function tg(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:E(e,"createEvent")?Tm(e.createEvent):void 0,updateEvent:E(e,"updateEvent")?Mm(e.updateEvent):void 0,deleteEvent:E(e,"deleteEvent")?Fm(e.deleteEvent):void 0}}function ng(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:Am(e.createEvent),updateEvent:jm(e.updateEvent),deleteEvent:Dm(e.deleteEvent)}}function rg(e){return ig(e)}function ig(e,t){return e==null?e:{objects:qe(e.objects,eg)}}function og(e){if(e!==void 0)return e===null?null:{objects:qe(e.objects,ng)}}function sg(e){return ag(e)}function ag(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:E(e,"selectedValueDefaults")?qe(e.selectedValueDefaults,_m):void 0,selectedFieldSettings:E(e,"selectedFieldSettings")?qe(e.selectedFieldSettings,hm):void 0}}function cg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:qe(e.selectedValueDefaults,al),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:qe(e.selectedFieldSettings,sl)}}function ug(e){return lg(e)}function lg(e,t){return e==null?e:{objects:E(e,"objects")?qe(e.objects,sg):void 0}}function dg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,cg)}}function fg(e){return pg(e)}function pg(e,t){return e==null?e:{provider:e.provider,module:E(e,"module")?e.module:void 0,read:E(e,"read")?Xm(e.read):void 0,write:E(e,"write")?ug(e.write):void 0,proxy:E(e,"proxy")?Yh(e.proxy):void 0,subscribe:E(e,"subscribe")?rg(e.subscribe):void 0}}function hg(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:Zm(e.read),write:dg(e.write),proxy:il(e.proxy),subscribe:og(e.subscribe)}}function mg(e){return gg(e)}function gg(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:fg(e.content)}}function yg(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(e,"updateTime")?new Date(e.updateTime):void 0}}function cl(e){return wg(e)}function wg(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0}}function bg(e){return Ig(e)}function Ig(e,t){return e==null?e:{token:e.token,issuedAt:E(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:E(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Cg(e){return xg(e)}function xg(e,t){return e==null?e:{token:e.token,issuedAt:E(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:E(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Og(e){return _g(e)}function _g(e,t){return e==null?e:{accessToken:E(e,"accessToken")?bg(e.accessToken):void 0,refreshToken:E(e,"refreshToken")?Cg(e.refreshToken):void 0,scopes:E(e,"scopes")?e.scopes:void 0}}function co(e){return Sg(e)}function Sg(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:E(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:E(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0}}function Eg(e){return Ng(e)}function Ng(e,t){return e==null?e:{value:e.value,source:e.source,displayName:E(e,"displayName")?e.displayName:void 0}}function ua(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function vi(e){return Tg(e)}function Tg(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:E(e,"providerApp")?co(e.providerApp):void 0,group:cl(e.group),consumer:yg(e.consumer),providerWorkspaceRef:E(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:E(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:E(e,"oauth2AuthorizationCode")?Og(e.oauth2AuthorizationCode):void 0,apiKey:E(e,"apiKey")?e.apiKey:void 0,providerMetadata:E(e,"providerMetadata")?qe(e.providerMetadata,Eg):void 0}}function ul(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function ll(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function dl(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 Rg(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 Ag(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 fl(e){if(e!==void 0)return e===null?null:{accessToken:Rg(e.accessToken),refreshToken:Ag(e.refreshToken),scopes:e.scopes}}function Fg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,ua),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:ul(e.basicAuth),oauth2ClientCredentials:ll(e.oauth2ClientCredentials),oauth2PasswordCredentials:dl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:fl(e.oauth2AuthorizationCode)}}function Pg(e){return Dg(e)}function Dg(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0}}function Mg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function kg(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:hg(e.content)}}function jg(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:kg(e.config)}}function Lg(e){return Vg(e)}function Vg(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,useModule:E(e,"useModule")?e.useModule:void 0}}function $g(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function Kg(e){return Ug(e)}function Ug(e,t){return e==null?e:{mode:E(e,"mode")?e.mode:void 0,pageSize:E(e,"pageSize")?e.pageSize:void 0}}function qg(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Bg(e){let t=!0;return t=t&&"fieldName"in e,t}function Jg(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:E(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Hg(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Wg(e){let t=!0;return t=t&&"mapToName"in e,t}function pl(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:E(e,"default")?e.default:void 0,prompt:E(e,"prompt")?e.prompt:void 0}}function zg(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ec(e){return Qg(e)}function Qg(e,t){return e==null?e:{...Jg(e),...pl(e)}}function Nc(e){if(e!==void 0)return e===null?null:Bg(e)?Hg(e):Wg(e)?zg(e):{}}function hl(e){return Gg(e)}function Gg(e,t){return e}function Xg(e){return Yg(e)}function Yg(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:E(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:E(e,"requiredFields")?e.requiredFields.map(Ec):void 0,optionalFields:E(e,"optionalFields")?e.optionalFields.map(Ec):void 0,optionalFieldsAuto:E(e,"optionalFieldsAuto")?hl(e.optionalFieldsAuto):void 0,backfill:E(e,"backfill")?nl(e.backfill):void 0,delivery:E(e,"delivery")?Kg(e.delivery):void 0,enabled:E(e,"enabled")?e.enabled:void 0}}function Zg(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(Nc),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Nc),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Hh(e.backfill),delivery:qg(e.delivery),enabled:e.enabled}}function ey(e){return ty(e)}function ty(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(Xg):void 0}}function ny(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Zg)}}function ry(e){return iy(e)}function iy(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0}}function oy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function sy(e){return ay(e)}function ay(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,watchFieldsAuto:E(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:E(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function cy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function uy(e){return ly(e)}function ly(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:E(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:E(e,"createEvent")?Pg(e.createEvent):void 0,updateEvent:E(e,"updateEvent")?sy(e.updateEvent):void 0,deleteEvent:E(e,"deleteEvent")?ry(e.deleteEvent):void 0,associationChangeEvent:E(e,"associationChangeEvent")?Mh(e.associationChangeEvent):void 0,otherEvents:E(e,"otherEvents")?e.otherEvents:void 0}}function dy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:Mg(e.createEvent),updateEvent:cy(e.updateEvent),deleteEvent:oy(e.deleteEvent),associationChangeEvent:jh(e.associationChangeEvent),otherEvents:e.otherEvents}}function fy(e){return py(e)}function py(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(uy):void 0}}function hy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(dy)}}function ml(e){return my(e)}function my(e,t){return e==null?e:{allowAnyFields:E(e,"allowAnyFields")?e.allowAnyFields:void 0}}function gy(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function yy(e){return vy(e)}function vy(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:E(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:E(e,"valueDefaults")?ml(e.valueDefaults):void 0}}function wy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:gy(e.valueDefaults)}}function by(e){return Iy(e)}function Iy(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(yy):void 0}}function Cy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(wy)}}function xy(e){return Oy(e)}function Oy(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:E(e,"displayName")?e.displayName:void 0,module:E(e,"module")?e.module:void 0,read:E(e,"read")?ey(e.read):void 0,write:E(e,"write")?by(e.write):void 0,proxy:E(e,"proxy")?Lg(e.proxy):void 0,subscribe:E(e,"subscribe")?fy(e.subscribe):void 0}}function _y(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:ny(e.read),write:Cy(e.write),proxy:$g(e.proxy),subscribe:hy(e.subscribe)}}function Sy(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:_y(e.content)}}function Ey(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Sy(e.latestRevision)}}function Ny(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Ty(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 Ry(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Ay(e){return Fy(e)}function Fy(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Py(e){return Dy(e)}function Dy(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:E(e,"prompt")?e.prompt:void 0,docsURL:E(e,"docsURL")?e.docsURL:void 0}}function My(e){return ky(e)}function ky(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function jy(e){return Ly(e)}function Ly(e,t){return e==null?e:{headers:E(e,"headers")?e.headers.map(Ay):void 0,queryParams:E(e,"queryParams")?e.queryParams.map(My):void 0,inputs:E(e,"inputs")?e.inputs.map(Py):void 0}}function Vy(e){return $y(e)}function $y(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Ky(e){return Uy(e)}function Uy(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:E(e,"valueType")?e.valueType:void 0,providerType:E(e,"providerType")?e.providerType:void 0,readOnly:E(e,"readOnly")?e.readOnly:void 0,values:E(e,"values")?e.values.map(Vy):void 0}}function qy(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,ua),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:ul(e.basicAuth),oauth2ClientCredentials:ll(e.oauth2ClientCredentials),oauth2PasswordCredentials:dl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:fl(e.oauth2AuthorizationCode)}}function By(e){return Jy(e)}function Jy(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,useModule:E(e,"useModule")?e.useModule:void 0}}function Hy(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:E(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function ts(e){return Wy(e)}function Wy(e,t){return e==null?e:{...Hy(e),...pl(e)}}function zy(e){return Qy(e)}function Qy(e,t){return e==null?e:{error:E(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:E(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:E(e,"requiredFields")?e.requiredFields.map(ts):void 0,optionalFields:E(e,"optionalFields")?e.optionalFields.map(ts):void 0,optionalFieldsAuto:E(e,"optionalFieldsAuto")?hl(e.optionalFieldsAuto):void 0,allFieldsMetadata:E(e,"allFieldsMetadata")?qe(e.allFieldsMetadata,Ky):void 0,allFields:E(e,"allFields")?e.allFields.map(ts):void 0,backfill:E(e,"backfill")?nl(e.backfill):void 0}}function Gy(e){return Xy(e)}function Xy(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(zy):void 0}}function Yy(e){return Zy(e)}function Zy(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:E(e,"valueDefaults")?ml(e.valueDefaults):void 0}}function ev(e){return tv(e)}function tv(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(Yy):void 0}}function nv(e){return rv(e)}function rv(e,t){return e==null?e:{name:e.name,displayName:E(e,"displayName")?e.displayName:void 0,module:E(e,"module")?e.module:void 0,provider:e.provider,read:E(e,"read")?Gy(e.read):void 0,write:E(e,"write")?ev(e.write):void 0,proxy:E(e,"proxy")?By(e.proxy):void 0}}function iv(e){return ov(e)}function ov(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:nv(e.content)}}function hi(e){return sv(e)}function sv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:E(e,"group")?cl(e.group):void 0,healthStatus:e.healthStatus,connection:vi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0,config:mg(e.config)}}function av(e){return cv(e)}function cv(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:xy(e.content)}}function ns(e){return uv(e)}function uv(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(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:av(e.latestRevision)}}function lv(e){return dv(e)}function dv(e,t){return e==null?e:{iconURL:E(e,"iconURL")?e.iconURL:void 0,logoURL:E(e,"logoURL")?e.logoURL:void 0}}function fv(e){return pv(e)}function pv(e,t){return e==null?e:{iconURL:E(e,"iconURL")?e.iconURL:void 0,logoURL:E(e,"logoURL")?e.logoURL:void 0}}function hv(e){return mv(e)}function mv(e,t){return e==null?e:{regular:E(e,"regular")?fv(e.regular):void 0,darkMode:E(e,"darkMode")?lv(e.darkMode):void 0}}function gv(e){return yv(e)}function yv(e,t){return e==null?e:{name:e.name,displayName:E(e,"displayName")?e.displayName:void 0,defaultValue:E(e,"defaultValue")?e.defaultValue:void 0,docsURL:E(e,"docsURL")?e.docsURL:void 0,moduleDependencies:E(e,"moduleDependencies")?e.moduleDependencies:void 0}}function vv(e){return wv(e)}function wv(e,t){return e==null?e:{name:e.name,moduleDependencies:E(e,"moduleDependencies")?e.moduleDependencies:void 0}}function bv(e){return Iv(e)}function Iv(e,t){return e==null?e:{create:E(e,"create")?e.create:void 0,update:E(e,"update")?e.update:void 0,_delete:E(e,"delete")?e.delete:void 0,passThrough:E(e,"passThrough")?e.passThrough:void 0}}function gl(e){return Cv(e)}function Cv(e,t){return e==null?e:{bulkWrite:Hm(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:E(e,"subscribeSupport")?bv(e.subscribeSupport):void 0}}function xv(e){return Ov(e)}function Ov(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:gl(e.support)}}function _v(e){return Sv(e)}function Sv(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:E(e,"capture")?e.capture:void 0}}function Ev(e){return Nv(e)}function Nv(e,t){return e==null?e:{workspaceRefField:E(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:E(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:E(e,"scopesField")?e.scopesField:void 0,otherFields:E(e,"otherFields")?e.otherFields.map(_v):void 0}}const rs={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function Tv(e){return Rv(e)}function Rv(e,t){return e==null?e:{grantType:e.grantType,authURL:E(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:E(e,"audience")?e.audience:void 0,tokenMetadataFields:Ev(e.tokenMetadataFields),docsURL:E(e,"docsURL")?e.docsURL:void 0,authURLParams:E(e,"authURLParams")?e.authURLParams:void 0}}function Av(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,ua),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function Fv(e){return Pv(e)}function Pv(e,t){return e==null?e:{input:E(e,"input")?e.input.map(gv):void 0,postAuthentication:E(e,"postAuthentication")?e.postAuthentication.map(vv):void 0}}function Dv(e){return Mv(e)}function Mv(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Tc(e){return kv(e)}function kv(e,t){return e==null?e:{name:e.name,authType:$h(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:E(e,"oauth2Opts")?Tv(e.oauth2Opts):void 0,apiKeyOpts:E(e,"apiKeyOpts")?Ph(e.apiKeyOpts):void 0,basicOpts:E(e,"basicOpts")?Lm(e.basicOpts):void 0,customOpts:E(e,"customOpts")?jy(e.customOpts):void 0,support:gl(e.support),providerOpts:e.providerOpts,authHealthCheck:E(e,"authHealthCheck")?Lh(e.authHealthCheck):void 0,displayName:E(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:E(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:E(e,"media")?hv(e.media):void 0,labels:E(e,"labels")?e.labels:void 0,subscribeOpts:E(e,"subscribeOpts")?Dv(e.subscribeOpts):void 0,modules:E(e,"modules")?qe(e.modules,xv):void 0,metadata:E(e,"metadata")?Fv(e.metadata):void 0}}function jv(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:Fg(e.connection)}}function Lv(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:cm(e.read),write:Nm(e.write),proxy:il(e.proxy)}}function Vv(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Lv(e.content)}}function $v(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Vv(e.config)}}function Kv(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:$v(e.installation)}}function Uv(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function qv(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Uv(e.project)}}function Bv(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 Jv(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Bv(e.providerApp)}}class Hv extends nn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:i,query:r},n);return new Hr(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:qy(t.generateConnectionParams)},n);return new Me(o,s=>vi(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:i,query:r},n);return new Me(o,s=>vi(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Me(o,s=>s.map(vi))}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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ie("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:i,query:r,body:jv(t.updateConnectionRequest)},n);return new Me(o,s=>vi(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Wv extends nn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:jg(t.installation)},n);return new Me(o,s=>hi(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:i,query:r},n);return new Hr(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:r},n);return new Me(o,s=>hi(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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:i,query:r},n);return new Me(o,s=>s.map(hi))}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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallationsForProject.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Me(o,s=>s.map(hi))}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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ie("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:i,query:r,body:Kv(t.installationUpdate)},n);return new Me(o,s=>hi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class zv extends nn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ie("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={};t.destructive!==void 0&&(r.destructive=t.destructive);const i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:$m(t.batchUpsertIntegrationsRequest)},n);return new Me(o,s=>s.map(ns))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ie("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Ey(t.integration)},n);return new Hr(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:i,query:r},n);return new Hr(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new ie("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getIntegration.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationIdOrName}".replace("{integrationIdOrName}",encodeURIComponent(String(t.integrationIdOrName))).replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Me(o,s=>ns(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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Me(o,s=>s.map(ns))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Qv extends nn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:Av(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new Me(o):new _c(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:i,query:r},n);return this.isJsonMime(o.headers.get("content-type"))?new Me(o):new _c(o)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Gv extends nn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:Ny(t.project)},n);return new Me(o,s=>Zi(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Me(o,s=>Zi(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const o=this.configuration.accessToken,s=await o("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Me(i,o=>o.map(Zi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ie("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:qv(t.projectUpdate)},n);return new Me(o,s=>Zi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Xv extends nn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new Me(o,s=>Tc(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const o=this.configuration.accessToken,s=await o("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Me(i,o=>qe(o,Tc))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Yv extends nn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Ty(t.providerApp)},n);return new Me(o,s=>co(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:i,query:r},n);return new Hr(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Me(o,s=>s.map(co))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ie("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:r,body:Jv(t.providerAppUpdate)},n);return new Me(o,s=>co(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Zv extends nn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ie("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={};t.destructive!==void 0&&(r.destructive=t.destructive);const i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Ry(t.revision)},n);return new Hr(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ie("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};if(this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(i.Authorization=`Bearer ${a}`)}const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:i,query:r},n);return new Me(o,s=>iv(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var yl=Symbol.for("immer-nothing"),Rc=Symbol.for("immer-draftable"),At=Symbol.for("immer-state"),ew=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 xt(e,...t){if(process.env.NODE_ENV!=="production"){const n=ew[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 Wr=Object.getPrototypeOf;function zr(e){return!!e&&!!e[At]}function xr(e){var t;return e?vl(e)||Array.isArray(e)||!!e[Rc]||!!((t=e.constructor)!=null&&t[Rc])||Di(e)||Do(e):!1}var tw=Object.prototype.constructor.toString();function vl(e){if(!e||typeof e!="object")return!1;const t=Wr(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)===tw}function yo(e,t){Po(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Po(e){const t=e[At];return t?t.type_:Array.isArray(e)?1:Di(e)?2:Do(e)?3:0}function Ls(e,t){return Po(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function wl(e,t,n){const r=Po(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function nw(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Di(e){return e instanceof Map}function Do(e){return e instanceof Set}function ar(e){return e.copy_||e.base_}function Vs(e,t){if(Di(e))return new Map(e);if(Do(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=vl(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[At];let i=Reflect.ownKeys(r);for(let o=0;o<i.length;o++){const s=i[o],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Wr(e),r)}else{const r=Wr(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function la(e,t=!1){return Mo(e)||zr(e)||!xr(e)||(Po(e)>1&&Object.defineProperties(e,{set:{value:eo},add:{value:eo},clear:{value:eo},delete:{value:eo}}),Object.freeze(e),t&&Object.values(e).forEach(n=>la(n,!0))),e}function eo(){xt(2)}function Mo(e){return Object.isFrozen(e)}var rw={};function Or(e){const t=rw[e];return t||xt(0,e),t}var xi;function bl(){return xi}function iw(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ac(e,t){t&&(Or("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function $s(e){Ks(e),e.drafts_.forEach(ow),e.drafts_=null}function Ks(e){e===xi&&(xi=e.parent_)}function Fc(e){return xi=iw(xi,e)}function ow(e){const t=e[At];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Pc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[At].modified_&&($s(t),xt(4)),xr(e)&&(e=vo(t,e),t.parent_||wo(t,e)),t.patches_&&Or("Patches").generateReplacementPatches_(n[At].base_,e,t.patches_,t.inversePatches_)):e=vo(t,n,[]),$s(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==yl?e:void 0}function vo(e,t,n){if(Mo(t))return t;const r=t[At];if(!r)return yo(t,(i,o)=>Dc(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return wo(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,s=!1;r.type_===3&&(o=new Set(i),i.clear(),s=!0),yo(o,(a,u)=>Dc(e,r,i,a,u,n,s)),wo(e,i,!1),n&&e.patches_&&Or("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Dc(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&xt(5),zr(i)){const a=o&&t&&t.type_!==3&&!Ls(t.assigned_,r)?o.concat(r):void 0,u=vo(e,i,a);if(wl(n,r,u),zr(u))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(xr(i)&&!Mo(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;vo(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Di(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&wo(e,i)}}function wo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&la(t,n)}function sw(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:bl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=da;n&&(i=[r],o=Oi);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var da={get(e,t){if(t===At)return e;const n=ar(e);if(!Ls(n,t))return aw(e,n,t);const r=n[t];return e.finalized_||!xr(r)?r:r===is(e.base_,t)?(os(e),e.copy_[t]=qs(r,e)):r},has(e,t){return t in ar(e)},ownKeys(e){return Reflect.ownKeys(ar(e))},set(e,t,n){const r=Il(ar(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=is(ar(e),t),o=i==null?void 0:i[At];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(nw(n,i)&&(n!==void 0||Ls(e.base_,t)))return!0;os(e),Us(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 is(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,os(e),Us(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ar(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){xt(11)},getPrototypeOf(e){return Wr(e.base_)},setPrototypeOf(){xt(12)}},Oi={};yo(da,(e,t)=>{Oi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Oi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&xt(13),Oi.set.call(this,e,t,void 0)};Oi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&xt(14),da.set.call(this,e[0],t,n,e[0])};function is(e,t){const n=e[At];return(n?ar(n):e)[t]}function aw(e,t,n){var i;const r=Il(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Il(e,t){if(!(t in e))return;let n=Wr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Wr(n)}}function Us(e){e.modified_||(e.modified_=!0,e.parent_&&Us(e.parent_))}function os(e){e.copy_||(e.copy_=Vs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var cw=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const s=this;return function(u=o,...f){return s.produce(u,l=>n.call(this,l,...f))}}typeof n!="function"&&xt(6),r!==void 0&&typeof r!="function"&&xt(7);let i;if(xr(t)){const o=Fc(this),s=qs(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?$s(o):Ks(o)}return Ac(o,r),Pc(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===yl&&(i=void 0),this.autoFreeze_&&la(i,!0),r){const o=[],s=[];Or("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else xt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,u=>t(u,...a));let r,i;return[this.produce(t,n,(s,a)=>{r=s,i=a}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){xr(e)||xt(8),zr(e)&&(e=uw(e));const t=Fc(this),n=qs(e,void 0);return n[At].isManual_=!0,Ks(t),n}finishDraft(e,t){const n=e&&e[At];(!n||!n.isManual_)&&xt(9);const{scope_:r}=n;return Ac(r,t),Pc(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=Or("Patches").applyPatches_;return zr(e)?r(e,t):this.produce(e,i=>r(i,t))}};function qs(e,t){const n=Di(e)?Or("MapSet").proxyMap_(e,t):Do(e)?Or("MapSet").proxySet_(e,t):sw(e,t);return(t?t.scope_:bl()).drafts_.push(n),n}function uw(e){return zr(e)||xt(10,e),Cl(e)}function Cl(e){if(!xr(e)||Mo(e))return e;const t=e[At];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Vs(e,!0);return yo(n,(r,i)=>{wl(n,r,Cl(i))}),t&&(t.finalized_=!1),n}var lw=new cw,Nt=lw.produce,Hn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ko(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bo={exports:{}};bo.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,a="[object Arguments]",u="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",d="[object Date]",h="[object Error]",m="[object Function]",y="[object GeneratorFunction]",w="[object Map]",g="[object Number]",O="[object Null]",p="[object Object]",b="[object Promise]",v="[object Proxy]",x="[object RegExp]",S="[object Set]",A="[object String]",N="[object Symbol]",F="[object Undefined]",R="[object WeakMap]",D="[object ArrayBuffer]",K="[object DataView]",j="[object Float32Array]",L="[object Float64Array]",se="[object Int8Array]",re="[object Int16Array]",ge="[object Int32Array]",de="[object Uint8Array]",be="[object Uint8ClampedArray]",P="[object Uint16Array]",$="[object Uint32Array]",H=/[\\^$.*+?()[\]{}|]/g,U=/^\[object .+?Constructor\]$/,q=/^(?:0|[1-9]\d*)$/,V={};V[j]=V[L]=V[se]=V[re]=V[ge]=V[de]=V[be]=V[P]=V[$]=!0,V[a]=V[u]=V[D]=V[l]=V[K]=V[d]=V[h]=V[m]=V[w]=V[g]=V[p]=V[x]=V[S]=V[A]=V[R]=!1;var G=typeof Hn=="object"&&Hn&&Hn.Object===Object&&Hn,Z=typeof self=="object"&&self&&self.Object===Object&&self,Y=G||Z||Function("return this")(),ee=t&&!t.nodeType&&t,ne=ee&&!0&&e&&!e.nodeType&&e,ce=ne&&ne.exports===ee,k=ce&&G.process,ve=function(){try{return k&&k.binding&&k.binding("util")}catch{}}(),z=ve&&ve.isTypedArray;function Xe(C,T){for(var M=-1,te=C==null?0:C.length,Pe=0,fe=[];++M<te;){var Ve=C[M];T(Ve,M,C)&&(fe[Pe++]=Ve)}return fe}function Ce(C,T){for(var M=-1,te=T.length,Pe=C.length;++M<te;)C[Pe+M]=T[M];return C}function st(C,T){for(var M=-1,te=C==null?0:C.length;++M<te;)if(T(C[M],M,C))return!0;return!1}function Ue(C,T){for(var M=-1,te=Array(C);++M<C;)te[M]=T(M);return te}function rt(C){return function(T){return C(T)}}function xe(C,T){return C.has(T)}function ze(C,T){return C==null?void 0:C[T]}function ft(C){var T=-1,M=Array(C.size);return C.forEach(function(te,Pe){M[++T]=[Pe,te]}),M}function yt(C,T){return function(M){return C(T(M))}}function vt(C){var T=-1,M=Array(C.size);return C.forEach(function(te){M[++T]=te}),M}var Ye=Array.prototype,Ze=Function.prototype,De=Object.prototype,J=Y["__core-js_shared__"],pe=Ze.toString,_e=De.hasOwnProperty,ln=function(){var C=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),dn=De.toString,fn=RegExp("^"+pe.call(_e).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),wt=ce?Y.Buffer:void 0,Fe=Y.Symbol,nr=Y.Uint8Array,En=De.propertyIsEnumerable,Nn=Ye.splice,St=Fe?Fe.toStringTag:void 0,pn=Object.getOwnPropertySymbols,Tn=wt?wt.isBuffer:void 0,Rn=yt(Object.keys,Object),hn=Rr(Y,"DataView"),Gt=Rr(Y,"Map"),je=Rr(Y,"Promise"),at=Rr(Y,"Set"),ae=Rr(Y,"WeakMap"),he=Rr(Object,"create"),pt=ir(hn),mn=ir(Gt),X=ir(je),ue=ir(at),le=ir(ae),Le=Fe?Fe.prototype:void 0,Be=Le?Le.valueOf:void 0;function et(C){var T=-1,M=C==null?0:C.length;for(this.clear();++T<M;){var te=C[T];this.set(te[0],te[1])}}function Pt(){this.__data__=he?he(null):{},this.size=0}function it(C){var T=this.has(C)&&delete this.__data__[C];return this.size-=T?1:0,T}function bt(C){var T=this.__data__;if(he){var M=T[C];return M===r?void 0:M}return _e.call(T,C)?T[C]:void 0}function Ae(C){var T=this.__data__;return he?T[C]!==void 0:_e.call(T,C)}function An(C,T){var M=this.__data__;return this.size+=this.has(C)?0:1,M[C]=he&&T===void 0?r:T,this}et.prototype.clear=Pt,et.prototype.delete=it,et.prototype.get=bt,et.prototype.has=Ae,et.prototype.set=An;function $t(C){var T=-1,M=C==null?0:C.length;for(this.clear();++T<M;){var te=C[T];this.set(te[0],te[1])}}function Xo(){this.__data__=[],this.size=0}function Ui(C){var T=this.__data__,M=Hi(T,C);if(M<0)return!1;var te=T.length-1;return M==te?T.pop():Nn.call(T,M,1),--this.size,!0}function qi(C){var T=this.__data__,M=Hi(T,C);return M<0?void 0:T[M][1]}function Bi(C){return Hi(this.__data__,C)>-1}function Ji(C,T){var M=this.__data__,te=Hi(M,C);return te<0?(++this.size,M.push([C,T])):M[te][1]=T,this}$t.prototype.clear=Xo,$t.prototype.delete=Ui,$t.prototype.get=qi,$t.prototype.has=Bi,$t.prototype.set=Ji;function Xt(C){var T=-1,M=C==null?0:C.length;for(this.clear();++T<M;){var te=C[T];this.set(te[0],te[1])}}function Oe(){this.size=0,this.__data__={hash:new et,map:new(Gt||$t),string:new et}}function Kt(C){var T=Wi(this,C).delete(C);return this.size-=T?1:0,T}function li(C){return Wi(this,C).get(C)}function rr(C){return Wi(this,C).has(C)}function Yo(C,T){var M=Wi(this,C),te=M.size;return M.set(C,T),this.size+=M.size==te?0:1,this}Xt.prototype.clear=Oe,Xt.prototype.delete=Kt,Xt.prototype.get=li,Xt.prototype.has=rr,Xt.prototype.set=Yo;function Fn(C){var T=-1,M=C==null?0:C.length;for(this.__data__=new Xt;++T<M;)this.add(C[T])}function Gf(C){return this.__data__.set(C,r),this}function Xf(C){return this.__data__.has(C)}Fn.prototype.add=Fn.prototype.push=Gf,Fn.prototype.has=Xf;function Pn(C){var T=this.__data__=new $t(C);this.size=T.size}function Yf(){this.__data__=new $t,this.size=0}function Zf(C){var T=this.__data__,M=T.delete(C);return this.size=T.size,M}function ep(C){return this.__data__.get(C)}function tp(C){return this.__data__.has(C)}function np(C,T){var M=this.__data__;if(M instanceof $t){var te=M.__data__;if(!Gt||te.length<n-1)return te.push([C,T]),this.size=++M.size,this;M=this.__data__=new Xt(te)}return M.set(C,T),this.size=M.size,this}Pn.prototype.clear=Yf,Pn.prototype.delete=Zf,Pn.prototype.get=ep,Pn.prototype.has=tp,Pn.prototype.set=np;function rp(C,T){var M=zi(C),te=!M&&vp(C),Pe=!M&&!te&&Zo(C),fe=!M&&!te&&!Pe&&lc(C),Ve=M||te||Pe||fe,tt=Ve?Ue(C.length,String):[],ot=tt.length;for(var ke in C)_e.call(C,ke)&&!(Ve&&(ke=="length"||Pe&&(ke=="offset"||ke=="parent")||fe&&(ke=="buffer"||ke=="byteLength"||ke=="byteOffset")||pp(ke,ot)))&&tt.push(ke);return tt}function Hi(C,T){for(var M=C.length;M--;)if(sc(C[M][0],T))return M;return-1}function ip(C,T,M){var te=T(C);return zi(C)?te:Ce(te,M(C))}function di(C){return C==null?C===void 0?F:O:St&&St in Object(C)?dp(C):yp(C)}function nc(C){return fi(C)&&di(C)==a}function rc(C,T,M,te,Pe){return C===T?!0:C==null||T==null||!fi(C)&&!fi(T)?C!==C&&T!==T:op(C,T,M,te,rc,Pe)}function op(C,T,M,te,Pe,fe){var Ve=zi(C),tt=zi(T),ot=Ve?u:Dn(C),ke=tt?u:Dn(T);ot=ot==a?p:ot,ke=ke==a?p:ke;var Et=ot==p,Ut=ke==p,ct=ot==ke;if(ct&&Zo(C)){if(!Zo(T))return!1;Ve=!0,Et=!1}if(ct&&!Et)return fe||(fe=new Pn),Ve||lc(C)?ic(C,T,M,te,Pe,fe):up(C,T,ot,M,te,Pe,fe);if(!(M&i)){var Dt=Et&&_e.call(C,"__wrapped__"),Mt=Ut&&_e.call(T,"__wrapped__");if(Dt||Mt){var Mn=Dt?C.value():C,gn=Mt?T.value():T;return fe||(fe=new Pn),Pe(Mn,gn,M,te,fe)}}return ct?(fe||(fe=new Pn),lp(C,T,M,te,Pe,fe)):!1}function sp(C){if(!uc(C)||mp(C))return!1;var T=ac(C)?fn:U;return T.test(ir(C))}function ap(C){return fi(C)&&cc(C.length)&&!!V[di(C)]}function cp(C){if(!gp(C))return Rn(C);var T=[];for(var M in Object(C))_e.call(C,M)&&M!="constructor"&&T.push(M);return T}function ic(C,T,M,te,Pe,fe){var Ve=M&i,tt=C.length,ot=T.length;if(tt!=ot&&!(Ve&&ot>tt))return!1;var ke=fe.get(C);if(ke&&fe.get(T))return ke==T;var Et=-1,Ut=!0,ct=M&o?new Fn:void 0;for(fe.set(C,T),fe.set(T,C);++Et<tt;){var Dt=C[Et],Mt=T[Et];if(te)var Mn=Ve?te(Mt,Dt,Et,T,C,fe):te(Dt,Mt,Et,C,T,fe);if(Mn!==void 0){if(Mn)continue;Ut=!1;break}if(ct){if(!st(T,function(gn,or){if(!xe(ct,or)&&(Dt===gn||Pe(Dt,gn,M,te,fe)))return ct.push(or)})){Ut=!1;break}}else if(!(Dt===Mt||Pe(Dt,Mt,M,te,fe))){Ut=!1;break}}return fe.delete(C),fe.delete(T),Ut}function up(C,T,M,te,Pe,fe,Ve){switch(M){case K:if(C.byteLength!=T.byteLength||C.byteOffset!=T.byteOffset)return!1;C=C.buffer,T=T.buffer;case D:return!(C.byteLength!=T.byteLength||!fe(new nr(C),new nr(T)));case l:case d:case g:return sc(+C,+T);case h:return C.name==T.name&&C.message==T.message;case x:case A:return C==T+"";case w:var tt=ft;case S:var ot=te&i;if(tt||(tt=vt),C.size!=T.size&&!ot)return!1;var ke=Ve.get(C);if(ke)return ke==T;te|=o,Ve.set(C,T);var Et=ic(tt(C),tt(T),te,Pe,fe,Ve);return Ve.delete(C),Et;case N:if(Be)return Be.call(C)==Be.call(T)}return!1}function lp(C,T,M,te,Pe,fe){var Ve=M&i,tt=oc(C),ot=tt.length,ke=oc(T),Et=ke.length;if(ot!=Et&&!Ve)return!1;for(var Ut=ot;Ut--;){var ct=tt[Ut];if(!(Ve?ct in T:_e.call(T,ct)))return!1}var Dt=fe.get(C);if(Dt&&fe.get(T))return Dt==T;var Mt=!0;fe.set(C,T),fe.set(T,C);for(var Mn=Ve;++Ut<ot;){ct=tt[Ut];var gn=C[ct],or=T[ct];if(te)var dc=Ve?te(or,gn,ct,T,C,fe):te(gn,or,ct,C,T,fe);if(!(dc===void 0?gn===or||Pe(gn,or,M,te,fe):dc)){Mt=!1;break}Mn||(Mn=ct=="constructor")}if(Mt&&!Mn){var Qi=C.constructor,Gi=T.constructor;Qi!=Gi&&"constructor"in C&&"constructor"in T&&!(typeof Qi=="function"&&Qi instanceof Qi&&typeof Gi=="function"&&Gi instanceof Gi)&&(Mt=!1)}return fe.delete(C),fe.delete(T),Mt}function oc(C){return ip(C,Ip,fp)}function Wi(C,T){var M=C.__data__;return hp(T)?M[typeof T=="string"?"string":"hash"]:M.map}function Rr(C,T){var M=ze(C,T);return sp(M)?M:void 0}function dp(C){var T=_e.call(C,St),M=C[St];try{C[St]=void 0;var te=!0}catch{}var Pe=dn.call(C);return te&&(T?C[St]=M:delete C[St]),Pe}var fp=pn?function(C){return C==null?[]:(C=Object(C),Xe(pn(C),function(T){return En.call(C,T)}))}:Cp,Dn=di;(hn&&Dn(new hn(new ArrayBuffer(1)))!=K||Gt&&Dn(new Gt)!=w||je&&Dn(je.resolve())!=b||at&&Dn(new at)!=S||ae&&Dn(new ae)!=R)&&(Dn=function(C){var T=di(C),M=T==p?C.constructor:void 0,te=M?ir(M):"";if(te)switch(te){case pt:return K;case mn:return w;case X:return b;case ue:return S;case le:return R}return T});function pp(C,T){return T=T??s,!!T&&(typeof C=="number"||q.test(C))&&C>-1&&C%1==0&&C<T}function hp(C){var T=typeof C;return T=="string"||T=="number"||T=="symbol"||T=="boolean"?C!=="__proto__":C===null}function mp(C){return!!ln&&ln in C}function gp(C){var T=C&&C.constructor,M=typeof T=="function"&&T.prototype||De;return C===M}function yp(C){return dn.call(C)}function ir(C){if(C!=null){try{return pe.call(C)}catch{}try{return C+""}catch{}}return""}function sc(C,T){return C===T||C!==C&&T!==T}var vp=nc(function(){return arguments}())?nc:function(C){return fi(C)&&_e.call(C,"callee")&&!En.call(C,"callee")},zi=Array.isArray;function wp(C){return C!=null&&cc(C.length)&&!ac(C)}var Zo=Tn||xp;function bp(C,T){return rc(C,T)}function ac(C){if(!uc(C))return!1;var T=di(C);return T==m||T==y||T==f||T==v}function cc(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=s}function uc(C){var T=typeof C;return C!=null&&(T=="object"||T=="function")}function fi(C){return C!=null&&typeof C=="object"}var lc=z?rt(z):ap;function Ip(C){return wp(C)?rp(C):cp(C)}function Cp(){return[]}function xp(){return!1}e.exports=bp})(bo,bo.exports);var dw=bo.exports;const xl=ko(dw),Je=async(e,t)=>{var n;if(e instanceof Zu){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);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 u=`${a} ${s!=null&&s.remedy?`
|
|
4
4
|
|
|
5
|
-
[Remedy] ${s.remedy}`:""}`;t&&t(u)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)};function ko(){const e=st(),{projectIdOrName:t}=je(),{setError:n,removeError:r}=an(),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(we.INTEGRATION_LIST,t)):r(we.INTEGRATION_LIST,t)},[o.isError,o.error,t,n,r]),o}const da=(e,t)=>{var s;const n=st(),{projectIdOrName:r}=je(),{data:o}=ko(),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})},Zn=()=>{var o,i;const{setError:e}=an(),t=st(),{projectIdOrName:n}=je(),r=Yn({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return b.useEffect(()=>{r.isError&&e(we.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 Nr(){const{integrationNameOrId:e,groupRef:t}=Tr(),n=da(e,t),{isPending:r,isFetching:o,isError:i,isSuccess:s,error:a,data:u}=n;return{installation:u==null?void 0:u[0],isPending:r,isFetching:o,isError:i,isSuccess:s,error:a}}const oi=e=>{const t=ko(),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}},fa=()=>{const{groupRef:e,integrationNameOrId:t}=Tr(),{provider:n}=oi(t),r=ga({groupRef:e,provider:n}),{isPending:o,isFetching:i,isError:s,isSuccess:a,error:u,data:f}=r;return{connection:f==null?void 0:f[0],error:u,isPending:o,isFetching:i,isError:s,isSuccess:a}},xl=()=>{var h;const e=Ue(),t=st(),{connection:n,isPending:r,isFetching:o}=fa(),{projectIdOrName:i}=je(),{integrationNameOrId:s}=Tr(),{data:a}=oi(s),u=n==null?void 0:n.id,f=a==null?void 0:a.id,l=(h=a==null?void 0:a.latestRevision)==null?void 0:h.id,d=r||o;return b.useEffect(()=>{u||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[u,e]),Yn({queryKey:["amp","hydratedRevision",i,f,l,u],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!f)throw new Error("integrationId is required");if(!l)throw new Error("revisionId is required");if(!u)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:f,revisionId:l,connectionId:u})},retry:3,enabled:!!i&&!!f&&!!l&&!!u&&!d})};function pa(){var f,l;const e=xl(),{isPending:t,isFetching:n,isError:r,isSuccess:o,error:i,data:s}=e,a=s==null?void 0:s.content,u=b.useMemo(()=>({getReadObject:d=>{var m,y;const h=(y=(m=a==null?void 0:a.read)==null?void 0:m.objects)==null?void 0:y.find(w=>w.objectName===d);return h?{object:h,getRequiredFields:()=>h.requiredFields??[],getOptionalFields:()=>h.optionalFields??[]}:(console.error(`Object ${d} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:d=>{var m,y;const h=(y=(m=a==null?void 0:a.write)==null?void 0:m.objects)==null?void 0:y.find(w=>w.objectName===d);return h?{object:h}:(console.error(`Object ${d} not found`),{object:null})},getCustomerFieldsForObject:d=>{var m,y;const h=(y=(m=a==null?void 0:a.read)==null?void 0:m.objects)==null?void 0:y.find(w=>w.objectName===d);return h?{allFields:h.allFieldsMetadata??{},getField:w=>{var O;const g=(O=h.allFieldsMetadata)==null?void 0:O[w];return g||(console.error(`Field ${w} not found`),null)}}:(console.error(`Object ${d} not found`),{allFields:null,getField:()=>null})}}),[(f=a==null?void 0:a.read)==null?void 0:f.objects,(l=a==null?void 0:a.write)==null?void 0:l.objects]);return{data:s,...u,isPending:t,isFetching:n,isError:r,isSuccess:o,error:i}}function fw(e){var m,y,w,g;const[t,n]=b.useState(e),r=b.useRef(void 0),{getReadObject:o,data:i}=pa(),{installation:s}=Nr(),a=b.useCallback(()=>t,[t]),u=b.useCallback((O,p)=>{var S,F;p.provider=p.provider||((S=i==null?void 0:i.content)==null?void 0:S.provider)||"";const v=p.read||{objects:{}},I=v.objects||{},x=I[O]||{},E=o(O),A={};return(F=E==null?void 0:E.getRequiredFields())==null||F.forEach(R=>{"fieldName"in R&&(A[R.fieldName]=!0)}),x.objectName=x.objectName||O,x.selectedFields=x.selectedFields||A,I[O]=x,v.objects=I,p.read=v,{read:v,objects:I,obj:x}},[o,(m=i==null?void 0:i.content)==null?void 0:m.provider]),f=b.useCallback(O=>{var p,v;return{object:(v=(p=t.read)==null?void 0:p.objects)==null?void 0:v[O],getSelectedField:I=>{var x,E,A,S;return!!((S=(A=(E=(x=t.read)==null?void 0:x.objects)==null?void 0:E[O])==null?void 0:A.selectedFields)!=null&&S[I])},setSelectedField:({fieldName:I,selected:x})=>{n(E=>Et(E,A=>{const{obj:S}=u(O,A);S.selectedFields=S.selectedFields||{},S.selectedFields[I]=x,S.selectedFields[I]===!1&&delete S.selectedFields[I]}))},getFieldMapping:I=>{var x,E,A,S;return(S=(A=(E=(x=t.read)==null?void 0:x.objects)==null?void 0:E[O])==null?void 0:A.selectedFieldMappings)==null?void 0:S[I]},setFieldMapping:({fieldName:I,mapToName:x})=>{n(E=>Et(E,A=>{const{obj:S}=u(O,A);S.selectedFieldMappings=S.selectedFieldMappings||{},S.selectedFieldMappings[x]=I}))},deleteFieldMapping:I=>{n(x=>Et(x,E=>{var S,F,R;const A=(R=(F=(S=E.read)==null?void 0:S.objects)==null?void 0:F[O])==null?void 0:R.selectedFieldMappings;A&&I in A&&delete A[I]}))}}},[(y=t.read)==null?void 0:y.objects,u]),l=b.useCallback(O=>{var E,A;const p=(A=(E=t.write)==null?void 0:E.objects)==null?void 0:A[O],v=S=>{const F=S.write||{},R=F.objects||{},D=R[O]||{objectName:O};return R[O]=D,F.objects=R,S.write=F,{write:F,objects:R,obj:D}},I=(S,F)=>{var R,D;return(D=(R=p==null?void 0:p.selectedFieldSettings)==null?void 0:R[S])==null?void 0:D[F]},x=(S,F,R)=>{n(D=>Et(D,K=>{var L;const{obj:j}=v(K);j.selectedFieldSettings={...j.selectedFieldSettings,[S]:{...(L=j.selectedFieldSettings)==null?void 0:L[S],[F]:R}}}))};return{object:p,setEnableWrite:()=>{n(S=>Et(S,F=>{const{obj:R}=v(F);R.objectName=O}))},setDisableWrite:()=>{n(S=>Et(S,F=>{const{objects:R}=v(F);delete R[O]}))},getWriteObject:()=>{var S,F;return(F=(S=t.write)==null?void 0:S.objects)==null?void 0:F[O]},getSelectedFieldSettings:S=>{var F;return(F=p==null?void 0:p.selectedFieldSettings)==null?void 0:F[S]},setSelectedFieldSettings:({fieldName:S,settings:F})=>{n(R=>Et(R,D=>{const{obj:K}=v(D),j=K.selectedFieldSettings||{};K.selectedFieldSettings={...j,[S]:F},F===void 0&&delete K.selectedFieldSettings[S]}))},getDefaultValues:S=>I(S,"default"),setDefaultValues:({fieldName:S,value:F})=>x(S,"default",F),getWriteOnCreateSetting:S=>I(S,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:S,value:F})=>x(S,"writeOnCreate",F),getWriteOnUpdateSetting:S=>I(S,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:S,value:F})=>x(S,"writeOnUpdate",F)}},[(w=t.write)==null?void 0:w.objects]),d=b.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(O=>Et(O,p=>{p.proxy={enabled:!0}}))},setDisableProxy:()=>{n(O=>Et(O,p=>{p.proxy={enabled:!1}}))},getProxyEnabled:()=>{var O;return((O=t.proxy)==null?void 0:O.enabled)||!1}}),[t.proxy]),h=b.useCallback(()=>{n(O=>Et(O,p=>{var v;Object.assign(p,(v=s==null?void 0:s.config)==null?void 0:v.content)}))},[(g=s==null?void 0:s.config)==null?void 0:g.content]);return b.useEffect(()=>{s&&(console.debug("Installation found",{installation:s}),r.current?Cl(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:l,proxy:d}}const ha=b.createContext(null);function pw({children:e,initialConfig:t}){const n=fw(t);return c.jsx(ha.Provider,{value:n,children:e})}function hw(){const e=b.useContext(ha);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function mw(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=b.useContext(ha);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const Ol=b.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Tr(){const e=b.useContext(Ol);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function ma({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 c.jsx(Ol.Provider,{value:s,children:c.jsx(pw,{initialConfig:{},children:e})})}class Us{constructor(t){this.connectionApi=new Hv(t),this.installationApi=new Wv(t),this.integrationApi=new zv(t),this.oAuthApi=new Qv(t),this.projectApi=new Gv(t),this.providerApi=new Xv(t),this.providerAppApi=new Yv(t),this.revisionApi=new Zv(t)}}const _l="2.9.7",gw="v1",to="https://api.withampersand.com";function Sl(){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 to;case"mock":return"http://127.0.0.1:4010";case"":return to;default:return e??to}}catch{return to}}const yw=(e,t)=>`${e}/${t}`;function vw(){return yw(Sl(),gw)}const El=Sl(),Nl=vw(),ww=new aa({basePath:Nl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":_l}});new Us(ww);const bw=e=>({header:"X-Api-Key",value:e}),Iw=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")}},Dc=(e,t)=>new aa({basePath:Nl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":_l,[e]:t}});function st(){const e=zu(),{getToken:t}=wh(),{consumerRef:n,groupRef:r}=Tr();return b.useCallback(async()=>{if(e){const i=bw(e),s=Dc(i.header,i.value);return new Us(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=Iw(i),a=Dc(s.header,s.value);return new Us(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 ga=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=je(),r=st();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 Cw(){return c.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.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"}),c.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const xw="_box_1p7c5_1",Mc={box:xw};function _n({children:e,className:t,style:n}){return c.jsx("div",{className:t?`${Mc.box} ${t}`:Mc.box,style:n,children:e})}const Ow="_container_1wvzr_1",kc={container:Ow};function si({children:e,className:t,style:n}){return c.jsx("div",{className:t?`${kc.container} ${t}`:kc.container,style:n,children:e})}const _w="_errorBoxContainer_4sdb2_1",Sw="_errorBox_4sdb2_1",Ew="_errorText_4sdb2_20",qs={errorBoxContainer:_w,errorBox:Sw,errorText:Ew};function Tl({message:e}){return c.jsx(_n,{className:qs.errorBox,children:c.jsx("p",{className:qs.errorText,children:e})})}function Rl({message:e,children:t}){return c.jsxs(si,{className:qs.errorBoxContainer,children:[c.jsx(Cw,{}),c.jsx(Tl,{message:e}),t]})}const Nw="_loader_6ubm6_1",Tw={loader:Nw};function Rw(){return c.jsx("span",{className:Tw.loader})}function _i(){return c.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:c.jsx(Rw,{})})}function Al({children:e}){return c.jsx(si,{style:{maxWidth:"55rem"},children:c.jsx(_n,{children:e})})}function ai(){return c.jsx(Al,{children:c.jsx(_i,{})})}function Tt({message:e,children:t}){return c.jsx(Al,{children:c.jsx(Rl,{message:e,children:t})})}function on(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Aw(e,t){return(t==null?void 0:t.displayName)??on(e)}const Fw=e=>e.split(`
|
|
6
|
-
`).filter(n=>n.trim()!==""),Pw=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null;function Dw(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 Mw=()=>{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}},Fl=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 at(){const e=b.useContext(Fl);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function kw({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:u,fieldMapping:f,resetComponent:l}){const{data:d}=ko(),{setError:h,isError:m,removeError:y}=an(),{isIntegrationDeleted:w,setIntegrationDeleted:g,resetIntegrationDeleted:O}=Mw(),p=b.useMemo(()=>Pw(t,d||[]),[t,d]),{data:v,isLoading:I,isError:x,error:E}=da(t,o),A=(v==null?void 0:v[0])||null;b.useEffect(()=>{O()},[t,n,r,o,i,f]),b.useEffect(()=>{p===null&&(d!=null&&d.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,p,d]),b.useEffect(()=>{x?(h(we.INSTALLATION_LIST,(p==null?void 0:p.id)||""),He(E)):y(we.INSTALLATION_LIST,(p==null?void 0:p.id)||"")},[x,p,h,y,E]);const S=Ue(),F=b.useCallback(()=>{S.invalidateQueries({queryKey:["amp","installations"]})},[S]),R=b.useCallback(j=>{S.setQueryData(["amp","installations"],[j]),S.invalidateQueries({queryKey:["amp","installations"]})},[S]),D=(p==null?void 0:p.id)||"",K=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:R,resetInstallations:F,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:u,isIntegrationDeleted:w,setIntegrationDeleted:g,fieldMapping:f,resetComponent:l}),[p,n,r,o,i,A,R,F,s,a,u,w,g,f,l]);if(I)return c.jsx(ai,{});if(p===null)return c.jsx(Tt,{message:`Integration "${t}" not found`});if(m(we.INSTALLATION_LIST,D)){const j=`Error retrieving installation information for integration "${(p==null?void 0:p.name)||"unknown"}"`;return c.jsx(Tt,{message:j})}return c.jsx(Fl.Provider,{value:K,children:e})}const Pl=b.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Qt=()=>{const e=b.useContext(Pl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Dl({groupRef:e,provider:t,children:n}){const r=Ue(),{setError:o,isError:i}=an(),{projectIdOrName:s,isLoading:a}=Zn(),{integrationId:u,groupRef:f}=at(),{provider:l}=oi(u),{data:d,isLoading:h,isError:m,error:y}=ga({groupRef:e||f,provider:l||t}),w=d==null?void 0:d[0],g=b.useCallback(v=>{r.setQueryData(["amp","connections"],()=>v),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),O=b.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);b.useEffect(()=>{m?(o(we.CONNECTION_LIST,s,!0),He(y)):o(we.CONNECTION_LIST,s,!1)},[m,o,s,y]);const p=b.useMemo(()=>({connections:d||null,isConnectionsLoading:h,selectedConnection:w||null,setConnections:g,setSelectedConnection:O}),[d,h,w,g,O]);if(h||a)return c.jsx(ai,{});if(s&&i(we.PROJECT,s))return c.jsx(Tt,{message:`Error loading project ${s}`});if(s&&i(we.CONNECTION_LIST,s))return c.jsx(Tt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID or Project Name not found. ConnectionsProvider must be used within AmpersandProvider");return c.jsx(Pl.Provider,{value:p,children:n})}const Ml=()=>{const e=st(),t=Ue(),[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 jw(e){return typeof e.provider=="string"}function Lw(e){if(!jw(e))throw new Error("Config must have a provider field for creation");return e}function kl(){const{projectIdOrName:e}=je(),{groupRef:t,integrationNameOrId:n}=Tr(),{data:r}=oi(n),{connection:o}=fa(),{installation:i}=Nr(),s=Ue(),{mutate:a,isIdle:u,isPending:f,error:l,errorMsg:d}=Ml();return{createInstallation:({config:m,onSuccess:y,onError:w,onSettled:g})=>{if(i){const p=new Error("Installation already created. Try updating instead.");w==null||w(p),g==null||g();return}if(!r){const p=new Error("No integration found");w==null||w(p),g==null||g();return}const O={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:o==null?void 0:o.id,config:{content:Lw(m)}}};return a(O,{onSuccess:p=>{y==null||y(p)},onError:p=>{w==null||w(p)},onSettled:()=>{g==null||g(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:u,isPending:f,error:l,errorMsg:d}}const Vw=()=>{const e=st(),t=Ue(),[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 jl(){const{projectIdOrName:e}=je(),{integrationNameOrId:t}=Tr(),{data:n}=oi(t),{installation:r}=Nr(),o=Ue(),{mutate:i,isIdle:s,isPending:a,error:u,errorMsg:f}=Vw();return{updateInstallation:({config:d,onSuccess:h,onError:m,onSettled:y})=>{var v,I,x,E,A;if(!r){const S=new Error("Installation not created yet. Try creating the installation first.");m==null||m(S),y==null||y();return}if(!n){const S=new Error("No integration found");m==null||m(S),y==null||y();return}const w=[],g=Object.keys(((v=d==null?void 0:d.write)==null?void 0:v.objects)||{}).length,O=Object.keys(((E=(x=(I=r==null?void 0:r.config)==null?void 0:I.content)==null?void 0:x.write)==null?void 0:E.objects)||{}).length;if((g>0||g===0&&O>0)&&w.push("config.content.write.objects"),(A=d==null?void 0:d.read)!=null&&A.objects){const S=Object.keys(d.read.objects);w.push(...S.map(F=>`config.content.read.objects.${F}`))}const p={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:w,installation:{config:{content:d}}}};return i(p,{onSuccess:S=>{h==null||h(S)},onError:S=>{m==null||m(S)},onSettled:()=>{y==null||y(),o.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:u,errorMsg:f}}const $w=()=>{const e=st(),t=Ue(),[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 Kw(){const{projectIdOrName:e}=je(),{integrationNameOrId:t}=Tr(),{data:n}=oi(t),{installation:r}=Nr(),o=Ue(),{mutate:i,isIdle:s,isPending:a,error:u,errorMsg:f}=$w();return{deleteInstallation:({onSuccess:d,onError:h,onSettled:m})=>{if(!r){const y=new Error("Installation not found. Not able to delete installation.");h==null||h(y),m==null||m();return}if(!n){const y=new Error("No integration found");h==null||h(y),m==null||m();return}return i({projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id},{onSuccess:()=>{d==null||d()},onError:y=>{h==null||h(y)},onSettled:()=>{m==null||m(),o.invalidateQueries({queryKey:["amp","installations"]}),o.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:u,errorMsg:f}}function Ll(){const[e,t]=b.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var bo={exports:{}};bo.exports;(function(e,t){var n=9007199254740991,r="[object Arguments]",o="[object Function]",i="[object GeneratorFunction]",s="[object Map]",a="[object Object]",u="[object Promise]",f="[object Set]",l="[object WeakMap]",d="[object DataView]",h=/[\\^$.*+?()[\]{}|]/g,m=/^\[object .+?Constructor\]$/,y=typeof Hn=="object"&&Hn&&Hn.Object===Object&&Hn,w=typeof self=="object"&&self&&self.Object===Object&&self,g=y||w||Function("return this")(),O=t&&!t.nodeType&&t,p=O&&!0&&e&&!e.nodeType&&e,v=p&&p.exports===O;function I(J,pe){return J==null?void 0:J[pe]}function x(J){var pe=!1;if(J!=null&&typeof J.toString!="function")try{pe=!!(J+"")}catch{}return pe}function E(J,pe){return function(_e){return J(pe(_e))}}var A=Function.prototype,S=Object.prototype,F=g["__core-js_shared__"],R=function(){var J=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||"");return J?"Symbol(src)_1."+J:""}(),D=A.toString,K=S.hasOwnProperty,j=S.toString,L=RegExp("^"+D.call(K).replace(h,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),se=v?g.Buffer:void 0,re=S.propertyIsEnumerable,ge=se?se.isBuffer:void 0,de=E(Object.keys,Object),be=k(g,"DataView"),P=k(g,"Map"),$=k(g,"Promise"),H=k(g,"Set"),U=k(g,"WeakMap"),q=!re.call({valueOf:1},"valueOf"),V=Ce(be),G=Ce(P),Z=Ce($),Y=Ce(H),ee=Ce(U);function ne(J){return j.call(J)}function ce(J){if(!Ye(J)||z(J))return!1;var pe=yt(J)||x(J)?L:m;return pe.test(Ce(J))}function k(J,pe){var _e=I(J,pe);return ce(_e)?_e:void 0}var ve=ne;(be&&ve(new be(new ArrayBuffer(1)))!=d||P&&ve(new P)!=s||$&&ve($.resolve())!=u||H&&ve(new H)!=f||U&&ve(new U)!=l)&&(ve=function(J){var pe=j.call(J),_e=pe==a?J.constructor:void 0,ln=_e?Ce(_e):void 0;if(ln)switch(ln){case V:return d;case G:return s;case Z:return u;case Y:return f;case ee:return l}return pe});function z(J){return!!R&&R in J}function Xe(J){var pe=J&&J.constructor,_e=typeof pe=="function"&&pe.prototype||S;return J===_e}function Ce(J){if(J!=null){try{return D.call(J)}catch{}try{return J+""}catch{}}return""}function ct(J){return xe(J)&&K.call(J,"callee")&&(!re.call(J,"callee")||j.call(J)==r)}var qe=Array.isArray;function rt(J){return J!=null&&vt(J.length)&&!yt(J)}function xe(J){return Ze(J)&&rt(J)}var ze=ge||De;function ft(J){if(rt(J)&&(qe(J)||typeof J=="string"||typeof J.splice=="function"||ze(J)||ct(J)))return!J.length;var pe=ve(J);if(pe==s||pe==f)return!J.size;if(q||Xe(J))return!de(J).length;for(var _e in J)if(K.call(J,_e))return!1;return!0}function yt(J){var pe=Ye(J)?j.call(J):"";return pe==o||pe==i}function vt(J){return typeof J=="number"&&J>-1&&J%1==0&&J<=n}function Ye(J){var pe=typeof J;return!!J&&(pe=="object"||pe=="function")}function Ze(J){return!!J&&typeof J=="object"}function De(){return!1}e.exports=ft})(bo,bo.exports);var Uw=bo.exports;const qw=Mo(Uw),Qr="other",Io="manage-tab";function er(e){return!e.fieldName}function Vl(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Bw(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!er(n)&&!!n.fieldName))||null}function Jw(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>er(r)&&!!r.mapToName))||[]}function Hw(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>er(r)&&!!r.mapToName))||[]}function $l(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!er(n)&&!!n.fieldName))||null}const Kl=(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 Ww(e){return er(e)?e.mapToName:e.fieldName}const Ul=(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)&&on(s==null?void 0:s.objectName),completed:e?!!Kl(e,s.objectName):!1})}),n},ql=e=>{var n;return{name:Qr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function zw(e,t){var i;const n=Ul(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?ql(e):void 0;return o&&n.push(o),n}function Bl(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(we.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function jc(e,t){return qw(e)?!0:Object.values(e).every(t)}function ya(e,t,n){const r=jc(e,n),o=jc(t,n);return r&&o?!0:r!==o?!1:Cl(e,t)}function Jl(e,t){return ya(e,t,n=>n===!1||n===void 0)}function Hl(e,t){return ya(e,t,n=>!n||n==="")}function Wl(e,t){return ya(e,t,n=>!n||typeof n!="object"?!0:Object.keys(n).length===0)}function zl(e,t){const n=new Set(Object.values(e).map(o=>o==null?void 0:o.objectName)),r=new Set(Object.values(t).map(o=>o==null?void 0:o.objectName));return n.size===r.size&&[...n].every(o=>r.has(o))}const Qw=(e,t,n)=>{var y,w,g,O,p,v;if(!e)return null;const r=Vl(e,t),o=r&&Bw(r),i=r&&$l(r),s=r&&Jw(r),a=r&&Hw(r),u=(r==null?void 0:r.allFields)||[],f=(r==null?void 0:r.allFieldsMetadata)||{},l=n==null?void 0:n.content,d=((g=(w=(y=l==null?void 0:l.read)==null?void 0:y.objects)==null?void 0:w[t])==null?void 0:g.selectedValueMappings)||{},h=((v=(p=(O=l==null?void 0:l.read)==null?void 0:O.objects)==null?void 0:p[t])==null?void 0:v.selectedFieldMappings)||{},m=va(n,{content:{read:e}},t);return{allFields:u,allFieldsMetadata:f,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:m,selectedFieldMappings:h,selectedValueMappings:d}},Gw=(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||{}}};function Ql(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:Qw(r,t,n),write:Gw(o,n)}}const Gl=(e,t,n,r)=>{const o=Ql(e,n,t);r(n,o)},Xw=(e,t,n)=>{const r=zw(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=Ql(e,i,t))}),n(o)},Xl=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(Ww(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},Yl=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},Zl=(e,t)=>!t||!t[e]?[]:t[e],ed=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t},va=(e,t,n)=>{var f,l,d,h,m;if(!e||!t)return{};const r=(f=t==null?void 0:t.content)==null?void 0:f.read;if(!r)return{};const o=Vl(r,n),i=o&&$l(o),s=new Set((i==null?void 0:i.filter(y=>!er(y)&&!!y.fieldName).map(y=>y.fieldName))||[]),a=((m=(h=(d=(l=e==null?void 0:e.content)==null?void 0:l.read)==null?void 0:d.objects)==null?void 0:h[n])==null?void 0:m.selectedFields)||{};return Object.entries(a).reduce((y,[w,g])=>(s.has(w)&&(y[w]=g),y),{})},td=(e,t)=>{var r,o,i,s;return!e||!t?{}:((s=(i=(o=(r=e==null?void 0:e.content)==null?void 0:r.read)==null?void 0:o.objects)==null?void 0:i[t])==null?void 0:s.selectedFieldMappings)||{}};function nd(e,t){return t[e]||void 0}function Mi(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Yw=(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)},Zw=(e,t,n,r,o)=>{const i=Xl(e),s=Yl(e),a=Zl(t,o),u=ed(e),f=Yw(n,t);if(!f)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const l={createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,selectedFields:i,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:u||{},backfill:f.backfill}}}}};return Mi(n)&&(l.content.proxy={enabled:!0}),l},rd=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},eb=e=>{const t=e.content.write;return t==null?void 0:t.objects},tb=(e,t,n)=>{if(!eb(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=rd(e),i={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return Mi(t)&&(i.content.proxy={enabled:!0}),i};var id={exports:{}};/*!
|
|
5
|
+
[Remedy] ${s.remedy}`:""}`;t&&t(u)}catch(o){console.error("Error parsing error response body:",o)}}else console.error("Unexpected error:",e.message)};function jo(){const e=ut(),{projectIdOrName:t}=Ke(),{setError:n,removeError:r}=sn(),i=Er({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 I.useEffect(()=>{i.isError?(Je(i.error),n(we.INTEGRATION_LIST,t)):r(we.INTEGRATION_LIST,t)},[i.isError,i.error,t,n,r]),i}const fa=(e,t)=>{var s;const n=ut(),{projectIdOrName:r}=Ke(),{data:i}=jo(),o=(s=i==null?void 0:i.find(a=>a.name===e))==null?void 0:s.id;return Er({queryKey:["amp","installations",r,o,t],queryFn:async()=>{if(!r)throw new Error("Project ID is required");if(!o)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await n()).installationApi.listInstallations({projectIdOrName:r,integrationId:o,groupRef:t})},enabled:!!r&&!!o&&!!t&&!!i&&i.length>0})},Yn=()=>{var i,o;const{setError:e}=sn(),t=ut(),{projectIdOrName:n}=Ke(),r=Er({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return I.useEffect(()=>{r.isError&&e(we.PROJECT,n)},[r.isError,n,e]),{...r,projectIdOrName:n,appName:(i=r.data)==null?void 0:i.name,projectId:(o=r.data)==null?void 0:o.id}};function Nr(){const{integrationNameOrId:e,groupRef:t}=Tr(),n=fa(e,t),{isPending:r,isFetching:i,isError:o,isSuccess:s,error:a,data:u}=n;return{installation:u==null?void 0:u[0],isPending:r,isFetching:i,isError:o,isSuccess:s,error:a}}const oi=e=>{const t=jo(),n=t.data,r=n==null?void 0:n.find(i=>i.name===e||i.id===e);return{...t,data:r,provider:r==null?void 0:r.provider}},pa=()=>{const{groupRef:e,integrationNameOrId:t}=Tr(),{provider:n}=oi(t),r=ga({groupRef:e,provider:n}),{isPending:i,isFetching:o,isError:s,isSuccess:a,error:u,data:f}=r;return{connection:f==null?void 0:f[0],error:u,isPending:i,isFetching:o,isError:s,isSuccess:a}},Ol=()=>{var d;const e=ut(),{connection:t,isPending:n,isFetching:r}=pa(),{projectIdOrName:i}=Ke(),{integrationNameOrId:o}=Tr(),{data:s}=oi(o),a=t==null?void 0:t.id,u=s==null?void 0:s.id,f=(d=s==null?void 0:s.latestRevision)==null?void 0:d.id;return Er({queryKey:["amp","hydratedRevision",i,u,f,a],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!u)throw new Error("integrationId is required");if(!f)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await e()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:u,revisionId:f,connectionId:a})},enabled:!!i&&!!u&&!!f&&!!a&&!(n||r)})};function Lo(){var l,d;const e=Ol(),{isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,data:a}=e,u=a==null?void 0:a.content,f=I.useMemo(()=>({getReadObject:h=>{var y,w;const m=(w=(y=u==null?void 0:u.read)==null?void 0:y.objects)==null?void 0:w.find(g=>g.objectName===h);return m?{object:m,getRequiredFields:()=>m.requiredFields??[],getOptionalFields:()=>m.optionalFields??[]}:(console.error(`Object ${h} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:h=>{var y,w;const m=(w=(y=u==null?void 0:u.write)==null?void 0:y.objects)==null?void 0:w.find(g=>g.objectName===h);return m?{object:m}:(console.error(`Object ${h} not found`),{object:null})},getCustomerFieldsForObject:h=>{var y,w;const m=(w=(y=u==null?void 0:u.read)==null?void 0:y.objects)==null?void 0:w.find(g=>g.objectName===h);return m?{allFields:m.allFieldsMetadata??{},getField:g=>{var p;const O=(p=m.allFieldsMetadata)==null?void 0:p[g];return O||(console.error(`Field ${g} not found`),null)}}:(console.error(`Object ${h} not found`),{allFields:null,getField:()=>null})}}),[(l=u==null?void 0:u.read)==null?void 0:l.objects,(d=u==null?void 0:u.write)==null?void 0:d.objects]);return{data:a,isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,...f}}function fw(e){var m,y,w,g;const[t,n]=I.useState(e),r=I.useRef(void 0),{getReadObject:i,data:o}=Lo(),{installation:s}=Nr(),a=I.useCallback(()=>t,[t]),u=I.useCallback((O,p)=>{var N,F;p.provider=p.provider||((N=o==null?void 0:o.content)==null?void 0:N.provider)||"";const b=p.read||{objects:{}},v=b.objects||{},x=v[O]||{},S=i(O),A={};return(F=S==null?void 0:S.getRequiredFields())==null||F.forEach(R=>{"fieldName"in R&&(A[R.fieldName]=!0)}),x.objectName=x.objectName||O,x.selectedFields=x.selectedFields||A,v[O]=x,b.objects=v,p.read=b,{read:b,objects:v,obj:x}},[i,(m=o==null?void 0:o.content)==null?void 0:m.provider]),f=I.useCallback(O=>{var p,b;return{object:(b=(p=t.read)==null?void 0:p.objects)==null?void 0:b[O],getSelectedField:v=>{var x,S,A,N;return!!((N=(A=(S=(x=t.read)==null?void 0:x.objects)==null?void 0:S[O])==null?void 0:A.selectedFields)!=null&&N[v])},setSelectedField:({fieldName:v,selected:x})=>{n(S=>Nt(S,A=>{const{obj:N}=u(O,A);N.selectedFields=N.selectedFields||{},N.selectedFields[v]=x,N.selectedFields[v]===!1&&delete N.selectedFields[v]}))},getFieldMapping:v=>{var x,S,A,N;return(N=(A=(S=(x=t.read)==null?void 0:x.objects)==null?void 0:S[O])==null?void 0:A.selectedFieldMappings)==null?void 0:N[v]},setFieldMapping:({fieldName:v,mapToName:x})=>{n(S=>Nt(S,A=>{const{obj:N}=u(O,A);N.selectedFieldMappings=N.selectedFieldMappings||{},N.selectedFieldMappings[x]=v}))},deleteFieldMapping:v=>{n(x=>Nt(x,S=>{var N,F,R;const A=(R=(F=(N=S.read)==null?void 0:N.objects)==null?void 0:F[O])==null?void 0:R.selectedFieldMappings;A&&v in A&&delete A[v]}))}}},[(y=t.read)==null?void 0:y.objects,u]),l=I.useCallback(O=>{var S,A;const p=(A=(S=t.write)==null?void 0:S.objects)==null?void 0:A[O],b=N=>{const F=N.write||{},R=F.objects||{},D=R[O]||{objectName:O};return R[O]=D,F.objects=R,N.write=F,{write:F,objects:R,obj:D}},v=(N,F)=>{var R,D;return(D=(R=p==null?void 0:p.selectedFieldSettings)==null?void 0:R[N])==null?void 0:D[F]},x=(N,F,R)=>{n(D=>Nt(D,K=>{var L;const{obj:j}=b(K);j.selectedFieldSettings={...j.selectedFieldSettings,[N]:{...(L=j.selectedFieldSettings)==null?void 0:L[N],[F]:R}}}))};return{object:p,setEnableWrite:()=>{n(N=>Nt(N,F=>{const{obj:R}=b(F);R.objectName=O}))},setDisableWrite:()=>{n(N=>Nt(N,F=>{const{objects:R}=b(F);delete R[O]}))},getWriteObject:()=>{var N,F;return(F=(N=t.write)==null?void 0:N.objects)==null?void 0:F[O]},getSelectedFieldSettings:N=>{var F;return(F=p==null?void 0:p.selectedFieldSettings)==null?void 0:F[N]},setSelectedFieldSettings:({fieldName:N,settings:F})=>{n(R=>Nt(R,D=>{const{obj:K}=b(D),j=K.selectedFieldSettings||{};K.selectedFieldSettings={...j,[N]:F},F===void 0&&delete K.selectedFieldSettings[N]}))},getDefaultValues:N=>v(N,"default"),setDefaultValues:({fieldName:N,value:F})=>x(N,"default",F),getWriteOnCreateSetting:N=>v(N,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:N,value:F})=>x(N,"writeOnCreate",F),getWriteOnUpdateSetting:N=>v(N,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:N,value:F})=>x(N,"writeOnUpdate",F)}},[(w=t.write)==null?void 0:w.objects]),d=I.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(O=>Nt(O,p=>{p.proxy={enabled:!0}}))},setDisableProxy:()=>{n(O=>Nt(O,p=>{p.proxy={enabled:!1}}))},getProxyEnabled:()=>{var O;return((O=t.proxy)==null?void 0:O.enabled)||!1}}),[t.proxy]),h=I.useCallback(()=>{n(O=>Nt(O,p=>{var b;Object.assign(p,(b=s==null?void 0:s.config)==null?void 0:b.content)}))},[(g=s==null?void 0:s.config)==null?void 0:g.content]);return I.useEffect(()=>{s&&(console.debug("Installation found",{installation:s}),r.current?xl(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:l,proxy:d}}const ha=I.createContext(null);function pw({children:e,initialConfig:t}){const n=fw(t);return c.jsx(ha.Provider,{value:n,children:e})}function hw(){const e=I.useContext(ha);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function mw(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=I.useContext(ha);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const _l=I.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Tr(){const e=I.useContext(_l);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function ma({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o}){const s=I.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o}),[t,n,r,i,o]);return c.jsx(_l.Provider,{value:s,children:c.jsx(pw,{initialConfig:{},children:e})})}class Bs{constructor(t){this.connectionApi=new Hv(t),this.installationApi=new Wv(t),this.integrationApi=new zv(t),this.oAuthApi=new Qv(t),this.projectApi=new Gv(t),this.providerApi=new Xv(t),this.providerAppApi=new Yv(t),this.revisionApi=new Zv(t)}}const Sl="2.9.9",gw="v1",to="https://api.withampersand.com";function El(){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 to;case"mock":return"http://127.0.0.1:4010";case"":return to;default:return e??to}}catch{return to}}const yw=(e,t)=>`${e}/${t}`;function vw(){return yw(El(),gw)}const Nl=El(),Tl=vw(),ww=new ca({basePath:Tl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Sl}});new Bs(ww);const bw=e=>({header:"X-Api-Key",value:e}),Iw=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")}},Mc=(e,t)=>new ca({basePath:Tl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Sl,[e]:t}});function ut(){const e=Qu(),{getToken:t}=wh(),{consumerRef:n,groupRef:r}=Tr();return I.useCallback(async()=>{if(e){const o=bw(e),s=Mc(o.header,o.value);return new Bs(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 o=await t({consumerRef:n,groupRef:r}),s=Iw(o),a=Mc(s.header,s.value);return new Bs(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 ga=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Ke(),r=ut();return Er({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 Cw({height:e="48",width:t="48"}){return c.jsxs("svg",{width:t,height:e,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.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"}),c.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const xw="_box_1p7c5_1",kc={box:xw};function _n({children:e,className:t,style:n}){return c.jsx("div",{className:t?`${kc.box} ${t}`:kc.box,style:n,children:e})}const Ow="_container_1wvzr_1",jc={container:Ow};function si({children:e,className:t,style:n}){return c.jsx("div",{className:t?`${jc.container} ${t}`:jc.container,style:n,children:e})}const _w="_errorBoxContainer_19655_1",Sw="_errorBox_19655_1",Ew="_errorIconWrapper_19655_23",Nw="_errorText_19655_34",uo={errorBoxContainer:_w,errorBox:Sw,errorIconWrapper:Ew,errorText:Nw};function Rl({message:e}){return c.jsxs(_n,{className:uo.errorBox,children:[c.jsx("div",{className:uo.errorIconWrapper,children:c.jsx(Cw,{width:"20",height:"20"})}),c.jsx("p",{className:uo.errorText,children:e})]})}function Al({message:e,children:t}){return c.jsxs(si,{className:uo.errorBoxContainer,children:[c.jsx(Rl,{message:e}),t]})}const Tw="_loader_6ubm6_1",Rw={loader:Tw};function Aw(){return c.jsx("span",{className:Rw.loader})}function _i(){return c.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:c.jsx(Aw,{})})}function Fl({children:e}){return c.jsx(si,{style:{maxWidth:"55rem"},children:c.jsx(_n,{children:e})})}function ai(){return c.jsx(Fl,{children:c.jsx(_i,{})})}function _t({message:e,children:t}){return c.jsx(Fl,{children:c.jsx(Al,{message:e,children:t})})}function rn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fw(e,t){return(t==null?void 0:t.displayName)??rn(e)}const Pw=e=>e.split(`
|
|
6
|
+
`).filter(n=>n.trim()!==""),Dw=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null;function Mw(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 kw=()=>{const[e,t]=I.useState(!1),n=I.useCallback(()=>{t(!0)},[t]),r=I.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},Pl=I.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 lt(){const e=I.useContext(Pl);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function jw({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:u,fieldMapping:f,resetComponent:l}){const{data:d}=jo(),{setError:h,isError:m,removeError:y}=sn(),{isIntegrationDeleted:w,setIntegrationDeleted:g,resetIntegrationDeleted:O}=kw(),p=I.useMemo(()=>Dw(t,d||[]),[t,d]),{data:b,isLoading:v,isError:x,error:S}=fa(t,i),A=(b==null?void 0:b[0])||null;I.useEffect(()=>{O()},[t,n,r,i,o,f]),I.useEffect(()=>{p===null&&(d!=null&&d.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,p,d]),I.useEffect(()=>{x?(h(we.INSTALLATION_LIST,(p==null?void 0:p.id)||""),Je(S)):y(we.INSTALLATION_LIST,(p==null?void 0:p.id)||"")},[x,p,h,y,S]);const N=We(),F=I.useCallback(()=>{N.invalidateQueries({queryKey:["amp","installations"]})},[N]),R=I.useCallback(j=>{N.setQueryData(["amp","installations"],[j]),N.invalidateQueries({queryKey:["amp","installations"]})},[N]),D=(p==null?void 0:p.id)||"",K=I.useMemo(()=>({integrationId:(p==null?void 0:p.id)||"",provider:(p==null?void 0:p.provider)||"",integrationObj:p,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:A||void 0,setInstallation:R,resetInstallations:F,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:u,isIntegrationDeleted:w,setIntegrationDeleted:g,fieldMapping:f,resetComponent:l}),[p,n,r,i,o,A,R,F,s,a,u,w,g,f,l]);if(v)return c.jsx(ai,{});if(p===null)return c.jsx(_t,{message:`Integration "${t}" not found`});if(m(we.INSTALLATION_LIST,D)){const j=`Error retrieving installation information for integration "${(p==null?void 0:p.name)||"unknown"}"`;return c.jsx(_t,{message:j})}return c.jsx(Pl.Provider,{value:K,children:e})}const Dl=I.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),an=()=>{const e=I.useContext(Dl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Ml({groupRef:e,provider:t,children:n}){const r=We(),{setError:i,isError:o}=sn(),{projectIdOrName:s,isLoading:a}=Yn(),{integrationId:u,groupRef:f}=lt(),{provider:l}=oi(u),{data:d,isLoading:h,isError:m,error:y}=ga({groupRef:e||f,provider:l||t}),w=d==null?void 0:d[0],g=I.useCallback(b=>{r.setQueryData(["amp","connections"],()=>b),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),O=I.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);I.useEffect(()=>{m?(i(we.CONNECTION_LIST,s,!0),Je(y)):i(we.CONNECTION_LIST,s,!1)},[m,i,s,y]);const p=I.useMemo(()=>({connections:d||null,isConnectionsLoading:h,selectedConnection:w||null,setConnections:g,setSelectedConnection:O}),[d,h,w,g,O]);if(h||a)return c.jsx(ai,{});if(s&&o(we.PROJECT,s))return c.jsx(_t,{message:`Error loading project ${s}`});if(s&&o(we.CONNECTION_LIST,s))return c.jsx(_t,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID or Project Name not found. ConnectionsProvider must be used within AmpersandProvider");return c.jsx(Dl.Provider,{value:p,children:n})}const kl=()=>{const e=ut(),t=We(),[n,r]=I.useState(null);return{...On({mutationKey:["createInstallation"],mutationFn:async o=>(await e()).installationApi.createInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error creating installation"),Je(o,r)}}),errorMsg:n}};function Lw(e){return typeof e.provider=="string"}function Vw(e){return Lw(e)?{data:e}:{error:new Error("Config must have a provider field for creation")}}function jl(){const{projectIdOrName:e}=Ke(),{groupRef:t,integrationNameOrId:n}=Tr(),{data:r}=oi(n),{connection:i}=pa(),{installation:o}=Nr(),s=We(),{mutate:a,isIdle:u,isPending:f,error:l,errorMsg:d}=kl();return{createInstallation:({config:m,onSuccess:y,onError:w,onSettled:g})=>{if(o){const b=new Error("Installation already created. Try updating instead.");w==null||w(b),g==null||g();return}if(!r){const b=new Error("No integration found");w==null||w(b),g==null||g();return}const O=Vw(m);if(O.error||!O.data){w==null||w(O.error||new Error("Invalid configuration data")),g==null||g();return}const p={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:i==null?void 0:i.id,config:{content:O.data}}};return a(p,{onSuccess:b=>{y==null||y(b)},onError:b=>{w==null||w(b)},onSettled:()=>{g==null||g(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:u,isPending:f,error:l,errorMsg:d}}const $w=()=>{const e=ut(),t=We(),[n,r]=I.useState(null);return{...On({mutationKey:["updateInstallation"],mutationFn:async o=>(await e()).installationApi.updateInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error updating installation"),Je(o,r)}}),errorMsg:n}};function Ll(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=Tr(),{data:n}=oi(t),{installation:r}=Nr(),i=We(),{mutate:o,isIdle:s,isPending:a,error:u,errorMsg:f}=$w();return{updateInstallation:({config:d,onSuccess:h,onError:m,onSettled:y})=>{var O,p,b,v,x;if(!r){const S=new Error("Installation not created yet. Try creating the installation first.");m==null||m(S),y==null||y();return}if(!n){const S=new Error("No integration found");m==null||m(S),y==null||y();return}const w=[];if((O=d==null?void 0:d.write)!=null&&O.objects){const S=Object.keys(d.write.objects).length,A=Object.keys(((v=(b=(p=r==null?void 0:r.config)==null?void 0:p.content)==null?void 0:b.write)==null?void 0:v.objects)||{}).length;(S>0||S===0&&A>0)&&w.push("config.content.write.objects")}if((x=d==null?void 0:d.read)!=null&&x.objects){const S=Object.keys(d.read.objects);w.push(...S.map(A=>`config.content.read.objects.${A}`))}const g={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:w,installation:{config:{content:d}}}};return o(g,{onSuccess:S=>{h==null||h(S)},onError:S=>{m==null||m(S)},onSettled:()=>{y==null||y(),i.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:u,errorMsg:f}}const Kw=()=>{const e=ut(),t=We(),[n,r]=I.useState(null);return{...On({mutationKey:["deleteInstallation"],mutationFn:async o=>(await e()).installationApi.deleteInstallation(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:o=>{console.error("Error deleting installation"),Je(o,r)}}),errorMsg:n}};function Uw(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=Tr(),{data:n}=oi(t),{installation:r}=Nr(),i=We(),{mutate:o,isIdle:s,isPending:a,error:u,errorMsg:f}=Kw();return{deleteInstallation:({onSuccess:d,onError:h,onSettled:m})=>{if(!r){const y=new Error("Installation not found. Not able to delete installation.");h==null||h(y),m==null||m();return}if(!n){const y=new Error("No integration found");h==null||h(y),m==null||m();return}return o({projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id},{onSuccess:()=>{d==null||d()},onError:y=>{h==null||h(y)},onSettled:()=>{m==null||m(),i.invalidateQueries({queryKey:["amp","installations"]}),i.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:u,errorMsg:f}}function Vl(){const[e,t]=I.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Io={exports:{}};Io.exports;(function(e,t){var n=9007199254740991,r="[object Arguments]",i="[object Function]",o="[object GeneratorFunction]",s="[object Map]",a="[object Object]",u="[object Promise]",f="[object Set]",l="[object WeakMap]",d="[object DataView]",h=/[\\^$.*+?()[\]{}|]/g,m=/^\[object .+?Constructor\]$/,y=typeof Hn=="object"&&Hn&&Hn.Object===Object&&Hn,w=typeof self=="object"&&self&&self.Object===Object&&self,g=y||w||Function("return this")(),O=t&&!t.nodeType&&t,p=O&&!0&&e&&!e.nodeType&&e,b=p&&p.exports===O;function v(J,pe){return J==null?void 0:J[pe]}function x(J){var pe=!1;if(J!=null&&typeof J.toString!="function")try{pe=!!(J+"")}catch{}return pe}function S(J,pe){return function(_e){return J(pe(_e))}}var A=Function.prototype,N=Object.prototype,F=g["__core-js_shared__"],R=function(){var J=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||"");return J?"Symbol(src)_1."+J:""}(),D=A.toString,K=N.hasOwnProperty,j=N.toString,L=RegExp("^"+D.call(K).replace(h,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),se=b?g.Buffer:void 0,re=N.propertyIsEnumerable,ge=se?se.isBuffer:void 0,de=S(Object.keys,Object),be=k(g,"DataView"),P=k(g,"Map"),$=k(g,"Promise"),H=k(g,"Set"),U=k(g,"WeakMap"),q=!re.call({valueOf:1},"valueOf"),V=Ce(be),G=Ce(P),Z=Ce($),Y=Ce(H),ee=Ce(U);function ne(J){return j.call(J)}function ce(J){if(!Ye(J)||z(J))return!1;var pe=yt(J)||x(J)?L:m;return pe.test(Ce(J))}function k(J,pe){var _e=v(J,pe);return ce(_e)?_e:void 0}var ve=ne;(be&&ve(new be(new ArrayBuffer(1)))!=d||P&&ve(new P)!=s||$&&ve($.resolve())!=u||H&&ve(new H)!=f||U&&ve(new U)!=l)&&(ve=function(J){var pe=j.call(J),_e=pe==a?J.constructor:void 0,ln=_e?Ce(_e):void 0;if(ln)switch(ln){case V:return d;case G:return s;case Z:return u;case Y:return f;case ee:return l}return pe});function z(J){return!!R&&R in J}function Xe(J){var pe=J&&J.constructor,_e=typeof pe=="function"&&pe.prototype||N;return J===_e}function Ce(J){if(J!=null){try{return D.call(J)}catch{}try{return J+""}catch{}}return""}function st(J){return xe(J)&&K.call(J,"callee")&&(!re.call(J,"callee")||j.call(J)==r)}var Ue=Array.isArray;function rt(J){return J!=null&&vt(J.length)&&!yt(J)}function xe(J){return Ze(J)&&rt(J)}var ze=ge||De;function ft(J){if(rt(J)&&(Ue(J)||typeof J=="string"||typeof J.splice=="function"||ze(J)||st(J)))return!J.length;var pe=ve(J);if(pe==s||pe==f)return!J.size;if(q||Xe(J))return!de(J).length;for(var _e in J)if(K.call(J,_e))return!1;return!0}function yt(J){var pe=Ye(J)?j.call(J):"";return pe==i||pe==o}function vt(J){return typeof J=="number"&&J>-1&&J%1==0&&J<=n}function Ye(J){var pe=typeof J;return!!J&&(pe=="object"||pe=="function")}function Ze(J){return!!J&&typeof J=="object"}function De(){return!1}e.exports=ft})(Io,Io.exports);var qw=Io.exports;const Bw=ko(qw),Qr="other",Co="manage-tab";function Zn(e){return!e.fieldName}function $l(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Jw(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Zn(n)&&!!n.fieldName))||null}function Hw(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Zn(r)&&!!r.mapToName))||[]}function Ww(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Zn(r)&&!!r.mapToName))||[]}function Kl(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Zn(n)&&!!n.fieldName))||null}const Ul=(e,t)=>{var n,r,i;return(i=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:i[t]};function zw(e){return Zn(e)?e.mapToName:e.fieldName}const ql=(e,t)=>{var r,i,o;const n=[];return(o=(i=(r=t.content)==null?void 0:r.read)==null?void 0:i.objects)==null||o.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&rn(s==null?void 0:s.objectName),completed:e?!!Ul(e,s.objectName):!1})}),n},Bl=e=>{var n;return{name:Qr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Qw(e,t){var o;const n=ql(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?Bl(e):void 0;return i&&n.push(i),n}function Jl(e,t,n){const r=(e==null?void 0:e.filter(o=>!(t!=null&&t[o==null?void 0:o.mapToName])))||[],i=r.map(o=>o.mapToName);return n(we.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Lc(e,t){return Bw(e)?!0:Object.values(e).every(t)}function ya(e,t,n){const r=Lc(e,n),i=Lc(t,n);return r&&i?!0:r!==i?!1:xl(e,t)}function Hl(e,t){return ya(e,t,n=>n===!1||n===void 0)}function Wl(e,t){return ya(e,t,n=>!n||n==="")}function zl(e,t){return ya(e,t,n=>!n||typeof n!="object"?!0:Object.keys(n).length===0)}function Ql(e,t){const n=new Set(Object.values(e).map(i=>i==null?void 0:i.objectName)),r=new Set(Object.values(t).map(i=>i==null?void 0:i.objectName));return n.size===r.size&&[...n].every(i=>r.has(i))}const Gw=(e,t,n)=>{var y,w,g,O,p,b;if(!e)return null;const r=$l(e,t),i=r&&Jw(r),o=r&&Kl(r),s=r&&Hw(r),a=r&&Ww(r),u=(r==null?void 0:r.allFields)||[],f=(r==null?void 0:r.allFieldsMetadata)||{},l=n==null?void 0:n.content,d=((g=(w=(y=l==null?void 0:l.read)==null?void 0:y.objects)==null?void 0:w[t])==null?void 0:g.selectedValueMappings)||{},h=((b=(p=(O=l==null?void 0:l.read)==null?void 0:O.objects)==null?void 0:p[t])==null?void 0:b.selectedFieldMappings)||{},m=va(n,{content:{read:e}},t);return{allFields:u,allFieldsMetadata:f,requiredFields:i,optionalFields:o,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:m,selectedFieldMappings:h,selectedValueMappings:d}},Xw=(e,t)=>{var r,i;if(!e)return null;const n=(i=(r=t==null?void 0:t.content)==null?void 0:r.write)==null?void 0:i.objects;return{writeObjects:(e==null?void 0:e.objects)||[],selectedWriteObjects:n||{}}};function Gl(e,t,n){var o,s;const r=(o=e==null?void 0:e.content)==null?void 0:o.read,i=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:Gw(r,t,n),write:Xw(i,n)}}const Xl=(e,t,n,r)=>{const i=Gl(e,n,t);r(n,i)},Yw=(e,t,n)=>{const r=Qw(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=Gl(e,o,t))}),n(i)},Yl=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(zw(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},Zl=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},ed=(e,t)=>!t||!t[e]?[]:t[e],td=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t},va=(e,t,n)=>{var f,l,d,h,m;if(!e||!t)return{};const r=(f=t==null?void 0:t.content)==null?void 0:f.read;if(!r)return{};const i=$l(r,n),o=i&&Kl(i),s=new Set((o==null?void 0:o.filter(y=>!Zn(y)&&!!y.fieldName).map(y=>y.fieldName))||[]),a=((m=(h=(d=(l=e==null?void 0:e.content)==null?void 0:l.read)==null?void 0:d.objects)==null?void 0:h[n])==null?void 0:m.selectedFields)||{};return Object.entries(a).reduce((y,[w,g])=>(s.has(w)&&(y[w]=g),y),{})},nd=(e,t)=>{var r,i,o,s;return!e||!t?{}:((s=(o=(i=(r=e==null?void 0:e.content)==null?void 0:r.read)==null?void 0:i.objects)==null?void 0:o[t])==null?void 0:s.selectedFieldMappings)||{}};function rd(e,t){return t[e]||void 0}function Mi(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Zw=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(i=>i.objectName===t)},eb=(e,t,n,r,i)=>{const o=Yl(e),s=Zl(e),a=ed(t,i),u=td(e),f=Zw(n,t);if(!f)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const l={createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:u||{},backfill:f.backfill}}}}};return Mi(n)&&(l.content.proxy={enabled:!0}),l},id=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},tb=e=>{const t=e.content.write;return t==null?void 0:t.objects},nb=(e,t,n)=>{if(!tb(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=id(e),o={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return Mi(t)&&(o.content.proxy={enabled:!0}),o};var od={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})()})(id);var nb=id.exports;const Vt=Mo(nb),rb="_button_kwfiu_1",ib="_danger_kwfiu_42",ob="_ghost_kwfiu_47",is={button:rb,danger:ib,ghost:ob};function We({className:e,style:t,type:n,children:r,variant:o,...i}){const s=Vt(is.button,{[is.danger]:o==="danger",[is.ghost]:o==="ghost",[e||""]:!!e});return c.jsx("button",{type:n,className:s,style:t,...i,children:r})}const sb={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 ki({children:e,style:t}){return c.jsx(_n,{style:{...sb,...t},children:e})}const jo=e=>{const t=st(),{provider:n}=at(),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})},dt=e=>{const t=jo(e),{data:n}=t,{provider:r}=at(),o=n&&Aw(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function cn({error:e}){return e?c.jsx(ki,{style:{marginTop:"2em"},children:e}):null}const ab="_input_1ymb7_1",cb="_inputError_1ymb7_27",os={input:ab,inputError:cb};function od({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Vt(os.inputError,os.input):os.input;return c.jsx("input",{id:e,type:t,className:Vt(i,n),...o})}function ub(){return c.jsx("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:c.jsxs("g",{opacity:"0.5",children:[c.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"}),c.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 c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[c.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"}),c.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"}),c.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 db({id:e,name:t,placeholder:n="Password",onChange:r,value:o,className:i,isError:s}){const[a,u]=b.useState(!1),f=()=>u(l=>!l);return c.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[c.jsx(Ot.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:o,className:i,isError:s}),c.jsx(We,{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:c.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?c.jsx(lb,{}):c.jsx(ub,{})})})]})}const fb="_textarea_18zl4_1",pb="_textareaError_18zl4_14",ss={textarea:fb,textareaError:pb};function hb({className:e,isError:t=!1,...n}){const r=t?Vt(ss.textareaError,ss.textarea):ss.textarea;return c.jsx("textarea",{className:Vt(e,r),...n})}const Ot={Input:od,Textarea:hb,PasswordInput:db},mb=()=>{const{projectIdOrName:e}=je(),t=st();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 sd(){var n,r;const{data:e}=mb();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:c.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:[c.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),c.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:c.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})})]})}function tr({children:e}){return c.jsx(si,{children:c.jsxs(_n,{children:[c.jsx("div",{style:{padding:"3rem 2rem"},children:e}),c.jsx(sd,{})]})})}function nr({children:e}){return c.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function gb({children:e}){return c.jsx("p",{style:{padding:".5em 0"},children:e})}const yb="_link_oo2kv_1",vb={link:yb};function wa({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return c.jsx("a",{className:Vt(vb.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function Co({url:e,providerDisplayName:t,credentialName:n}){return c.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[c.jsx(wa,{href:e,newTab:!0,children:c.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function Lo(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 Gr(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function ad({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var O,p;const[s,a]=b.useState({apiKey:""}),u=((O=t.metadata)==null?void 0:O.input)||[],f=v=>{const{name:I,value:x}=v.currentTarget;a(E=>({...E,[I]:x.trim()}))},{apiKey:l}=s,{providerName:d}=dt(e),h=l.length>0,m=Gr(u,s),y=r||!h||!m,w=(p=t.apiKeyOpts)==null?void 0:p.docsURL,g=()=>{const v=Lo(u,s);n({apiKey:l,providerMetadata:v})};return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&c.jsx(Co,{url:w,providerDisplayName:d||on(e),credentialName:"API key"}),c.jsx(Ot.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:f}),u.map(v=>c.jsxs("div",{children:[v.docsURL&&c.jsx(Co,{url:v.docsURL,providerDisplayName:d||on(e),credentialName:v.displayName||v.name}),c.jsx(Ot.Input,{id:v.name,name:v.name,type:"text",placeholder:v.displayName||v.name,onChange:f})]},v.name)),c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:y,type:i||"submit",onClick:g,variant:o,children:"Next"})]})}function wb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=dt(e);return c.jsxs(tr,{children:[c.jsx(nr,{children:`Set up ${i} integration`}),c.jsx(cn,{error:r}),c.jsx(ad,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function bb({...e}){return c.jsx(wb,{...e})}const Ib={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 c.jsx(_n,{style:{...Ib,...t},children:e})}const ba=()=>{const e=st(),t=Ue(),[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}},Cb="_divider_1kmoj_1",Lc={divider:Cb};function $o({className:e,style:t}){return c.jsx("hr",{className:e?`${Lc.divider} ${e}`:Lc.divider,style:t})}function Ft({string:e}){return c.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[c.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),c.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:c.jsx($o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function xb({provider:e}){const{projectIdOrName:t}=je(),{providerName:n,data:r}=dt(e),{selectedConnection:o,isConnectionsLoading:i}=Qt(),{mutateAsync:s,isPending:a,error:u}=ba(),[f,l]=b.useState(null),[d,h]=b.useState(!1),m=()=>h(!1),y=()=>{h(!0),l(null)},w=(u==null?void 0:u.message)||f||null,g=async O=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:O.apiKey}}},{onError:p=>{console.error("Update connection error:",p),He(p,l)},onSuccess:()=>{y()}})}catch(p){console.error("Update connection caught error:",p),He(p,l)}};return r?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${n} API Key`}),d&&c.jsx(Vo,{children:"Connection updated successfully"}),w&&c.jsx(ki,{children:`Error updating connection ${w}`}),c.jsx(ad,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function cd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var g,O;const[i,s]=b.useState({username:"",password:""}),a=((g=t.metadata)==null?void 0:g.input)||[],{username:u,password:f}=i,{providerName:l}=dt(e),d=p=>{const{name:v,value:I}=p.currentTarget;s(x=>({...x,[v]:I.trim()}))},h=Gr(a,i),m=r||!h,y=()=>{const p=Lo(a,i);n({user:u,pass:f,providerMetadata:p})},w=(O=t.basicOpts)==null?void 0:O.docsURL;return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&c.jsx(Co,{url:w,providerDisplayName:l||on(e),credentialName:"credentials"}),c.jsx(Ot.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:d}),c.jsx(Ot.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:d}),a.map(p=>c.jsxs("div",{children:[p.docsURL&&c.jsx(Co,{url:p.docsURL,providerDisplayName:l||on(e),credentialName:p.displayName||p.name}),c.jsx(Ot.Input,{id:p.name,name:p.name,type:"text",placeholder:p.displayName||p.name,onChange:d})]},p.name)),c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:m,type:"button",onClick:y,variant:o,children:"Next"})]})}function Ob({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=dt(e);return c.jsxs(tr,{children:[c.jsx(nr,{children:`Set up ${i} integration`}),c.jsx(cn,{error:r}),c.jsx(cd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function _b({...e}){return c.jsx(Ob,{...e})}function Sb({provider:e}){const{projectIdOrName:t}=je(),{providerName:n,data:r}=dt(e),{selectedConnection:o,isConnectionsLoading:i}=Qt(),{mutateAsync:s,isPending:a,error:u}=ba(),[f,l]=b.useState(null),[d,h]=b.useState(!1),m=()=>h(!1),y=()=>{h(!0),l(null)},w=(u==null?void 0:u.message)||f||null,g=async O=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:O.user,password:O.pass}}}},{onError:p=>{console.error(p),He(p,l)},onSuccess:()=>{y()}})}catch(p){console.error(p),He(p,l)}};return r?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${n} credentials`}),d&&c.jsx(Vo,{children:"Connection updated successfully"}),w&&c.jsx(ki,{children:`Error updating connection: ${w}`}),c.jsx(cd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function ud({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:o}){var I;const[i,s]=b.useState({clientSecret:"",clientId:"",scopes:""}),[a,u]=b.useState(null),{data:f}=jo(e),l=((I=f==null?void 0:f.metadata)==null?void 0:I.input)||[],d=x=>{const{name:E,value:A}=x.currentTarget;s(S=>({...S,[E]:A.trim()})),u(null)},{clientSecret:h,clientId:m,scopes:y}=i,w=h.length>0,g=m.length>0,O=Gr(l,i),p=n||!w||!g||!O,v=()=>{const x=Lo(l,i),E={clientId:m,clientSecret:h,providerMetadata:x};r&&y.length>0&&(E.scopes=Fw(y)),t(E)};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[c.jsx(Ot.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:d}),c.jsx(Ot.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:d}),r&&c.jsx(Ot.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:d}),l.map(x=>c.jsx(Ot.Input,{id:x.name,name:x.name,type:"text",placeholder:x.displayName||x.name,onChange:d},x.name))]}),c.jsx(cn,{error:a}),c.jsx("br",{}),c.jsx(We,{style:{width:"100%"},disabled:p,type:"button",onClick:v,variant:o,children:"Next"})]})}function Eb({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return c.jsxs(tr,{children:[c.jsx(nr,{children:`Set up ${o} integration`}),c.jsx(cn,{error:n}),c.jsx("br",{}),c.jsx(ud,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function Nb({provider:e}){var p;const{projectIdOrName:t}=je(),{selectedConnection:n,isConnectionsLoading:r}=Qt(),{providerName:o,data:i}=dt(e),{mutateAsync:s,isPending:a,error:u}=ba(),[f,l]=b.useState(null),[d,h]=b.useState(!1),m=()=>{h(!1)},y=()=>{h(!0),l(null)},w=(p=i==null?void 0:i.oauth2Opts)==null?void 0:p.explicitScopesRequired,g=(u==null?void 0:u.message)||f||null,O=async v=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:v.clientId,clientSecret:v.clientSecret,scopes:v.scopes}}}}),y()}catch(I){He(I,l)}};return c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Re-authenticate to ${o}`}),d&&c.jsx(Vo,{children:"Connection updated successfully"}),g&&c.jsx(ki,{children:`Error updating connection ${g}`}),c.jsx(ud,{provider:o||"",handleSubmit:O,isButtonDisabled:a||r,explicitScopesRequired:w,buttonVariant:"ghost"})]})]})}const Vc=600,$c=600,Tb="AUTHORIZATION_SUCCEEDED",Rb="AUTHORIZATION_FAILED";function Ab(e,t,n,r){return b.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Vc)/2,i=window.screenY+(window.outerHeight-$c)/2.5,s=`width=${Vc},height=${$c},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Fb(e,t,n,r){const o=Ue();return b.useCallback(i=>{var s,a;if(i.origin===El){if(i.data.eventType===Tb){const u=(s=i.data.data)==null?void 0:s.connection;u?(e(u),o.setQueriesData({queryKey:["amp","connections"]},()=>[u]),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===Rb&&(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 Pb({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s,onWindowClose:a}){const[u,f]=b.useState(null),[l,d]=b.useState(null),h=Ue(),m=b.useRef(null),y=Fb(f,l,r,i),w=Ab(n,d,y,t);b.useEffect(()=>{t&&!l&&!u&&!o&&!s&&(r==null||r(null),w())},[t,l,w,u,o,s,r]);const g=b.useCallback(()=>{h.invalidateQueries({queryKey:["amp","connections"]}),d(null),!u&&!o?console.error("Window closed and no connection was found. Please try again."):u&&(r==null||r(null)),a==null||a()},[u,o,r,a,h]);return b.useEffect(()=>{if(l)return m.current=setInterval(()=>{l!=null&&l.closed&&(m.current&&clearInterval(m.current),m.current=null,g())},500),()=>{m.current&&(clearInterval(m.current),m.current=null),window.removeEventListener("message",y)}},[g,l,y]),c.jsx("div",{children:e})}const Db=()=>{const e=st(),t=Ue();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 Mb({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs("div",{style:{padding:"1rem 0"},children:[c.jsx("p",{children:`Re-authenticate to ${r}`}),c.jsx(cn,{error:t}),c.jsx(We,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function kb({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Qt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=dt(e),{mutateAsync:s,isPending:a,error:u}=Db(),[f,l]=b.useState(null),[d,h]=b.useState(!1),[m,y]=b.useState(null),w=()=>{h(!1)},g=()=>{h(!0),l(null),y(null)},O=(u==null?void 0:u.message)||f||null,p=async()=>{w(),l(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});y(I)}catch(I){He(I,l)}},v=b.useCallback(I=>{l(I)},[]);return c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Update connection"}),d&&c.jsx(Vo,{children:"Connection updated successfully"}),c.jsx(Pb,{windowTitle:`Connect to ${i}`,oauthUrl:m||null,onError:v,error:O,isSuccessConnect:d,onSuccessConnect:g,children:c.jsx(Mb,{handleSubmit:p,error:O,providerName:i,isButtonDisabled:a||n||d})})]})}function Ia({provider:e}){var r;const{data:t}=jo(e);if((t==null?void 0:t.authType)===_c.Basic)return c.jsx(Sb,{provider:e});if((t==null?void 0:t.authType)===_c.ApiKey)return c.jsx(xb,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===ts.AuthorizationCode||n===ts.AuthorizationCodePkce)return c.jsx(kb,{provider:e});if(n===ts.ClientCredentials)return c.jsx(Nb,{provider:e})}return null}const jb=()=>{const e=st(),t=Ue(),[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 ld({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectIdOrName:s}=je(),{selectedConnection:a}=Qt(),{mutate:u,isPending:f}=jb(),l=!s||!a||!a.id||f,d=async()=>{l||(console.warn("deleting connection",{projectIdOrName:s,connectionId:a==null?void 0:a.id}),u({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:y=>{He(y,i)}}))},h=f?"Pending...":e;return c.jsx(We,{type:"button",onClick:d,disabled:l,variant:t,style:n,children:h})}const dd=b.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),ci=()=>{const e=b.useContext(dd);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},Lb=()=>{var f;const e=Ue(),t=st(),{selectedConnection:n,isConnectionsLoading:r}=Qt(),{projectIdOrName:o}=je(),{integrationId:i,integrationObj:s}=at(),a=n==null?void 0:n.id,u=(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,u,a],queryFn:async()=>{if(!o)throw new Error("projectIdOrName is required");if(!i)throw new Error("integrationId is required");if(!u)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:o,integrationId:i,revisionId:u,connectionId:a})},retry:3,enabled:!!o&&!!i&&!!u&&!!a&&!r})};function Vb({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=at(),{isError:o,removeError:i,setError:s}=an(),a=(r==null?void 0:r.name)||n,[u,f]=b.useState(null),[l,d]=b.useState(null),{data:h,isLoading:m,isError:y,error:w}=Lb();b.useEffect(()=>{y?(s(we.HYDRATED_REVISION,a),He(w,f)):(i(we.HYDRATED_REVISION,a),f(null),d(null))},[y,a,s,i,w,f]);const g=b.useMemo(()=>{var p,v,I;return{hydratedRevision:h||null,loading:m,readAction:(p=h==null?void 0:h.content)==null?void 0:p.read,writeObjects:((I=(v=h==null?void 0:h.content)==null?void 0:v.write)==null?void 0:I.objects)||[]}},[h,m]);if(m)return c.jsx(ai,{});const O=(r==null?void 0:r.provider)||"provider";if(o(we.HYDRATED_REVISION,a)){const p=(r==null?void 0:r.name)||n||"unknown integration",v=`${u?`: ${u}`:`Error retrieving objects from ${O} or integration details for ${p}`}`;return c.jsx(Tt,{message:v,children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[c.jsx(Ia,{provider:O}),c.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),l&&c.jsx(Tl,{message:l}),c.jsx(ld,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:I=>d(I)})]})})}return c.jsx(dd.Provider,{value:g,children:e})}const fd=b.createContext(null);function pd(){const e=b.useContext(fd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const hd=b.createContext(()=>{});function $b(){const e=b.useContext(hd);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const md=b.createContext(void 0),Kb={};function Ca(){const e=b.useContext(md);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Ub({children:e}){const{installation:t}=at(),{hydratedRevision:n,loading:r}=ci(),[o,i]=b.useState(Kb),s=t==null?void 0:t.config;b.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&Xw(n,s,i)},[n,r,s,o]);const a=b.useCallback((l,d)=>{i(h=>Et(h,m=>{m[l]=Et(m[l],d)}))},[i]),u=b.useCallback((l,d)=>{i(h=>Et(h,m=>{m[l]=d}))},[i]),f=b.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:u}),[o,u,a]);return c.jsx(md.Provider,{value:f,children:e})}const Gt=()=>{const{appName:e}=Zn(),{objectConfigurationsState:t,setConfigureState:n}=Ca(),{selectedObjectName:r}=pd(),o=nd(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function Cn(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 ye(){return ye=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},ye.apply(null,arguments)}function Bs(e,t){return Bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Bs(e,t)}function qb(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Bs(e,t)}var Js={exports:{}},no={exports:{}},Se={};/** @license React v16.13.1
|
|
10
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(o=i(o,r(a)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var a in o)t.call(o,a)&&o[a]&&(s=i(s,a));return s}function i(o,s){return s?o?o+" "+s:o+s:o}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(od);var rb=od.exports;const Vt=ko(rb),ib="_button_kwfiu_1",ob="_danger_kwfiu_42",sb="_ghost_kwfiu_47",ss={button:ib,danger:ob,ghost:sb};function He({className:e,style:t,type:n,children:r,variant:i,...o}){const s=Vt(ss.button,{[ss.danger]:i==="danger",[ss.ghost]:i==="ghost",[e||""]:!!e});return c.jsx("button",{type:n,className:s,style:t,...o,children:r})}const ab={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 ki({children:e,style:t}){return c.jsx(_n,{style:{...ab,...t},children:e})}const Vo=e=>{const t=ut(),{provider:n}=lt(),r=e||n;return Er({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},dt=e=>{const t=Vo(e),{data:n}=t,{provider:r}=lt(),i=n&&Fw(n==null?void 0:n.name,n);return{...t,providerName:i,selectedProvider:e||r}};function cn({error:e}){return e?c.jsx(ki,{style:{marginTop:"2em"},children:e}):null}const cb="_input_1ymb7_1",ub="_inputError_1ymb7_27",as={input:cb,inputError:ub};function sd({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?Vt(as.inputError,as.input):as.input;return c.jsx("input",{id:e,type:t,className:Vt(o,n),...i})}function lb(){return c.jsx("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:c.jsxs("g",{opacity:"0.5",children:[c.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"}),c.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 db(){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[c.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"}),c.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"}),c.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 fb({id:e,name:t,placeholder:n="Password",onChange:r,value:i,className:o,isError:s}){const[a,u]=I.useState(!1),f=()=>u(l=>!l);return c.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[c.jsx(Ot.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:i,className:o,isError:s}),c.jsx(He,{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:c.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?c.jsx(db,{}):c.jsx(lb,{})})})]})}const pb="_textarea_18zl4_1",hb="_textareaError_18zl4_14",cs={textarea:pb,textareaError:hb};function mb({className:e,isError:t=!1,...n}){const r=t?Vt(cs.textareaError,cs.textarea):cs.textarea;return c.jsx("textarea",{className:Vt(e,r),...n})}const Ot={Input:sd,Textarea:mb,PasswordInput:fb},gb=()=>{const{projectIdOrName:e}=Ke(),t=ut();return Er({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 ad(){var n,r;const{data:e}=gb();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:c.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:[c.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),c.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:c.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})})]})}function er({children:e}){return c.jsx(si,{children:c.jsxs(_n,{children:[c.jsx("div",{style:{padding:"3rem 2rem"},children:e}),c.jsx(ad,{})]})})}function tr({children:e}){return c.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function yb({children:e}){return c.jsx("p",{style:{padding:".5em 0"},children:e})}const vb="_link_oo2kv_1",wb={link:vb};function wa({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return c.jsx("a",{className:Vt(wb.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function xo({url:e,providerDisplayName:t,credentialName:n}){return c.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[c.jsx(wa,{href:e,newTab:!0,children:c.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function $o(e,t){const n={},r=[];if(e.forEach(i=>{const o=t[i.name];!o||o.trim()===""?r.push(i.displayName||i.name):n[i.name]={value:o,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function Gr(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function cd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i,submitButtonType:o}){var O,p;const[s,a]=I.useState({apiKey:""}),u=((O=t.metadata)==null?void 0:O.input)||[],f=b=>{const{name:v,value:x}=b.currentTarget;a(S=>({...S,[v]:x.trim()}))},{apiKey:l}=s,{providerName:d}=dt(e),h=l.length>0,m=Gr(u,s),y=r||!h||!m,w=(p=t.apiKeyOpts)==null?void 0:p.docsURL,g=()=>{const b=$o(u,s);n({apiKey:l,providerMetadata:b})};return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&c.jsx(xo,{url:w,providerDisplayName:d||rn(e),credentialName:"API key"}),c.jsx(Ot.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:f}),u.map(b=>c.jsxs("div",{children:[b.docsURL&&c.jsx(xo,{url:b.docsURL,providerDisplayName:d||rn(e),credentialName:b.displayName||b.name}),c.jsx(Ot.Input,{id:b.name,name:b.name,type:"text",placeholder:b.displayName||b.name,onChange:f})]},b.name)),c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:y,type:o||"submit",onClick:g,variant:i,children:"Next"})]})}function bb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){const{providerName:o}=dt(e);return c.jsxs(er,{children:[c.jsx(tr,{children:`Set up ${o} integration`}),c.jsx(cn,{error:r}),c.jsx(cd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i})]})}function Ib({...e}){return c.jsx(bb,{...e})}const Cb={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 Ko({children:e,style:t}){return c.jsx(_n,{style:{...Cb,...t},children:e})}const ba=()=>{const e=ut(),t=We(),[n,r]=I.useState(null);return{...On({mutationKey:["updateConnection"],mutationFn:async o=>(await e()).connectionApi.updateConnection(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},xb="_divider_1kmoj_1",Vc={divider:xb};function Uo({className:e,style:t}){return c.jsx("hr",{className:e?`${Vc.divider} ${e}`:Vc.divider,style:t})}function Ft({string:e}){return c.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[c.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),c.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:c.jsx(Uo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Ob({provider:e}){const{projectIdOrName:t}=Ke(),{providerName:n,data:r}=dt(e),{selectedConnection:i,isConnectionsLoading:o}=an(),{mutateAsync:s,isPending:a,error:u}=ba(),[f,l]=I.useState(null),[d,h]=I.useState(!1),m=()=>h(!1),y=()=>{h(!0),l(null)},w=(u==null?void 0:u.message)||f||null,g=async O=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(i==null?void 0:i.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:O.apiKey}}},{onError:p=>{console.error("Update connection error:",p),Je(p,l)},onSuccess:()=>{y()}})}catch(p){console.error("Update connection caught error:",p),Je(p,l)}};return r?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${n} API Key`}),d&&c.jsx(Ko,{children:"Connection updated successfully"}),w&&c.jsx(ki,{children:`Error updating connection ${w}`}),c.jsx(cd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||o,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function ud({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i}){var g,O;const[o,s]=I.useState({username:"",password:""}),a=((g=t.metadata)==null?void 0:g.input)||[],{username:u,password:f}=o,{providerName:l}=dt(e),d=p=>{const{name:b,value:v}=p.currentTarget;s(x=>({...x,[b]:v.trim()}))},h=Gr(a,o),m=r||!h,y=()=>{const p=$o(a,o);n({user:u,pass:f,providerMetadata:p})},w=(O=t.basicOpts)==null?void 0:O.docsURL;return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&c.jsx(xo,{url:w,providerDisplayName:l||rn(e),credentialName:"credentials"}),c.jsx(Ot.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:d}),c.jsx(Ot.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:d}),a.map(p=>c.jsxs("div",{children:[p.docsURL&&c.jsx(xo,{url:p.docsURL,providerDisplayName:l||rn(e),credentialName:p.displayName||p.name}),c.jsx(Ot.Input,{id:p.name,name:p.name,type:"text",placeholder:p.displayName||p.name,onChange:d})]},p.name)),c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:m,type:"button",onClick:y,variant:i,children:"Next"})]})}function _b({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){const{providerName:o}=dt(e);return c.jsxs(er,{children:[c.jsx(tr,{children:`Set up ${o} integration`}),c.jsx(cn,{error:r}),c.jsx(ud,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i})]})}function Sb({...e}){return c.jsx(_b,{...e})}function Eb({provider:e}){const{projectIdOrName:t}=Ke(),{providerName:n,data:r}=dt(e),{selectedConnection:i,isConnectionsLoading:o}=an(),{mutateAsync:s,isPending:a,error:u}=ba(),[f,l]=I.useState(null),[d,h]=I.useState(!1),m=()=>h(!1),y=()=>{h(!0),l(null)},w=(u==null?void 0:u.message)||f||null,g=async O=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(i==null?void 0:i.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:O.user,password:O.pass}}}},{onError:p=>{console.error(p),Je(p,l)},onSuccess:()=>{y()}})}catch(p){console.error(p),Je(p,l)}};return r?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${n} credentials`}),d&&c.jsx(Ko,{children:"Connection updated successfully"}),w&&c.jsx(ki,{children:`Error updating connection: ${w}`}),c.jsx(ud,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||o,buttonVariant:"ghost"})]})]}):null}function ld({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:i}){var v;const[o,s]=I.useState({clientSecret:"",clientId:"",scopes:""}),[a,u]=I.useState(null),{data:f}=Vo(e),l=((v=f==null?void 0:f.metadata)==null?void 0:v.input)||[],d=x=>{const{name:S,value:A}=x.currentTarget;s(N=>({...N,[S]:A.trim()})),u(null)},{clientSecret:h,clientId:m,scopes:y}=o,w=h.length>0,g=m.length>0,O=Gr(l,o),p=n||!w||!g||!O,b=()=>{const x=$o(l,o),S={clientId:m,clientSecret:h,providerMetadata:x};r&&y.length>0&&(S.scopes=Pw(y)),t(S)};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[c.jsx(Ot.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:d}),c.jsx(Ot.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:d}),r&&c.jsx(Ot.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:d}),l.map(x=>c.jsx(Ot.Input,{id:x.name,name:x.name,type:"text",placeholder:x.displayName||x.name,onChange:d},x.name))]}),c.jsx(cn,{error:a}),c.jsx("br",{}),c.jsx(He,{style:{width:"100%"},disabled:p,type:"button",onClick:b,variant:i,children:"Next"})]})}function Nb({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:i,explicitScopesRequired:o}){return c.jsxs(er,{children:[c.jsx(tr,{children:`Set up ${i} integration`}),c.jsx(cn,{error:n}),c.jsx("br",{}),c.jsx(ld,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:o})]})}function Tb({provider:e}){var p;const{projectIdOrName:t}=Ke(),{selectedConnection:n,isConnectionsLoading:r}=an(),{providerName:i,data:o}=dt(e),{mutateAsync:s,isPending:a,error:u}=ba(),[f,l]=I.useState(null),[d,h]=I.useState(!1),m=()=>{h(!1)},y=()=>{h(!0),l(null)},w=(p=o==null?void 0:o.oauth2Opts)==null?void 0:p.explicitScopesRequired,g=(u==null?void 0:u.message)||f||null,O=async b=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:b.clientId,clientSecret:b.clientSecret,scopes:b.scopes}}}}),y()}catch(v){Je(v,l)}};return c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Re-authenticate to ${i}`}),d&&c.jsx(Ko,{children:"Connection updated successfully"}),g&&c.jsx(ki,{children:`Error updating connection ${g}`}),c.jsx(ld,{provider:i||"",handleSubmit:O,isButtonDisabled:a||r,explicitScopesRequired:w,buttonVariant:"ghost"})]})]})}const $c=600,Kc=600,Rb="AUTHORIZATION_SUCCEEDED",Ab="AUTHORIZATION_FAILED";function Fb(e,t,n,r){return I.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-$c)/2,o=window.screenY+(window.outerHeight-Kc)/2.5,s=`width=${$c},height=${Kc},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Pb(e,t,n,r){const i=We();return I.useCallback(o=>{var s,a;if(o.origin===Nl){if(o.data.eventType===Rb){const u=(s=o.data.data)==null?void 0:s.connection;u?(e(u),i.setQueriesData({queryKey:["amp","connections"]},()=>[u]),t==null||t.close(),r==null||r(),i.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:o})}o.data.eventType===Ab&&(console.error("OAuth failed: ",{event:o}),n==null||n(((a=o==null?void 0:o.data)==null?void 0:a.message)??"Something went wrong. Please try again."))}},[t,n,i,e,r])}function Db({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i,onSuccessConnect:o,isSuccessConnect:s,onWindowClose:a}){const[u,f]=I.useState(null),[l,d]=I.useState(null),h=We(),m=I.useRef(null),y=Pb(f,l,r,o),w=Fb(n,d,y,t);I.useEffect(()=>{t&&!l&&!u&&!i&&!s&&(r==null||r(null),w())},[t,l,w,u,i,s,r]);const g=I.useCallback(()=>{h.invalidateQueries({queryKey:["amp","connections"]}),d(null),!u&&!i?console.error("Window closed and no connection was found. Please try again."):u&&(r==null||r(null)),a==null||a()},[u,i,r,a,h]);return I.useEffect(()=>{if(l)return m.current=setInterval(()=>{l!=null&&l.closed&&(m.current&&clearInterval(m.current),m.current=null,g())},500),()=>{m.current&&(clearInterval(m.current),m.current=null),window.removeEventListener("message",y)}},[g,l,y]),c.jsx("div",{children:e})}const Mb=()=>{const e=ut(),t=We();return On({mutationKey:["updateOauthConnection"],mutationFn:async n=>!n.projectIdOrName||!n.connectionId?Promise.reject(new Error("Project ID and connection ID are required")):(await e()).oAuthApi.oauthUpdate(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function kb({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs("div",{style:{padding:"1rem 0"},children:[c.jsx("p",{children:`Re-authenticate to ${r}`}),c.jsx(cn,{error:t}),c.jsx(He,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function jb({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=an(),r=t==null?void 0:t.id,i=t==null?void 0:t.projectId,{providerName:o}=dt(e),{mutateAsync:s,isPending:a,error:u}=Mb(),[f,l]=I.useState(null),[d,h]=I.useState(!1),[m,y]=I.useState(null),w=()=>{h(!1)},g=()=>{h(!0),l(null),y(null)},O=(u==null?void 0:u.message)||f||null,p=async()=>{w(),l(null);try{const v=await s({projectIdOrName:i||"",connectionId:r||""});y(v)}catch(v){Je(v,l)}},b=I.useCallback(v=>{l(v)},[]);return c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Update connection"}),d&&c.jsx(Ko,{children:"Connection updated successfully"}),c.jsx(Db,{windowTitle:`Connect to ${o}`,oauthUrl:m||null,onError:b,error:O,isSuccessConnect:d,onSuccessConnect:g,children:c.jsx(kb,{handleSubmit:p,error:O,providerName:o,isButtonDisabled:a||n||d})})]})}function Ia({provider:e}){var r;const{data:t}=Vo(e);if((t==null?void 0:t.authType)===Sc.Basic)return c.jsx(Eb,{provider:e});if((t==null?void 0:t.authType)===Sc.ApiKey)return c.jsx(Ob,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===rs.AuthorizationCode||n===rs.AuthorizationCodePkce)return c.jsx(jb,{provider:e});if(n===rs.ClientCredentials)return c.jsx(Tb,{provider:e})}return null}const Lb=()=>{const e=ut(),t=We(),[n,r]=I.useState(null);return{...On({mutationKey:["deleteConnection"],mutationFn:async o=>(await e()).connectionApi.deleteConnection(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)},onError:o=>{console.error("Error deleting connection"),Je(o,r)}}),errorMsg:n}};function dd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i,onDisconnectError:o}){const{projectIdOrName:s}=Ke(),{selectedConnection:a}=an(),{mutate:u,isPending:f}=Lb(),l=!s||!a||!a.id||f,d=async()=>{l||(console.warn("deleting connection",{projectIdOrName:s,connectionId:a==null?void 0:a.id}),u({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),i()},onError:y=>{Je(y,o)}}))},h=f?"Pending...":e;return c.jsx(He,{type:"button",onClick:d,disabled:l,variant:t,style:n,children:h})}const fd=I.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),ci=()=>{const e=I.useContext(fd);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function Vb({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=lt(),{isError:i,removeError:o,setError:s}=sn(),a=(r==null?void 0:r.name)||n,[u,f]=I.useState(null),[l,d]=I.useState(null),{data:h,isLoading:m,isError:y,error:w}=Lo();I.useEffect(()=>{y?(s(we.HYDRATED_REVISION,a),Je(w,f)):(o(we.HYDRATED_REVISION,a),f(null),d(null))},[y,a,s,o,w,f]);const g=I.useMemo(()=>{var p,b,v;return{hydratedRevision:h||null,loading:m,readAction:(p=h==null?void 0:h.content)==null?void 0:p.read,writeObjects:((v=(b=h==null?void 0:h.content)==null?void 0:b.write)==null?void 0:v.objects)||[]}},[h,m]),O=(r==null?void 0:r.provider)||"provider";if(i(we.HYDRATED_REVISION,a)){const p=(r==null?void 0:r.name)||n||"unknown integration",b=`${u?`: ${u}`:`Error retrieving objects from ${O} or integration details for ${p}`}`;return c.jsx(_t,{message:b,children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[c.jsx(Ia,{provider:O}),c.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),l&&c.jsx(Rl,{message:l}),c.jsx(dd,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:v=>d(v)})]})})}return m?c.jsx(ai,{}):c.jsx(fd.Provider,{value:g,children:e})}const pd=I.createContext(null);function hd(){const e=I.useContext(pd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const md=I.createContext(()=>{});function $b(){const e=I.useContext(md);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const gd=I.createContext(void 0),Kb={};function Ca(){const e=I.useContext(gd);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Ub({children:e}){const{installation:t}=lt(),{hydratedRevision:n,loading:r}=ci(),[i,o]=I.useState(Kb),s=t==null?void 0:t.config;I.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&Yw(n,s,o)},[n,r,s,i]);const a=I.useCallback((l,d)=>{o(h=>Nt(h,m=>{m[l]=Nt(m[l],d)}))},[o]),u=I.useCallback((l,d)=>{o(h=>Nt(h,m=>{m[l]=d}))},[o]),f=I.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:u}),[i,u,a]);return c.jsx(gd.Provider,{value:f,children:e})}const Qt=()=>{const{appName:e}=Yn(),{objectConfigurationsState:t,setConfigureState:n}=Ca(),{selectedObjectName:r}=hd(),i=rd(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}};function Cn(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 ye(){return ye=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},ye.apply(null,arguments)}function Js(e,t){return Js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Js(e,t)}function qb(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Js(e,t)}var Hs={exports:{}},no={exports:{}},Se={};/** @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
|
|
17
|
+
*/var Uc;function Bb(){if(Uc)return Se;Uc=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,p=e?Symbol.for("react.scope"):60119;function b(x){if(typeof x=="object"&&x!==null){var S=x.$$typeof;switch(S){case t:switch(x=x.type,x){case u:case f:case r:case o:case i:case d:return x;default:switch(x=x&&x.$$typeof,x){case a:case l:case y:case m:case s:return x;default:return S}}case n:return S}}}function v(x){return b(x)===f}return Se.AsyncMode=u,Se.ConcurrentMode=f,Se.ContextConsumer=a,Se.ContextProvider=s,Se.Element=t,Se.ForwardRef=l,Se.Fragment=r,Se.Lazy=y,Se.Memo=m,Se.Portal=n,Se.Profiler=o,Se.StrictMode=i,Se.Suspense=d,Se.isAsyncMode=function(x){return v(x)||b(x)===u},Se.isConcurrentMode=v,Se.isContextConsumer=function(x){return b(x)===a},Se.isContextProvider=function(x){return b(x)===s},Se.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===t},Se.isForwardRef=function(x){return b(x)===l},Se.isFragment=function(x){return b(x)===r},Se.isLazy=function(x){return b(x)===y},Se.isMemo=function(x){return b(x)===m},Se.isPortal=function(x){return b(x)===n},Se.isProfiler=function(x){return b(x)===o},Se.isStrictMode=function(x){return b(x)===i},Se.isSuspense=function(x){return b(x)===d},Se.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===r||x===f||x===o||x===i||x===d||x===h||typeof x=="object"&&x!==null&&(x.$$typeof===y||x.$$typeof===m||x.$$typeof===s||x.$$typeof===a||x.$$typeof===l||x.$$typeof===g||x.$$typeof===O||x.$$typeof===p||x.$$typeof===w)},Se.typeOf=b,Se}var Ee={};/** @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
|
|
24
|
+
*/var qc;function Jb(){return qc||(qc=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,p=e?Symbol.for("react.scope"):60119;function b(k){return typeof k=="string"||typeof k=="function"||k===r||k===f||k===o||k===i||k===d||k===h||typeof k=="object"&&k!==null&&(k.$$typeof===y||k.$$typeof===m||k.$$typeof===s||k.$$typeof===a||k.$$typeof===l||k.$$typeof===g||k.$$typeof===O||k.$$typeof===p||k.$$typeof===w)}function v(k){if(typeof k=="object"&&k!==null){var ve=k.$$typeof;switch(ve){case t:var z=k.type;switch(z){case u:case f:case r:case o:case i:case d:return z;default:var Xe=z&&z.$$typeof;switch(Xe){case a:case l:case y:case m:case s:return Xe;default:return ve}}case n:return ve}}}var x=u,S=f,A=a,N=s,F=t,R=l,D=r,K=y,j=m,L=n,se=o,re=i,ge=d,de=!1;function be(k){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),P(k)||v(k)===u}function P(k){return v(k)===f}function $(k){return v(k)===a}function H(k){return v(k)===s}function U(k){return typeof k=="object"&&k!==null&&k.$$typeof===t}function q(k){return v(k)===l}function V(k){return v(k)===r}function G(k){return v(k)===y}function Z(k){return v(k)===m}function Y(k){return v(k)===n}function ee(k){return v(k)===o}function ne(k){return v(k)===i}function ce(k){return v(k)===d}Ee.AsyncMode=x,Ee.ConcurrentMode=S,Ee.ContextConsumer=A,Ee.ContextProvider=N,Ee.Element=F,Ee.ForwardRef=R,Ee.Fragment=D,Ee.Lazy=K,Ee.Memo=j,Ee.Portal=L,Ee.Profiler=se,Ee.StrictMode=re,Ee.Suspense=ge,Ee.isAsyncMode=be,Ee.isConcurrentMode=P,Ee.isContextConsumer=$,Ee.isContextProvider=H,Ee.isElement=U,Ee.isForwardRef=q,Ee.isFragment=V,Ee.isLazy=G,Ee.isMemo=Z,Ee.isPortal=Y,Ee.isProfiler=ee,Ee.isStrictMode=ne,Ee.isSuspense=ce,Ee.isValidElementType=b,Ee.typeOf=v}()),Ee}var Bc;function yd(){return Bc||(Bc=1,process.env.NODE_ENV==="production"?no.exports=Bb():no.exports=Jb()),no.exports}/*
|
|
25
25
|
object-assign
|
|
26
26
|
(c) Sindre Sorhus
|
|
27
27
|
@license MIT
|
|
28
|
-
*/var
|
|
29
|
-
Valid keys: `+JSON.stringify(Object.keys(P),null," "));var k=ce(Z,ne,q,V,G+"."+ne,n);if(k)return k}return null}return g($)}function L(P){switch(typeof P){case"number":case"string":case"undefined":return!0;case"boolean":return!P;case"object":if(Array.isArray(P))return P.every(L);if(P===null||a(P))return!0;var $=d(P);if($){var H=$.call(P),U;if($!==P.entries){for(;!(U=H.next()).done;)if(!L(U.value))return!1}else for(;!(U=H.next()).done;){var q=U.value;if(q&&!L(q[1]))return!1}}else return!1;return!0;default:return!1}}function se(P,$){return P==="symbol"?!0:$?$["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&$ instanceof Symbol:!1}function re(P){var $=typeof P;return Array.isArray(P)?"array":P instanceof RegExp?"object":se($,P)?"symbol":$}function ge(P){if(typeof P>"u"||P===null)return""+P;var $=re(P);if($==="object"){if(P instanceof Date)return"date";if(P instanceof RegExp)return"regexp"}return $}function de(P){var $=ge(P);switch($){case"array":case"object":return"an "+$;case"boolean":case"date":case"regexp":return"a "+$;default:return $}}function be(P){return!P.constructor||!P.constructor.name?h:P.constructor.name}return m.checkPropTypes=
|
|
28
|
+
*/var us,Jc;function Hb(){if(Jc)return us;Jc=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var u=Object.getOwnPropertyNames(s).map(function(l){return s[l]});if(u.join("")!=="0123456789")return!1;var f={};return"abcdefghijklmnopqrst".split("").forEach(function(l){f[l]=l}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return us=i()?Object.assign:function(o,s){for(var a,u=r(o),f,l=1;l<arguments.length;l++){a=Object(arguments[l]);for(var d in a)t.call(a,d)&&(u[d]=a[d]);if(e){f=e(a);for(var h=0;h<f.length;h++)n.call(a,f[h])&&(u[f[h]]=a[f[h]])}}return u},us}var ls,Hc;function xa(){if(Hc)return ls;Hc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ls=e,ls}var ds,Wc;function vd(){return Wc||(Wc=1,ds=Function.call.bind(Object.prototype.hasOwnProperty)),ds}var fs,zc;function Wb(){if(zc)return fs;zc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=xa(),n={},r=vd();e=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,a,u,f){if(process.env.NODE_ENV!=="production"){for(var l in o)if(r(o,l)){var d;try{if(typeof o[l]!="function"){var h=Error((u||"React class")+": "+a+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}d=o[l](s,l,u,a,null,t)}catch(y){d=y}if(d&&!(d instanceof Error)&&e((u||"React class")+": type specification of "+a+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in n)){n[d.message]=!0;var m=f?f():"";e("Failed "+a+" type: "+d.message+(m??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},fs=i,fs}var ps,Qc;function zb(){if(Qc)return ps;Qc=1;var e=yd(),t=Hb(),n=xa(),r=vd(),i=Wb(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(a){var u="Warning: "+a;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}});function s(){return null}return ps=function(a,u){var f=typeof Symbol=="function"&&Symbol.iterator,l="@@iterator";function d(P){var $=P&&(f&&P[f]||P[l]);if(typeof $=="function")return $}var h="<<anonymous>>",m={array:O("array"),bigint:O("bigint"),bool:O("boolean"),func:O("function"),number:O("number"),object:O("object"),string:O("string"),symbol:O("symbol"),any:p(),arrayOf:b,element:v(),elementType:x(),instanceOf:S,node:R(),objectOf:N,oneOf:A,oneOfType:F,shape:K,exact:j};function y(P,$){return P===$?P!==0||1/P===1/$:P!==P&&$!==$}function w(P,$){this.message=P,this.data=$&&typeof $=="object"?$:{},this.stack=""}w.prototype=Error.prototype;function g(P){if(process.env.NODE_ENV!=="production")var $={},H=0;function U(V,G,Z,Y,ee,ne,ce){if(Y=Y||h,ne=ne||Z,ce!==n){if(u){var k=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw k.name="Invariant Violation",k}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=Y+":"+Z;!$[ve]&&H<3&&(o("You are manually calling a React.PropTypes validation function for the `"+ne+"` 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."),$[ve]=!0,H++)}}return G[Z]==null?V?G[Z]===null?new w("The "+ee+" `"+ne+"` is marked as required "+("in `"+Y+"`, but its value is `null`.")):new w("The "+ee+" `"+ne+"` is marked as required in "+("`"+Y+"`, but its value is `undefined`.")):null:P(G,Z,Y,ee,ne)}var q=U.bind(null,!1);return q.isRequired=U.bind(null,!0),q}function O(P){function $(H,U,q,V,G,Z){var Y=H[U],ee=re(Y);if(ee!==P){var ne=ge(Y);return new w("Invalid "+V+" `"+G+"` of type "+("`"+ne+"` supplied to `"+q+"`, expected ")+("`"+P+"`."),{expectedType:P})}return null}return g($)}function p(){return g(s)}function b(P){function $(H,U,q,V,G){if(typeof P!="function")return new w("Property `"+G+"` of component `"+q+"` has invalid PropType notation inside arrayOf.");var Z=H[U];if(!Array.isArray(Z)){var Y=re(Z);return new w("Invalid "+V+" `"+G+"` of type "+("`"+Y+"` supplied to `"+q+"`, expected an array."))}for(var ee=0;ee<Z.length;ee++){var ne=P(Z,ee,q,V,G+"["+ee+"]",n);if(ne instanceof Error)return ne}return null}return g($)}function v(){function P($,H,U,q,V){var G=$[H];if(!a(G)){var Z=re(G);return new w("Invalid "+q+" `"+V+"` of type "+("`"+Z+"` supplied to `"+U+"`, expected a single ReactElement."))}return null}return g(P)}function x(){function P($,H,U,q,V){var G=$[H];if(!e.isValidElementType(G)){var Z=re(G);return new w("Invalid "+q+" `"+V+"` of type "+("`"+Z+"` supplied to `"+U+"`, expected a single ReactElement type."))}return null}return g(P)}function S(P){function $(H,U,q,V,G){if(!(H[U]instanceof P)){var Z=P.name||h,Y=be(H[U]);return new w("Invalid "+V+" `"+G+"` of type "+("`"+Y+"` supplied to `"+q+"`, expected ")+("instance of `"+Z+"`."))}return null}return g($)}function A(P){if(!Array.isArray(P))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),s;function $(H,U,q,V,G){for(var Z=H[U],Y=0;Y<P.length;Y++)if(y(Z,P[Y]))return null;var ee=JSON.stringify(P,function(ce,k){var ve=ge(k);return ve==="symbol"?String(k):k});return new w("Invalid "+V+" `"+G+"` of value `"+String(Z)+"` "+("supplied to `"+q+"`, expected one of "+ee+"."))}return g($)}function N(P){function $(H,U,q,V,G){if(typeof P!="function")return new w("Property `"+G+"` of component `"+q+"` has invalid PropType notation inside objectOf.");var Z=H[U],Y=re(Z);if(Y!=="object")return new w("Invalid "+V+" `"+G+"` of type "+("`"+Y+"` supplied to `"+q+"`, expected an object."));for(var ee in Z)if(r(Z,ee)){var ne=P(Z,ee,q,V,G+"."+ee,n);if(ne instanceof Error)return ne}return null}return g($)}function F(P){if(!Array.isArray(P))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var $=0;$<P.length;$++){var H=P[$];if(typeof H!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+de(H)+" at index "+$+"."),s}function U(q,V,G,Z,Y){for(var ee=[],ne=0;ne<P.length;ne++){var ce=P[ne],k=ce(q,V,G,Z,Y,n);if(k==null)return null;k.data&&r(k.data,"expectedType")&&ee.push(k.data.expectedType)}var ve=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new w("Invalid "+Z+" `"+Y+"` supplied to "+("`"+G+"`"+ve+"."))}return g(U)}function R(){function P($,H,U,q,V){return L($[H])?null:new w("Invalid "+q+" `"+V+"` supplied to "+("`"+U+"`, expected a ReactNode."))}return g(P)}function D(P,$,H,U,q){return new w((P||"React class")+": "+$+" type `"+H+"."+U+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+q+"`.")}function K(P){function $(H,U,q,V,G){var Z=H[U],Y=re(Z);if(Y!=="object")return new w("Invalid "+V+" `"+G+"` of type `"+Y+"` "+("supplied to `"+q+"`, expected `object`."));for(var ee in P){var ne=P[ee];if(typeof ne!="function")return D(q,V,G,ee,ge(ne));var ce=ne(Z,ee,q,V,G+"."+ee,n);if(ce)return ce}return null}return g($)}function j(P){function $(H,U,q,V,G){var Z=H[U],Y=re(Z);if(Y!=="object")return new w("Invalid "+V+" `"+G+"` of type `"+Y+"` "+("supplied to `"+q+"`, expected `object`."));var ee=t({},H[U],P);for(var ne in ee){var ce=P[ne];if(r(P,ne)&&typeof ce!="function")return D(q,V,G,ne,ge(ce));if(!ce)return new w("Invalid "+V+" `"+G+"` key `"+ne+"` supplied to `"+q+"`.\nBad object: "+JSON.stringify(H[U],null," ")+`
|
|
29
|
+
Valid keys: `+JSON.stringify(Object.keys(P),null," "));var k=ce(Z,ne,q,V,G+"."+ne,n);if(k)return k}return null}return g($)}function L(P){switch(typeof P){case"number":case"string":case"undefined":return!0;case"boolean":return!P;case"object":if(Array.isArray(P))return P.every(L);if(P===null||a(P))return!0;var $=d(P);if($){var H=$.call(P),U;if($!==P.entries){for(;!(U=H.next()).done;)if(!L(U.value))return!1}else for(;!(U=H.next()).done;){var q=U.value;if(q&&!L(q[1]))return!1}}else return!1;return!0;default:return!1}}function se(P,$){return P==="symbol"?!0:$?$["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&$ instanceof Symbol:!1}function re(P){var $=typeof P;return Array.isArray(P)?"array":P instanceof RegExp?"object":se($,P)?"symbol":$}function ge(P){if(typeof P>"u"||P===null)return""+P;var $=re(P);if($==="object"){if(P instanceof Date)return"date";if(P instanceof RegExp)return"regexp"}return $}function de(P){var $=ge(P);switch($){case"array":case"object":return"an "+$;case"boolean":case"date":case"regexp":return"a "+$;default:return $}}function be(P){return!P.constructor||!P.constructor.name?h:P.constructor.name}return m.checkPropTypes=i,m.resetWarningCache=i.resetWarningCache,m.PropTypes=m,m},ps}var hs,Gc;function Qb(){if(Gc)return hs;Gc=1;var e=xa();function t(){}function n(){}return n.resetWarningCache=t,hs=function(){function r(s,a,u,f,l,d){if(d!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},hs}if(process.env.NODE_ENV!=="production"){var Gb=yd(),Xb=!0;Hs.exports=zb()(Gb.isElement,Xb)}else Hs.exports=Qb()();var Yb=Hs.exports;const W=ko(Yb);var Ws={exports:{}},Ne={};/**
|
|
30
30
|
* @license React
|
|
31
31
|
* react-is.production.min.js
|
|
32
32
|
*
|
|
@@ -34,7 +34,7 @@ Valid keys: `+JSON.stringify(Object.keys(P),null," "));var k=ce(Z,ne,q,V,G+"."+
|
|
|
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
|
|
37
|
+
*/var Xc;function Zb(){if(Xc)return Ne;Xc=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function w(g){if(typeof g=="object"&&g!==null){var O=g.$$typeof;switch(O){case e:switch(g=g.type,g){case n:case i:case r:case f:case l:return g;default:switch(g=g&&g.$$typeof,g){case a:case s:case u:case h:case d:case o:return g;default:return O}}case t:return O}}}return Ne.ContextConsumer=s,Ne.ContextProvider=o,Ne.Element=e,Ne.ForwardRef=u,Ne.Fragment=n,Ne.Lazy=h,Ne.Memo=d,Ne.Portal=t,Ne.Profiler=i,Ne.StrictMode=r,Ne.Suspense=f,Ne.SuspenseList=l,Ne.isAsyncMode=function(){return!1},Ne.isConcurrentMode=function(){return!1},Ne.isContextConsumer=function(g){return w(g)===s},Ne.isContextProvider=function(g){return w(g)===o},Ne.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},Ne.isForwardRef=function(g){return w(g)===u},Ne.isFragment=function(g){return w(g)===n},Ne.isLazy=function(g){return w(g)===h},Ne.isMemo=function(g){return w(g)===d},Ne.isPortal=function(g){return w(g)===t},Ne.isProfiler=function(g){return w(g)===i},Ne.isStrictMode=function(g){return w(g)===r},Ne.isSuspense=function(g){return w(g)===f},Ne.isSuspenseList=function(g){return w(g)===l},Ne.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===i||g===r||g===f||g===l||g===m||typeof g=="object"&&g!==null&&(g.$$typeof===h||g.$$typeof===d||g.$$typeof===o||g.$$typeof===s||g.$$typeof===u||g.$$typeof===y||g.getModuleId!==void 0)},Ne.typeOf=w,Ne}var Te={};/**
|
|
38
38
|
* @license React
|
|
39
39
|
* react-is.development.js
|
|
40
40
|
*
|
|
@@ -42,11 +42,11 @@ Valid keys: `+JSON.stringify(Object.keys(P),null," "));var k=ce(Z,ne,q,V,G+"."+
|
|
|
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 Xc;function eI(){return Xc||(Xc=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"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),y=!1,w=!1,g=!1,O=!1,p=!1,v;v=Symbol.for("react.module.reference");function I(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===o||p||z===r||z===f||z===l||O||z===m||y||w||g||typeof z=="object"&&z!==null&&(z.$$typeof===h||z.$$typeof===d||z.$$typeof===i||z.$$typeof===s||z.$$typeof===u||z.$$typeof===v||z.getModuleId!==void 0))}function x(z){if(typeof z=="object"&&z!==null){var Xe=z.$$typeof;switch(Xe){case e:var Ce=z.type;switch(Ce){case n:case o:case r:case f:case l:return Ce;default:var ct=Ce&&Ce.$$typeof;switch(ct){case a:case s:case u:case h:case d:case i:return ct;default:return Xe}}case t:return Xe}}}var E=s,A=i,S=e,F=u,R=n,D=h,K=d,j=t,L=o,se=r,re=f,ge=l,de=!1,be=!1;function P(z){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function $(z){return be||(be=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function H(z){return x(z)===s}function U(z){return x(z)===i}function q(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function V(z){return x(z)===u}function G(z){return x(z)===n}function Z(z){return x(z)===h}function Y(z){return x(z)===d}function ee(z){return x(z)===t}function ne(z){return x(z)===o}function ce(z){return x(z)===r}function k(z){return x(z)===f}function ve(z){return x(z)===l}Te.ContextConsumer=E,Te.ContextProvider=A,Te.Element=S,Te.ForwardRef=F,Te.Fragment=R,Te.Lazy=D,Te.Memo=K,Te.Portal=j,Te.Profiler=L,Te.StrictMode=se,Te.Suspense=re,Te.SuspenseList=ge,Te.isAsyncMode=P,Te.isConcurrentMode=$,Te.isContextConsumer=H,Te.isContextProvider=U,Te.isElement=q,Te.isForwardRef=V,Te.isFragment=G,Te.isLazy=Z,Te.isMemo=Y,Te.isPortal=ee,Te.isProfiler=ne,Te.isStrictMode=ce,Te.isSuspense=k,Te.isSuspenseList=ve,Te.isValidElementType=I,Te.typeOf=x}()),Te}process.env.NODE_ENV==="production"?Hs.exports=Zb():Hs.exports=eI();var Yc=Hs.exports;const Zc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,eu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",ps=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return eu(n.overflowY,t)||eu(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},ro=(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,tI=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},nI=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{inline:s,boundary:a,skipOverflowHiddenElements:u}=t,f=typeof a=="function"?a:j=>j!==a;if(!Zc(e))throw new TypeError("Invalid target");const l=document.scrollingElement||document.documentElement,d=[];let h=e;for(;Zc(h)&&f(h);){if(h=tI(h),h===l){d.push(h);break}h!=null&&h===document.body&&ps(h)&&!ps(document.documentElement)||h!=null&&ps(h,u)&&d.push(h)}const m=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:w,scrollY:g}=window,{height:O,width:p,top:v,right:I,bottom:x,left:E}=e.getBoundingClientRect(),{top:A,right:S,left:F}=(j=>{const L=window.getComputedStyle(j);return{top:parseFloat(L.scrollMarginTop)||0,right:parseFloat(L.scrollMarginRight)||0,bottom:parseFloat(L.scrollMarginBottom)||0,left:parseFloat(L.scrollMarginLeft)||0}})(e);let R=v-A,D=s==="center"?E+p/2-F+S:s==="end"?I+S:E-F;const K=[];for(let j=0;j<d.length;j++){const L=d[j],{height:se,width:re,top:ge,right:de,bottom:be,left:P}=L.getBoundingClientRect();if(v>=0&&E>=0&&x<=y&&I<=m&&v>=ge&&x<=be&&E>=P&&I<=de)return K;const $=getComputedStyle(L),H=parseInt($.borderLeftWidth,10),U=parseInt($.borderTopWidth,10),q=parseInt($.borderRightWidth,10),V=parseInt($.borderBottomWidth,10);let G=0,Z=0;const Y="offsetWidth"in L?L.offsetWidth-L.clientWidth-H-q:0,ee="offsetHeight"in L?L.offsetHeight-L.clientHeight-U-V:0,ne="offsetWidth"in L?L.offsetWidth===0?0:re/L.offsetWidth:0,ce="offsetHeight"in L?L.offsetHeight===0?0:se/L.offsetHeight:0;if(l===L)G=ro(g,g+y,y,U,V,g+R,g+R+O,O),Z=s==="start"?D:s==="center"?D-m/2:s==="end"?D-m:ro(w,w+m,m,H,q,w+D,w+D+p,p),G=Math.max(0,G+g),Z=Math.max(0,Z+w);else{G=ro(ge,be,se,U,V+ee,R,R+O,O),Z=s==="start"?D-P-H:s==="center"?D-(P+re/2)+Y/2:s==="end"?D-de+q+Y:ro(P,de,re,H,q+Y,D,D+p,p);const{scrollLeft:k,scrollTop:ve}=L;G=ce===0?0:Math.max(0,Math.min(ve+G/ce,L.scrollHeight-se/ce+ee)),Z=ne===0?0:Math.max(0,Math.min(k+Z/ne,L.scrollWidth-re/ne+Y)),R+=ve-G,D+=k-Z}K.push({el:L,top:G,left:Z})}return K};var Xr=function(){return Xr=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},Xr.apply(this,arguments)};var rI=0;function tu(e){return typeof e=="function"?e:Nt}function Nt(){}function vd(e,t){if(e){var n=nI(e,{boundary:t});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function nu(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Oa(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 Qe(){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 wd(){return String(rI++)}function iI(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 ru(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function bd(e){return typeof e.type=="string"}function Id(e){return e.props}function oI(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var sI=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function io(e){e===void 0&&(e={});var t={};return sI.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function xo(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=Oo(t,r)?t[r]:e[r],n},{})}function Oo(e,t){return e[t]!==void 0}function Ws(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function aI(e){return Object.prototype.toString.call(e)==="[object Object]"}function lr(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 u=Yr(a,t<0,n,r,o);return u===-1?e>=i?-1:e:u}function Yr(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?Yr(t?i-1:0,t,n,r):-1}function _o(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(nu(o,e,n)||r&&nu(o,n.document.activeElement,n))})}var _a=Nt;process.env.NODE_ENV!=="production"&&(_a=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 cI=Oa(function(e){Cd(e).textContent=""},500);function Cd(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 xd(e,t){if(!(!e||!t)){var n=Cd(t);n.textContent=e,cI(t)}}function uI(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Od=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,_d=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Sd=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,uo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,lo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Ed=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Nd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Td=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Rd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Ad=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Fd=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Pd=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Dd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,zs=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Md=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,kd=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,jd=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,lI=Object.freeze({__proto__:null,blurButton:Md,blurInput:Fd,changeInput:Pd,clickButton:zs,clickItem:Ad,controlledPropUpdatedSelectedItem:kd,itemMouseEnter:Sd,keyDownArrowDown:lo,keyDownArrowUp:uo,keyDownEnd:Rd,keyDownEnter:Nd,keyDownEscape:Ed,keyDownHome:Td,keyDownSpaceButton:Dd,mouseUp:_d,touchEnd:jd,unknown:Od}),dI=["refKey","ref"],fI=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],pI=["onKeyDown","onBlur","onChange","onInput","onChangeText"],hI=["refKey","ref"],mI=["onMouseMove","onMouseDown","onClick","onPress","index","item"],gI=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+wd(),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,v){var I=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(x){return x!==I}),p()},v);i.timeoutIds.push(I)},i.setItemCount=function(p){i.itemCount=p},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(p,v){var I=i.getItemNodeFromIndex(v);return I&&I.hasAttribute("disabled")},i.setHighlightedIndex=function(p,v){p===void 0&&(p=i.props.defaultHighlightedIndex),v===void 0&&(v={}),v=io(v),i.internalSetState(ye({highlightedIndex:p},v))},i.clearSelection=function(p){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},p)},i.selectItem=function(p,v,I){v=io(v),i.internalSetState(ye({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:p,inputValue:i.props.itemToString(p)},v),I)},i.selectItemAtIndex=function(p,v,I){var x=i.items[p];x!=null&&i.selectItem(x,v,I)},i.selectHighlightedItem=function(p,v){return i.selectItemAtIndex(i.getState().highlightedIndex,p,v)},i.internalSetState=function(p,v){var I,x,E={},A=typeof p=="function";return!A&&p.hasOwnProperty("inputValue")&&i.props.onInputValueChange(p.inputValue,ye({},i.getStateAndHelpers(),p)),i.setState(function(S){var F;S=i.getState(S);var R=A?p(S):p;R=i.props.stateReducer(S,R),I=R.hasOwnProperty("selectedItem");var D={};return I&&R.selectedItem!==S.selectedItem&&(x=R.selectedItem),(F=R).type||(F.type=Od),Object.keys(R).forEach(function(K){S[K]!==R[K]&&(E[K]=R[K]),K!=="type"&&(R[K],Oo(i.props,K)||(D[K]=R[K]))}),A&&R.hasOwnProperty("inputValue")&&i.props.onInputValueChange(R.inputValue,ye({},i.getStateAndHelpers(),R)),D},function(){tu(v)();var S=Object.keys(E).length>1;S&&i.props.onStateChange(E,i.getStateAndHelpers()),I&&i.props.onSelect(p.selectedItem,i.getStateAndHelpers()),x!==void 0&&i.props.onChange(x,i.getStateAndHelpers()),i.props.onUserAction(E,i.getStateAndHelpers())})},i.rootRef=function(p){return i._rootNode=p},i.getRootProps=function(p,v){var I,x=p===void 0?{}:p,E=x.refKey,A=E===void 0?"ref":E,S=x.ref,F=Cn(x,dI),R=v===void 0?{}:v,D=R.suppressRefError,K=D===void 0?!1:D;i.getRootProps.called=!0,i.getRootProps.refKey=A,i.getRootProps.suppressRefError=K;var j=i.getState(),L=j.isOpen;return ye((I={},I[A]=Fr(S,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),F)},i.keyDownHandlers={ArrowDown:function(v){var I=this;if(v.preventDefault(),this.getState().isOpen){var x=v.shiftKey?5:1;this.moveHighlightedIndex(x,{type:lo})}else this.internalSetState({isOpen:!0,type:lo},function(){var E=I.getItemCount();if(E>0){var A=I.getState(),S=A.highlightedIndex,F=lr(S,1,{length:E},I.isItemDisabled,!0);I.setHighlightedIndex(F,{type:lo})}})},ArrowUp:function(v){var I=this;if(v.preventDefault(),this.getState().isOpen){var x=v.shiftKey?-5:-1;this.moveHighlightedIndex(x,{type:uo})}else this.internalSetState({isOpen:!0,type:uo},function(){var E=I.getItemCount();if(E>0){var A=I.getState(),S=A.highlightedIndex,F=lr(S,-1,{length:E},I.isItemDisabled,!0);I.setHighlightedIndex(F,{type:uo})}})},Enter:function(v){if(v.which!==229){var I=this.getState(),x=I.isOpen,E=I.highlightedIndex;if(x&&E!=null){v.preventDefault();var A=this.items[E],S=this.getItemNodeFromIndex(E);if(A==null||S&&S.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Nd})}}},Escape:function(v){v.preventDefault(),this.reset(ye({type:Ed},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=ye({},i.keyDownHandlers,{" ":function(v){v.preventDefault(),this.toggleMenu({type:Dd})}}),i.inputKeyDownHandlers=ye({},i.keyDownHandlers,{Home:function(v){var I=this.getState(),x=I.isOpen;if(x){v.preventDefault();var E=this.getItemCount();if(!(E<=0||!x)){var A=Yr(0,!1,{length:E},this.isItemDisabled);this.setHighlightedIndex(A,{type:Td})}}},End:function(v){var I=this.getState(),x=I.isOpen;if(x){v.preventDefault();var E=this.getItemCount();if(!(E<=0||!x)){var A=Yr(E-1,!0,{length:E},this.isItemDisabled);this.setHighlightedIndex(A,{type:Rd})}}}}),i.getToggleButtonProps=function(p){var v=p===void 0?{}:p,I=v.onClick;v.onPress;var x=v.onKeyDown,E=v.onKeyUp,A=v.onBlur,S=Cn(v,fI),F=i.getState(),R=F.isOpen,D={onClick:Qe(I,i.buttonHandleClick),onKeyDown:Qe(x,i.buttonHandleKeyDown),onKeyUp:Qe(E,i.buttonHandleKeyUp),onBlur:Qe(A,i.buttonHandleBlur)},K=S.disabled?{}:D;return ye({type:"button",role:"button","aria-label":R?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},K,S)},i.buttonHandleKeyUp=function(p){p.preventDefault()},i.buttonHandleKeyDown=function(p){var v=Ws(p);i.buttonKeyDownHandlers[v]&&i.buttonKeyDownHandlers[v].call(i,p)},i.buttonHandleClick=function(p){if(p.preventDefault(),i.props.environment){var v=i.props.environment.document,I=v.body,x=v.activeElement;I&&I===x&&p.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:zs}):i.internalSetTimeout(function(){return i.toggleMenu({type:zs})})},i.buttonHandleBlur=function(p){var v=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!==v&&i.reset({type:Md})}})},i.getLabelProps=function(p){return ye({htmlFor:i.inputId,id:i.labelId},p)},i.getInputProps=function(p){var v=p===void 0?{}:p,I=v.onKeyDown,x=v.onBlur,E=v.onChange,A=v.onInput;v.onChangeText;var S=Cn(v,pI),F,R={};F="onChange";var D=i.getState(),K=D.inputValue,j=D.isOpen,L=D.highlightedIndex;if(!S.disabled){var se;R=(se={},se[F]=Qe(E,A,i.inputHandleChange),se.onKeyDown=Qe(I,i.inputHandleKeyDown),se.onBlur=Qe(x,i.inputHandleBlur),se)}return ye({"aria-autocomplete":"list","aria-activedescendant":j&&typeof L=="number"&&L>=0?i.getItemId(L):void 0,"aria-controls":j?i.menuId:void 0,"aria-labelledby":S&&S["aria-label"]?void 0:i.labelId,autoComplete:"off",value:K,id:i.inputId},R,S)},i.inputHandleKeyDown=function(p){var v=Ws(p);v&&i.inputKeyDownHandlers[v]&&i.inputKeyDownHandlers[v].call(i,p)},i.inputHandleChange=function(p){i.internalSetState({type:Pd,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 v=i.props.environment.document.activeElement,I=(v==null||(p=v.dataset)==null?void 0:p.toggle)&&i._rootNode&&i._rootNode.contains(v);I||i.reset({type:Fd})}})},i.menuRef=function(p){i._menuNode=p},i.getMenuProps=function(p,v){var I,x=p===void 0?{}:p,E=x.refKey,A=E===void 0?"ref":E,S=x.ref,F=Cn(x,hI),R=v===void 0?{}:v,D=R.suppressRefError,K=D===void 0?!1:D;return i.getMenuProps.called=!0,i.getMenuProps.refKey=A,i.getMenuProps.suppressRefError=K,ye((I={},I[A]=Fr(S,i.menuRef),I.role="listbox",I["aria-labelledby"]=F&&F["aria-label"]?void 0:i.labelId,I.id=i.menuId,I),F)},i.getItemProps=function(p){var v,I=p===void 0?{}:p,x=I.onMouseMove,E=I.onMouseDown,A=I.onClick;I.onPress;var S=I.index,F=I.item,R=F===void 0?process.env.NODE_ENV==="production"?void 0:oI("getItemProps","item"):F,D=Cn(I,mI);S===void 0?(i.items.push(R),S=i.items.indexOf(R)):i.items[S]=R;var K="onClick",j=A,L=(v={onMouseMove:Qe(x,function(){S!==i.getState().highlightedIndex&&(i.setHighlightedIndex(S,{type:Sd}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:Qe(E,function(re){re.preventDefault()})},v[K]=Qe(j,function(){i.selectItemAtIndex(S,{type:Ad})}),v),se=D.disabled?{onMouseDown:L.onMouseDown}:L;return ye({id:i.getItemId(S),role:"option","aria-selected":i.getState().highlightedIndex===S},se,D)},i.clearItems=function(){i.items=[]},i.reset=function(p,v){p===void 0&&(p={}),p=io(p),i.internalSetState(function(I){var x=I.selectedItem;return ye({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(x)},p)},v)},i.toggleMenu=function(p,v){p===void 0&&(p={}),p=io(p),i.internalSetState(function(I){var x=I.isOpen;return ye({isOpen:!x},x&&{highlightedIndex:i.props.defaultHighlightedIndex},p)},function(){var I=i.getState(),x=I.isOpen,E=I.highlightedIndex;x&&i.getItemCount()>0&&typeof E=="number"&&i.setHighlightedIndex(E,p),tu(v)()})},i.openMenu=function(p){i.internalSetState({isOpen:!0},p)},i.closeMenu=function(p){i.internalSetState({isOpen:!1},p)},i.updateStatus=Oa(function(){var p;if((p=i.props)!=null&&(p=p.environment)!=null&&p.document){var v=i.getState(),I=i.items[v.highlightedIndex],x=i.getItemCount(),E=i.props.getA11yStatusMessage(ye({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:x,highlightedItem:I},v));i.previousResultCount=x,xd(E,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,u=s.initialHighlightedIndex,f=u===void 0?a:u,l=s.defaultIsOpen,d=s.initialIsOpen,h=d===void 0?l:d,m=s.initialInputValue,y=m===void 0?"":m,w=s.initialSelectedItem,g=w===void 0?null:w,O=i.getState({highlightedIndex:f,isOpen:h,inputValue:y,selectedItem:g});return O.selectedItem!=null&&i.props.initialInputValue===void 0&&(O.inputValue=i.props.itemToString(O.selectedItem)),i.state=O,i}qb(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),xo(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(),u=this.getState(),f=u.highlightedIndex;if(a>0){var l=lr(f,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(l,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,u=i.selectedItem,f=i.isOpen,l=this.props.itemToString,d=this.id,h=this.getRootProps,m=this.getToggleButtonProps,y=this.getLabelProps,w=this.getMenuProps,g=this.getInputProps,O=this.getItemProps,p=this.openMenu,v=this.closeMenu,I=this.toggleMenu,x=this.selectItem,E=this.selectItemAtIndex,A=this.selectHighlightedItem,S=this.setHighlightedIndex,F=this.clearSelection,R=this.clearItems,D=this.reset,K=this.setItemCount,j=this.unsetItemCount,L=this.internalSetState;return{getRootProps:h,getToggleButtonProps:m,getLabelProps:y,getMenuProps:w,getInputProps:g,getItemProps:O,reset:D,openMenu:p,closeMenu:v,toggleMenu:I,selectItem:x,selectItemAtIndex:E,selectHighlightedItem:A,setHighlightedIndex:S,clearSelection:F,clearItems:R,setItemCount:K,unsetItemCount:j,setState:L,itemToString:l,id:d,highlightedIndex:s,inputValue:a,isOpen:f,selectedItem:u}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&iu(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(m){i.isMouseDown=!1;var y=_o(m.target,[i._rootNode,i._menuNode],i.props.environment);!y&&i.getState().isOpen&&i.reset({type:_d},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},u=function(){i.isTouchMove=!1},f=function(){i.isTouchMove=!0},l=function(m){var y=_o(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!y&&i.getState().isOpen&&i.reset({type:jd},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},d=this.props.environment;d.addEventListener("mousedown",s),d.addEventListener("mouseup",a),d.addEventListener("touchstart",u),d.addEventListener("touchmove",f),d.addEventListener("touchend",l),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),d.removeEventListener("mousedown",s),d.removeEventListener("mouseup",a),d.removeEventListener("touchstart",u),d.removeEventListener("touchmove",f),d.removeEventListener("touchend",l)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,u=a.highlightedIndex,f=s.highlightedIndex===void 0?i:s,l=f.highlightedIndex,d=u&&this.getState().isOpen&&!i.isOpen,h=u!==l;return d||h},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(_a(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&iu(this._menuNode,this.getMenuProps)),Oo(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:kd,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=ru(this.props.children,Nt);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=ru(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&&yI(s,this.getRootProps),s;if(bd(s))return b.cloneElement(s,this.getRootProps(Id(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:iI,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&aI(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:Nt,onInputValueChange:Nt,onUserAction:Nt,onChange:Nt,onSelect:Nt,onOuterClick:Nt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:vd},e.stateChangeTypes=lI,e}();process.env.NODE_ENV!=="production"&&(gI.propTypes={children:W.func,defaultHighlightedIndex:W.number,defaultIsOpen:W.bool,initialHighlightedIndex:W.number,initialSelectedItem:W.any,initialInputValue:W.string,initialIsOpen:W.bool,getA11yStatusMessage:W.func,itemToString:W.func,onChange:W.func,onSelect:W.func,onStateChange:W.func,onInputValueChange:W.func,onUserAction:W.func,onOuterClick:W.func,selectedItemChanged:W.func,stateReducer:W.func,itemCount:W.number,id:W.string,environment:W.shape({addEventListener:W.func.isRequired,removeEventListener:W.func.isRequired,document:W.shape({createElement:W.func.isRequired,getElementById:W.func.isRequired,activeElement:W.any.isRequired,body:W.any.isRequired}).isRequired,Node:W.func.isRequired}),suppressRefError:W.bool,scrollIntoView:W.func,selectedItem:W.any,isOpen:W.bool,inputValue:W.string,highlightedIndex:W.number,labelId:W.string,inputId:W.string,menuId:W.string,getItemId:W.func});function iu(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 yI(e,t){var n=t.refKey,r=n!=="ref",o=!bd(e);o&&!r&&!Yc.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+'"'),!Yc.isForwardRef(e)&&!Id(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Ld={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function vI(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){wI(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(ye({type:o},i))}function wI(e,t,n,r){var o=t.props,i=t.type,s="on"+Sa(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](ye({type:i},r))}function bI(e,t){return t.changes}var ou=Oa(function(e,t){xd(e,t)},200),II=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?b.useLayoutEffect:b.useEffect,CI="useId"in b?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,u="downshift-"+b.useId();n||(n=u);var f=b.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(l){return n+"-item-"+l},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return f.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+wd():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,u=t.inputId,f=b.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(l){return r+"-item-"+l},toggleButtonId:a||r+"-toggle-button",inputId:u||r+"-input"});return f.current};function xI(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 Sa(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Vd(e){var t=b.useRef(e);return t.current=e,t}function OI(e,t,n,r){var o=b.useRef(),i=b.useRef(),s=b.useCallback(function(m,y){i.current=y,m=xo(m,y.props);var w=e(m,y),g=y.props.stateReducer(m,ye({},y,{changes:w}));return g},[e]),a=b.useReducer(s,t,n),u=a[0],f=a[1],l=Vd(t),d=b.useCallback(function(m){return f(ye({props:l.current},m))},[l]),h=i.current;return b.useEffect(function(){var m=xo(o.current,h==null?void 0:h.props),y=h&&o.current&&!r(m,u);y&&vI(h,m,u),o.current=u},[u,h,r]),[u,d]}var wi={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:bI,scrollIntoView:vd,environment:typeof window>"u"?void 0:window};function zn(e,t,n){n===void 0&&(n=Ld);var r=e["default"+Sa(t)];return r!==void 0?r:n[t]}function bi(e,t,n){n===void 0&&(n=Ld);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Sa(t)];return o!==void 0?o:zn(e,t,n)}function _I(e){var t=bi(e,"selectedItem"),n=bi(e,"isOpen"),r=RI(e),o=bi(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 Ii(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,u=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:u?r.findIndex(function(l){return a(u)===a(l)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function SI(e,t,n){var r=b.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return b.useEffect(function(){if(!e)return Nt;var o=n.map(function(l){return l.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(l){r.current.isMouseDown=!1,_o(l.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function u(){r.current.isTouchMove=!0}function f(l){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!_o(l.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",u),e.addEventListener("touchend",f),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",u),e.removeEventListener("touchend",f)}},[n,e,t]),r.current}var $d=function(){return Nt};process.env.NODE_ENV!=="production"&&($d=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 u=a.suppressRefError,f=a.refKey,l=a.elementRef;u||l!=null&&l.current||console.error('downshift: The ref prop "'+f+'" from '+s+" was not applied correctly on your element.")})},[]);var i=b.useCallback(function(s,a,u,f){o.current[s]={suppressRefError:a,refKey:u,elementRef:f}},[]);return i});function EI(e,t,n,r){r===void 0&&(r={});var o=r.document,i=Ko();b.useEffect(function(){if(!(!e||i||!o)){var s=e(t);ou(s,o)}},n),b.useEffect(function(){return function(){ou.cancel(),uI(o)}},[o])}function NI(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 II(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Kd=Nt;process.env.NODE_ENV!=="production"&&(Kd=function(t){var n=t.props,r=t.state,o=b.useRef(n),i=Ko();b.useEffect(function(){i||(_a(r,o.current,n),o.current=n)},[r,n,i])});function su(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return ye({isOpen:!1,highlightedIndex:-1},o&&ye({selectedItem:e.items[t],isOpen:zn(e,"isOpen"),highlightedIndex:zn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function TI(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Ko(){var e=b.useRef(!0);return b.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Qs(e){var t=zn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function RI(e){var t=bi(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var fo={environment:W.shape({addEventListener:W.func.isRequired,removeEventListener:W.func.isRequired,document:W.shape({createElement:W.func.isRequired,getElementById:W.func.isRequired,activeElement:W.any.isRequired,body:W.any.isRequired}).isRequired,Node:W.func.isRequired}),itemToString:W.func,itemToKey:W.func,stateReducer:W.func},Ud=ye({},fo,{getA11yStatusMessage:W.func,highlightedIndex:W.number,defaultHighlightedIndex:W.number,initialHighlightedIndex:W.number,isOpen:W.bool,defaultIsOpen:W.bool,initialIsOpen:W.bool,selectedItem:W.any,initialSelectedItem:W.any,defaultSelectedItem:W.any,id:W.string,labelId:W.string,menuId:W.string,getItemId:W.func,toggleButtonId:W.string,onSelectedItemChange:W.func,onHighlightedIndexChange:W.func,onStateChange:W.func,onIsOpenChange:W.func,scrollIntoView:W.func});function AI(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:Ii(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:Ii(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:Qs(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 ye({},e,i)}Xr(Xr({},Ud),{items:W.array.isRequired,isItemDisabled:W.func});Xr(Xr({},wi),{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 Ea=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Na=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ta=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Ra=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Aa=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Fa=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Pa=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Da=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Ma=process.env.NODE_ENV!=="production"?"__input_change__":8,So=process.env.NODE_ENV!=="production"?"__input_blur__":9,ka=process.env.NODE_ENV!=="production"?"__input_click__":10,qd=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Bd=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ja=process.env.NODE_ENV!=="production"?"__item_click__":13,Jd=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Hd=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Wd=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,zd=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Qd=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,La=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Gd=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Xd=process.env.NODE_ENV!=="production"?"__function_reset__":21,Va=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Yd=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:Va,FunctionCloseMenu:zd,FunctionOpenMenu:Wd,FunctionReset:Xd,FunctionSelectItem:La,FunctionSetHighlightedIndex:Qd,FunctionSetInputValue:Gd,FunctionToggleMenu:Hd,InputBlur:So,InputChange:Ma,InputClick:ka,InputKeyDownArrowDown:Ea,InputKeyDownArrowUp:Na,InputKeyDownEnd:Aa,InputKeyDownEnter:Da,InputKeyDownEscape:Ta,InputKeyDownHome:Ra,InputKeyDownPageDown:Pa,InputKeyDownPageUp:Fa,ItemClick:ja,ItemMouseMove:Bd,MenuMouseLeave:qd,ToggleButtonClick:Jd});function FI(e){var t=_I(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)),ye({},t,{inputValue:r})}var PI=ye({},Ud,{items:W.array.isRequired,isItemDisabled:W.func,inputValue:W.string,defaultInputValue:W.string,initialInputValue:W.string,inputId:W.string,onInputValueChange:W.func});function DI(e,t,n,r){var o=b.useRef(),i=OI(e,t,n,r),s=i[0],a=i[1],u=Ko();return b.useEffect(function(){if(Oo(t,"selectedItem")){if(!u){var f=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);f&&a({type:Va,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[xo(s,t),a]}var Zd=Nt;process.env.NODE_ENV!=="production"&&(Zd=function(t,n){W.checkPropTypes(PI,t,"prop",n.name)});var MI=ye({},wi,{isItemDisabled:function(){return!1}});function kI(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case ja:s={isOpen:zn(o,"isOpen"),highlightedIndex:Qs(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Ea:e.isOpen?s={highlightedIndex:lr(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:Ii(o,e,1),isOpen:o.items.length>=0};break;case Na:e.isOpen?i?s=su(o,e.highlightedIndex):s={highlightedIndex:lr(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:Ii(o,e,-1),isOpen:o.items.length>=0};break;case Da:s=su(o,e.highlightedIndex);break;case Ta:s=ye({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Fa:s={highlightedIndex:lr(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Pa:s={highlightedIndex:lr(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case Ra:s={highlightedIndex:Yr(0,!1,o.items,o.isItemDisabled)};break;case Aa:s={highlightedIndex:Yr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case So:s=ye({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 Ma:s={isOpen:!0,highlightedIndex:Qs(o),inputValue:t.inputValue};break;case ka:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ii(o,e,0)};break;case La:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case Va:s={inputValue:t.inputValue};break;default:return AI(e,t,Yd)}return ye({},e,s)}var jI=["onMouseLeave","refKey","ref"],LI=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],VI=["onClick","onPress","refKey","ref"],$I=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];$a.stateChangeTypes=Yd;function $a(e){e===void 0&&(e={}),Zd(e,$a);var t=ye({},MI,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=DI(kI,t,FI,TI),a=s[0],u=s[1],f=a.isOpen,l=a.highlightedIndex,d=a.selectedItem,h=a.inputValue,m=b.useRef(null),y=b.useRef({}),w=b.useRef(null),g=b.useRef(null),O=Ko(),p=CI(t),v=b.useRef(),I=Vd({state:a,props:t}),x=b.useCallback(function(H){return y.current[p.getItemId(H)]},[p]);EI(i,a,[f,l,d,h],o);var E=NI({menuElement:m.current,highlightedIndex:l,isOpen:f,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:x});Kd({props:t,state:a}),b.useEffect(function(){var H=bi(t,"isOpen");H&&w.current&&w.current.focus()},[]),b.useEffect(function(){O||(v.current=n.length)});var A=SI(o,b.useCallback(function(){I.current.state.isOpen&&u({type:So,selectItem:!1})},[u,I]),b.useMemo(function(){return[m,g,w]},[m.current,g.current,w.current])),S=$d("getInputProps","getMenuProps");b.useEffect(function(){f||(y.current={})},[f]),b.useEffect(function(){var H;!f||!(o!=null&&o.document)||!(w!=null&&(H=w.current)!=null&&H.focus)||o.document.activeElement!==w.current&&w.current.focus()},[f,o]);var F=b.useMemo(function(){return{ArrowDown:function(U){U.preventDefault(),u({type:Ea,altKey:U.altKey})},ArrowUp:function(U){U.preventDefault(),u({type:Na,altKey:U.altKey})},Home:function(U){I.current.state.isOpen&&(U.preventDefault(),u({type:Ra}))},End:function(U){I.current.state.isOpen&&(U.preventDefault(),u({type:Aa}))},Escape:function(U){var q=I.current.state;(q.isOpen||q.inputValue||q.selectedItem||q.highlightedIndex>-1)&&(U.preventDefault(),u({type:Ta}))},Enter:function(U){var q=I.current.state;!q.isOpen||U.which===229||(U.preventDefault(),u({type:Da}))},PageUp:function(U){I.current.state.isOpen&&(U.preventDefault(),u({type:Fa}))},PageDown:function(U){I.current.state.isOpen&&(U.preventDefault(),u({type:Pa}))}}},[u,I]),R=b.useCallback(function(H){return ye({id:p.labelId,htmlFor:p.inputId},H)},[p]),D=b.useCallback(function(H,U){var q,V=H===void 0?{}:H,G=V.onMouseLeave,Z=V.refKey,Y=Z===void 0?"ref":Z,ee=V.ref,ne=Cn(V,jI),ce=U===void 0?{}:U,k=ce.suppressRefError,ve=k===void 0?!1:k;return S("getMenuProps",ve,Y,m),ye((q={},q[Y]=Fr(ee,function(z){m.current=z}),q.id=p.menuId,q.role="listbox",q["aria-labelledby"]=ne&&ne["aria-label"]?void 0:""+p.labelId,q.onMouseLeave=Qe(G,function(){u({type:qd})}),q),ne)},[u,S,p]),K=b.useCallback(function(H){var U,q,V=H===void 0?{}:H,G=V.item,Z=V.index,Y=V.refKey,ee=Y===void 0?"ref":Y,ne=V.ref,ce=V.onMouseMove,k=V.onMouseDown,ve=V.onClick;V.onPress;var z=V.disabled,Xe=Cn(V,LI);z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ce=I.current,ct=Ce.props,qe=Ce.state,rt=xI(G,Z,ct.items,"Pass either item or index to getItemProps!"),xe=rt[0],ze=rt[1],ft=ct.isItemDisabled(xe,ze),yt="onClick",vt=ve,Ye=function(){A.isTouchEnd||ze===qe.highlightedIndex||(E.current=!1,u({type:Bd,index:ze,disabled:ft}))},Ze=function(){u({type:ja,index:ze})},De=function(pe){return pe.preventDefault()};return ye((U={},U[ee]=Fr(ne,function(J){J&&(y.current[p.getItemId(ze)]=J)}),U["aria-disabled"]=ft,U["aria-selected"]=ze===qe.highlightedIndex,U.id=p.getItemId(ze),U.role="option",U),!ft&&(q={},q[yt]=Qe(vt,Ze),q),{onMouseMove:Qe(ce,Ye),onMouseDown:Qe(k,De)},Xe)},[u,p,I,A,E]),j=b.useCallback(function(H){var U,q=H===void 0?{}:H,V=q.onClick;q.onPress;var G=q.refKey,Z=G===void 0?"ref":G,Y=q.ref,ee=Cn(q,VI),ne=I.current.state,ce=function(){u({type:Jd})};return ye((U={},U[Z]=Fr(Y,function(k){g.current=k}),U["aria-controls"]=p.menuId,U["aria-expanded"]=ne.isOpen,U.id=p.toggleButtonId,U.tabIndex=-1,U),!ee.disabled&&ye({},{onClick:Qe(V,ce)}),ee)},[u,I,p]),L=b.useCallback(function(H,U){var q,V=H===void 0?{}:H,G=V.onKeyDown,Z=V.onChange,Y=V.onInput,ee=V.onBlur;V.onChangeText;var ne=V.onClick,ce=V.refKey,k=ce===void 0?"ref":ce,ve=V.ref,z=Cn(V,$I),Xe=U===void 0?{}:U,Ce=Xe.suppressRefError,ct=Ce===void 0?!1:Ce;S("getInputProps",ct,k,w);var qe=I.current.state,rt=function(De){var J=Ws(De);J&&F[J]&&F[J](De)},xe=function(De){u({type:Ma,inputValue:De.target.value})},ze=function(De){if(o!=null&&o.document&&qe.isOpen&&!A.isMouseDown){var J=De.relatedTarget===null&&o.document.activeElement!==o.document.body;u({type:So,selectItem:!J})}},ft=function(){u({type:ka})},yt="onChange",vt={};if(!z.disabled){var Ye;vt=(Ye={},Ye[yt]=Qe(Z,Y,xe),Ye.onKeyDown=Qe(G,rt),Ye.onBlur=Qe(ee,ze),Ye.onClick=Qe(ne,ft),Ye)}return ye((q={},q[k]=Fr(ve,function(Ze){w.current=Ze}),q["aria-activedescendant"]=qe.isOpen&&qe.highlightedIndex>-1?p.getItemId(qe.highlightedIndex):"",q["aria-autocomplete"]="list",q["aria-controls"]=p.menuId,q["aria-expanded"]=qe.isOpen,q["aria-labelledby"]=z&&z["aria-label"]?void 0:p.labelId,q.autoComplete="off",q.id=p.inputId,q.role="combobox",q.value=qe.inputValue,q),vt,z)},[u,p,o,F,I,A,S]),se=b.useCallback(function(){u({type:Hd})},[u]),re=b.useCallback(function(){u({type:zd})},[u]),ge=b.useCallback(function(){u({type:Wd})},[u]),de=b.useCallback(function(H){u({type:Qd,highlightedIndex:H})},[u]),be=b.useCallback(function(H){u({type:La,selectedItem:H})},[u]),P=b.useCallback(function(H){u({type:Gd,inputValue:H})},[u]),$=b.useCallback(function(){u({type:Xd})},[u]);return{getItemProps:K,getLabelProps:R,getMenuProps:D,getInputProps:L,getToggleButtonProps:j,toggleMenu:se,openMenu:ge,closeMenu:re,setHighlightedIndex:de,setInputValue:P,selectItem:be,reset:$,highlightedIndex:l,isOpen:f,selectedItem:d,inputValue:h}}fo.stateReducer,fo.itemToKey,fo.environment,W.array,W.array,W.array,W.func,W.number,W.number,W.number,W.func,W.func,W.string,W.string;wi.itemToKey,wi.stateReducer,wi.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 KI="_comboboxContainer_1lcc8_1",UI="_inputContainer_1lcc8_12",qI="_input_1lcc8_12",BI="_toggleButton_1lcc8_33",JI="_menu_1lcc8_39",HI="_menuBottom_1lcc8_55",WI="_menuTop_1lcc8_61",zI="_menuItem_1lcc8_66",QI="_highlighted_1lcc8_73",GI="_selected_1lcc8_77",XI="_hidden_1lcc8_81",qt={comboboxContainer:KI,inputContainer:UI,input:qI,toggleButton:BI,menu:JI,menuBottom:HI,menuTop:WI,menuItem:zI,highlighted:QI,selected:GI,hidden:XI};function YI(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function ef({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,u]=b.useState(e),f=b.useRef(null);b.useEffect(()=>u(e),[e]);const l=b.useCallback(E=>{(E==null?void 0:E.length)>0?u(e.filter(YI(E))):u(e)},[e]),{isOpen:d,getToggleButtonProps:h,getMenuProps:m,getInputProps:y,highlightedIndex:w,getItemProps:g,setInputValue:O}=$a({items:a,selectedItem:t?e.find(E=>E.value===t):null,itemToString:E=>(E==null?void 0:E.label)||"",onInputValueChange:({inputValue:E})=>l(E),onSelectedItemChange:({selectedItem:E})=>{var A;n(E),(A=f.current)==null||A.blur()}}),p=()=>{O(""),u(e)},v=()=>p(),I=b.useMemo(()=>{var E;return(E=e.find(A=>A.value===t))==null?void 0:E.label},[e,t]),x=()=>{O(t&&I?I:"")};return c.jsxs("div",{style:{position:"relative",...i},children:[c.jsx("div",{className:qt.comboboxContainer,children:c.jsxs("div",{className:qt.inputContainer,children:[c.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:qt.input,...y({onFocus:v,onBlur:x,ref:f})}),c.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:qt.toggleButton,type:"button",...h(),children:d?c.jsx(c.Fragment,{children:"↑"}):c.jsx(c.Fragment,{children:"↓"})})]})}),c.jsx("ul",{className:`${qt.menu} ${d&&e.length?"":qt.hidden} ${s==="top"?qt.menuTop:qt.menuBottom}`,...m(),children:d&&a.map((E,A)=>c.jsx("li",{className:`${qt.menuItem} ${w===A?qt.highlighted:""} ${t===(E==null?void 0:E.value)?qt.selected:""}`,...g({item:E,index:A}),children:c.jsx("span",{children:E.label})},E.id))})]})}const Zr=Math.min,Ir=Math.max,Eo=Math.round,oo=Math.floor,Gn=e=>({x:e,y:e}),ZI={left:"right",right:"left",bottom:"top",top:"bottom"},e0={start:"end",end:"start"};function Gs(e,t,n){return Ir(e,Zr(t,n))}function ji(e,t){return typeof e=="function"?e(t):e}function Sr(e){return e.split("-")[0]}function Li(e){return e.split("-")[1]}function tf(e){return e==="x"?"y":"x"}function Ka(e){return e==="y"?"height":"width"}function ei(e){return["top","bottom"].includes(Sr(e))?"y":"x"}function Ua(e){return tf(ei(e))}function t0(e,t,n){n===void 0&&(n=!1);const r=Li(e),o=Ua(e),i=Ka(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=No(s)),[s,No(s)]}function n0(e){const t=No(e);return[Xs(e),t,Xs(t)]}function Xs(e){return e.replace(/start|end/g,t=>e0[t])}function r0(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 i0(e,t,n,r){const o=Li(e);let i=r0(Sr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Xs)))),i}function No(e){return e.replace(/left|right|bottom|top/g,t=>ZI[t])}function o0(e){return{top:0,right:0,bottom:0,left:0,...e}}function nf(e){return typeof e!="number"?o0(e):{top:e,right:e,bottom:e,left:e}}function To(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 au(e,t,n){let{reference:r,floating:o}=e;const i=ei(t),s=Ua(t),a=Ka(s),u=Sr(t),f=i==="y",l=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let m;switch(u){case"top":m={x:l,y:r.y-o.height};break;case"bottom":m={x:l,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-o.width,y:d};break;default:m={x:r.x,y:r.y}}switch(Li(t)){case"start":m[s]-=h*(n&&f?-1:1);break;case"end":m[s]+=h*(n&&f?-1:1);break}return m}const s0=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),u=await(s.isRTL==null?void 0:s.isRTL(t));let f=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:d}=au(f,r,u),h=r,m={},y=0;for(let w=0;w<a.length;w++){const{name:g,fn:O}=a[w],{x:p,y:v,data:I,reset:x}=await O({x:l,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:f,platform:s,elements:{reference:e,floating:t}});l=p??l,d=v??d,m={...m,[g]:{...m[g],...I}},x&&y<=50&&(y++,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:l,y:d}=au(f,h,u)),w=-1)}return{x:l,y:d,placement:h,strategy:o,middlewareData:m}};async function rf(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:h=!1,padding:m=0}=ji(t,e),y=nf(m),g=a[h?d==="floating"?"reference":"floating":d],O=To(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(g)))==null||n?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:f,rootBoundary:l,strategy:u})),p=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),I=await(i.isElement==null?void 0:i.isElement(v))?await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1},x=To(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:p,offsetParent:v,strategy:u}):p);return{top:(O.top-x.top+y.top)/I.y,bottom:(x.bottom-O.bottom+y.bottom)/I.y,left:(O.left-x.left+y.left)/I.x,right:(x.right-O.right+y.right)/I.x}}const a0=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:u}=t,{element:f,padding:l=0}=ji(e,t)||{};if(f==null)return{};const d=nf(l),h={x:n,y:r},m=Ua(o),y=Ka(m),w=await s.getDimensions(f),g=m==="y",O=g?"top":"left",p=g?"bottom":"right",v=g?"clientHeight":"clientWidth",I=i.reference[y]+i.reference[m]-h[m]-i.floating[y],x=h[m]-i.reference[m],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let A=E?E[v]:0;(!A||!await(s.isElement==null?void 0:s.isElement(E)))&&(A=a.floating[v]||i.floating[y]);const S=I/2-x/2,F=A/2-w[y]/2-1,R=Zr(d[O],F),D=Zr(d[p],F),K=R,j=A-w[y]-D,L=A/2-w[y]/2+S,se=Gs(K,L,j),re=!u.arrow&&Li(o)!=null&&L!==se&&i.reference[y]/2-(L<K?R:D)-w[y]/2<0,ge=re?L<K?L-K:L-j:0;return{[m]:h[m]+ge,data:{[m]:se,centerOffset:L-se-ge,...re&&{alignmentOffset:ge}},reset:re}}}),c0=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:u,elements:f}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:w=!0,...g}=ji(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const O=Sr(o),p=ei(a),v=Sr(a)===a,I=await(u.isRTL==null?void 0:u.isRTL(f.floating)),x=h||(v||!w?[No(a)]:n0(a)),E=y!=="none";!h&&E&&x.push(...i0(a,w,y,I));const A=[a,...x],S=await rf(t,g),F=[];let R=((r=i.flip)==null?void 0:r.overflows)||[];if(l&&F.push(S[O]),d){const L=t0(o,s,I);F.push(S[L[0]],S[L[1]])}if(R=[...R,{placement:o,overflows:F}],!F.every(L=>L<=0)){var D,K;const L=(((D=i.flip)==null?void 0:D.index)||0)+1,se=A[L];if(se)return{data:{index:L,overflows:R},reset:{placement:se}};let re=(K=R.filter(ge=>ge.overflows[0]<=0).sort((ge,de)=>ge.overflows[1]-de.overflows[1])[0])==null?void 0:K.placement;if(!re)switch(m){case"bestFit":{var j;const ge=(j=R.filter(de=>{if(E){const be=ei(de.placement);return be===p||be==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(be=>be>0).reduce((be,P)=>be+P,0)]).sort((de,be)=>de[1]-be[1])[0])==null?void 0:j[0];ge&&(re=ge);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}};async function u0(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Sr(n),a=Li(n),u=ei(n)==="y",f=["left","top"].includes(s)?-1:1,l=i&&u?-1:1,d=ji(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:y}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof y=="number"&&(m=a==="end"?y*-1:y),u?{x:m*l,y:h*f}:{x:h*f,y:m*l}}const l0=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,u=await u0(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:i+u.y,data:{...u,placement:s}}}}},d0=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:g=>{let{x:O,y:p}=g;return{x:O,y:p}}},...u}=ji(e,t),f={x:n,y:r},l=await rf(t,u),d=ei(Sr(o)),h=tf(d);let m=f[h],y=f[d];if(i){const g=h==="y"?"top":"left",O=h==="y"?"bottom":"right",p=m+l[g],v=m-l[O];m=Gs(p,m,v)}if(s){const g=d==="y"?"top":"left",O=d==="y"?"bottom":"right",p=y+l[g],v=y-l[O];y=Gs(p,y,v)}const w=a.fn({...t,[h]:m,[d]:y});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:i,[d]:s}}}}}};function Uo(){return typeof window<"u"}function ui(e){return of(e)?(e.nodeName||"").toLowerCase():"#document"}function Rt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function un(e){var t;return(t=(of(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function of(e){return Uo()?e instanceof Node||e instanceof Rt(e).Node:!1}function Wt(e){return Uo()?e instanceof Element||e instanceof Rt(e).Element:!1}function sn(e){return Uo()?e instanceof HTMLElement||e instanceof Rt(e).HTMLElement:!1}function cu(e){return!Uo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Rt(e).ShadowRoot}function Vi(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 f0(e){return["table","td","th"].includes(ui(e))}function qo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function qa(e){const t=Ba(),n=Wt(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 p0(e){let t=Xn(e);for(;sn(t)&&!ti(t);){if(qa(t))return t;if(qo(t))return null;t=Xn(t)}return null}function Ba(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ti(e){return["html","body","#document"].includes(ui(e))}function zt(e){return Rt(e).getComputedStyle(e)}function Bo(e){return Wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xn(e){if(ui(e)==="html")return e;const t=e.assignedSlot||e.parentNode||cu(e)&&e.host||un(e);return cu(t)?t.host:t}function sf(e){const t=Xn(e);return ti(t)?e.ownerDocument?e.ownerDocument.body:e.body:sn(t)&&Vi(t)?t:sf(t)}function Si(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=sf(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Rt(o);if(i){const a=Ys(s);return t.concat(s,s.visualViewport||[],Vi(o)?o:[],a&&n?Si(a):[])}return t.concat(o,Si(o,[],n))}function Ys(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function af(e){const t=zt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=sn(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Eo(n)!==i||Eo(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Ja(e){return Wt(e)?e:e.contextElement}function Pr(e){const t=Ja(e);if(!sn(t))return Gn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=af(t);let s=(i?Eo(n.width):n.width)/r,a=(i?Eo(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const h0=Gn(0);function cf(e){const t=Rt(e);return!Ba()||!t.visualViewport?h0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function m0(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Rt(e)?!1:t}function Er(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Ja(e);let s=Gn(1);t&&(r?Wt(r)&&(s=Pr(r)):s=Pr(e));const a=m0(i,n,r)?cf(i):Gn(0);let u=(o.left+a.x)/s.x,f=(o.top+a.y)/s.y,l=o.width/s.x,d=o.height/s.y;if(i){const h=Rt(i),m=r&&Wt(r)?Rt(r):r;let y=h,w=Ys(y);for(;w&&r&&m!==y;){const g=Pr(w),O=w.getBoundingClientRect(),p=zt(w),v=O.left+(w.clientLeft+parseFloat(p.paddingLeft))*g.x,I=O.top+(w.clientTop+parseFloat(p.paddingTop))*g.y;u*=g.x,f*=g.y,l*=g.x,d*=g.y,u+=v,f+=I,y=Rt(w),w=Ys(y)}}return To({width:l,height:d,x:u,y:f})}function g0(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=un(r),a=t?qo(t.floating):!1;if(r===s||a&&i)return n;let u={scrollLeft:0,scrollTop:0},f=Gn(1);const l=Gn(0),d=sn(r);if((d||!d&&!i)&&((ui(r)!=="body"||Vi(s))&&(u=Bo(r)),sn(r))){const h=Er(r);f=Pr(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+l.x,y:n.y*f.y-u.scrollTop*f.y+l.y}}function y0(e){return Array.from(e.getClientRects())}function Zs(e,t){const n=Bo(e).scrollLeft;return t?t.left+n:Er(un(e)).left+n}function v0(e){const t=un(e),n=Bo(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+Zs(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 w0(e,t){const n=Rt(e),r=un(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,u=0;if(o){i=o.width,s=o.height;const f=Ba();(!f||f&&t==="fixed")&&(a=o.offsetLeft,u=o.offsetTop)}return{width:i,height:s,x:a,y:u}}function b0(e,t){const n=Er(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=sn(e)?Pr(e):Gn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,u=o*i.x,f=r*i.y;return{width:s,height:a,x:u,y:f}}function uu(e,t,n){let r;if(t==="viewport")r=w0(e,n);else if(t==="document")r=v0(un(e));else if(Wt(t))r=b0(t,n);else{const o=cf(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return To(r)}function uf(e,t){const n=Xn(e);return n===t||!Wt(n)||ti(n)?!1:zt(n).position==="fixed"||uf(n,t)}function I0(e,t){const n=t.get(e);if(n)return n;let r=Si(e,[],!1).filter(a=>Wt(a)&&ui(a)!=="body"),o=null;const i=zt(e).position==="fixed";let s=i?Xn(e):e;for(;Wt(s)&&!ti(s);){const a=zt(s),u=qa(s);!u&&a.position==="fixed"&&(o=null),(i?!u&&!o:!u&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Vi(s)&&!u&&uf(e,s))?r=r.filter(l=>l!==s):o=a,s=Xn(s)}return t.set(e,r),r}function C0(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?qo(t)?[]:I0(t,this._c):[].concat(n),r],a=s[0],u=s.reduce((f,l)=>{const d=uu(t,l,o);return f.top=Ir(d.top,f.top),f.right=Zr(d.right,f.right),f.bottom=Zr(d.bottom,f.bottom),f.left=Ir(d.left,f.left),f},uu(t,a,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function x0(e){const{width:t,height:n}=af(e);return{width:t,height:n}}function O0(e,t,n){const r=sn(t),o=un(t),i=n==="fixed",s=Er(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const u=Gn(0);if(r||!r&&!i)if((ui(t)!=="body"||Vi(o))&&(a=Bo(t)),r){const m=Er(t,!0,i,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else o&&(u.x=Zs(o));let f=0,l=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();l=m.top+a.scrollTop,f=m.left+a.scrollLeft-Zs(o,m)}const d=s.left+a.scrollLeft-u.x-f,h=s.top+a.scrollTop-u.y-l;return{x:d,y:h,width:s.width,height:s.height}}function hs(e){return zt(e).position==="static"}function lu(e,t){if(!sn(e)||zt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return un(e)===n&&(n=n.ownerDocument.body),n}function lf(e,t){const n=Rt(e);if(qo(e))return n;if(!sn(e)){let o=Xn(e);for(;o&&!ti(o);){if(Wt(o)&&!hs(o))return o;o=Xn(o)}return n}let r=lu(e,t);for(;r&&f0(r)&&hs(r);)r=lu(r,t);return r&&ti(r)&&hs(r)&&!qa(r)?n:r||p0(e)||n}const _0=async function(e){const t=this.getOffsetParent||lf,n=this.getDimensions,r=await n(e.floating);return{reference:O0(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function S0(e){return zt(e).direction==="rtl"}const E0={convertOffsetParentRelativeRectToViewportRelativeRect:g0,getDocumentElement:un,getClippingRect:C0,getOffsetParent:lf,getElementRects:_0,getClientRects:y0,getDimensions:x0,getScale:Pr,isElement:Wt,isRTL:S0};function N0(e,t){let n=null,r;const o=un(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),i();const{left:f,top:l,width:d,height:h}=e.getBoundingClientRect();if(a||t(),!d||!h)return;const m=oo(l),y=oo(o.clientWidth-(f+d)),w=oo(o.clientHeight-(l+h)),g=oo(f),p={rootMargin:-m+"px "+-y+"px "+-w+"px "+-g+"px",threshold:Ir(0,Zr(1,u))||1};let v=!0;function I(x){const E=x[0].intersectionRatio;if(E!==u){if(!v)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}v=!1}try{n=new IntersectionObserver(I,{...p,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,p)}n.observe(e)}return s(!0),i}function T0(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:u=!1}=r,f=Ja(e),l=o||i?[...f?Si(f):[],...Si(t)]:[];l.forEach(O=>{o&&O.addEventListener("scroll",n,{passive:!0}),i&&O.addEventListener("resize",n)});const d=f&&a?N0(f,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(O=>{let[p]=O;p&&p.target===f&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),f&&!u&&m.observe(f),m.observe(t));let y,w=u?Er(e):null;u&&g();function g(){const O=Er(e);w&&(O.x!==w.x||O.y!==w.y||O.width!==w.width||O.height!==w.height)&&n(),w=O,y=requestAnimationFrame(g)}return n(),()=>{var O;l.forEach(p=>{o&&p.removeEventListener("scroll",n),i&&p.removeEventListener("resize",n)}),d==null||d(),(O=m)==null||O.disconnect(),m=null,u&&cancelAnimationFrame(y)}}const R0=l0,A0=d0,F0=c0,P0=a0,du=(e,t,n)=>{const r=new Map,o={platform:E0,...n},i={...o.platform,_c:r};return s0(e,t,{...o,platform:i})};/*
|
|
45
|
+
*/var Yc;function eI(){return Yc||(Yc=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),y=!1,w=!1,g=!1,O=!1,p=!1,b;b=Symbol.for("react.module.reference");function v(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===i||p||z===r||z===f||z===l||O||z===m||y||w||g||typeof z=="object"&&z!==null&&(z.$$typeof===h||z.$$typeof===d||z.$$typeof===o||z.$$typeof===s||z.$$typeof===u||z.$$typeof===b||z.getModuleId!==void 0))}function x(z){if(typeof z=="object"&&z!==null){var Xe=z.$$typeof;switch(Xe){case e:var Ce=z.type;switch(Ce){case n:case i:case r:case f:case l:return Ce;default:var st=Ce&&Ce.$$typeof;switch(st){case a:case s:case u:case h:case d:case o:return st;default:return Xe}}case t:return Xe}}}var S=s,A=o,N=e,F=u,R=n,D=h,K=d,j=t,L=i,se=r,re=f,ge=l,de=!1,be=!1;function P(z){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function $(z){return be||(be=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function H(z){return x(z)===s}function U(z){return x(z)===o}function q(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function V(z){return x(z)===u}function G(z){return x(z)===n}function Z(z){return x(z)===h}function Y(z){return x(z)===d}function ee(z){return x(z)===t}function ne(z){return x(z)===i}function ce(z){return x(z)===r}function k(z){return x(z)===f}function ve(z){return x(z)===l}Te.ContextConsumer=S,Te.ContextProvider=A,Te.Element=N,Te.ForwardRef=F,Te.Fragment=R,Te.Lazy=D,Te.Memo=K,Te.Portal=j,Te.Profiler=L,Te.StrictMode=se,Te.Suspense=re,Te.SuspenseList=ge,Te.isAsyncMode=P,Te.isConcurrentMode=$,Te.isContextConsumer=H,Te.isContextProvider=U,Te.isElement=q,Te.isForwardRef=V,Te.isFragment=G,Te.isLazy=Z,Te.isMemo=Y,Te.isPortal=ee,Te.isProfiler=ne,Te.isStrictMode=ce,Te.isSuspense=k,Te.isSuspenseList=ve,Te.isValidElementType=v,Te.typeOf=x}()),Te}process.env.NODE_ENV==="production"?Ws.exports=Zb():Ws.exports=eI();var Zc=Ws.exports;const eu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,tu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",ms=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return tu(n.overflowY,t)||tu(n.overflowX,t)||(r=>{const i=(o=>{if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},ro=(e,t,n,r,i,o,s,a)=>o<e&&s>t||o>e&&s<t?0:o<=e&&a<=n||s>=t&&a>=n?o-e-r:s>t&&a<n||o<e&&a>n?s-t+i:0,tI=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},nI=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{inline:s,boundary:a,skipOverflowHiddenElements:u}=t,f=typeof a=="function"?a:j=>j!==a;if(!eu(e))throw new TypeError("Invalid target");const l=document.scrollingElement||document.documentElement,d=[];let h=e;for(;eu(h)&&f(h);){if(h=tI(h),h===l){d.push(h);break}h!=null&&h===document.body&&ms(h)&&!ms(document.documentElement)||h!=null&&ms(h,u)&&d.push(h)}const m=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(o=(i=window.visualViewport)==null?void 0:i.height)!=null?o:innerHeight,{scrollX:w,scrollY:g}=window,{height:O,width:p,top:b,right:v,bottom:x,left:S}=e.getBoundingClientRect(),{top:A,right:N,left:F}=(j=>{const L=window.getComputedStyle(j);return{top:parseFloat(L.scrollMarginTop)||0,right:parseFloat(L.scrollMarginRight)||0,bottom:parseFloat(L.scrollMarginBottom)||0,left:parseFloat(L.scrollMarginLeft)||0}})(e);let R=b-A,D=s==="center"?S+p/2-F+N:s==="end"?v+N:S-F;const K=[];for(let j=0;j<d.length;j++){const L=d[j],{height:se,width:re,top:ge,right:de,bottom:be,left:P}=L.getBoundingClientRect();if(b>=0&&S>=0&&x<=y&&v<=m&&b>=ge&&x<=be&&S>=P&&v<=de)return K;const $=getComputedStyle(L),H=parseInt($.borderLeftWidth,10),U=parseInt($.borderTopWidth,10),q=parseInt($.borderRightWidth,10),V=parseInt($.borderBottomWidth,10);let G=0,Z=0;const Y="offsetWidth"in L?L.offsetWidth-L.clientWidth-H-q:0,ee="offsetHeight"in L?L.offsetHeight-L.clientHeight-U-V:0,ne="offsetWidth"in L?L.offsetWidth===0?0:re/L.offsetWidth:0,ce="offsetHeight"in L?L.offsetHeight===0?0:se/L.offsetHeight:0;if(l===L)G=ro(g,g+y,y,U,V,g+R,g+R+O,O),Z=s==="start"?D:s==="center"?D-m/2:s==="end"?D-m:ro(w,w+m,m,H,q,w+D,w+D+p,p),G=Math.max(0,G+g),Z=Math.max(0,Z+w);else{G=ro(ge,be,se,U,V+ee,R,R+O,O),Z=s==="start"?D-P-H:s==="center"?D-(P+re/2)+Y/2:s==="end"?D-de+q+Y:ro(P,de,re,H,q+Y,D,D+p,p);const{scrollLeft:k,scrollTop:ve}=L;G=ce===0?0:Math.max(0,Math.min(ve+G/ce,L.scrollHeight-se/ce+ee)),Z=ne===0?0:Math.max(0,Math.min(k+Z/ne,L.scrollWidth-re/ne+Y)),R+=ve-G,D+=k-Z}K.push({el:L,top:G,left:Z})}return K};var Xr=function(){return Xr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Xr.apply(this,arguments)};var rI=0;function nu(e){return typeof e=="function"?e:Tt}function Tt(){}function wd(e,t){if(e){var n=nI(e,{boundary:t});n.forEach(function(r){var i=r.el,o=r.top,s=r.left;i.scrollTop=o,i.scrollLeft=s})}}function ru(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Oa(e,t){var n;function r(){n&&clearTimeout(n)}function i(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return i.cancel=r,i}function Qe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(o)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function 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(i){typeof i=="function"?i(r):i&&(i.current=r)})}}function bd(){return String(rI++)}function iI(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 iu(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Id(e){return typeof e.type=="string"}function Cd(e){return e.props}function oI(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var sI=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function io(e){e===void 0&&(e={});var t={};return sI.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Oo(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=_o(t,r)?t[r]:e[r],n},{})}function _o(e,t){return e[t]!==void 0}function zs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function aI(e){return Object.prototype.toString.call(e)==="[object Object]"}function ur(e,t,n,r,i){var o=n.length;if(o===0)return-1;var s=o-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var u=Yr(a,t<0,n,r,i);return u===-1?e>=o?-1:e:u}function Yr(e,t,n,r,i){i===void 0&&(i=!1);var o=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<o;a++)if(!r(n[a],a))return a;return i?Yr(t?o-1:0,t,n,r):-1}function So(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(ru(i,e,n)||r&&ru(i,n.document.activeElement,n))})}var _a=Tt;process.env.NODE_ENV!=="production"&&(_a=function(t,n,r){var i="This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props";Object.keys(t).forEach(function(o){n[o]!==void 0&&r[o]===void 0?console.error('downshift: A component has changed the controlled prop "'+o+'" to be uncontrolled. '+i):n[o]===void 0&&r[o]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+o+'" to be controlled. '+i)})});var cI=Oa(function(e){xd(e).textContent=""},500);function xd(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 Od(e,t){if(!(!e||!t)){var n=xd(t);n.textContent=e,cI(t)}}function uI(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var _d=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Sd=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Ed=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,lo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,fo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Nd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Td=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Rd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Ad=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Fd=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Pd=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Dd=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Md=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Qs=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,kd=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,jd=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Ld=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,lI=Object.freeze({__proto__:null,blurButton:kd,blurInput:Pd,changeInput:Dd,clickButton:Qs,clickItem:Fd,controlledPropUpdatedSelectedItem:jd,itemMouseEnter:Ed,keyDownArrowDown:fo,keyDownArrowUp:lo,keyDownEnd:Ad,keyDownEnter:Td,keyDownEscape:Nd,keyDownHome:Rd,keyDownSpaceButton:Md,mouseUp:Sd,touchEnd:Ld,unknown:_d}),dI=["refKey","ref"],fI=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],pI=["onKeyDown","onBlur","onChange","onInput","onChangeText"],hI=["refKey","ref"],mI=["onMouseMove","onMouseDown","onClick","onPress","index","item"],gI=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+bd(),o.menuId=o.props.menuId||o.id+"-menu",o.labelId=o.props.labelId||o.id+"-label",o.inputId=o.props.inputId||o.id+"-input",o.getItemId=o.props.getItemId||function(p){return o.id+"-item-"+p},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(p,b){var v=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(x){return x!==v}),p()},b);o.timeoutIds.push(v)},o.setItemCount=function(p){o.itemCount=p},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(p,b){var v=o.getItemNodeFromIndex(b);return v&&v.hasAttribute("disabled")},o.setHighlightedIndex=function(p,b){p===void 0&&(p=o.props.defaultHighlightedIndex),b===void 0&&(b={}),b=io(b),o.internalSetState(ye({highlightedIndex:p},b))},o.clearSelection=function(p){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},p)},o.selectItem=function(p,b,v){b=io(b),o.internalSetState(ye({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:p,inputValue:o.props.itemToString(p)},b),v)},o.selectItemAtIndex=function(p,b,v){var x=o.items[p];x!=null&&o.selectItem(x,b,v)},o.selectHighlightedItem=function(p,b){return o.selectItemAtIndex(o.getState().highlightedIndex,p,b)},o.internalSetState=function(p,b){var v,x,S={},A=typeof p=="function";return!A&&p.hasOwnProperty("inputValue")&&o.props.onInputValueChange(p.inputValue,ye({},o.getStateAndHelpers(),p)),o.setState(function(N){var F;N=o.getState(N);var R=A?p(N):p;R=o.props.stateReducer(N,R),v=R.hasOwnProperty("selectedItem");var D={};return v&&R.selectedItem!==N.selectedItem&&(x=R.selectedItem),(F=R).type||(F.type=_d),Object.keys(R).forEach(function(K){N[K]!==R[K]&&(S[K]=R[K]),K!=="type"&&(R[K],_o(o.props,K)||(D[K]=R[K]))}),A&&R.hasOwnProperty("inputValue")&&o.props.onInputValueChange(R.inputValue,ye({},o.getStateAndHelpers(),R)),D},function(){nu(b)();var N=Object.keys(S).length>1;N&&o.props.onStateChange(S,o.getStateAndHelpers()),v&&o.props.onSelect(p.selectedItem,o.getStateAndHelpers()),x!==void 0&&o.props.onChange(x,o.getStateAndHelpers()),o.props.onUserAction(S,o.getStateAndHelpers())})},o.rootRef=function(p){return o._rootNode=p},o.getRootProps=function(p,b){var v,x=p===void 0?{}:p,S=x.refKey,A=S===void 0?"ref":S,N=x.ref,F=Cn(x,dI),R=b===void 0?{}:b,D=R.suppressRefError,K=D===void 0?!1:D;o.getRootProps.called=!0,o.getRootProps.refKey=A,o.getRootProps.suppressRefError=K;var j=o.getState(),L=j.isOpen;return ye((v={},v[A]=Fr(N,o.rootRef),v.role="combobox",v["aria-expanded"]=L,v["aria-haspopup"]="listbox",v["aria-owns"]=L?o.menuId:void 0,v["aria-labelledby"]=o.labelId,v),F)},o.keyDownHandlers={ArrowDown:function(b){var v=this;if(b.preventDefault(),this.getState().isOpen){var x=b.shiftKey?5:1;this.moveHighlightedIndex(x,{type:fo})}else this.internalSetState({isOpen:!0,type:fo},function(){var S=v.getItemCount();if(S>0){var A=v.getState(),N=A.highlightedIndex,F=ur(N,1,{length:S},v.isItemDisabled,!0);v.setHighlightedIndex(F,{type:fo})}})},ArrowUp:function(b){var v=this;if(b.preventDefault(),this.getState().isOpen){var x=b.shiftKey?-5:-1;this.moveHighlightedIndex(x,{type:lo})}else this.internalSetState({isOpen:!0,type:lo},function(){var S=v.getItemCount();if(S>0){var A=v.getState(),N=A.highlightedIndex,F=ur(N,-1,{length:S},v.isItemDisabled,!0);v.setHighlightedIndex(F,{type:lo})}})},Enter:function(b){if(b.which!==229){var v=this.getState(),x=v.isOpen,S=v.highlightedIndex;if(x&&S!=null){b.preventDefault();var A=this.items[S],N=this.getItemNodeFromIndex(S);if(A==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Td})}}},Escape:function(b){b.preventDefault(),this.reset(ye({type:Nd},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=ye({},o.keyDownHandlers,{" ":function(b){b.preventDefault(),this.toggleMenu({type:Md})}}),o.inputKeyDownHandlers=ye({},o.keyDownHandlers,{Home:function(b){var v=this.getState(),x=v.isOpen;if(x){b.preventDefault();var S=this.getItemCount();if(!(S<=0||!x)){var A=Yr(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(A,{type:Rd})}}},End:function(b){var v=this.getState(),x=v.isOpen;if(x){b.preventDefault();var S=this.getItemCount();if(!(S<=0||!x)){var A=Yr(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(A,{type:Ad})}}}}),o.getToggleButtonProps=function(p){var b=p===void 0?{}:p,v=b.onClick;b.onPress;var x=b.onKeyDown,S=b.onKeyUp,A=b.onBlur,N=Cn(b,fI),F=o.getState(),R=F.isOpen,D={onClick:Qe(v,o.buttonHandleClick),onKeyDown:Qe(x,o.buttonHandleKeyDown),onKeyUp:Qe(S,o.buttonHandleKeyUp),onBlur:Qe(A,o.buttonHandleBlur)},K=N.disabled?{}:D;return ye({type:"button",role:"button","aria-label":R?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},K,N)},o.buttonHandleKeyUp=function(p){p.preventDefault()},o.buttonHandleKeyDown=function(p){var b=zs(p);o.buttonKeyDownHandlers[b]&&o.buttonKeyDownHandlers[b].call(o,p)},o.buttonHandleClick=function(p){if(p.preventDefault(),o.props.environment){var b=o.props.environment.document,v=b.body,x=b.activeElement;v&&v===x&&p.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:Qs}):o.internalSetTimeout(function(){return o.toggleMenu({type:Qs})})},o.buttonHandleBlur=function(p){var b=p.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var v=o.props.environment.document.activeElement;(v==null||v.id!==o.inputId)&&v!==b&&o.reset({type:kd})}})},o.getLabelProps=function(p){return ye({htmlFor:o.inputId,id:o.labelId},p)},o.getInputProps=function(p){var b=p===void 0?{}:p,v=b.onKeyDown,x=b.onBlur,S=b.onChange,A=b.onInput;b.onChangeText;var N=Cn(b,pI),F,R={};F="onChange";var D=o.getState(),K=D.inputValue,j=D.isOpen,L=D.highlightedIndex;if(!N.disabled){var se;R=(se={},se[F]=Qe(S,A,o.inputHandleChange),se.onKeyDown=Qe(v,o.inputHandleKeyDown),se.onBlur=Qe(x,o.inputHandleBlur),se)}return ye({"aria-autocomplete":"list","aria-activedescendant":j&&typeof L=="number"&&L>=0?o.getItemId(L):void 0,"aria-controls":j?o.menuId:void 0,"aria-labelledby":N&&N["aria-label"]?void 0:o.labelId,autoComplete:"off",value:K,id:o.inputId},R,N)},o.inputHandleKeyDown=function(p){var b=zs(p);b&&o.inputKeyDownHandlers[b]&&o.inputKeyDownHandlers[b].call(o,p)},o.inputHandleChange=function(p){o.internalSetState({type:Dd,isOpen:!0,inputValue:p.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var p;if(!(o.isMouseDown||!o.props.environment)){var b=o.props.environment.document.activeElement,v=(b==null||(p=b.dataset)==null?void 0:p.toggle)&&o._rootNode&&o._rootNode.contains(b);v||o.reset({type:Pd})}})},o.menuRef=function(p){o._menuNode=p},o.getMenuProps=function(p,b){var v,x=p===void 0?{}:p,S=x.refKey,A=S===void 0?"ref":S,N=x.ref,F=Cn(x,hI),R=b===void 0?{}:b,D=R.suppressRefError,K=D===void 0?!1:D;return o.getMenuProps.called=!0,o.getMenuProps.refKey=A,o.getMenuProps.suppressRefError=K,ye((v={},v[A]=Fr(N,o.menuRef),v.role="listbox",v["aria-labelledby"]=F&&F["aria-label"]?void 0:o.labelId,v.id=o.menuId,v),F)},o.getItemProps=function(p){var b,v=p===void 0?{}:p,x=v.onMouseMove,S=v.onMouseDown,A=v.onClick;v.onPress;var N=v.index,F=v.item,R=F===void 0?process.env.NODE_ENV==="production"?void 0:oI("getItemProps","item"):F,D=Cn(v,mI);N===void 0?(o.items.push(R),N=o.items.indexOf(R)):o.items[N]=R;var K="onClick",j=A,L=(b={onMouseMove:Qe(x,function(){N!==o.getState().highlightedIndex&&(o.setHighlightedIndex(N,{type:Ed}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:Qe(S,function(re){re.preventDefault()})},b[K]=Qe(j,function(){o.selectItemAtIndex(N,{type:Fd})}),b),se=D.disabled?{onMouseDown:L.onMouseDown}:L;return ye({id:o.getItemId(N),role:"option","aria-selected":o.getState().highlightedIndex===N},se,D)},o.clearItems=function(){o.items=[]},o.reset=function(p,b){p===void 0&&(p={}),p=io(p),o.internalSetState(function(v){var x=v.selectedItem;return ye({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(x)},p)},b)},o.toggleMenu=function(p,b){p===void 0&&(p={}),p=io(p),o.internalSetState(function(v){var x=v.isOpen;return ye({isOpen:!x},x&&{highlightedIndex:o.props.defaultHighlightedIndex},p)},function(){var v=o.getState(),x=v.isOpen,S=v.highlightedIndex;x&&o.getItemCount()>0&&typeof S=="number"&&o.setHighlightedIndex(S,p),nu(b)()})},o.openMenu=function(p){o.internalSetState({isOpen:!0},p)},o.closeMenu=function(p){o.internalSetState({isOpen:!1},p)},o.updateStatus=Oa(function(){var p;if((p=o.props)!=null&&(p=p.environment)!=null&&p.document){var b=o.getState(),v=o.items[b.highlightedIndex],x=o.getItemCount(),S=o.props.getA11yStatusMessage(ye({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:x,highlightedItem:v},b));o.previousResultCount=x,Od(S,o.props.environment.document)}},200);var s=o.props,a=s.defaultHighlightedIndex,u=s.initialHighlightedIndex,f=u===void 0?a:u,l=s.defaultIsOpen,d=s.initialIsOpen,h=d===void 0?l:d,m=s.initialInputValue,y=m===void 0?"":m,w=s.initialSelectedItem,g=w===void 0?null:w,O=o.getState({highlightedIndex:f,isOpen:h,inputValue:y,selectedItem:g});return O.selectedItem!=null&&o.props.initialInputValue===void 0&&(O.inputValue=o.props.itemToString(O.selectedItem)),o.state=O,o}qb(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(o){clearTimeout(o)}),this.timeoutIds=[]},r.getState=function(o){return o===void 0&&(o=this.state),Oo(o,this.props)},r.getItemCount=function(){var o=this.items.length;return this.itemCount!=null?o=this.itemCount:this.props.itemCount!==void 0&&(o=this.props.itemCount),o},r.getItemNodeFromIndex=function(o){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(o)):null},r.scrollHighlightedItemIntoView=function(){{var o=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(o,this._menuNode)}},r.moveHighlightedIndex=function(o,s){var a=this.getItemCount(),u=this.getState(),f=u.highlightedIndex;if(a>0){var l=ur(f,o,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(l,s)}},r.getStateAndHelpers=function(){var o=this.getState(),s=o.highlightedIndex,a=o.inputValue,u=o.selectedItem,f=o.isOpen,l=this.props.itemToString,d=this.id,h=this.getRootProps,m=this.getToggleButtonProps,y=this.getLabelProps,w=this.getMenuProps,g=this.getInputProps,O=this.getItemProps,p=this.openMenu,b=this.closeMenu,v=this.toggleMenu,x=this.selectItem,S=this.selectItemAtIndex,A=this.selectHighlightedItem,N=this.setHighlightedIndex,F=this.clearSelection,R=this.clearItems,D=this.reset,K=this.setItemCount,j=this.unsetItemCount,L=this.internalSetState;return{getRootProps:h,getToggleButtonProps:m,getLabelProps:y,getMenuProps:w,getInputProps:g,getItemProps:O,reset:D,openMenu:p,closeMenu:b,toggleMenu:v,selectItem:x,selectItemAtIndex:S,selectHighlightedItem:A,setHighlightedIndex:N,clearSelection:F,clearItems:R,setItemCount:K,unsetItemCount:j,setState:L,itemToString:l,id:d,highlightedIndex:s,inputValue:a,isOpen:f,selectedItem:u}},r.componentDidMount=function(){var o=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&ou(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){o.internalClearTimeouts()};else{var s=function(){o.isMouseDown=!0},a=function(m){o.isMouseDown=!1;var y=So(m.target,[o._rootNode,o._menuNode],o.props.environment);!y&&o.getState().isOpen&&o.reset({type:Sd},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},u=function(){o.isTouchMove=!1},f=function(){o.isTouchMove=!0},l=function(m){var y=So(m.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!y&&o.getState().isOpen&&o.reset({type:Ld},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},d=this.props.environment;d.addEventListener("mousedown",s),d.addEventListener("mouseup",a),d.addEventListener("touchstart",u),d.addEventListener("touchmove",f),d.addEventListener("touchend",l),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),d.removeEventListener("mousedown",s),d.removeEventListener("mouseup",a),d.removeEventListener("touchstart",u),d.removeEventListener("touchmove",f),d.removeEventListener("touchend",l)}}},r.shouldScroll=function(o,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,u=a.highlightedIndex,f=s.highlightedIndex===void 0?o:s,l=f.highlightedIndex,d=u&&this.getState().isOpen&&!o.isOpen,h=u!==l;return d||h},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(_a(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&ou(this._menuNode,this.getMenuProps)),_o(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:jd,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,o)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var o=iu(this.props.children,Tt);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=iu(o(this.getStateAndHelpers()));if(!s)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&yI(s,this.getRootProps),s;if(Id(s))return I.cloneElement(s,this.getRootProps(Cd(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}(I.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:iI,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&aI(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:Tt,onInputValueChange:Tt,onUserAction:Tt,onChange:Tt,onSelect:Tt,onOuterClick:Tt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:wd},e.stateChangeTypes=lI,e}();process.env.NODE_ENV!=="production"&&(gI.propTypes={children:W.func,defaultHighlightedIndex:W.number,defaultIsOpen:W.bool,initialHighlightedIndex:W.number,initialSelectedItem:W.any,initialInputValue:W.string,initialIsOpen:W.bool,getA11yStatusMessage:W.func,itemToString:W.func,onChange:W.func,onSelect:W.func,onStateChange:W.func,onInputValueChange:W.func,onUserAction:W.func,onOuterClick:W.func,selectedItemChanged:W.func,stateReducer:W.func,itemCount:W.number,id:W.string,environment:W.shape({addEventListener:W.func.isRequired,removeEventListener:W.func.isRequired,document:W.shape({createElement:W.func.isRequired,getElementById:W.func.isRequired,activeElement:W.any.isRequired,body:W.any.isRequired}).isRequired,Node:W.func.isRequired}),suppressRefError:W.bool,scrollIntoView:W.func,selectedItem:W.any,isOpen:W.bool,inputValue:W.string,highlightedIndex:W.number,labelId:W.string,inputId:W.string,menuId:W.string,getItemId:W.func});function ou(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 yI(e,t){var n=t.refKey,r=n!=="ref",i=!Id(e);i&&!r&&!Zc.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!i&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!Zc.isForwardRef(e)&&!Cd(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 vI(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){wI(s,e,t,n),n[s]!==t[s]&&(o[s]=n[s])}),r.onStateChange&&Object.keys(o).length&&r.onStateChange(ye({type:i},o))}function wI(e,t,n,r){var i=t.props,o=t.type,s="on"+Sa(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](ye({type:o},r))}function bI(e,t){return t.changes}var su=Oa(function(e,t){Od(e,t)},200),II=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?I.useLayoutEffect:I.useEffect,CI="useId"in I?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,a=t.inputId,u="downshift-"+I.useId();n||(n=u);var f=I.useRef({labelId:r||n+"-label",menuId:i||n+"-menu",getItemId:o||function(l){return n+"-item-"+l},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return f.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+bd():n,i=t.labelId,o=t.menuId,s=t.getItemId,a=t.toggleButtonId,u=t.inputId,f=I.useRef({labelId:i||r+"-label",menuId:o||r+"-menu",getItemId:s||function(l){return r+"-item-"+l},toggleButtonId:a||r+"-toggle-button",inputId:u||r+"-input"});return f.current};function xI(e,t,n,r){var i,o;if(e===void 0){if(t===void 0)throw new Error(r);i=n[t],o=t}else o=t===void 0?n.indexOf(e):t,i=e;return[i,o]}function Sa(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function $d(e){var t=I.useRef(e);return t.current=e,t}function OI(e,t,n,r){var i=I.useRef(),o=I.useRef(),s=I.useCallback(function(m,y){o.current=y,m=Oo(m,y.props);var w=e(m,y),g=y.props.stateReducer(m,ye({},y,{changes:w}));return g},[e]),a=I.useReducer(s,t,n),u=a[0],f=a[1],l=$d(t),d=I.useCallback(function(m){return f(ye({props:l.current},m))},[l]),h=o.current;return I.useEffect(function(){var m=Oo(i.current,h==null?void 0:h.props),y=h&&i.current&&!r(m,u);y&&vI(h,m,u),i.current=u},[u,h,r]),[u,d]}var wi={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:bI,scrollIntoView:wd,environment:typeof window>"u"?void 0:window};function zn(e,t,n){n===void 0&&(n=Vd);var r=e["default"+Sa(t)];return r!==void 0?r:n[t]}function bi(e,t,n){n===void 0&&(n=Vd);var r=e[t];if(r!==void 0)return r;var i=e["initial"+Sa(t)];return i!==void 0?i:zn(e,t,n)}function _I(e){var t=bi(e,"selectedItem"),n=bi(e,"isOpen"),r=RI(e),i=bi(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(o){return e.itemToKey(o)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:i}}function Ii(e,t,n){var r=e.items,i=e.initialHighlightedIndex,o=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,u=t.selectedItem,f=t.highlightedIndex;return r.length===0?-1:i!==void 0&&f===i&&!s(r[i],i)?i:o!==void 0&&!s(r[o],o)?o:u?r.findIndex(function(l){return a(u)===a(l)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function SI(e,t,n){var r=I.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return I.useEffect(function(){if(!e)return Tt;var i=n.map(function(l){return l.current});function o(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(l){r.current.isMouseDown=!1,So(l.target,i,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function u(){r.current.isTouchMove=!0}function f(l){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!So(l.target,i,e,!1)&&t()}return e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",u),e.addEventListener("touchend",f),function(){e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",u),e.removeEventListener("touchend",f)}},[n,e,t]),r.current}var Kd=function(){return Tt};process.env.NODE_ENV!=="production"&&(Kd=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=I.useRef(n.reduce(function(s,a){return s[a]={},s},{}));I.useEffect(function(){Object.keys(i.current).forEach(function(s){var a=i.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var u=a.suppressRefError,f=a.refKey,l=a.elementRef;u||l!=null&&l.current||console.error('downshift: The ref prop "'+f+'" from '+s+" was not applied correctly on your element.")})},[]);var o=I.useCallback(function(s,a,u,f){i.current[s]={suppressRefError:a,refKey:u,elementRef:f}},[]);return o});function EI(e,t,n,r){r===void 0&&(r={});var i=r.document,o=qo();I.useEffect(function(){if(!(!e||o||!i)){var s=e(t);su(s,i)}},n),I.useEffect(function(){return function(){su.cancel(),uI(i)}},[i])}function NI(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,o=e.menuElement,s=e.scrollIntoView,a=I.useRef(!0);return II(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var Ud=Tt;process.env.NODE_ENV!=="production"&&(Ud=function(t){var n=t.props,r=t.state,i=I.useRef(n),o=qo();I.useEffect(function(){o||(_a(r,i.current,n),i.current=n)},[r,n,o])});function au(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return ye({isOpen:!1,highlightedIndex:-1},i&&ye({selectedItem:e.items[t],isOpen:zn(e,"isOpen"),highlightedIndex:zn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function TI(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function qo(){var e=I.useRef(!0);return I.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Gs(e){var t=zn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function RI(e){var t=bi(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var po={environment:W.shape({addEventListener:W.func.isRequired,removeEventListener:W.func.isRequired,document:W.shape({createElement:W.func.isRequired,getElementById:W.func.isRequired,activeElement:W.any.isRequired,body:W.any.isRequired}).isRequired,Node:W.func.isRequired}),itemToString:W.func,itemToKey:W.func,stateReducer:W.func},qd=ye({},po,{getA11yStatusMessage:W.func,highlightedIndex:W.number,defaultHighlightedIndex:W.number,initialHighlightedIndex:W.number,isOpen:W.bool,defaultIsOpen:W.bool,initialIsOpen:W.bool,selectedItem:W.any,initialSelectedItem:W.any,defaultSelectedItem:W.any,id:W.string,labelId:W.string,menuId:W.string,getItemId:W.func,toggleButtonId:W.string,onSelectedItemChange:W.func,onHighlightedIndexChange:W.func,onStateChange:W.func,onIsOpenChange:W.func,scrollIntoView:W.func});function AI(e,t,n){var r=t.type,i=t.props,o;switch(r){case n.ItemMouseMove:o={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:o={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:o={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ii(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:Ii(i,e,0)};break;case n.FunctionCloseMenu:o={isOpen:!1};break;case n.FunctionSetHighlightedIndex:o={highlightedIndex:i.isItemDisabled(i.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:o={inputValue:t.inputValue};break;case n.FunctionReset:o={highlightedIndex:Gs(i),isOpen:zn(i,"isOpen"),selectedItem:zn(i,"selectedItem"),inputValue:zn(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return ye({},e,o)}Xr(Xr({},qd),{items:W.array.isRequired,isItemDisabled:W.func});Xr(Xr({},wi),{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 Ea=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Na=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ta=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Ra=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Aa=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Fa=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Pa=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Da=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Ma=process.env.NODE_ENV!=="production"?"__input_change__":8,Eo=process.env.NODE_ENV!=="production"?"__input_blur__":9,ka=process.env.NODE_ENV!=="production"?"__input_click__":10,Bd=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Jd=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ja=process.env.NODE_ENV!=="production"?"__item_click__":13,Hd=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Wd=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,zd=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Qd=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Gd=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,La=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Xd=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Yd=process.env.NODE_ENV!=="production"?"__function_reset__":21,Va=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Zd=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:Va,FunctionCloseMenu:Qd,FunctionOpenMenu:zd,FunctionReset:Yd,FunctionSelectItem:La,FunctionSetHighlightedIndex:Gd,FunctionSetInputValue:Xd,FunctionToggleMenu:Wd,InputBlur:Eo,InputChange:Ma,InputClick:ka,InputKeyDownArrowDown:Ea,InputKeyDownArrowUp:Na,InputKeyDownEnd:Aa,InputKeyDownEnter:Da,InputKeyDownEscape:Ta,InputKeyDownHome:Ra,InputKeyDownPageDown:Pa,InputKeyDownPageUp:Fa,ItemClick:ja,ItemMouseMove:Jd,MenuMouseLeave:Bd,ToggleButtonClick:Hd});function FI(e){var t=_I(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)),ye({},t,{inputValue:r})}var PI=ye({},qd,{items:W.array.isRequired,isItemDisabled:W.func,inputValue:W.string,defaultInputValue:W.string,initialInputValue:W.string,inputId:W.string,onInputValueChange:W.func});function DI(e,t,n,r){var i=I.useRef(),o=OI(e,t,n,r),s=o[0],a=o[1],u=qo();return I.useEffect(function(){if(_o(t,"selectedItem")){if(!u){var f=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);f&&a({type:Va,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Oo(s,t),a]}var ef=Tt;process.env.NODE_ENV!=="production"&&(ef=function(t,n){W.checkPropTypes(PI,t,"prop",n.name)});var MI=ye({},wi,{isItemDisabled:function(){return!1}});function kI(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case ja:s={isOpen:zn(i,"isOpen"),highlightedIndex:Gs(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case Ea:e.isOpen?s={highlightedIndex:ur(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:Ii(i,e,1),isOpen:i.items.length>=0};break;case Na:e.isOpen?o?s=au(i,e.highlightedIndex):s={highlightedIndex:ur(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Ii(i,e,-1),isOpen:i.items.length>=0};break;case Da:s=au(i,e.highlightedIndex);break;case Ta:s=ye({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Fa:s={highlightedIndex:ur(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case Pa:s={highlightedIndex:ur(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case Ra:s={highlightedIndex:Yr(0,!1,i.items,i.isItemDisabled)};break;case Aa:s={highlightedIndex:Yr(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case Eo:s=ye({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=i.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])});break;case Ma:s={isOpen:!0,highlightedIndex:Gs(i),inputValue:t.inputValue};break;case ka:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ii(i,e,0)};break;case La:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case Va:s={inputValue:t.inputValue};break;default:return AI(e,t,Zd)}return ye({},e,s)}var jI=["onMouseLeave","refKey","ref"],LI=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],VI=["onClick","onPress","refKey","ref"],$I=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];$a.stateChangeTypes=Zd;function $a(e){e===void 0&&(e={}),ef(e,$a);var t=ye({},MI,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=DI(kI,t,FI,TI),a=s[0],u=s[1],f=a.isOpen,l=a.highlightedIndex,d=a.selectedItem,h=a.inputValue,m=I.useRef(null),y=I.useRef({}),w=I.useRef(null),g=I.useRef(null),O=qo(),p=CI(t),b=I.useRef(),v=$d({state:a,props:t}),x=I.useCallback(function(H){return y.current[p.getItemId(H)]},[p]);EI(o,a,[f,l,d,h],i);var S=NI({menuElement:m.current,highlightedIndex:l,isOpen:f,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:x});Ud({props:t,state:a}),I.useEffect(function(){var H=bi(t,"isOpen");H&&w.current&&w.current.focus()},[]),I.useEffect(function(){O||(b.current=n.length)});var A=SI(i,I.useCallback(function(){v.current.state.isOpen&&u({type:Eo,selectItem:!1})},[u,v]),I.useMemo(function(){return[m,g,w]},[m.current,g.current,w.current])),N=Kd("getInputProps","getMenuProps");I.useEffect(function(){f||(y.current={})},[f]),I.useEffect(function(){var H;!f||!(i!=null&&i.document)||!(w!=null&&(H=w.current)!=null&&H.focus)||i.document.activeElement!==w.current&&w.current.focus()},[f,i]);var F=I.useMemo(function(){return{ArrowDown:function(U){U.preventDefault(),u({type:Ea,altKey:U.altKey})},ArrowUp:function(U){U.preventDefault(),u({type:Na,altKey:U.altKey})},Home:function(U){v.current.state.isOpen&&(U.preventDefault(),u({type:Ra}))},End:function(U){v.current.state.isOpen&&(U.preventDefault(),u({type:Aa}))},Escape:function(U){var q=v.current.state;(q.isOpen||q.inputValue||q.selectedItem||q.highlightedIndex>-1)&&(U.preventDefault(),u({type:Ta}))},Enter:function(U){var q=v.current.state;!q.isOpen||U.which===229||(U.preventDefault(),u({type:Da}))},PageUp:function(U){v.current.state.isOpen&&(U.preventDefault(),u({type:Fa}))},PageDown:function(U){v.current.state.isOpen&&(U.preventDefault(),u({type:Pa}))}}},[u,v]),R=I.useCallback(function(H){return ye({id:p.labelId,htmlFor:p.inputId},H)},[p]),D=I.useCallback(function(H,U){var q,V=H===void 0?{}:H,G=V.onMouseLeave,Z=V.refKey,Y=Z===void 0?"ref":Z,ee=V.ref,ne=Cn(V,jI),ce=U===void 0?{}:U,k=ce.suppressRefError,ve=k===void 0?!1:k;return N("getMenuProps",ve,Y,m),ye((q={},q[Y]=Fr(ee,function(z){m.current=z}),q.id=p.menuId,q.role="listbox",q["aria-labelledby"]=ne&&ne["aria-label"]?void 0:""+p.labelId,q.onMouseLeave=Qe(G,function(){u({type:Bd})}),q),ne)},[u,N,p]),K=I.useCallback(function(H){var U,q,V=H===void 0?{}:H,G=V.item,Z=V.index,Y=V.refKey,ee=Y===void 0?"ref":Y,ne=V.ref,ce=V.onMouseMove,k=V.onMouseDown,ve=V.onClick;V.onPress;var z=V.disabled,Xe=Cn(V,LI);z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ce=v.current,st=Ce.props,Ue=Ce.state,rt=xI(G,Z,st.items,"Pass either item or index to getItemProps!"),xe=rt[0],ze=rt[1],ft=st.isItemDisabled(xe,ze),yt="onClick",vt=ve,Ye=function(){A.isTouchEnd||ze===Ue.highlightedIndex||(S.current=!1,u({type:Jd,index:ze,disabled:ft}))},Ze=function(){u({type:ja,index:ze})},De=function(pe){return pe.preventDefault()};return ye((U={},U[ee]=Fr(ne,function(J){J&&(y.current[p.getItemId(ze)]=J)}),U["aria-disabled"]=ft,U["aria-selected"]=ze===Ue.highlightedIndex,U.id=p.getItemId(ze),U.role="option",U),!ft&&(q={},q[yt]=Qe(vt,Ze),q),{onMouseMove:Qe(ce,Ye),onMouseDown:Qe(k,De)},Xe)},[u,p,v,A,S]),j=I.useCallback(function(H){var U,q=H===void 0?{}:H,V=q.onClick;q.onPress;var G=q.refKey,Z=G===void 0?"ref":G,Y=q.ref,ee=Cn(q,VI),ne=v.current.state,ce=function(){u({type:Hd})};return ye((U={},U[Z]=Fr(Y,function(k){g.current=k}),U["aria-controls"]=p.menuId,U["aria-expanded"]=ne.isOpen,U.id=p.toggleButtonId,U.tabIndex=-1,U),!ee.disabled&&ye({},{onClick:Qe(V,ce)}),ee)},[u,v,p]),L=I.useCallback(function(H,U){var q,V=H===void 0?{}:H,G=V.onKeyDown,Z=V.onChange,Y=V.onInput,ee=V.onBlur;V.onChangeText;var ne=V.onClick,ce=V.refKey,k=ce===void 0?"ref":ce,ve=V.ref,z=Cn(V,$I),Xe=U===void 0?{}:U,Ce=Xe.suppressRefError,st=Ce===void 0?!1:Ce;N("getInputProps",st,k,w);var Ue=v.current.state,rt=function(De){var J=zs(De);J&&F[J]&&F[J](De)},xe=function(De){u({type:Ma,inputValue:De.target.value})},ze=function(De){if(i!=null&&i.document&&Ue.isOpen&&!A.isMouseDown){var J=De.relatedTarget===null&&i.document.activeElement!==i.document.body;u({type:Eo,selectItem:!J})}},ft=function(){u({type:ka})},yt="onChange",vt={};if(!z.disabled){var Ye;vt=(Ye={},Ye[yt]=Qe(Z,Y,xe),Ye.onKeyDown=Qe(G,rt),Ye.onBlur=Qe(ee,ze),Ye.onClick=Qe(ne,ft),Ye)}return ye((q={},q[k]=Fr(ve,function(Ze){w.current=Ze}),q["aria-activedescendant"]=Ue.isOpen&&Ue.highlightedIndex>-1?p.getItemId(Ue.highlightedIndex):"",q["aria-autocomplete"]="list",q["aria-controls"]=p.menuId,q["aria-expanded"]=Ue.isOpen,q["aria-labelledby"]=z&&z["aria-label"]?void 0:p.labelId,q.autoComplete="off",q.id=p.inputId,q.role="combobox",q.value=Ue.inputValue,q),vt,z)},[u,p,i,F,v,A,N]),se=I.useCallback(function(){u({type:Wd})},[u]),re=I.useCallback(function(){u({type:Qd})},[u]),ge=I.useCallback(function(){u({type:zd})},[u]),de=I.useCallback(function(H){u({type:Gd,highlightedIndex:H})},[u]),be=I.useCallback(function(H){u({type:La,selectedItem:H})},[u]),P=I.useCallback(function(H){u({type:Xd,inputValue:H})},[u]),$=I.useCallback(function(){u({type:Yd})},[u]);return{getItemProps:K,getLabelProps:R,getMenuProps:D,getInputProps:L,getToggleButtonProps:j,toggleMenu:se,openMenu:ge,closeMenu:re,setHighlightedIndex:de,setInputValue:P,selectItem:be,reset:$,highlightedIndex:l,isOpen:f,selectedItem:d,inputValue:h}}po.stateReducer,po.itemToKey,po.environment,W.array,W.array,W.array,W.func,W.number,W.number,W.number,W.func,W.func,W.string,W.string;wi.itemToKey,wi.stateReducer,wi.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 KI="_comboboxContainer_1lcc8_1",UI="_inputContainer_1lcc8_12",qI="_input_1lcc8_12",BI="_toggleButton_1lcc8_33",JI="_menu_1lcc8_39",HI="_menuBottom_1lcc8_55",WI="_menuTop_1lcc8_61",zI="_menuItem_1lcc8_66",QI="_highlighted_1lcc8_73",GI="_selected_1lcc8_77",XI="_hidden_1lcc8_81",qt={comboboxContainer:KI,inputContainer:UI,input:qI,toggleButton:BI,menu:JI,menuBottom:HI,menuTop:WI,menuItem:zI,highlighted:QI,selected:GI,hidden:XI};function YI(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function tf({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:i,style:o,menuPosition:s="bottom"}){const[a,u]=I.useState(e),f=I.useRef(null);I.useEffect(()=>u(e),[e]);const l=I.useCallback(S=>{(S==null?void 0:S.length)>0?u(e.filter(YI(S))):u(e)},[e]),{isOpen:d,getToggleButtonProps:h,getMenuProps:m,getInputProps:y,highlightedIndex:w,getItemProps:g,setInputValue:O}=$a({items:a,selectedItem:t?e.find(S=>S.value===t):null,itemToString:S=>(S==null?void 0:S.label)||"",onInputValueChange:({inputValue:S})=>l(S),onSelectedItemChange:({selectedItem:S})=>{var A;n(S),(A=f.current)==null||A.blur()}}),p=()=>{O(""),u(e)},b=()=>p(),v=I.useMemo(()=>{var S;return(S=e.find(A=>A.value===t))==null?void 0:S.label},[e,t]),x=()=>{O(t&&v?v:"")};return c.jsxs("div",{style:{position:"relative",...o},children:[c.jsx("div",{className:qt.comboboxContainer,children:c.jsxs("div",{className:qt.inputContainer,children:[c.jsx("input",{style:{border:"none"},disabled:i,placeholder:r,className:qt.input,...y({onFocus:b,onBlur:x,ref:f})}),c.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:qt.toggleButton,type:"button",...h(),children:d?c.jsx(c.Fragment,{children:"↑"}):c.jsx(c.Fragment,{children:"↓"})})]})}),c.jsx("ul",{className:`${qt.menu} ${d&&e.length?"":qt.hidden} ${s==="top"?qt.menuTop:qt.menuBottom}`,...m(),children:d&&a.map((S,A)=>c.jsx("li",{className:`${qt.menuItem} ${w===A?qt.highlighted:""} ${t===(S==null?void 0:S.value)?qt.selected:""}`,...g({item:S,index:A}),children:c.jsx("span",{children:S.label})},S.id))})]})}const Zr=Math.min,br=Math.max,No=Math.round,oo=Math.floor,Gn=e=>({x:e,y:e}),ZI={left:"right",right:"left",bottom:"top",top:"bottom"},e0={start:"end",end:"start"};function Xs(e,t,n){return br(e,Zr(t,n))}function ji(e,t){return typeof e=="function"?e(t):e}function _r(e){return e.split("-")[0]}function Li(e){return e.split("-")[1]}function nf(e){return e==="x"?"y":"x"}function Ka(e){return e==="y"?"height":"width"}function ei(e){return["top","bottom"].includes(_r(e))?"y":"x"}function Ua(e){return nf(ei(e))}function t0(e,t,n){n===void 0&&(n=!1);const r=Li(e),i=Ua(e),o=Ka(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=To(s)),[s,To(s)]}function n0(e){const t=To(e);return[Ys(e),t,Ys(t)]}function Ys(e){return e.replace(/start|end/g,t=>e0[t])}function r0(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:s;default:return[]}}function i0(e,t,n,r){const i=Li(e);let o=r0(_r(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Ys)))),o}function To(e){return e.replace(/left|right|bottom|top/g,t=>ZI[t])}function o0(e){return{top:0,right:0,bottom:0,left:0,...e}}function rf(e){return typeof e!="number"?o0(e):{top:e,right:e,bottom:e,left:e}}function Ro(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function cu(e,t,n){let{reference:r,floating:i}=e;const o=ei(t),s=Ua(t),a=Ka(s),u=_r(t),f=o==="y",l=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let m;switch(u){case"top":m={x:l,y:r.y-i.height};break;case"bottom":m={x:l,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-i.width,y:d};break;default:m={x:r.x,y:r.y}}switch(Li(t)){case"start":m[s]-=h*(n&&f?-1:1);break;case"end":m[s]+=h*(n&&f?-1:1);break}return m}const s0=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),u=await(s.isRTL==null?void 0:s.isRTL(t));let f=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:l,y:d}=cu(f,r,u),h=r,m={},y=0;for(let w=0;w<a.length;w++){const{name:g,fn:O}=a[w],{x:p,y:b,data:v,reset:x}=await O({x:l,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:m,rects:f,platform:s,elements:{reference:e,floating:t}});l=p??l,d=b??d,m={...m,[g]:{...m[g],...v}},x&&y<=50&&(y++,typeof x=="object"&&(x.placement&&(h=x.placement),x.rects&&(f=x.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:l,y:d}=cu(f,h,u)),w=-1)}return{x:l,y:d,placement:h,strategy:i,middlewareData:m}};async function of(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:h=!1,padding:m=0}=ji(t,e),y=rf(m),g=a[h?d==="floating"?"reference":"floating":d],O=Ro(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:f,rootBoundary:l,strategy:u})),p=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),v=await(o.isElement==null?void 0:o.isElement(b))?await(o.getScale==null?void 0:o.getScale(b))||{x:1,y:1}:{x:1,y:1},x=Ro(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:p,offsetParent:b,strategy:u}):p);return{top:(O.top-x.top+y.top)/v.y,bottom:(x.bottom-O.bottom+y.bottom)/v.y,left:(O.left-x.left+y.left)/v.x,right:(x.right-O.right+y.right)/v.x}}const a0=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:u}=t,{element:f,padding:l=0}=ji(e,t)||{};if(f==null)return{};const d=rf(l),h={x:n,y:r},m=Ua(i),y=Ka(m),w=await s.getDimensions(f),g=m==="y",O=g?"top":"left",p=g?"bottom":"right",b=g?"clientHeight":"clientWidth",v=o.reference[y]+o.reference[m]-h[m]-o.floating[y],x=h[m]-o.reference[m],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let A=S?S[b]:0;(!A||!await(s.isElement==null?void 0:s.isElement(S)))&&(A=a.floating[b]||o.floating[y]);const N=v/2-x/2,F=A/2-w[y]/2-1,R=Zr(d[O],F),D=Zr(d[p],F),K=R,j=A-w[y]-D,L=A/2-w[y]/2+N,se=Xs(K,L,j),re=!u.arrow&&Li(i)!=null&&L!==se&&o.reference[y]/2-(L<K?R:D)-w[y]/2<0,ge=re?L<K?L-K:L-j:0;return{[m]:h[m]+ge,data:{[m]:se,centerOffset:L-se-ge,...re&&{alignmentOffset:ge}},reset:re}}}),c0=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:u,elements:f}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:w=!0,...g}=ji(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const O=_r(i),p=ei(a),b=_r(a)===a,v=await(u.isRTL==null?void 0:u.isRTL(f.floating)),x=h||(b||!w?[To(a)]:n0(a)),S=y!=="none";!h&&S&&x.push(...i0(a,w,y,v));const A=[a,...x],N=await of(t,g),F=[];let R=((r=o.flip)==null?void 0:r.overflows)||[];if(l&&F.push(N[O]),d){const L=t0(i,s,v);F.push(N[L[0]],N[L[1]])}if(R=[...R,{placement:i,overflows:F}],!F.every(L=>L<=0)){var D,K;const L=(((D=o.flip)==null?void 0:D.index)||0)+1,se=A[L];if(se)return{data:{index:L,overflows:R},reset:{placement:se}};let re=(K=R.filter(ge=>ge.overflows[0]<=0).sort((ge,de)=>ge.overflows[1]-de.overflows[1])[0])==null?void 0:K.placement;if(!re)switch(m){case"bestFit":{var j;const ge=(j=R.filter(de=>{if(S){const be=ei(de.placement);return be===p||be==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(be=>be>0).reduce((be,P)=>be+P,0)]).sort((de,be)=>de[1]-be[1])[0])==null?void 0:j[0];ge&&(re=ge);break}case"initialPlacement":re=a;break}if(i!==re)return{reset:{placement:re}}}return{}}}};async function u0(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=_r(n),a=Li(n),u=ei(n)==="y",f=["left","top"].includes(s)?-1:1,l=o&&u?-1:1,d=ji(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:y}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof y=="number"&&(m=a==="end"?y*-1:y),u?{x:m*l,y:h*f}:{x:h*f,y:m*l}}const l0=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,u=await u0(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:o+u.y,data:{...u,placement:s}}}}},d0=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x:O,y:p}=g;return{x:O,y:p}}},...u}=ji(e,t),f={x:n,y:r},l=await of(t,u),d=ei(_r(i)),h=nf(d);let m=f[h],y=f[d];if(o){const g=h==="y"?"top":"left",O=h==="y"?"bottom":"right",p=m+l[g],b=m-l[O];m=Xs(p,m,b)}if(s){const g=d==="y"?"top":"left",O=d==="y"?"bottom":"right",p=y+l[g],b=y-l[O];y=Xs(p,y,b)}const w=a.fn({...t,[h]:m,[d]:y});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:o,[d]:s}}}}}};function Bo(){return typeof window<"u"}function ui(e){return sf(e)?(e.nodeName||"").toLowerCase():"#document"}function Rt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function un(e){var t;return(t=(sf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function sf(e){return Bo()?e instanceof Node||e instanceof Rt(e).Node:!1}function Wt(e){return Bo()?e instanceof Element||e instanceof Rt(e).Element:!1}function on(e){return Bo()?e instanceof HTMLElement||e instanceof Rt(e).HTMLElement:!1}function uu(e){return!Bo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Rt(e).ShadowRoot}function Vi(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=zt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function f0(e){return["table","td","th"].includes(ui(e))}function Jo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function qa(e){const t=Ba(),n=Wt(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 p0(e){let t=Xn(e);for(;on(t)&&!ti(t);){if(qa(t))return t;if(Jo(t))return null;t=Xn(t)}return null}function Ba(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ti(e){return["html","body","#document"].includes(ui(e))}function zt(e){return Rt(e).getComputedStyle(e)}function Ho(e){return Wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xn(e){if(ui(e)==="html")return e;const t=e.assignedSlot||e.parentNode||uu(e)&&e.host||un(e);return uu(t)?t.host:t}function af(e){const t=Xn(e);return ti(t)?e.ownerDocument?e.ownerDocument.body:e.body:on(t)&&Vi(t)?t:af(t)}function Si(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=af(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=Rt(i);if(o){const a=Zs(s);return t.concat(s,s.visualViewport||[],Vi(i)?i:[],a&&n?Si(a):[])}return t.concat(i,Si(i,[],n))}function Zs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cf(e){const t=zt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=on(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=No(n)!==o||No(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Ja(e){return Wt(e)?e:e.contextElement}function Pr(e){const t=Ja(e);if(!on(t))return Gn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=cf(t);let s=(o?No(n.width):n.width)/r,a=(o?No(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const h0=Gn(0);function uf(e){const t=Rt(e);return!Ba()||!t.visualViewport?h0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function m0(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Rt(e)?!1:t}function Sr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=Ja(e);let s=Gn(1);t&&(r?Wt(r)&&(s=Pr(r)):s=Pr(e));const a=m0(o,n,r)?uf(o):Gn(0);let u=(i.left+a.x)/s.x,f=(i.top+a.y)/s.y,l=i.width/s.x,d=i.height/s.y;if(o){const h=Rt(o),m=r&&Wt(r)?Rt(r):r;let y=h,w=Zs(y);for(;w&&r&&m!==y;){const g=Pr(w),O=w.getBoundingClientRect(),p=zt(w),b=O.left+(w.clientLeft+parseFloat(p.paddingLeft))*g.x,v=O.top+(w.clientTop+parseFloat(p.paddingTop))*g.y;u*=g.x,f*=g.y,l*=g.x,d*=g.y,u+=b,f+=v,y=Rt(w),w=Zs(y)}}return Ro({width:l,height:d,x:u,y:f})}function g0(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=un(r),a=t?Jo(t.floating):!1;if(r===s||a&&o)return n;let u={scrollLeft:0,scrollTop:0},f=Gn(1);const l=Gn(0),d=on(r);if((d||!d&&!o)&&((ui(r)!=="body"||Vi(s))&&(u=Ho(r)),on(r))){const h=Sr(r);f=Pr(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+l.x,y:n.y*f.y-u.scrollTop*f.y+l.y}}function y0(e){return Array.from(e.getClientRects())}function ea(e,t){const n=Ho(e).scrollLeft;return t?t.left+n:Sr(un(e)).left+n}function v0(e){const t=un(e),n=Ho(e),r=e.ownerDocument.body,i=br(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=br(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+ea(e);const a=-n.scrollTop;return zt(r).direction==="rtl"&&(s+=br(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function w0(e,t){const n=Rt(e),r=un(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,u=0;if(i){o=i.width,s=i.height;const f=Ba();(!f||f&&t==="fixed")&&(a=i.offsetLeft,u=i.offsetTop)}return{width:o,height:s,x:a,y:u}}function b0(e,t){const n=Sr(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=on(e)?Pr(e):Gn(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,u=i*o.x,f=r*o.y;return{width:s,height:a,x:u,y:f}}function lu(e,t,n){let r;if(t==="viewport")r=w0(e,n);else if(t==="document")r=v0(un(e));else if(Wt(t))r=b0(t,n);else{const i=uf(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Ro(r)}function lf(e,t){const n=Xn(e);return n===t||!Wt(n)||ti(n)?!1:zt(n).position==="fixed"||lf(n,t)}function I0(e,t){const n=t.get(e);if(n)return n;let r=Si(e,[],!1).filter(a=>Wt(a)&&ui(a)!=="body"),i=null;const o=zt(e).position==="fixed";let s=o?Xn(e):e;for(;Wt(s)&&!ti(s);){const a=zt(s),u=qa(s);!u&&a.position==="fixed"&&(i=null),(o?!u&&!i:!u&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Vi(s)&&!u&&lf(e,s))?r=r.filter(l=>l!==s):i=a,s=Xn(s)}return t.set(e,r),r}function C0(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Jo(t)?[]:I0(t,this._c):[].concat(n),r],a=s[0],u=s.reduce((f,l)=>{const d=lu(t,l,i);return f.top=br(d.top,f.top),f.right=Zr(d.right,f.right),f.bottom=Zr(d.bottom,f.bottom),f.left=br(d.left,f.left),f},lu(t,a,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function x0(e){const{width:t,height:n}=cf(e);return{width:t,height:n}}function O0(e,t,n){const r=on(t),i=un(t),o=n==="fixed",s=Sr(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const u=Gn(0);if(r||!r&&!o)if((ui(t)!=="body"||Vi(i))&&(a=Ho(t)),r){const m=Sr(t,!0,o,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else i&&(u.x=ea(i));let f=0,l=0;if(i&&!r&&!o){const m=i.getBoundingClientRect();l=m.top+a.scrollTop,f=m.left+a.scrollLeft-ea(i,m)}const d=s.left+a.scrollLeft-u.x-f,h=s.top+a.scrollTop-u.y-l;return{x:d,y:h,width:s.width,height:s.height}}function gs(e){return zt(e).position==="static"}function du(e,t){if(!on(e)||zt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return un(e)===n&&(n=n.ownerDocument.body),n}function df(e,t){const n=Rt(e);if(Jo(e))return n;if(!on(e)){let i=Xn(e);for(;i&&!ti(i);){if(Wt(i)&&!gs(i))return i;i=Xn(i)}return n}let r=du(e,t);for(;r&&f0(r)&&gs(r);)r=du(r,t);return r&&ti(r)&&gs(r)&&!qa(r)?n:r||p0(e)||n}const _0=async function(e){const t=this.getOffsetParent||df,n=this.getDimensions,r=await n(e.floating);return{reference:O0(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function S0(e){return zt(e).direction==="rtl"}const E0={convertOffsetParentRelativeRectToViewportRelativeRect:g0,getDocumentElement:un,getClippingRect:C0,getOffsetParent:df,getElementRects:_0,getClientRects:y0,getDimensions:x0,getScale:Pr,isElement:Wt,isRTL:S0};function N0(e,t){let n=null,r;const i=un(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),o();const{left:f,top:l,width:d,height:h}=e.getBoundingClientRect();if(a||t(),!d||!h)return;const m=oo(l),y=oo(i.clientWidth-(f+d)),w=oo(i.clientHeight-(l+h)),g=oo(f),p={rootMargin:-m+"px "+-y+"px "+-w+"px "+-g+"px",threshold:br(0,Zr(1,u))||1};let b=!0;function v(x){const S=x[0].intersectionRatio;if(S!==u){if(!b)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(v,{...p,root:i.ownerDocument})}catch{n=new IntersectionObserver(v,p)}n.observe(e)}return s(!0),o}function T0(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=Ja(e),l=i||o?[...f?Si(f):[],...Si(t)]:[];l.forEach(O=>{i&&O.addEventListener("scroll",n,{passive:!0}),o&&O.addEventListener("resize",n)});const d=f&&a?N0(f,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(O=>{let[p]=O;p&&p.target===f&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var b;(b=m)==null||b.observe(t)})),n()}),f&&!u&&m.observe(f),m.observe(t));let y,w=u?Sr(e):null;u&&g();function g(){const O=Sr(e);w&&(O.x!==w.x||O.y!==w.y||O.width!==w.width||O.height!==w.height)&&n(),w=O,y=requestAnimationFrame(g)}return n(),()=>{var O;l.forEach(p=>{i&&p.removeEventListener("scroll",n),o&&p.removeEventListener("resize",n)}),d==null||d(),(O=m)==null||O.disconnect(),m=null,u&&cancelAnimationFrame(y)}}const R0=l0,A0=d0,F0=c0,P0=a0,fu=(e,t,n)=>{const r=new Map,i={platform:E0,...n},o={...i.platform,_c:r};return s0(e,t,{...i,platform:o})};/*
|
|
46
46
|
* React Tooltip
|
|
47
47
|
* {@link https://github.com/ReactTooltip/react-tooltip}
|
|
48
48
|
* @copyright ReactTooltip Team
|
|
49
49
|
* @license MIT
|
|
50
|
-
*/const D0="react-tooltip-core-styles",M0="react-tooltip-base-styles",fu={core:!1,base:!1};function pu({css:e,id:t=M0,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||fu[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=D0),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.id=t,u.type="text/css",s==="top"&&a.firstChild?a.insertBefore(u,a.firstChild):a.appendChild(u),u.styleSheet?u.styleSheet.cssText=e:u.appendChild(document.createTextNode(e)),fu[n]=!0}const hu=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[R0(Number(o)),F0({fallbackAxisSideDirection:"start"}),A0({padding:5})],border:a,arrowSize:u=8})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const f=s;return n?(f.push(P0({element:n,padding:5})),du(e,t,{placement:r,strategy:i,middleware:f}).then(({x:l,y:d,placement:h,middlewareData:m})=>{var y,w;const g={left:`${l}px`,top:`${d}px`,border:a},{x:O,y:p}=(y=m.arrow)!==null&&y!==void 0?y:{x:0,y:0},v=(w={top:"bottom",right:"left",bottom:"top",left:"right"}[h.split("-")[0]])!==null&&w!==void 0?w:"bottom",I=a&&{borderBottom:a,borderRight:a};let x=0;if(a){const E=`${a}`.match(/(\d+)px/);x=E!=null&&E[1]?Number(E[1]):1}return{tooltipStyles:g,tooltipArrowStyles:{left:O!=null?`${O}px`:"",top:p!=null?`${p}px`:"",right:"",bottom:"",...I,[v]:`-${u/2+x}px`},place:h}})):du(e,t,{placement:"bottom",strategy:i,middleware:f}).then(({x:l,y:d,placement:h})=>({tooltipStyles:{left:`${l}px`,top:`${d}px`},tooltipArrowStyles:{},place:h}))},mu=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),gu=(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},yu=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",ea=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>ea(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!yu(e)||!yu(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>ea(e[o],t[o]))},k0=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"})},vu=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(k0(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},j0=typeof window<"u"?b.useLayoutEffect:b.useEffect,kt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},L0="DEFAULT_TOOLTIP_ID",V0={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},$0=b.createContext({getTooltipData:()=>V0});function df(e=L0){return b.useContext($0).getTooltipData(e)}var Ar={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"},ms={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 K0=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:u=10,events:f=["hover"],openOnClick:l=!1,positionStrategy:d="absolute",middlewares:h,wrapper:m,delayShow:y=0,delayHide:w=0,float:g=!1,hidden:O=!1,noArrow:p=!1,clickable:v=!1,closeOnEsc:I=!1,closeOnScroll:x=!1,closeOnResize:E=!1,openEvents:A,closeEvents:S,globalCloseEvents:F,imperativeModeOnly:R,style:D,position:K,afterShow:j,afterHide:L,disableTooltip:se,content:re,contentWrapperRef:ge,isOpen:de,defaultIsOpen:be=!1,setIsOpen:P,activeAnchor:$,setActiveAnchor:H,border:U,opacity:q,arrowColor:V,arrowSize:G=8,role:Z="tooltip"})=>{var Y;const ee=b.useRef(null),ne=b.useRef(null),ce=b.useRef(null),k=b.useRef(null),ve=b.useRef(null),[z,Xe]=b.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ce,ct]=b.useState(!1),[qe,rt]=b.useState(!1),[xe,ze]=b.useState(null),ft=b.useRef(!1),yt=b.useRef(null),{anchorRefs:vt,setActiveAnchor:Ye}=df(t),Ze=b.useRef(!1),[De,J]=b.useState([]),pe=b.useRef(!1),_e=l||f.includes("click"),ln=_e||(A==null?void 0:A.click)||(A==null?void 0:A.dblclick)||(A==null?void 0:A.mousedown),dn=A?{...A}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!A&&_e&&Object.assign(dn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const fn=S?{...S}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!S&&_e&&Object.assign(fn,{mouseleave:!1,blur:!1,mouseout:!1});const wt=F?{...F}:{escape:I||!1,scroll:x||!1,resize:E||!1,clickOutsideAnchor:ln||!1};R&&(Object.assign(dn,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(fn,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(wt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),j0(()=>(pe.current=!0,()=>{pe.current=!1}),[]);const Fe=X=>{pe.current&&(X&&rt(!0),setTimeout(()=>{pe.current&&(P==null||P(X),de===void 0&&ct(X))},10))};b.useEffect(()=>{if(de===void 0)return()=>null;de&&rt(!0);const X=setTimeout(()=>{ct(de)},10);return()=>{clearTimeout(X)}},[de]),b.useEffect(()=>{if(Ce!==ft.current)if(kt(ve),ft.current=Ce,Ce)j==null||j();else{const X=(ue=>{const le=ue.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,Ve,Je]=le;return Number(Ve)*(Je==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));ve.current=setTimeout(()=>{rt(!1),ze(null),L==null||L()},X+25)}},[Ce]);const rr=X=>{Xe(ue=>ea(ue,X)?ue:X)},En=(X=y)=>{kt(ce),qe?Fe(!0):ce.current=setTimeout(()=>{Fe(!0)},X)},Nn=(X=w)=>{kt(k),k.current=setTimeout(()=>{Ze.current||Fe(!1)},X)},_t=X=>{var ue;if(!X)return;const le=(ue=X.currentTarget)!==null&&ue!==void 0?ue:X.target;if(!(le!=null&&le.isConnected))return H(null),void Ye({current:null});y?En():Fe(!0),H(le),Ye({current:le}),kt(k)},pn=()=>{v?Nn(w||100):w?Nn():Fe(!1),kt(ce)},Tn=({x:X,y:ue})=>{var le;const Ve={getBoundingClientRect:()=>({x:X,y:ue,width:0,height:0,top:ue,left:X,right:X,bottom:ue})};hu({place:(le=xe==null?void 0:xe.place)!==null&&le!==void 0?le:a,offset:u,elementReference:Ve,tooltipReference:ee.current,tooltipArrowReference:ne.current,strategy:d,middlewares:h,border:U,arrowSize:G}).then(Je=>{rr(Je)})},Rn=X=>{if(!X)return;const ue=X,le={x:ue.clientX,y:ue.clientY};Tn(le),yt.current=le},hn=X=>{var ue;if(!Ce)return;const le=X.target;le.isConnected&&(!((ue=ee.current)===null||ue===void 0)&&ue.contains(le)||[document.querySelector(`[id='${i}']`),...De].some(Ve=>Ve==null?void 0:Ve.contains(le))||(Fe(!1),kt(ce)))},Xt=gu(_t,50),Le=gu(pn,50),ut=X=>{Le.cancel(),Xt(X)},ae=()=>{Xt.cancel(),Le()},he=b.useCallback(()=>{var X,ue;const le=(X=xe==null?void 0:xe.position)!==null&&X!==void 0?X:K;le?Tn(le):g?yt.current&&Tn(yt.current):$!=null&&$.isConnected&&hu({place:(ue=xe==null?void 0:xe.place)!==null&&ue!==void 0?ue:a,offset:u,elementReference:$,tooltipReference:ee.current,tooltipArrowReference:ne.current,strategy:d,middlewares:h,border:U,arrowSize:G}).then(Ve=>{pe.current&&rr(Ve)})},[Ce,$,re,D,a,xe==null?void 0:xe.place,u,d,K,xe==null?void 0:xe.position,g,G]);b.useEffect(()=>{var X,ue;const le=new Set(vt);De.forEach(Oe=>{se!=null&&se(Oe)||le.add({current:Oe})});const Ve=document.querySelector(`[id='${i}']`);Ve&&!(se!=null&&se(Ve))&&le.add({current:Ve});const Je=()=>{Fe(!1)},et=vu($),Pt=vu(ee.current);wt.scroll&&(window.addEventListener("scroll",Je),et==null||et.addEventListener("scroll",Je),Pt==null||Pt.addEventListener("scroll",Je));let it=null;wt.resize?window.addEventListener("resize",Je):$&&ee.current&&(it=T0($,ee.current,he,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const bt=Oe=>{Oe.key==="Escape"&&Fe(!1)};wt.escape&&window.addEventListener("keydown",bt),wt.clickOutsideAnchor&&window.addEventListener("click",hn);const Ae=[],An=Oe=>!!(Oe!=null&&Oe.target&&($!=null&&$.contains(Oe.target))),$t=Oe=>{Ce&&An(Oe)||_t(Oe)},Qo=Oe=>{Ce&&An(Oe)&&pn()},Ui=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],qi=["click","dblclick","mousedown","mouseup"];Object.entries(dn).forEach(([Oe,Kt])=>{Kt&&(Ui.includes(Oe)?Ae.push({event:Oe,listener:ut}):qi.includes(Oe)&&Ae.push({event:Oe,listener:$t}))}),Object.entries(fn).forEach(([Oe,Kt])=>{Kt&&(Ui.includes(Oe)?Ae.push({event:Oe,listener:ae}):qi.includes(Oe)&&Ae.push({event:Oe,listener:Qo}))}),g&&Ae.push({event:"pointermove",listener:Rn});const Bi=()=>{Ze.current=!0},Ji=()=>{Ze.current=!1,pn()},Yt=v&&(fn.mouseout||fn.mouseleave);return Yt&&((X=ee.current)===null||X===void 0||X.addEventListener("mouseover",Bi),(ue=ee.current)===null||ue===void 0||ue.addEventListener("mouseout",Ji)),Ae.forEach(({event:Oe,listener:Kt})=>{le.forEach(li=>{var ir;(ir=li.current)===null||ir===void 0||ir.addEventListener(Oe,Kt)})}),()=>{var Oe,Kt;wt.scroll&&(window.removeEventListener("scroll",Je),et==null||et.removeEventListener("scroll",Je),Pt==null||Pt.removeEventListener("scroll",Je)),wt.resize?window.removeEventListener("resize",Je):it==null||it(),wt.clickOutsideAnchor&&window.removeEventListener("click",hn),wt.escape&&window.removeEventListener("keydown",bt),Yt&&((Oe=ee.current)===null||Oe===void 0||Oe.removeEventListener("mouseover",Bi),(Kt=ee.current)===null||Kt===void 0||Kt.removeEventListener("mouseout",Ji)),Ae.forEach(({event:li,listener:ir})=>{le.forEach(Go=>{var Fn;(Fn=Go.current)===null||Fn===void 0||Fn.removeEventListener(li,ir)})})}},[$,he,qe,vt,De,A,S,F,_e,y,w]),b.useEffect(()=>{var X,ue;let le=(ue=(X=xe==null?void 0:xe.anchorSelect)!==null&&X!==void 0?X:s)!==null&&ue!==void 0?ue:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ve=new MutationObserver(Je=>{const et=[],Pt=[];Je.forEach(it=>{if(it.type==="attributes"&&it.attributeName==="data-tooltip-id"&&(it.target.getAttribute("data-tooltip-id")===t?et.push(it.target):it.oldValue===t&&Pt.push(it.target)),it.type==="childList"){if($){const bt=[...it.removedNodes].filter(Ae=>Ae.nodeType===1);if(le)try{Pt.push(...bt.filter(Ae=>Ae.matches(le))),Pt.push(...bt.flatMap(Ae=>[...Ae.querySelectorAll(le)]))}catch{}bt.some(Ae=>{var An;return!!(!((An=Ae==null?void 0:Ae.contains)===null||An===void 0)&&An.call(Ae,$))&&(rt(!1),Fe(!1),H(null),kt(ce),kt(k),!0)})}if(le)try{const bt=[...it.addedNodes].filter(Ae=>Ae.nodeType===1);et.push(...bt.filter(Ae=>Ae.matches(le))),et.push(...bt.flatMap(Ae=>[...Ae.querySelectorAll(le)]))}catch{}}}),(et.length||Pt.length)&&J(it=>[...it.filter(bt=>!Pt.includes(bt)),...et])});return Ve.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Ve.disconnect()}},[t,s,xe==null?void 0:xe.anchorSelect,$]),b.useEffect(()=>{he()},[he]),b.useEffect(()=>{if(!(ge!=null&&ge.current))return()=>null;const X=new ResizeObserver(()=>{setTimeout(()=>he())});return X.observe(ge.current),()=>{X.disconnect()}},[re,ge==null?void 0:ge.current]),b.useEffect(()=>{var X;const ue=document.querySelector(`[id='${i}']`),le=[...De,ue];$&&le.includes($)||H((X=De[0])!==null&&X!==void 0?X:ue)},[i,De,$]),b.useEffect(()=>(be&&Fe(!0),()=>{kt(ce),kt(k)}),[]),b.useEffect(()=>{var X;let ue=(X=xe==null?void 0:xe.anchorSelect)!==null&&X!==void 0?X:s;if(!ue&&t&&(ue=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ue)try{const le=Array.from(document.querySelectorAll(ue));J(le)}catch{J([])}},[t,s,xe==null?void 0:xe.anchorSelect]),b.useEffect(()=>{ce.current&&(kt(ce),En(y))},[y]);const pt=(Y=xe==null?void 0:xe.content)!==null&&Y!==void 0?Y:re,mn=Ce&&Object.keys(z.tooltipStyles).length>0;return b.useImperativeHandle(e,()=>({open:X=>{if(X!=null&&X.anchorSelect)try{document.querySelector(X.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${X.anchorSelect}" is not a valid CSS selector`)}ze(X??null),X!=null&&X.delay?En(X.delay):Fe(!0)},close:X=>{X!=null&&X.delay?Nn(X.delay):Fe(!1)},activeAnchor:$,place:z.place,isOpen:!!(qe&&!O&&pt&&mn)})),qe&&!O&&pt?b.createElement(m,{id:t,role:Z,className:Vt("react-tooltip",Ar.tooltip,ms.tooltip,ms[o],n,`react-tooltip__place-${z.place}`,Ar[mn?"show":"closing"],mn?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&Ar.fixed,v&&Ar.clickable),onTransitionEnd:X=>{kt(ve),Ce||X.propertyName!=="opacity"||(rt(!1),ze(null),L==null||L())},style:{...D,...z.tooltipStyles,opacity:q!==void 0&&mn?q:void 0},ref:ee},pt,b.createElement(m,{className:Vt("react-tooltip-arrow",Ar.arrow,ms.arrow,r,p&&Ar.noArrow),style:{...z.tooltipArrowStyles,background:V?`linear-gradient(to right bottom, transparent 50%, ${V} 50%)`:void 0,"--rt-arrow-size":`${G}px`},ref:ne})):null},U0=({content:e})=>b.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),q0=b.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:u="dark",place:f="top",offset:l=10,wrapper:d="div",children:h=null,events:m=["hover"],openOnClick:y=!1,positionStrategy:w="absolute",middlewares:g,delayShow:O=0,delayHide:p=0,float:v=!1,hidden:I=!1,noArrow:x=!1,clickable:E=!1,closeOnEsc:A=!1,closeOnScroll:S=!1,closeOnResize:F=!1,openEvents:R,closeEvents:D,globalCloseEvents:K,imperativeModeOnly:j=!1,style:L,position:se,isOpen:re,defaultIsOpen:ge=!1,disableStyleInjection:de=!1,border:be,opacity:P,arrowColor:$,arrowSize:H,setIsOpen:U,afterShow:q,afterHide:V,disableTooltip:G,role:Z="tooltip"},Y)=>{const[ee,ne]=b.useState(r),[ce,k]=b.useState(o),[ve,z]=b.useState(f),[Xe,Ce]=b.useState(u),[ct,qe]=b.useState(l),[rt,xe]=b.useState(O),[ze,ft]=b.useState(p),[yt,vt]=b.useState(v),[Ye,Ze]=b.useState(I),[De,J]=b.useState(d),[pe,_e]=b.useState(m),[ln,dn]=b.useState(w),[fn,wt]=b.useState(null),[Fe,rr]=b.useState(null),En=b.useRef(de),{anchorRefs:Nn,activeAnchor:_t}=df(e),pn=Le=>Le==null?void 0:Le.getAttributeNames().reduce((ut,ae)=>{var he;return ae.startsWith("data-tooltip-")&&(ut[ae.replace(/^data-tooltip-/,"")]=(he=Le==null?void 0:Le.getAttribute(ae))!==null&&he!==void 0?he:null),ut},{}),Tn=Le=>{const ut={place:ae=>{var he;z((he=ae)!==null&&he!==void 0?he:f)},content:ae=>{ne(ae??r)},html:ae=>{k(ae??o)},variant:ae=>{var he;Ce((he=ae)!==null&&he!==void 0?he:u)},offset:ae=>{qe(ae===null?l:Number(ae))},wrapper:ae=>{var he;J((he=ae)!==null&&he!==void 0?he:d)},events:ae=>{const he=ae==null?void 0:ae.split(" ");_e(he??m)},"position-strategy":ae=>{var he;dn((he=ae)!==null&&he!==void 0?he:w)},"delay-show":ae=>{xe(ae===null?O:Number(ae))},"delay-hide":ae=>{ft(ae===null?p:Number(ae))},float:ae=>{vt(ae===null?v:ae==="true")},hidden:ae=>{Ze(ae===null?I:ae==="true")},"class-name":ae=>{wt(ae)}};Object.values(ut).forEach(ae=>ae(null)),Object.entries(Le).forEach(([ae,he])=>{var pt;(pt=ut[ae])===null||pt===void 0||pt.call(ut,he)})};b.useEffect(()=>{ne(r)},[r]),b.useEffect(()=>{k(o)},[o]),b.useEffect(()=>{z(f)},[f]),b.useEffect(()=>{Ce(u)},[u]),b.useEffect(()=>{qe(l)},[l]),b.useEffect(()=>{xe(O)},[O]),b.useEffect(()=>{ft(p)},[p]),b.useEffect(()=>{vt(v)},[v]),b.useEffect(()=>{Ze(I)},[I]),b.useEffect(()=>{dn(w)},[w]),b.useEffect(()=>{En.current!==de&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[de]),b.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:de==="core",disableBase:de}}))},[]),b.useEffect(()=>{var Le;const ut=new Set(Nn);let ae=n;if(!ae&&e&&(ae=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ae)try{document.querySelectorAll(ae).forEach(ue=>{ut.add({current:ue})})}catch{console.warn(`[react-tooltip] "${ae}" is not a valid CSS selector`)}const he=document.querySelector(`[id='${t}']`);if(he&&ut.add({current:he}),!ut.size)return()=>null;const pt=(Le=Fe??he)!==null&&Le!==void 0?Le:_t.current,mn=new MutationObserver(ue=>{ue.forEach(le=>{var Ve;if(!pt||le.type!=="attributes"||!(!((Ve=le.attributeName)===null||Ve===void 0)&&Ve.startsWith("data-tooltip-")))return;const Je=pn(pt);Tn(Je)})}),X={attributes:!0,childList:!1,subtree:!1};if(pt){const ue=pn(pt);Tn(ue),mn.observe(pt,X)}return()=>{mn.disconnect()}},[Nn,_t,Fe,t,n]),b.useEffect(()=>{L!=null&&L.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),be&&!mu("border",`${be}`)&&console.warn(`[react-tooltip] "${be}" is not a valid \`border\`.`),L!=null&&L.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),P&&!mu("opacity",`${P}`)&&console.warn(`[react-tooltip] "${P}" is not a valid \`opacity\`.`)},[]);let Rn=h;const hn=b.useRef(null);if(i){const Le=i({content:(Fe==null?void 0:Fe.getAttribute("data-tooltip-content"))||ee||null,activeAnchor:Fe});Rn=Le?b.createElement("div",{ref:hn,className:"react-tooltip-content-wrapper"},Le):null}else ee&&(Rn=ee);ce&&(Rn=b.createElement(U0,{content:ce}));const Xt={forwardRef:Y,id:e,anchorId:t,anchorSelect:n,className:Vt(s,fn),classNameArrow:a,content:Rn,contentWrapperRef:hn,place:ve,variant:Xe,offset:ct,wrapper:De,events:pe,openOnClick:y,positionStrategy:ln,middlewares:g,delayShow:rt,delayHide:ze,float:yt,hidden:Ye,noArrow:x,clickable:E,closeOnEsc:A,closeOnScroll:S,closeOnResize:F,openEvents:R,closeEvents:D,globalCloseEvents:K,imperativeModeOnly:j,style:L,position:se,isOpen:re,defaultIsOpen:ge,border:be,opacity:P,arrowColor:$,arrowSize:H,setIsOpen:U,afterShow:q,afterHide:V,disableTooltip:G,activeAnchor:Fe,setActiveAnchor:Le=>rr(Le),role:Z};return b.createElement(K0,{...Xt})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||pu({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||pu({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 B0(){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[c.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[c.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"}),c.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_2896_16290",children:c.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function ff({id:e,tooltipText:t}){return c.jsxs(c.Fragment,{children:[c.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:B0()}),c.jsx(q0,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function J0(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};t.forEach(o=>{var a,u;const{field:i,value:s}=o;if(s===null){const f=n[i];delete n[i],f&&((a=e==null?void 0:e.read)!=null&&a.selectedValueMappings)&&e.read.selectedValueMappings[f]&&delete e.read.selectedValueMappings[f]}else{const f=n[i];n[i]=s,f&&f!==s&&((u=e==null?void 0:e.read)!=null&&u.selectedValueMappings)&&e.read.selectedValueMappings[f]&&delete e.read.selectedValueMappings[f]}})}function Ei(e,t,n){t(e,r=>J0(r,n))}const H0="Each field must be mapped to a unique value";function Ha({field:e,onSelectChange:t,allFields:n}){var p;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Gt(),[s,a]=b.useState(!0),{isError:u,removeError:f,getError:l}=an(),d=(p=r==null?void 0:r.read)==null?void 0:p.selectedFieldMappings,h=d==null?void 0:d[e.mapToName];b.useEffect(()=>{e._default&&!h&&o&&r&&Ei(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,h,r]);const m=b.useMemo(()=>n.map(v=>({id:v.fieldName,label:v.displayName,value:v.fieldName})),[n]),y=c.jsx(ef,{disabled:s,items:m,selectedValue:h||null,onSelectedItemChange:v=>{t({target:{name:e.mapToName,value:v==null?void 0:v.value}})},placeholder:"Please select one",style:{width:"100%"}}),w=b.useCallback(()=>{o&&(Ei(o,i,[{field:e.mapToName,value:null}]),u(we.MAPPING,o)&&f(we.MAPPING,o))},[e.mapToName,o,i,u,f]),{hasDuplicationError:g,errorMessage:O}=b.useMemo(()=>{const v=l(we.MAPPING,o),I=Array.isArray(v)&&v.length>0&&v.includes(e.mapToName);return{hasDuplicationError:I,errorMessage:I?H0:""}},[o,l,e.mapToName]);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[c.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),c.jsx("span",{children:(e==null?void 0:e.prompt)&&c.jsx(ff,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[y,c.jsx(We,{type:"button",variant:"ghost",onClick:w,children:"Clear"})]})]},e.mapToName),g&&c.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",O," "]},e.mapToName)]})}const W0="_formControl_9qd8d_1",z0="_formLabel_9qd8d_5",Q0="_formLabelRequired_9qd8d_11",G0="_formInput_9qd8d_16",X0="_formInputInvalid_9qd8d_20",Y0="_formError_9qd8d_24",Z0="_disabled_9qd8d_30",ar={formControl:W0,formLabel:z0,formLabelRequired:Q0,formInput:G0,formInputInvalid:X0,formError:Y0,disabled:Z0};function Jo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return c.jsxs("div",{className:Vt(ar.formControl,{[ar.disabled]:r}),children:[t&&c.jsx("label",{htmlFor:e,className:Vt(ar.formLabel,{[ar.formLabelRequired]:n}),children:t}),c.jsx("div",{id:e,className:Vt(ar.formInput,{[ar.formInputInvalid]:o}),children:s}),o&&i&&c.jsx("div",{className:ar.formError,role:"alert",children:i})]})}function pf({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(u=>e[u]===r),a=[n,...s];return o(we.MAPPING,t,a),!0}return!1}function eC({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>c.jsx(Jo,{id:r.mapToName,children:c.jsx(Ha,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function tC(){var y,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Gt(),{isError:r,removeError:o,setError:i}=an(),s=((y=t==null?void 0:t.read)==null?void 0:y.allFields)||[],{fieldMapping:a}=at(),u=(w=t==null?void 0:t.read)==null?void 0:w.selectedFieldMappings,f=g=>{const{value:O,name:p}=g.target;!O||pf({selectedFieldMappings:u,selectedObjectName:e,fieldName:p,fieldValue:O,setError:i})||(e&&Ei(e,n,[{field:p,value:O}]),r(we.MAPPING,p)&&o(we.MAPPING,p),e&&r(we.MAPPING,e)&&o(we.MAPPING,e))},l=b.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(g=>!g.fieldName),[a,e]),d=b.useMemo(()=>{var p;return(((p=t==null?void 0:t.read)==null?void 0:p.optionalMapFields)||[]).filter(v=>!l.some(I=>I.mapToName===v.mapToName))},[t,l]),h=l.length>0;return d.length>0||h?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Map the following optional fields"}),c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d==null?void 0:d.map(g=>c.jsx(Jo,{id:g.mapToName,children:c.jsx(Ha,{allFields:s,field:g,onSelectChange:f})},g.mapToName)),h&&c.jsx(eC,{dynamicFieldMappings:l,onSelectChange:f,allFields:s})]})]}):null}function nC(){var f;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Gt(),{isError:r,removeError:o,setError:i}=an(),s=(f=t==null?void 0:t.read)==null?void 0:f.selectedFieldMappings,a=l=>{const{value:d,name:h}=l.target;!d||pf({selectedFieldMappings:s,selectedObjectName:e,fieldName:h,fieldValue:d,setError:i})||(e&&Ei(e,n,[{field:h,value:d}]),r(we.MAPPING,h)&&o(we.MAPPING,h),e&&r(we.MAPPING,e)&&o(we.MAPPING,e))},u=b.useMemo(()=>{var l;return((l=t==null?void 0:t.read)==null?void 0:l.requiredMapFields)||[]},[t]);return u!=null&&u.length?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Map the following fields"}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:u.map(l=>{var d;return c.jsx(Jo,{id:l.mapToName,isInvalid:r(we.MAPPING,l.mapToName),errorMessage:"* required",children:c.jsx(Ha,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:l,onSelectChange:a})},l.mapToName)})})]}):null}const rC=(e,t)=>e.filter(n=>!t.has(n));function iC(){var h,m,y;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Gt(),{fieldMapping:r}=at(),o=((h=t==null?void 0:t.read)==null?void 0:h.selectedFieldMappings)||{},i=Object.keys(o),s=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],a=((y=t==null?void 0:t.read)==null?void 0:y.optionalMapFields)||[],u=e&&r?Object.values(r[e]||{}).flat().filter(w=>!w.fieldName):[],f=s.concat(u,a).map(w=>w.mapToName),l=new Set(f),d=rC(i,l);b.useEffect(()=>{e&&d.length&&Ei(e,n,d.map(w=>({field:w,value:null})))},[e,n,d])}const oC={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function sC({children:e,style:t}){return c.jsx(_n,{style:{...oC,...t},children:e})}function aC(){var f,l,d;const{data:e}=Zn(),{hydratedRevision:t}=ci(),{selectedObjectName:n}=Gt(),{providerName:r}=dt(),o=e==null?void 0:e.appName,i=(d=(l=(f=t==null?void 0:t.content)==null?void 0:f.read)==null?void 0:l.objects)==null?void 0:d.find(h=>h.objectName===n),s=(i==null?void 0:i.displayName)||n&&on(n),a=i==null?void 0:i.mapToName,u=(i==null?void 0:i.mapToDisplayName)||a&&on(a);return u&&o&&r?c.jsx(sC,{style:{marginTop:"1rem"},children:c.jsxs("p",{style:{margin:"1rem 0"},children:[c.jsx("b",{children:u})," in ",o," is mapped to"," ",c.jsx("b",{children:s})," in ",r,"."]})}):null}function wu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function hf(...e){return t=>{let n=!1;const r=e.map(o=>{const i=wu(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():wu(e[o],null)}}}}function ni(...e){return B.useCallback(hf(...e),e)}function Ho(e,t=[]){let n=[];function r(i,s){const a=B.createContext(s),u=n.length;n=[...n,s];const f=d=>{var O;const{scope:h,children:m,...y}=d,w=((O=h==null?void 0:h[e])==null?void 0:O[u])||a,g=B.useMemo(()=>y,Object.values(y));return c.jsx(w.Provider,{value:g,children:m})};f.displayName=i+"Provider";function l(d,h){var w;const m=((w=h==null?void 0:h[e])==null?void 0:w[u])||a,y=B.useContext(m);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[f,l]}const o=()=>{const i=n.map(s=>B.createContext(s));return function(a){const u=(a==null?void 0:a[e])||i;return B.useMemo(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return o.scopeName=e,[r,cC(o,...t)]}function cC(...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:u,scopeName:f})=>{const d=u(i)[`__scope${f}`];return{...a,...d}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Ht(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 Ni=globalThis!=null&&globalThis.document?B.useLayoutEffect:()=>{},uC=B[" useInsertionEffect ".trim().toString()]||Ni;function Wa({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=lC({defaultProp:t,onChange:n}),a=e!==void 0,u=a?e:o;{const l=B.useRef(e!==void 0);B.useEffect(()=>{const d=l.current;d!==a&&console.warn(`${r} is changing from ${d?"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.`),l.current=a},[a,r])}const f=B.useCallback(l=>{var d;if(a){const h=dC(l)?l(e):l;h!==e&&((d=s.current)==null||d.call(s,h))}else i(l)},[a,e,i,s]);return[u,f]}function lC({defaultProp:e,onChange:t}){const[n,r]=B.useState(e),o=B.useRef(n),i=B.useRef(t);return uC(()=>{i.current=t},[t]),B.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function dC(e){return typeof e=="function"}function fC(e){const t=B.useRef({value:e,previous:e});return B.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function pC(e){const[t,n]=B.useState(void 0);return Ni(()=>{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 u=i.borderBoxSize,f=Array.isArray(u)?u[0]:u;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 hC(e,t){return B.useReducer((n,r)=>t[n][r]??n,e)}var za=e=>{const{present:t,children:n}=e,r=mC(t),o=typeof n=="function"?n({present:r.isPresent}):B.Children.only(n),i=ni(r.ref,gC(o));return typeof n=="function"||r.isPresent?B.cloneElement(o,{ref:i}):null};za.displayName="Presence";function mC(e){const[t,n]=B.useState(),r=B.useRef(null),o=B.useRef(e),i=B.useRef("none"),s=e?"mounted":"unmounted",[a,u]=hC(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return B.useEffect(()=>{const f=so(r.current);i.current=a==="mounted"?f:"none"},[a]),Ni(()=>{const f=r.current,l=o.current;if(l!==e){const h=i.current,m=so(f);e?u("MOUNT"):m==="none"||(f==null?void 0:f.display)==="none"?u("UNMOUNT"):u(l&&h!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Ni(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,d=m=>{const w=so(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&w&&(u("ANIMATION_END"),!o.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=m=>{m.target===t&&(i.current=so(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:B.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function so(e){return(e==null?void 0:e.animationName)||"none"}function gC(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 ta(e){const t=yC(e),n=B.forwardRef((r,o)=>{const{children:i,...s}=r,a=B.Children.toArray(i),u=a.find(wC);if(u){const f=u.props.children,l=a.map(d=>d===u?B.Children.count(f)>1?B.Children.only(null):B.isValidElement(f)?f.props.children:null:d);return c.jsx(t,{...s,ref:o,children:B.isValidElement(f)?B.cloneElement(f,void 0,l):null})}return c.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function yC(e){const t=B.forwardRef((n,r)=>{const{children:o,...i}=n;if(B.isValidElement(o)){const s=IC(o),a=bC(i,o.props);return o.type!==B.Fragment&&(a.ref=r?hf(r,s):s),B.cloneElement(o,a)}return B.Children.count(o)>1?B.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vC=Symbol("radix.slottable");function wC(e){return B.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vC}function bC(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 u=i(...a);return o(...a),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function IC(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 CC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Sn=CC.reduce((e,t)=>{const n=ta(`Primitive.${t}`),r=B.forwardRef((o,i)=>{const{asChild:s,...a}=o,u=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Wo="Checkbox",[xC,WO]=Ho(Wo),[OC,Qa]=xC(Wo);function _C(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:a,onCheckedChange:u,required:f,value:l="on",internal_do_not_use_render:d}=e,[h,m]=Wa({prop:n,defaultProp:o??!1,onChange:u,caller:Wo}),[y,w]=B.useState(null),[g,O]=B.useState(null),p=B.useRef(!1),v=y?!!s||!!y.closest("form"):!0,I={checked:h,disabled:i,setChecked:m,control:y,setControl:w,name:a,form:s,value:l,hasConsumerStoppedPropagationRef:p,required:f,defaultChecked:Qn(o)?!1:o,isFormControl:v,bubbleInput:g,setBubbleInput:O};return c.jsx(OC,{scope:t,...I,children:SC(d)?d(I):r})}var mf="CheckboxTrigger",gf=B.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:s,disabled:a,checked:u,required:f,setControl:l,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:y}=Qa(mf,e),w=ni(o,l),g=B.useRef(u);return B.useEffect(()=>{const O=i==null?void 0:i.form;if(O){const p=()=>d(g.current);return O.addEventListener("reset",p),()=>O.removeEventListener("reset",p)}},[i,d]),c.jsx(Sn.button,{type:"button",role:"checkbox","aria-checked":Qn(u)?"mixed":u,"aria-required":f,"data-state":bf(u),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:w,onKeyDown:Ht(t,O=>{O.key==="Enter"&&O.preventDefault()}),onClick:Ht(n,O=>{d(p=>Qn(p)?!0:!p),y&&m&&(h.current=O.isPropagationStopped(),h.current||O.stopPropagation())})})});gf.displayName=mf;var Ga=B.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:u,onCheckedChange:f,form:l,...d}=e;return c.jsx(_C,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:a,required:s,onCheckedChange:f,name:r,form:l,value:u,internal_do_not_use_render:({isFormControl:h})=>c.jsxs(c.Fragment,{children:[c.jsx(gf,{...d,ref:t,__scopeCheckbox:n}),h&&c.jsx(wf,{__scopeCheckbox:n})]})})});Ga.displayName=Wo;var yf="CheckboxIndicator",Xa=B.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Qa(yf,n);return c.jsx(za,{present:r||Qn(i.checked)||i.checked===!0,children:c.jsx(Sn.span,{"data-state":bf(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Xa.displayName=yf;var vf="CheckboxBubbleInput",wf=B.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:s,required:a,disabled:u,name:f,value:l,form:d,bubbleInput:h,setBubbleInput:m}=Qa(vf,e),y=ni(n,m),w=fC(i),g=pC(r);B.useEffect(()=>{const p=h;if(!p)return;const v=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(v,"checked").set,E=!o.current;if(w!==i&&x){const A=new Event("click",{bubbles:E});p.indeterminate=Qn(i),x.call(p,Qn(i)?!1:i),p.dispatchEvent(A)}},[h,w,i,o]);const O=B.useRef(Qn(i)?!1:i);return c.jsx(Sn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??O.current,required:a,disabled:u,name:f,value:l,form:d,...t,tabIndex:-1,ref:y,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});wf.displayName=vf;function SC(e){return typeof e=="function"}function Qn(e){return e==="indeterminate"}function bf(e){return Qn(e)?"indeterminate":e?"checked":"unchecked"}function Ya(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 EC=["color"],If=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Ya(e,EC);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"}))}),NC=["color"],TC=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Ya(e,NC);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"}))}),RC=["color"],AC=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Ya(e,RC);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:"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const FC="_checkboxGroupContainer_hqfeu_1",PC="_stack_hqfeu_6",DC="_selectAllContainer_hqfeu_10",MC="_fieldContainer_hqfeu_17",kC="_checkbox_hqfeu_1",ri={checkboxGroupContainer:FC,stack:PC,selectAllContainer:DC,fieldContainer:MC,checkbox:kC};function jC({id:e,isChecked:t,label:n,onCheckedChange:r}){return c.jsxs("div",{className:ri.fieldContainer,children:[c.jsx(Ga,{className:ri.checkbox,id:e,onCheckedChange:r,checked:t,children:c.jsx(Xa,{children:c.jsx(If,{})})}),c.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function LC({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return c.jsxs("div",{className:ri.selectAllContainer,children:[c.jsx(Ga,{className:ri.checkbox,id:e,onCheckedChange:r,checked:o?"indeterminate":t,children:c.jsxs(Xa,{children:[o&&c.jsx(TC,{}),t===!0&&c.jsx(If,{})]})}),c.jsx("label",{htmlFor:e,children:n})]})}function VC({children:e}){return c.jsx("div",{className:ri.checkboxGroupContainer,children:e})}function $C({children:e}){return c.jsx("div",{className:ri.stack,children:e})}const KC="_paginationContainer_1p51x_1",UC="_pageInfo_1p51x_7",qC="_searchContainer_1p51x_13",BC="_searchInput_1p51x_17",JC="_noResults_1p51x_21",mi={paginationContainer:KC,pageInfo:UC,searchContainer:qC,searchInput:BC,noResults:JC};function Cf({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:o=!0,searchPlaceholder:i="Search fields..."}){const[s,a]=b.useState(1),[u,f]=b.useState(""),l=e.filter(v=>v.label.toLowerCase().includes(u.toLowerCase())),d=Math.ceil(l.length/n),h=(s-1)*n,m=h+n,y=l.slice(h,m),w=v=>{f(v),a(1)},g=v=>{l.forEach(I=>{t(I.id,v)})},O=l.length>0&&l.every(v=>v.isChecked),p=l.some(v=>v.isChecked);return c.jsxs(VC,{children:[o&&c.jsx("div",{className:mi.searchContainer,children:c.jsx(od,{id:"field-search",type:"text",placeholder:i,value:u,onChange:v=>w(v.target.value),className:mi.searchInput})}),r&&e.length>=2&&c.jsx(LC,{id:"select-all-fields",isChecked:O,label:`Select all ${l.length} ${u?"matching ":""}fields`,onCheckedChange:g,isIndeterminate:p&&!O}),c.jsx($C,{children:y.map(v=>c.jsx(jC,{id:v.id,isChecked:v.isChecked,label:v.label,onCheckedChange:I=>t(v.id,I===!0)},v.id))}),d>1&&c.jsxs("div",{className:mi.paginationContainer,children:[c.jsx(We,{type:"button",onClick:()=>a(v=>Math.max(1,v-1)),disabled:s===1,variant:"ghost",children:"<"}),c.jsxs("span",{className:mi.pageInfo,children:[s," of ",d]}),c.jsx(We,{type:"button",onClick:()=>a(v=>Math.min(d,v+1)),disabled:s===d,variant:"ghost",children:">"})]}),l.length===0&&u&&c.jsxs("div",{className:mi.noResults,children:['No fields found matching "',u,'"']})]})}function HC(e,t,n){var o;const r=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};r[t]=n,n||delete r[t]}function WC(e,t,n,r){t(e,o=>HC(o,n,r))}function zC(){var f,l;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Gt(),o=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,i=(l=t==null?void 0:t.read)==null?void 0:l.optionalFields,s=(d,h)=>{r&&t&&WC(r,n,d,h)},a=b.useMemo(()=>(i==null?void 0:i.filter(d=>!er(d)&&"fieldName"in d&&"displayName"in d).map(d=>({id:d.fieldName,label:d.displayName,isChecked:!!(o!=null&&o[d.fieldName])})).sort((d,h)=>d.label.localeCompare(h.label)))||[],[i,o]);return!!(i&&i.length>0)&&c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:`${e} reads the following optional fields`}),c.jsx(Cf,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${i==null?void 0:i.length}`)]})}function QC(){return c.jsx(zC,{})}const GC={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 XC({children:e,style:t,...n}){return c.jsx("span",{style:{...GC,...t},...n,children:e})}const YC="_errorAlert_1tcao_1",ZC="_errorHeader_1tcao_11",ex="_errorIcon_1tcao_17",tx="_errorTitle_1tcao_24",nx="_errorMessage_1tcao_30",gi={errorAlert:YC,errorHeader:ZC,errorIcon:ex,errorTitle:tx,errorMessage:nx};function rx({error:e}){return c.jsxs("div",{className:gi.errorAlert,children:[c.jsxs("div",{className:gi.errorHeader,children:[c.jsx(AC,{className:gi.errorIcon}),c.jsx("span",{className:gi.errorTitle,children:"Unable to load object"})]}),c.jsx("div",{className:gi.errorMessage,children:e})]})}function ix(){var s,a,u;const{data:e}=pa(),{selectedObjectName:t}=Gt(),{appName:n}=Zn(),r=(u=(a=(s=e==null?void 0:e.content)==null?void 0:s.read)==null?void 0:a.objects)==null?void 0:u.find(f=>f.objectName===t),o=r==null?void 0:r.error,i=r==null?void 0:r.requiredFields;return o?c.jsx(rx,{error:o}):c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:`${n} reads the following fields`}),c.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:i!=null&&i.length?i.map(f=>er(f)?null:c.jsx(XC,{children:f.displayName},f.fieldName)):"There are no required fields."})]})}function ox(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 xf(e,t,n,r,o){t(e,i=>ox(i,e,n,r,o))}function gs(e){return e.mapToDisplayName||e.mapToName||e.fieldName||""}function sx(e,t){if(!e.fieldName)return{isValid:!1,errorMessage:"Field name is missing"};const n=t==null?void 0:t.valueType;if(!["singleSelect","multiSelect"].includes(n||""))return{isValid:!1,errorMessage:"fieldName is not a singleSelect or multiSelect"};const r=t==null?void 0:t.values;if(!r)return{isValid:!1,errorMessage:"Field values array is missing"};const o=Object.keys(r).length,i=Object.keys((e==null?void 0:e.mappedValues)||[]).length;return o!==i?{isValid:!1,errorMessage:"field values and the values to be mapped are not of the same length"}:{isValid:!0}}function ax(e,t,n){const r=Object.values(t).filter(Boolean),o=t[n];return e.filter(i=>{const s=i.value===o,a=r.includes(i.value);return s||!a})}function cx({string:e,fieldName:t}){return c.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[c.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,c.jsx("b",{children:t})]}),c.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:c.jsx($o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function ux({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r}){var m;const{configureState:o,selectedObjectName:i,setConfigureState:s}=Gt(),a=b.useMemo(()=>{var y,w;return((w=(y=o==null?void 0:o.read)==null?void 0:y.selectedValueMappings)==null?void 0:w[n])||{}},[(m=o==null?void 0:o.read)==null?void 0:m.selectedValueMappings,n]),u=b.useMemo(()=>a==null?void 0:a[e.mappedValue],[a,e.mappedValue]),f=b.useMemo(()=>r.map(y=>({id:y.value,label:y.displayValue,value:y.value})),[r]),l=b.useCallback(y=>{y&&t({target:{name:e.mappedValue,value:y.value,fieldName:n}})},[t,n,e.mappedValue]),d=b.useMemo(()=>c.jsx(ef,{items:f,selectedValue:u||null,onSelectedItemChange:l,placeholder:"Please select one",style:{borderRadius:"8px",width:"100%"}},u),[u,f,l]),h=b.useCallback(()=>{i&&xf(i,s,e.mappedValue,"",n)},[i,s,e.mappedValue,n]);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[c.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:c.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[d,c.jsx(We,{type:"button",variant:"ghost",onClick:h,children:"Clear"})]})]},e.mappedValue)}function lx(){var u,f;const{fieldMapping:e}=at(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Gt(),o=(u=n==null?void 0:n.read)==null?void 0:u.selectedFieldMappings,i=(f=n==null?void 0:n.read)==null?void 0:f.selectedValueMappings,s=b.useMemo(()=>{const l=t&&e?Object.values(e[t]||{}).flat().filter(d=>d.mappedValues).map(d=>({...d})):[];if(o)for(let d=0;d<l.length;d+=1){const{mapToName:h}=l[d];o!=null&&o[h]&&(l[d].fieldName=o[h])}return l},[t,e,o]),a=b.useCallback(l=>{const{value:d,name:h,fieldName:m}=l.target;d&&t&&xf(t,r,h,d,m)},[t,r]);return s!=null&&s.length?c.jsx(c.Fragment,{children:s.map(l=>{var m,y,w;const d=(y=(m=n==null?void 0:n.read)==null?void 0:m.allFieldsMetadata)==null?void 0:y[l.fieldName],h=sx(l,d);return h.isValid?c.jsxs(c.Fragment,{children:[c.jsx(cx,{string:"Map the values for ",fieldName:gs(l)}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.jsx(Jo,{id:gs(l),children:(w=l==null?void 0:l.mappedValues)==null?void 0:w.map(g=>{const O=(d==null?void 0:d.values)||[],p=(i==null?void 0:i[l.fieldName])||{},v=ax(O,p,g.mappedValue);return c.jsx(ux,{allValueOptions:v,mappedValue:g,onSelectChange:a,fieldName:(l==null?void 0:l.fieldName)||""},`${g.mappedValue}-${l.fieldName}`)})},gs(l))})]}):(console.error(h.errorMessage,l),null)})}):null}const dx=!1;function fx(){return iC(),c.jsxs(c.Fragment,{children:[c.jsx(aC,{}),c.jsx(ix,{}),c.jsx(nC,{}),c.jsx(tC,{}),c.jsx(lx,{}),c.jsx(QC,{}),dx]})}function px(e,t,n){var r;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const o=e.write.selectedWriteObjects;n&&(o[t]={objectName:t}),n||delete o[t]}}function hx(e,t,n,r){t(e,o=>{px(o,n,r)})}function mx(){var f,l;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Gt(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(l=n==null?void 0:n.write)==null?void 0:l.writeObjects,s=(d,h)=>{t&&n&&hx(t,r,d,h)},a=!!i,u=(i==null?void 0:i.map(d=>({id:d.objectName,label:d.displayName,isChecked:!!(o!=null&&o[d.objectName])})))||[];return a&&c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:`Allow ${e} to write to these objects`}),c.jsx(Cf,{items:u,onItemChange:s,showSelectAll:i.length>=2})]})}function gx(){return c.jsx(c.Fragment,{children:c.jsx(mx,{})})}function Of({resetComponent:e,onDisconnectSuccess:t}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[c.jsx(Ft,{string:"Remove connection"}),c.jsx("p",{children:"Click to disconnect your connection from the provider."}),c.jsx(ld,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const yx="_authenticationRow_1g2ms_1",vx="_field_1g2ms_8",wx="_value_1g2ms_12",ys={authenticationRow:yx,field:vx,value:wx};function bu({label:e,value:t}){return c.jsxs("div",{className:ys.authenticationRow,children:[c.jsx("div",{className:ys.field,children:e}),c.jsx("div",{className:ys.value,children:t})]})}function bx(){const{selectedConnection:e}=Qt(),{providerName:t}=dt(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Connection details"}),c.jsxs("div",{style:{paddingBottom:"1rem"},children:[c.jsx(bu,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),c.jsx(bu,{label:"Status",value:on((e==null?void 0:e.status)||"")})]})]})}const Ix=()=>{const e=st(),t=Ue();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 _f({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=je(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=at(),[u,f]=b.useState(!1),l=!r||!o||!(i!=null&&i.id)||u,d=Ix(),h=async()=>{l||(f(!0),console.warn("uninstalling installation",{projectIdOrName:r,integrationId:o,installationId:i.id}),d.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)}))},m=u?"Uninstalling...":e,y=c.jsx(We,{type:"button",onClick:h,disabled:l,variant:t,style:n,children:m});return i!=null&&i.id?y:null}function Cx(){const{installation:e}=at(),{providerName:t}=dt();return e?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Uninstall entire integration"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?c.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."]}):c.jsx("p",{children:"You've successfully uninstalled the integration."}),c.jsx(_f,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function xx(){const{installation:e,resetComponent:t}=at();return c.jsxs(c.Fragment,{children:[c.jsx(bx,{}),c.jsx(Ia,{}),e&&c.jsx(Cx,{}),!e&&c.jsx(Of,{resetComponent:t})]})}function Sf({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var de,be,P,$,H,U,q,V,G,Z,Y,ee,ne,ce;const{installation:i}=Nr(),{hydratedRevision:s,loading:a}=ci(),{configureState:u,selectedObjectName:f}=Gt(),l=i==null?void 0:i.config,d=l&&f&&!!Kl(l,f)||!1,h=f?td(l,f):void 0,m=(de=u==null?void 0:u.read)==null?void 0:de.selectedFieldMappings,y=!Hl(h,m),w=s&&f?va(l,s,f):void 0,g=(be=u==null?void 0:u.read)==null?void 0:be.selectedOptionalFields,O=!Jl(w,g),p=f?(U=(H=($=(P=l==null?void 0:l.content)==null?void 0:P.read)==null?void 0:$.objects)==null?void 0:H[f])==null?void 0:U.selectedValueMappings:void 0,v=(q=u==null?void 0:u.read)==null?void 0:q.selectedValueMappings,I=!Wl(p,v),x=(G=(V=l==null?void 0:l.content)==null?void 0:V.write)==null?void 0:G.objects,E=(Z=u==null?void 0:u.write)==null?void 0:Z.selectedWriteObjects,A=!zl(x||{},E||{}),D=O||y||I||A||r||f!==Qr&&!d,K=!!((ce=(ne=(ee=(Y=s==null?void 0:s.content)==null?void 0:Y.read)==null?void 0:ee.objects)==null?void 0:ne.find(k=>k.objectName===f))!=null&&ce.error),j=a||n||!u||!f||!D||K,L=f===Qr,se=f===Io,re=c.jsx(We,{type:"submit",disabled:j,children:r?"Install":"Save"}),ge=c.jsx(We,{type:"button",onClick:t,disabled:j,variant:"ghost",children:"Reset"});return n?c.jsx(_i,{}):c.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[c.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!se&&c.jsxs(c.Fragment,{children:[re,ge]})}),c.jsxs(_n,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&c.jsx(ki,{children:typeof o=="string"?o:"Installation Failed."}),a&&c.jsx(_i,{}),s&&!L&&!se&&c.jsx(fx,{}),s&&L&&!se&&c.jsx(gx,{}),!a&&se&&c.jsx(xx,{})]})]})}const Ef=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i,fieldMapping:s}=at(),{hydratedRevision:a,loading:u}=ci(),{selectedObjectName:f}=pd(),{selectedConnection:l}=Qt(),d=zu(),{projectIdOrName:h}=je(),{resetBoundary:m,setErrors:y,setError:w,getError:g}=an(),{resetConfigureState:O,objectConfigurationsState:p}=Ca(),v=nd(f||"",p),{onNextIncompleteTab:I}=$b(),x=b.useCallback(()=>{m(we.INSTALLATION_MUTATION)},[m]),E=b.useCallback(S=>S?F=>{w(we.INSTALLATION_MUTATION,S,F)}:F=>{console.error("objectName is required to set installation error: ",F)},[w]),A=b.useCallback(S=>S?g(we.INSTALLATION_MUTATION,S):"",[g]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:a,loading:u,selectedObjectName:f,selectedConnection:l,apiKey:d,projectIdOrName:h,resetBoundary:m,setErrors:y,setMutateInstallationError:E,getMutateInstallationError:A,resetMutateInstallationErrorState:x,resetConfigureState:O,objectConfigurationsState:p,configureState:v,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:I,fieldMapping:s}},Ox=void 0;function _x(){const{consumerRef:e,setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,selectedConnection:i,resetBoundary:s,setErrors:a,setMutateInstallationError:u,getMutateInstallationError:f,resetMutateInstallationErrorState:l,resetConfigureState:d,objectConfigurationsState:h,configureState:m,onInstallSuccess:y,onNextIncompleteTab:w,fieldMapping:g}=Ef(),[O,p]=b.useState(!1),{createInstallation:v}=kl(),I=o===Qr,x=f(o),E=b.useCallback(()=>{s(we.MAPPING),n!=null&&n.content&&!r&&o&&Gl(n,Ox,o,d)},[s,n,r,o,d]);b.useEffect(()=>{!m&&(n!=null&&n.content)&&!r&&E()},[m,h,n,r,E]);const A=()=>{l();const{requiredMapFields:R,selectedFieldMappings:D}=(m==null?void 0:m.read)||{},{errorList:K}=Bl(R,D,a);if(!(K.length>0))if(o&&(i!=null&&i.id)&&e&&n){p(!0);const j=Zw(m,o,n,e,g);if(!j){console.error("Error when generating createConfig from configureState"),p(!1);return}v({config:j.content,onSuccess:L=>{t(L),y==null||y(L.id,L.config),p(!1),w()},onError:L=>{u(o)(L.message),p(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},S=()=>{if(l(),o&&(i!=null&&i.id)&&e&&n){p(!0);const R=tb(m,n,e);if(!R){console.error("Error when generating createConfig from configureState"),p(!1);return}v({config:R.content,onSuccess:D=>{t(D),y==null||y(D.id,D.config),p(!1),w()},onError:D=>{u(o)(D.message),p(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},F=R=>{R.preventDefault(),I?S():A()};return c.jsx(Sf,{errorMsg:x,isCreateMode:!0,isLoading:O,onSave:F,onReset:E})}const Sx=(e,t,n,r,o)=>{const i=Xl(e),s=Yl(e),a=Zl(t,o),u=ed(e),f={content:{read:{objects:{[t]:{objectName:t,selectedFields:i,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:u||{},backfill:r}}}}};return Mi(n)&&(f.content||(f.content={}),f.content.proxy={enabled:!0}),f},Ex=(e,t)=>{const r={content:{write:{objects:rd(e)}}};return Mi(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r};function Nx({installation:e}){const{setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,resetBoundary:i,setErrors:s,setMutateInstallationError:a,getMutateInstallationError:u,resetConfigureState:f,configureState:l,onUpdateSuccess:d,onNextIncompleteTab:h,fieldMapping:m}=Ef(),{updateInstallation:y}=jl(),[w,g]=b.useState(!1),O=o===Qr,p=u(o),{config:v}=e,I=b.useCallback(()=>{i(we.MAPPING),n!=null&&n.content&&!r&&o&&Gl(n,v,o,f)},[i,n,r,o,v,f]);b.useEffect(()=>{l||I()},[l,I]);const x=b.useMemo(()=>{var R,D,K;return(K=(D=(R=n==null?void 0:n.content)==null?void 0:R.read)==null?void 0:D.objects)==null?void 0:K.find(j=>(j==null?void 0:j.objectName)===o)},[n,o]),E=()=>{const{requiredMapFields:F,selectedFieldMappings:R}=(l==null?void 0:l.read)||{},{errorList:D}=Bl(F,R,s);if(!(D.length>0))if(n&&l&&o&&x){g(!0);const K=Sx(l,o,n,x.backfill,m);if(!K){console.error("Error when generating updateConfig from configureState"),g(!1);return}y({config:K.content,onSuccess:j=>{t(j),d==null||d(j.id,j.config),g(!1),h()},onError:j=>{a(o)(j.message),g(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},A=()=>{if(l&&n){g(!0);const F=Ex(l,n);if(!F){console.error("Error when generating write updateConfig from configureState"),g(!1);return}y({config:F.content,onSuccess:R=>{t(R),d==null||d(R.id,R.config),g(!1),h()},onError:R=>{a(o)(R.message),g(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},S=F=>{F.preventDefault(),O?A():E()};return c.jsx(Sf,{errorMsg:p,onSave:S,onReset:I,isLoading:w})}function Tx(){const{integrationObj:e,installation:t}=at();return e?t&&e?c.jsx(Nx,{installation:t}):c.jsx(_x,{}):c.jsx(Rl,{message:"We can't load the integration"})}class Nf extends b.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){var r,o;console.error("InstallIntegration Error Boundary caught an error:",t),console.error("[Error Info]:",n),(o=(r=this.props).onError)==null||o.call(r,t,n)}render(){var t;return this.state.hasError?this.props.fallback?this.props.fallback:c.jsx(Tt,{message:((t=this.state.error)==null?void 0:t.message)||"Something went wrong. Please try again later."}):this.props.children}}function Rx(){return c.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),c.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Za({text:e,children:t}){return c.jsx(si,{children:c.jsxs(_n,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[c.jsx(Rx,{}),c.jsx("p",{children:e}),t]})})}function Ax({provider:e}){const{providerName:t}=dt(e),n=`You have successfully installed your ${t} integration.`;return c.jsx(Za,{text:n,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:c.jsx(_f,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Fx=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function Px({children:e}){var x;const t=b.useRef(!1),{projectIdOrName:n}=je(),{hydratedRevision:r,loading:o}=ci(),{integrationObj:i,installation:s,groupRef:a,consumerRef:u,onInstallSuccess:f,isIntegrationDeleted:l}=at(),{mutate:d,isIdle:h,isPending:m,error:y,errorMsg:w}=Ml(),{selectedConnection:g,isConnectionsLoading:O}=Qt(),p=o||m||O,v=(x=r==null?void 0:r.content)==null?void 0:x.provider,I=Fx(r);return b.useEffect(()=>{var E;if(!p&&!O&&r&&I&&!s&&g&&(i!=null&&i.id)&&!l&&v){const A={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:g==null?void 0:g.id,config:{content:{provider:v}}}};Mi(r)===!0&&(A.installation.config.content.proxy=(E=r==null?void 0:r.content)==null?void 0:E.proxy),h&&!t.current&&d(A,{onSuccess:S=>{t.current||(f==null||f(S==null?void 0:S.id,S.config),t.current=!0)}})}},[r,I,s,g,n,i==null?void 0:i.id,a,u,p,f,l,O,v,d,h]),I&&v&&s?c.jsx(Ax,{provider:v}):y?c.jsx(Tt,{message:w??"Create installation failed"}):i?p?c.jsx(ai,{}):c.jsx("div",{children:e}):c.jsx(Tt,{message:"We can't load the integration"})}function $i(){const e=st(),t=Ue();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 Dx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:u}=je(),f=$i(),l=b.useCallback(d=>{var w;const{apiKey:h,providerMetadata:m}=d,y={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:(w=m==null?void 0:m.workspace)==null?void 0:w.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:h,...m&&{providerMetadata:m}}};f.mutate(y)},[u,i,o,r,n,e,f]);return a===null?c.jsx(bb,{provider:e,providerInfo:t,handleSubmit:l,error:null}):s}function Mx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:u}=je(),f=$i(),l=b.useCallback(d=>{var g;const{user:h,pass:m,providerMetadata:y}=d,w={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:(g=y==null?void 0:y.workspace)==null?void 0:g.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:h,password:m},...y&&{providerMetadata:y}}};f.mutate(w)},[u,i,o,r,n,e,f]);return a===null?c.jsx(_b,{provider:e,providerInfo:t,handleSubmit:l,error:null}):s}function Iu({url:e,prompt:t,inputName:n}){return c.jsx("p",{style:{color:"var(--amp-colors-text-muted)",display:"flex",justifyContent:"space-between"},children:c.jsxs("span",{children:[e?c.jsx(wa,{href:e,newTab:!0,children:c.jsx("span",{style:{textDecoration:"underline"},children:n})}):c.jsx("span",{children:n})," ",t&&c.jsx(ff,{id:`docs-helper-text-${Dw(n||(t==null?void 0:t.slice(0,50)))}`,tooltipText:t})]})})}function kx({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r}){var h,m;const[o,i]=b.useState({}),s=((h=e.metadata)==null?void 0:h.input)||[],a=y=>{const{name:w,value:g}=y.currentTarget;i(O=>({...O,[w]:g.trim()}))},u=Gr(s,o),f=n||!u,l=((m=e.customOpts)==null?void 0:m.inputs)||[],d=()=>{const y=Lo(s,o),w=Object.fromEntries(l.map(g=>[g.name,o[g.name]]));t({customAuth:w,providerMetadata:y})};return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[l.map(y=>c.jsxs("div",{children:[c.jsx(Iu,{url:y.docsURL,prompt:y.prompt,inputName:y.displayName}),c.jsx(Ot.PasswordInput,{id:y.name,name:y.name,onChange:a,placeholder:""})]},y.name)),s.map(y=>c.jsxs("div",{children:[y.docsURL&&c.jsx(Iu,{url:y.docsURL,prompt:y.displayName||y.name,inputName:y.displayName||on(y.name.toLowerCase())}),c.jsx(Ot.Input,{id:y.name,name:y.name,type:"text",placeholder:"",onChange:a})]},y.name)),c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"submit",onClick:d,variant:r,children:"Next"})]})}function jx({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r}){return c.jsxs(tr,{children:[c.jsx(nr,{children:`Set up ${e.displayName} integration`}),c.jsx(cn,{error:n}),c.jsx(kx,{providerInfo:e,handleSubmit:t,isButtonDisabled:r})]})}function Lx({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s}){const{projectIdOrName:a}=je(),u=$i(),[f,l]=b.useState(null),d=b.useCallback(h=>{var g;const{customAuth:m,providerMetadata:y}=h;l(null);const w={projectIdOrName:a,generateConnectionParams:{providerWorkspaceRef:(g=y==null?void 0:y.workspace)==null?void 0:g.value,groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:m,...y&&{providerMetadata:y}}};u.mutate(w,{onError:O=>{He(O,l)},onSuccess:()=>{l(null)}})},[a,o,r,n,t,e.name,u]);return s===null?c.jsx(jx,{providerInfo:e,handleSubmit:d,error:f}):i}function Vx({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 c.jsxs(tr,{children:[c.jsx(nr,{children:i||`Set up ${r} integration`}),c.jsx(cn,{error:t}),o,c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function $x({...e}){return c.jsx(Vx,{...e})}function Kx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:u}=je(),f=$i(),l=b.useCallback(()=>{const d={projectIdOrName:u,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};f.mutate(d)},[u,o,r,n,t,e,f]);return s===null?c.jsx($x,{handleSubmit:l,error:null,providerName:a}):i}const Ux=()=>{const e=st(),t=Ue();return On({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function qx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs(tr,{children:[c.jsx(nr,{children:`Set up ${r} integration`}),c.jsx(gb,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),c.jsx(cn,{error:t}),c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const Bx="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Jx({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return c.jsxs(tr,{children:[c.jsx(nr,{children:"Enter your Salesforce subdomain"}),c.jsx(wa,{href:Bx,newTab:!0,children:"What is my Salesforce subdomain?"}),c.jsx(cn,{error:n}),c.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[c.jsx(Ot.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),c.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function Hx({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return c.jsxs(tr,{children:[c.jsxs(nr,{children:["Enter your ",o," workspace"]}),c.jsx(cn,{error:n}),c.jsx("br",{}),i.map(s=>c.jsx(Ot.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),c.jsx("br",{}),c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Cu=600,xu=600,Ou="salesforce";function Wx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var D;const{projectId:s}=Zn(),a=Ue(),u=b.useRef(null),[f,l]=b.useState(null),[d,h]=b.useState(""),[m,y]=b.useState({}),[w,g]=b.useState({}),{data:O}=jo(e),p=((D=O==null?void 0:O.metadata)==null?void 0:D.input)||[],{mutateAsync:v,isPending:I}=Ux(),{isFetching:x,refetch:E}=ga({groupRef:r,provider:e});b.useEffect(()=>{const K=j=>{var L,se,re;j.origin===El&&(((L=j.data)==null?void 0:L.eventType)==="AUTHORIZATION_SUCCEEDED"?(l(null),console.debug("New connection:",j.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((se=j.data)==null?void 0:se.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",j.data.data.error),a.invalidateQueries({queryKey:["amp","connections"]}),l(j.data.data.error||"An error occurred. Please try again.")),(re=u.current)==null||re.close())};return window.addEventListener("message",K),()=>window.removeEventListener("message",K)},[a]);const A=K=>{h(K),y(j=>({...j,workspace:K})),g(j=>({...j,workspace:{value:K,source:"input"}}))},S=(K,j)=>{y(L=>({...L,[K]:j})),g(L=>({...L,[K]:{value:j,source:"input"}}))},F=async()=>{var K;l(null);try{const{data:j}=await E();if(j&&j.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(p.length>0&&!Gr(p,m)){l("Please fill in all required fields");return}try{const j=await v({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s||"",consumerName:n,groupName:o,providerWorkspaceRef:e===Ou?d:(K=w==null?void 0:w.workspace)==null?void 0:K.value,providerMetadata:w}});if(j){const L=window.screenX+(window.outerWidth-Cu)/2,se=window.screenY+(window.outerHeight-xu)/2.5,re=`width=${Cu},height=${xu},left=${L},top=${se}`;u.current=window.open(j,"OAuthPopup",re)}}catch(j){console.error(j),l(j instanceof Error?j.message:String(j)||"An error occurred. Please try again.")}},R=e===Ou?c.jsx(Jx,{handleSubmit:F,setWorkspace:A,error:f,isButtonDisabled:d.length===0||I||x}):p.length>0?c.jsx(Hx,{handleSubmit:F,setFormData:S,error:f,isButtonDisabled:!Gr(p,m)||I||x,providerName:i,metadataFields:p}):c.jsx(qx,{handleSubmit:F,error:f,providerName:i,isButtonDisabled:I||x});return c.jsx("div",{children:R})}function zx({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:u}=je(),f=$i(),[l,d]=b.useState(null),h=b.useCallback(m=>{var w,g;d(null);const y={projectIdOrName:u,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(g=(w=m.providerMetadata)==null?void 0:w.workspace)==null?void 0:g.value,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes},...m.providerMetadata&&{providerMetadata:m.providerMetadata}}};f.mutate(y,{onError:()=>d("Error loading provider info")})},[u,i,o,r,n,e,f]);return a===null?c.jsx(Eb,{provider:e,providerName:t,handleSubmit:h,error:l,explicitScopesRequired:s}):c.jsx(_i,{})}function Qx({...e}){return c.jsx(zx,{...e})}const Gx="authorizationCode",Xx="authorizationCodePKCE",Yx="clientCredentials";function Zx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:u}=dt(e);if(t.oauth2Opts===void 0)return c.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:f,explicitScopesRequired:l}=t.oauth2Opts,d={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:u};return f===Gx||f===Xx?c.jsx(Wx,{...d}):f===Yx?c.jsx(Qx,{...d,explicitScopesRequired:l,selectedConnection:s,setSelectedConnection:a}):f==="password"?c.jsx("em",{children:"Password flow not supported yet"}):c.jsxs("em",{children:["Unsupported grant type: ",f]})}function eO(e){const{selectedConnection:t}=Qt();b.useEffect(()=>{e&&t&&e(t)},[e,t])}function tO({onSuccess:e}){eO(e)}function Tf({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:u}){const{data:f,isLoading:l,isError:d,error:h,providerName:m,selectedProvider:y}=dt(e),{provider:w,isIntegrationDeleted:g}=at(),{selectedConnection:O,setSelectedConnection:p}=Qt();tO({onSuccess:s});const v=Ue(),I=f;b.useEffect(()=>{d&&(console.error("Error loading provider info."),He(h))},[d,h]);const x=b.useCallback(()=>{v.clear(),u()},[u,v]);if(!e&&!w)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(g)return c.jsx(Za,{text:"Integration successfully uninstalled.",children:c.jsx(We,{type:"button",onClick:x,style:{width:"100%"},children:"Reinstall Integration"})});if(O)return i;if(l)return c.jsx(ai,{});if(I==null)return c.jsx(Tt,{message:"Provider info was not found."});const E={provider:y,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:O,setSelectedConnection:p,providerName:m,providerInfo:I,onDisconnectSuccess:a};return I.authType==="none"?c.jsx(Kx,{...E,children:i}):I.authType==="basic"?c.jsx(Mx,{...E,children:i}):I.authType==="apiKey"?c.jsx(Dx,{...E,children:i}):I.authType==="custom"?c.jsx(Lx,{...E,children:i}):c.jsx(Zx,{...E})}function nO(e){const t=e+"CollectionProvider",[n,r]=Ho(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=w=>{const{scope:g,children:O}=w,p=b.useRef(null),v=b.useRef(new Map).current;return c.jsx(o,{scope:g,itemMap:v,collectionRef:p,children:O})};s.displayName=t;const a=e+"CollectionSlot",u=ta(a),f=b.forwardRef((w,g)=>{const{scope:O,children:p}=w,v=i(a,O),I=ni(g,v.collectionRef);return c.jsx(u,{ref:I,children:p})});f.displayName=a;const l=e+"CollectionItemSlot",d="data-radix-collection-item",h=ta(l),m=b.forwardRef((w,g)=>{const{scope:O,children:p,...v}=w,I=b.useRef(null),x=ni(g,I),E=i(l,O);return b.useEffect(()=>(E.itemMap.set(I,{ref:I,...v}),()=>void E.itemMap.delete(I))),c.jsx(h,{[d]:"",ref:x,children:p})});m.displayName=l;function y(w){const g=i(e+"CollectionConsumer",w);return b.useCallback(()=>{const p=g.collectionRef.current;if(!p)return[];const v=Array.from(p.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((E,A)=>v.indexOf(E.ref.current)-v.indexOf(A.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:f,ItemSlot:m},y,r]}var rO=B[" useId ".trim().toString()]||(()=>{}),iO=0;function Rf(e){const[t,n]=B.useState(rO());return Ni(()=>{n(r=>r??String(iO++))},[e]),e||(t?`radix-${t}`:"")}function oO(e){const t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var sO=B.createContext(void 0);function Af(e){const t=B.useContext(sO);return e||t||"ltr"}var vs="rovingFocusGroup.onEntryFocus",aO={bubbles:!1,cancelable:!0},Ki="RovingFocusGroup",[na,Ff,cO]=nO(Ki),[uO,Pf]=Ho(Ki,[cO]),[lO,dO]=uO(Ki),Df=B.forwardRef((e,t)=>c.jsx(na.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(na.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(fO,{...e,ref:t})})}));Df.displayName=Ki;var fO=B.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...d}=e,h=B.useRef(null),m=ni(t,h),y=Af(i),[w,g]=Wa({prop:s,defaultProp:a??null,onChange:u,caller:Ki}),[O,p]=B.useState(!1),v=oO(f),I=Ff(n),x=B.useRef(!1),[E,A]=B.useState(0);return B.useEffect(()=>{const S=h.current;if(S)return S.addEventListener(vs,v),()=>S.removeEventListener(vs,v)},[v]),c.jsx(lO,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:w,onItemFocus:B.useCallback(S=>g(S),[g]),onItemShiftTab:B.useCallback(()=>p(!0),[]),onFocusableItemAdd:B.useCallback(()=>A(S=>S+1),[]),onFocusableItemRemove:B.useCallback(()=>A(S=>S-1),[]),children:c.jsx(Sn.div,{tabIndex:O||E===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:Ht(e.onMouseDown,()=>{x.current=!0}),onFocus:Ht(e.onFocus,S=>{const F=!x.current;if(S.target===S.currentTarget&&F&&!O){const R=new CustomEvent(vs,aO);if(S.currentTarget.dispatchEvent(R),!R.defaultPrevented){const D=I().filter(re=>re.focusable),K=D.find(re=>re.active),j=D.find(re=>re.id===w),se=[K,j,...D].filter(Boolean).map(re=>re.ref.current);jf(se,l)}}x.current=!1}),onBlur:Ht(e.onBlur,()=>p(!1))})})}),Mf="RovingFocusGroupItem",kf=B.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,u=Rf(),f=i||u,l=dO(Mf,n),d=l.currentTabStopId===f,h=Ff(n),{onFocusableItemAdd:m,onFocusableItemRemove:y,currentTabStopId:w}=l;return B.useEffect(()=>{if(r)return m(),()=>y()},[r,m,y]),c.jsx(na.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:c.jsx(Sn.span,{tabIndex:d?0:-1,"data-orientation":l.orientation,...a,ref:t,onMouseDown:Ht(e.onMouseDown,g=>{r?l.onItemFocus(f):g.preventDefault()}),onFocus:Ht(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:Ht(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){l.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const O=mO(g,l.orientation,l.dir);if(O!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let v=h().filter(I=>I.focusable).map(I=>I.ref.current);if(O==="last")v.reverse();else if(O==="prev"||O==="next"){O==="prev"&&v.reverse();const I=v.indexOf(g.currentTarget);v=l.loop?gO(v,I+1):v.slice(I+1)}setTimeout(()=>jf(v))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:w!=null}):s})})});kf.displayName=Mf;var pO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mO(e,t,n){const r=hO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return pO[r]}function jf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function gO(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var yO=Df,vO=kf,zo="Tabs",[wO,zO]=Ho(zo,[Pf]),Lf=Pf(),[bO,ec]=wO(zo),Vf=B.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:u="automatic",...f}=e,l=Af(a),[d,h]=Wa({prop:r,onChange:o,defaultProp:i??"",caller:zo});return c.jsx(bO,{scope:n,baseId:Rf(),value:d,onValueChange:h,orientation:s,dir:l,activationMode:u,children:c.jsx(Sn.div,{dir:l,"data-orientation":s,...f,ref:t})})});Vf.displayName=zo;var $f="TabsList",Kf=B.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=ec($f,n),s=Lf(n);return c.jsx(yO,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:c.jsx(Sn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Kf.displayName=$f;var Uf="TabsTrigger",qf=B.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=ec(Uf,n),a=Lf(n),u=Jf(s.baseId,r),f=Hf(s.baseId,r),l=r===s.value;return c.jsx(vO,{asChild:!0,...a,focusable:!o,active:l,children:c.jsx(Sn.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":f,"data-state":l?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...i,ref:t,onMouseDown:Ht(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Ht(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Ht(e.onFocus,()=>{const d=s.activationMode!=="manual";!l&&!o&&d&&s.onValueChange(r)})})})});qf.displayName=Uf;var Bf="TabsContent",IO=B.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=ec(Bf,n),u=Jf(a.baseId,r),f=Hf(a.baseId,r),l=r===a.value,d=B.useRef(l);return B.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),c.jsx(za,{present:o||l,children:({present:h})=>c.jsx(Sn.div,{"data-state":l?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":u,hidden:!h,id:f,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&i})})});IO.displayName=Bf;function Jf(e,t){return`${e}-trigger-${t}`}function Hf(e,t){return`${e}-content-${t}`}var CO=Vf,xO=Kf,Wf=qf;const OO=c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[c.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),c.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function _O(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?OO:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:c.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function SO(){return c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.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"}),c.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 EO="_tabsRoot_ktpr0_1",NO="_tabsList_ktpr0_6",TO="_tabTrigger_ktpr0_12",Ro={tabsRoot:EO,tabsList:NO,tabTrigger:TO};function RO(){return c.jsxs(c.Fragment,{children:[c.jsx($o,{style:{margin:"1rem 0"}}),c.jsx(Wf,{value:Io,className:Ro.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[c.jsx(SO,{}),c.jsx("span",{children:"Manage"})]})})]})}function zf({objectName:e,completed:t,pending:n,displayName:r}){return c.jsx(Wf,{value:e,className:Ro.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[_O(t,n),c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsx("span",{children:r||e}),n&&c.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function AO({completed:e,pending:t,displayName:n}){return c.jsxs(c.Fragment,{children:[c.jsx($o,{style:{margin:"1rem 0"}}),c.jsx(zf,{objectName:Qr,completed:e,pending:t,displayName:n},"other-write")]})}function FO({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var l,d,h,m;const{data:i}=xl(),{installation:s}=Nr(),a=s==null?void 0:s.config,u=(d=(l=a==null?void 0:a.content)==null?void 0:l.write)==null?void 0:d.objects,f=(m=(h=r==null?void 0:r.other)==null?void 0:h.write)==null?void 0:m.selectedWriteObjects;return c.jsx(CO,{value:e,className:Ro.tabsRoot,onValueChange:n,children:c.jsxs(xO,{className:Ro.tabsList,children:[t.map(y=>{var D,K,j,L,se,re;const w=(j=(K=(D=a==null?void 0:a.content)==null?void 0:D.read)==null?void 0:K.objects)==null?void 0:j[y.name],g=r==null?void 0:r[y.name],O=td(a,y.name),p=(L=g==null?void 0:g.read)==null?void 0:L.selectedFieldMappings,v=!Hl(O,p),I=i?va(a,i,y.name):void 0,x=(se=g==null?void 0:g.read)==null?void 0:se.selectedOptionalFields,E=!Jl(I,x),A=w==null?void 0:w.selectedValueMappings,S=(re=g==null?void 0:g.read)==null?void 0:re.selectedValueMappings,F=!Wl(A,S),R=E||v||F||!1;return c.jsx(zf,{objectName:y.name,displayName:y.displayName,completed:y.completed,pending:R},y.name)}),o&&(()=>{const y=!zl(u||{},f||{});return c.jsx(AO,{completed:o.completed,pending:y,displayName:"Write"})})(),c.jsx(RO,{})]})})}function PO(e,t){return t===Io?{name:Io,completed:!1}:e.find(n=>n.name===t)}function DO({children:e}){var O;const{data:t}=Zn(),{installation:n}=at(),{providerName:r}=dt(),{hydratedRevision:o}=ci(),{objectConfigurationsState:i}=Ca(),[s,a]=b.useState(""),u=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,l=o&&Ul(f,o),d=l!==null,h=!!((O=o==null?void 0:o.content)!=null&&O.write),m=h?ql(f):void 0,y=b.useMemo(()=>{const p=[...l||[]];return m&&h&&p.push(m),p},[l,m,h]),w=PO(y,s),g=b.useCallback(()=>{const p=y.find(v=>w!==v&&!v.completed);p&&a(p.name)},[y,w]);return b.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,g]),c.jsx(hd.Provider,{value:g,children:c.jsx(fd.Provider,{value:w==null?void 0:w.name,children:c.jsxs(si,{style:{maxWidth:"55rem"},children:[c.jsxs(_n,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[c.jsxs("div",{style:{width:"20rem"},children:[c.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),c.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:u}),d&&c.jsx(FO,{value:s,readNavObjects:l,onValueChange:p=>a(p),objectConfigurationsState:i,writeNavObject:m})]}),e]}),c.jsx(sd,{})]})})})}function MO({...e}){return c.jsx(DO,{...e})}const kO="_resetContainer_lkwv9_4",Qf={resetContainer:kO},jO=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u})=>{var g;const{projectIdOrName:f,isLoading:l}=Zn(),{isLoading:d}=ko(),{isError:h,errorState:m}=an(),{seed:y,reset:w}=Ll();return l||d?c.jsx(ai,{}):h(we.PROJECT,f)?c.jsx(Tt,{message:`Error loading project ${f}`}):h(we.INTEGRATION_LIST,f)?c.jsx(Tt,{message:"Error retrieving integrations for the project, double check the API key"}):(g=m[we.INTEGRATION_LIST])!=null&&g.apiError?c.jsx(Tt,{message:"Something went wrong, couldn't find integration information"}):c.jsx("div",{className:Qf.resetContainer,children:c.jsx(kw,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u,resetComponent:w,children:c.jsx(Dl,{children:c.jsx(Tf,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:w,children:c.jsx(Vb,{resetComponent:w,children:c.jsx(Px,{children:c.jsx(Ub,{children:c.jsx(MO,{children:c.jsx(Tx,{})})})})})})})},y)})};function LO({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u}){const f={integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u};return c.jsx(Nf,{fallback:c.jsx(Tt,{message:"Something went wrong, couldn't find integration information"}),children:c.jsx(ma,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:c.jsx(jO,{...f})})})}function VO(){return c.jsxs(si,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[c.jsx(_i,{}),c.jsx("p",{children:"Redirecting"})]})}function $O({redirectURL:e,children:t}){return b.useEffect(()=>{e&&window.location.replace(e)},[e]),e?c.jsx(VO,{}):t}function KO({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=b.useState(!1);return c.jsxs(c.Fragment,{children:[r===!1&&c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Manage connection"}),c.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[c.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),c.jsx(We,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&c.jsxs(c.Fragment,{children:[c.jsx(Ia,{provider:n}),c.jsx(Of,{resetComponent:e,onDisconnectSuccess:t})]})]})}function UO({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Zn(),{providerName:o}=dt(e),i=`You have successfully connected your ${o} account to ${r}.`;return c.jsx(Za,{text:i,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:c.jsx(KO,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function qO({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:u}){const{seed:f,reset:l}=Ll(),d=b.useCallback(h=>{s?s(h.id):u&&u(h)},[s,u]);return c.jsx("div",{className:Qf.resetContainer,children:c.jsx(ma,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:c.jsx(Dl,{groupRef:r,provider:e,children:c.jsx(Tf,{resetComponent:l,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:d,onDisconnectSuccess:a,children:c.jsx($O,{redirectURL:i,children:c.jsx(UO,{resetComponent:l,provider:e,onDisconnectSuccess:a})})})})})},f)}const BO=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=da(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,u=n==null?void 0:n[0],f=u==null?void 0:u.config;return b.useEffect(()=>{o&&He(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:f}};exports.AmpersandContext=sa;exports.AmpersandProvider=Ih;exports.ConnectProvider=qO;exports.FieldSettingWriteOnCreateEnum=fm;exports.FieldSettingWriteOnUpdateEnum=pm;exports.InstallIntegration=LO;exports.InstallIntegrationErrorBoundary=Nf;exports.InstallationProvider=ma;exports.useAmpersandProviderProps=je;exports.useConfig=mw;exports.useConnection=fa;exports.useCreateInstallation=kl;exports.useDeleteInstallation=Kw;exports.useInstallation=Nr;exports.useIsIntegrationInstalled=BO;exports.useLocalConfig=hw;exports.useManifest=pa;exports.useUpdateInstallation=jl;
|
|
50
|
+
*/const D0="react-tooltip-core-styles",M0="react-tooltip-base-styles",pu={core:!1,base:!1};function hu({css:e,id:t=M0,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||pu[n]||n==="core"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=D0),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.id=t,u.type="text/css",s==="top"&&a.firstChild?a.insertBefore(u,a.firstChild):a.appendChild(u),u.styleSheet?u.styleSheet.cssText=e:u.appendChild(document.createTextNode(e)),pu[n]=!0}const mu=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[R0(Number(i)),F0({fallbackAxisSideDirection:"start"}),A0({padding:5})],border:a,arrowSize:u=8})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const f=s;return n?(f.push(P0({element:n,padding:5})),fu(e,t,{placement:r,strategy:o,middleware:f}).then(({x:l,y:d,placement:h,middlewareData:m})=>{var y,w;const g={left:`${l}px`,top:`${d}px`,border:a},{x:O,y:p}=(y=m.arrow)!==null&&y!==void 0?y:{x:0,y:0},b=(w={top:"bottom",right:"left",bottom:"top",left:"right"}[h.split("-")[0]])!==null&&w!==void 0?w:"bottom",v=a&&{borderBottom:a,borderRight:a};let x=0;if(a){const S=`${a}`.match(/(\d+)px/);x=S!=null&&S[1]?Number(S[1]):1}return{tooltipStyles:g,tooltipArrowStyles:{left:O!=null?`${O}px`:"",top:p!=null?`${p}px`:"",right:"",bottom:"",...v,[b]:`-${u/2+x}px`},place:h}})):fu(e,t,{placement:"bottom",strategy:o,middleware:f}).then(({x:l,y:d,placement:h})=>({tooltipStyles:{left:`${l}px`,top:`${d}px`},tooltipArrowStyles:{},place:h}))},gu=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),yu=(e,t,n)=>{let r=null;const i=function(...o){const s=()=>{r=null};!r&&(e.apply(this,o),r=setTimeout(s,t))};return i.cancel=()=>{r&&(clearTimeout(r),r=null)},i},vu=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",ta=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,o)=>ta(i,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!vu(e)||!vu(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>ta(e[i],t[i]))},k0=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"})},wu=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(k0(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},j0=typeof window<"u"?I.useLayoutEffect:I.useEffect,kt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},L0="DEFAULT_TOOLTIP_ID",V0={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},$0=I.createContext({getTooltipData:()=>V0});function ff(e=L0){return I.useContext($0).getTooltipData(e)}var Ar={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"},ys={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 K0=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i="dark",anchorId:o,anchorSelect:s,place:a="top",offset:u=10,events:f=["hover"],openOnClick:l=!1,positionStrategy:d="absolute",middlewares:h,wrapper:m,delayShow:y=0,delayHide:w=0,float:g=!1,hidden:O=!1,noArrow:p=!1,clickable:b=!1,closeOnEsc:v=!1,closeOnScroll:x=!1,closeOnResize:S=!1,openEvents:A,closeEvents:N,globalCloseEvents:F,imperativeModeOnly:R,style:D,position:K,afterShow:j,afterHide:L,disableTooltip:se,content:re,contentWrapperRef:ge,isOpen:de,defaultIsOpen:be=!1,setIsOpen:P,activeAnchor:$,setActiveAnchor:H,border:U,opacity:q,arrowColor:V,arrowSize:G=8,role:Z="tooltip"})=>{var Y;const ee=I.useRef(null),ne=I.useRef(null),ce=I.useRef(null),k=I.useRef(null),ve=I.useRef(null),[z,Xe]=I.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ce,st]=I.useState(!1),[Ue,rt]=I.useState(!1),[xe,ze]=I.useState(null),ft=I.useRef(!1),yt=I.useRef(null),{anchorRefs:vt,setActiveAnchor:Ye}=ff(t),Ze=I.useRef(!1),[De,J]=I.useState([]),pe=I.useRef(!1),_e=l||f.includes("click"),ln=_e||(A==null?void 0:A.click)||(A==null?void 0:A.dblclick)||(A==null?void 0:A.mousedown),dn=A?{...A}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!A&&_e&&Object.assign(dn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const fn=N?{...N}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!N&&_e&&Object.assign(fn,{mouseleave:!1,blur:!1,mouseout:!1});const wt=F?{...F}:{escape:v||!1,scroll:x||!1,resize:S||!1,clickOutsideAnchor:ln||!1};R&&(Object.assign(dn,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(fn,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(wt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),j0(()=>(pe.current=!0,()=>{pe.current=!1}),[]);const Fe=X=>{pe.current&&(X&&rt(!0),setTimeout(()=>{pe.current&&(P==null||P(X),de===void 0&&st(X))},10))};I.useEffect(()=>{if(de===void 0)return()=>null;de&&rt(!0);const X=setTimeout(()=>{st(de)},10);return()=>{clearTimeout(X)}},[de]),I.useEffect(()=>{if(Ce!==ft.current)if(kt(ve),ft.current=Ce,Ce)j==null||j();else{const X=(ue=>{const le=ue.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,Le,Be]=le;return Number(Le)*(Be==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));ve.current=setTimeout(()=>{rt(!1),ze(null),L==null||L()},X+25)}},[Ce]);const nr=X=>{Xe(ue=>ta(ue,X)?ue:X)},En=(X=y)=>{kt(ce),Ue?Fe(!0):ce.current=setTimeout(()=>{Fe(!0)},X)},Nn=(X=w)=>{kt(k),k.current=setTimeout(()=>{Ze.current||Fe(!1)},X)},St=X=>{var ue;if(!X)return;const le=(ue=X.currentTarget)!==null&&ue!==void 0?ue:X.target;if(!(le!=null&&le.isConnected))return H(null),void Ye({current:null});y?En():Fe(!0),H(le),Ye({current:le}),kt(k)},pn=()=>{b?Nn(w||100):w?Nn():Fe(!1),kt(ce)},Tn=({x:X,y:ue})=>{var le;const Le={getBoundingClientRect:()=>({x:X,y:ue,width:0,height:0,top:ue,left:X,right:X,bottom:ue})};mu({place:(le=xe==null?void 0:xe.place)!==null&&le!==void 0?le:a,offset:u,elementReference:Le,tooltipReference:ee.current,tooltipArrowReference:ne.current,strategy:d,middlewares:h,border:U,arrowSize:G}).then(Be=>{nr(Be)})},Rn=X=>{if(!X)return;const ue=X,le={x:ue.clientX,y:ue.clientY};Tn(le),yt.current=le},hn=X=>{var ue;if(!Ce)return;const le=X.target;le.isConnected&&(!((ue=ee.current)===null||ue===void 0)&&ue.contains(le)||[document.querySelector(`[id='${o}']`),...De].some(Le=>Le==null?void 0:Le.contains(le))||(Fe(!1),kt(ce)))},Gt=yu(St,50),je=yu(pn,50),at=X=>{je.cancel(),Gt(X)},ae=()=>{Gt.cancel(),je()},he=I.useCallback(()=>{var X,ue;const le=(X=xe==null?void 0:xe.position)!==null&&X!==void 0?X:K;le?Tn(le):g?yt.current&&Tn(yt.current):$!=null&&$.isConnected&&mu({place:(ue=xe==null?void 0:xe.place)!==null&&ue!==void 0?ue:a,offset:u,elementReference:$,tooltipReference:ee.current,tooltipArrowReference:ne.current,strategy:d,middlewares:h,border:U,arrowSize:G}).then(Le=>{pe.current&&nr(Le)})},[Ce,$,re,D,a,xe==null?void 0:xe.place,u,d,K,xe==null?void 0:xe.position,g,G]);I.useEffect(()=>{var X,ue;const le=new Set(vt);De.forEach(Oe=>{se!=null&&se(Oe)||le.add({current:Oe})});const Le=document.querySelector(`[id='${o}']`);Le&&!(se!=null&&se(Le))&&le.add({current:Le});const Be=()=>{Fe(!1)},et=wu($),Pt=wu(ee.current);wt.scroll&&(window.addEventListener("scroll",Be),et==null||et.addEventListener("scroll",Be),Pt==null||Pt.addEventListener("scroll",Be));let it=null;wt.resize?window.addEventListener("resize",Be):$&&ee.current&&(it=T0($,ee.current,he,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const bt=Oe=>{Oe.key==="Escape"&&Fe(!1)};wt.escape&&window.addEventListener("keydown",bt),wt.clickOutsideAnchor&&window.addEventListener("click",hn);const Ae=[],An=Oe=>!!(Oe!=null&&Oe.target&&($!=null&&$.contains(Oe.target))),$t=Oe=>{Ce&&An(Oe)||St(Oe)},Xo=Oe=>{Ce&&An(Oe)&&pn()},Ui=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],qi=["click","dblclick","mousedown","mouseup"];Object.entries(dn).forEach(([Oe,Kt])=>{Kt&&(Ui.includes(Oe)?Ae.push({event:Oe,listener:at}):qi.includes(Oe)&&Ae.push({event:Oe,listener:$t}))}),Object.entries(fn).forEach(([Oe,Kt])=>{Kt&&(Ui.includes(Oe)?Ae.push({event:Oe,listener:ae}):qi.includes(Oe)&&Ae.push({event:Oe,listener:Xo}))}),g&&Ae.push({event:"pointermove",listener:Rn});const Bi=()=>{Ze.current=!0},Ji=()=>{Ze.current=!1,pn()},Xt=b&&(fn.mouseout||fn.mouseleave);return Xt&&((X=ee.current)===null||X===void 0||X.addEventListener("mouseover",Bi),(ue=ee.current)===null||ue===void 0||ue.addEventListener("mouseout",Ji)),Ae.forEach(({event:Oe,listener:Kt})=>{le.forEach(li=>{var rr;(rr=li.current)===null||rr===void 0||rr.addEventListener(Oe,Kt)})}),()=>{var Oe,Kt;wt.scroll&&(window.removeEventListener("scroll",Be),et==null||et.removeEventListener("scroll",Be),Pt==null||Pt.removeEventListener("scroll",Be)),wt.resize?window.removeEventListener("resize",Be):it==null||it(),wt.clickOutsideAnchor&&window.removeEventListener("click",hn),wt.escape&&window.removeEventListener("keydown",bt),Xt&&((Oe=ee.current)===null||Oe===void 0||Oe.removeEventListener("mouseover",Bi),(Kt=ee.current)===null||Kt===void 0||Kt.removeEventListener("mouseout",Ji)),Ae.forEach(({event:li,listener:rr})=>{le.forEach(Yo=>{var Fn;(Fn=Yo.current)===null||Fn===void 0||Fn.removeEventListener(li,rr)})})}},[$,he,Ue,vt,De,A,N,F,_e,y,w]),I.useEffect(()=>{var X,ue;let le=(ue=(X=xe==null?void 0:xe.anchorSelect)!==null&&X!==void 0?X:s)!==null&&ue!==void 0?ue:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Le=new MutationObserver(Be=>{const et=[],Pt=[];Be.forEach(it=>{if(it.type==="attributes"&&it.attributeName==="data-tooltip-id"&&(it.target.getAttribute("data-tooltip-id")===t?et.push(it.target):it.oldValue===t&&Pt.push(it.target)),it.type==="childList"){if($){const bt=[...it.removedNodes].filter(Ae=>Ae.nodeType===1);if(le)try{Pt.push(...bt.filter(Ae=>Ae.matches(le))),Pt.push(...bt.flatMap(Ae=>[...Ae.querySelectorAll(le)]))}catch{}bt.some(Ae=>{var An;return!!(!((An=Ae==null?void 0:Ae.contains)===null||An===void 0)&&An.call(Ae,$))&&(rt(!1),Fe(!1),H(null),kt(ce),kt(k),!0)})}if(le)try{const bt=[...it.addedNodes].filter(Ae=>Ae.nodeType===1);et.push(...bt.filter(Ae=>Ae.matches(le))),et.push(...bt.flatMap(Ae=>[...Ae.querySelectorAll(le)]))}catch{}}}),(et.length||Pt.length)&&J(it=>[...it.filter(bt=>!Pt.includes(bt)),...et])});return Le.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Le.disconnect()}},[t,s,xe==null?void 0:xe.anchorSelect,$]),I.useEffect(()=>{he()},[he]),I.useEffect(()=>{if(!(ge!=null&&ge.current))return()=>null;const X=new ResizeObserver(()=>{setTimeout(()=>he())});return X.observe(ge.current),()=>{X.disconnect()}},[re,ge==null?void 0:ge.current]),I.useEffect(()=>{var X;const ue=document.querySelector(`[id='${o}']`),le=[...De,ue];$&&le.includes($)||H((X=De[0])!==null&&X!==void 0?X:ue)},[o,De,$]),I.useEffect(()=>(be&&Fe(!0),()=>{kt(ce),kt(k)}),[]),I.useEffect(()=>{var X;let ue=(X=xe==null?void 0:xe.anchorSelect)!==null&&X!==void 0?X:s;if(!ue&&t&&(ue=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ue)try{const le=Array.from(document.querySelectorAll(ue));J(le)}catch{J([])}},[t,s,xe==null?void 0:xe.anchorSelect]),I.useEffect(()=>{ce.current&&(kt(ce),En(y))},[y]);const pt=(Y=xe==null?void 0:xe.content)!==null&&Y!==void 0?Y:re,mn=Ce&&Object.keys(z.tooltipStyles).length>0;return I.useImperativeHandle(e,()=>({open:X=>{if(X!=null&&X.anchorSelect)try{document.querySelector(X.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${X.anchorSelect}" is not a valid CSS selector`)}ze(X??null),X!=null&&X.delay?En(X.delay):Fe(!0)},close:X=>{X!=null&&X.delay?Nn(X.delay):Fe(!1)},activeAnchor:$,place:z.place,isOpen:!!(Ue&&!O&&pt&&mn)})),Ue&&!O&&pt?I.createElement(m,{id:t,role:Z,className:Vt("react-tooltip",Ar.tooltip,ys.tooltip,ys[i],n,`react-tooltip__place-${z.place}`,Ar[mn?"show":"closing"],mn?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&Ar.fixed,b&&Ar.clickable),onTransitionEnd:X=>{kt(ve),Ce||X.propertyName!=="opacity"||(rt(!1),ze(null),L==null||L())},style:{...D,...z.tooltipStyles,opacity:q!==void 0&&mn?q:void 0},ref:ee},pt,I.createElement(m,{className:Vt("react-tooltip-arrow",Ar.arrow,ys.arrow,r,p&&Ar.noArrow),style:{...z.tooltipArrowStyles,background:V?`linear-gradient(to right bottom, transparent 50%, ${V} 50%)`:void 0,"--rt-arrow-size":`${G}px`},ref:ne})):null},U0=({content:e})=>I.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),q0=I.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:o,className:s,classNameArrow:a,variant:u="dark",place:f="top",offset:l=10,wrapper:d="div",children:h=null,events:m=["hover"],openOnClick:y=!1,positionStrategy:w="absolute",middlewares:g,delayShow:O=0,delayHide:p=0,float:b=!1,hidden:v=!1,noArrow:x=!1,clickable:S=!1,closeOnEsc:A=!1,closeOnScroll:N=!1,closeOnResize:F=!1,openEvents:R,closeEvents:D,globalCloseEvents:K,imperativeModeOnly:j=!1,style:L,position:se,isOpen:re,defaultIsOpen:ge=!1,disableStyleInjection:de=!1,border:be,opacity:P,arrowColor:$,arrowSize:H,setIsOpen:U,afterShow:q,afterHide:V,disableTooltip:G,role:Z="tooltip"},Y)=>{const[ee,ne]=I.useState(r),[ce,k]=I.useState(i),[ve,z]=I.useState(f),[Xe,Ce]=I.useState(u),[st,Ue]=I.useState(l),[rt,xe]=I.useState(O),[ze,ft]=I.useState(p),[yt,vt]=I.useState(b),[Ye,Ze]=I.useState(v),[De,J]=I.useState(d),[pe,_e]=I.useState(m),[ln,dn]=I.useState(w),[fn,wt]=I.useState(null),[Fe,nr]=I.useState(null),En=I.useRef(de),{anchorRefs:Nn,activeAnchor:St}=ff(e),pn=je=>je==null?void 0:je.getAttributeNames().reduce((at,ae)=>{var he;return ae.startsWith("data-tooltip-")&&(at[ae.replace(/^data-tooltip-/,"")]=(he=je==null?void 0:je.getAttribute(ae))!==null&&he!==void 0?he:null),at},{}),Tn=je=>{const at={place:ae=>{var he;z((he=ae)!==null&&he!==void 0?he:f)},content:ae=>{ne(ae??r)},html:ae=>{k(ae??i)},variant:ae=>{var he;Ce((he=ae)!==null&&he!==void 0?he:u)},offset:ae=>{Ue(ae===null?l:Number(ae))},wrapper:ae=>{var he;J((he=ae)!==null&&he!==void 0?he:d)},events:ae=>{const he=ae==null?void 0:ae.split(" ");_e(he??m)},"position-strategy":ae=>{var he;dn((he=ae)!==null&&he!==void 0?he:w)},"delay-show":ae=>{xe(ae===null?O:Number(ae))},"delay-hide":ae=>{ft(ae===null?p:Number(ae))},float:ae=>{vt(ae===null?b:ae==="true")},hidden:ae=>{Ze(ae===null?v:ae==="true")},"class-name":ae=>{wt(ae)}};Object.values(at).forEach(ae=>ae(null)),Object.entries(je).forEach(([ae,he])=>{var pt;(pt=at[ae])===null||pt===void 0||pt.call(at,he)})};I.useEffect(()=>{ne(r)},[r]),I.useEffect(()=>{k(i)},[i]),I.useEffect(()=>{z(f)},[f]),I.useEffect(()=>{Ce(u)},[u]),I.useEffect(()=>{Ue(l)},[l]),I.useEffect(()=>{xe(O)},[O]),I.useEffect(()=>{ft(p)},[p]),I.useEffect(()=>{vt(b)},[b]),I.useEffect(()=>{Ze(v)},[v]),I.useEffect(()=>{dn(w)},[w]),I.useEffect(()=>{En.current!==de&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[de]),I.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:de==="core",disableBase:de}}))},[]),I.useEffect(()=>{var je;const at=new Set(Nn);let ae=n;if(!ae&&e&&(ae=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ae)try{document.querySelectorAll(ae).forEach(ue=>{at.add({current:ue})})}catch{console.warn(`[react-tooltip] "${ae}" is not a valid CSS selector`)}const he=document.querySelector(`[id='${t}']`);if(he&&at.add({current:he}),!at.size)return()=>null;const pt=(je=Fe??he)!==null&&je!==void 0?je:St.current,mn=new MutationObserver(ue=>{ue.forEach(le=>{var Le;if(!pt||le.type!=="attributes"||!(!((Le=le.attributeName)===null||Le===void 0)&&Le.startsWith("data-tooltip-")))return;const Be=pn(pt);Tn(Be)})}),X={attributes:!0,childList:!1,subtree:!1};if(pt){const ue=pn(pt);Tn(ue),mn.observe(pt,X)}return()=>{mn.disconnect()}},[Nn,St,Fe,t,n]),I.useEffect(()=>{L!=null&&L.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),be&&!gu("border",`${be}`)&&console.warn(`[react-tooltip] "${be}" is not a valid \`border\`.`),L!=null&&L.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),P&&!gu("opacity",`${P}`)&&console.warn(`[react-tooltip] "${P}" is not a valid \`opacity\`.`)},[]);let Rn=h;const hn=I.useRef(null);if(o){const je=o({content:(Fe==null?void 0:Fe.getAttribute("data-tooltip-content"))||ee||null,activeAnchor:Fe});Rn=je?I.createElement("div",{ref:hn,className:"react-tooltip-content-wrapper"},je):null}else ee&&(Rn=ee);ce&&(Rn=I.createElement(U0,{content:ce}));const Gt={forwardRef:Y,id:e,anchorId:t,anchorSelect:n,className:Vt(s,fn),classNameArrow:a,content:Rn,contentWrapperRef:hn,place:ve,variant:Xe,offset:st,wrapper:De,events:pe,openOnClick:y,positionStrategy:ln,middlewares:g,delayShow:rt,delayHide:ze,float:yt,hidden:Ye,noArrow:x,clickable:S,closeOnEsc:A,closeOnScroll:N,closeOnResize:F,openEvents:R,closeEvents:D,globalCloseEvents:K,imperativeModeOnly:j,style:L,position:se,isOpen:re,defaultIsOpen:ge,border:be,opacity:P,arrowColor:$,arrowSize:H,setIsOpen:U,afterShow:q,afterHide:V,disableTooltip:G,activeAnchor:Fe,setActiveAnchor:je=>nr(je),role:Z};return I.createElement(K0,{...Gt})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||hu({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||hu({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 B0(){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[c.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[c.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"}),c.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_2896_16290",children:c.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function pf({id:e,tooltipText:t}){return c.jsxs(c.Fragment,{children:[c.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:B0()}),c.jsx(q0,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function J0(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};t.forEach(i=>{var a,u;const{field:o,value:s}=i;if(s===null){const f=n[o];delete n[o],f&&((a=e==null?void 0:e.read)!=null&&a.selectedValueMappings)&&e.read.selectedValueMappings[f]&&delete e.read.selectedValueMappings[f]}else{const f=n[o];n[o]=s,f&&f!==s&&((u=e==null?void 0:e.read)!=null&&u.selectedValueMappings)&&e.read.selectedValueMappings[f]&&delete e.read.selectedValueMappings[f]}})}function Ei(e,t,n){t(e,r=>J0(r,n))}const H0="Each field must be mapped to a unique value";function Ha({field:e,onSelectChange:t,allFields:n}){var p;const{configureState:r,selectedObjectName:i,setConfigureState:o}=Qt(),[s,a]=I.useState(!0),{isError:u,removeError:f,getError:l}=sn(),d=(p=r==null?void 0:r.read)==null?void 0:p.selectedFieldMappings,h=d==null?void 0:d[e.mapToName];I.useEffect(()=>{e._default&&!h&&i&&r&&Ei(i,o,[{field:e.mapToName,value:e._default}]),a(!1)},[e,o,i,h,r]);const m=I.useMemo(()=>n.map(b=>({id:b.fieldName,label:b.displayName,value:b.fieldName})),[n]),y=c.jsx(tf,{disabled:s,items:m,selectedValue:h||null,onSelectedItemChange:b=>{t({target:{name:e.mapToName,value:b==null?void 0:b.value}})},placeholder:"Please select one",style:{width:"100%"}}),w=I.useCallback(()=>{i&&(Ei(i,o,[{field:e.mapToName,value:null}]),u(we.MAPPING,i)&&f(we.MAPPING,i))},[e.mapToName,i,o,u,f]),{hasDuplicationError:g,errorMessage:O}=I.useMemo(()=>{const b=l(we.MAPPING,i),v=Array.isArray(b)&&b.length>0&&b.includes(e.mapToName);return{hasDuplicationError:v,errorMessage:v?H0:""}},[i,l,e.mapToName]);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[c.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),c.jsx("span",{children:(e==null?void 0:e.prompt)&&c.jsx(pf,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[y,c.jsx(He,{type:"button",variant:"ghost",onClick:w,children:"Clear"})]})]},e.mapToName),g&&c.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",O," "]},e.mapToName)]})}const W0="_formControl_9qd8d_1",z0="_formLabel_9qd8d_5",Q0="_formLabelRequired_9qd8d_11",G0="_formInput_9qd8d_16",X0="_formInputInvalid_9qd8d_20",Y0="_formError_9qd8d_24",Z0="_disabled_9qd8d_30",sr={formControl:W0,formLabel:z0,formLabelRequired:Q0,formInput:G0,formInputInvalid:X0,formError:Y0,disabled:Z0};function Wo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return c.jsxs("div",{className:Vt(sr.formControl,{[sr.disabled]:r}),children:[t&&c.jsx("label",{htmlFor:e,className:Vt(sr.formLabel,{[sr.formLabelRequired]:n}),children:t}),c.jsx("div",{id:e,className:Vt(sr.formInput,{[sr.formInputInvalid]:i}),children:s}),i&&o&&c.jsx("div",{className:sr.formError,role:"alert",children:o})]})}function hf({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:i}){if(!e||!t)return!1;if(Object.values(e).some(s=>s===r&&s!==n)){console.error("Each field must be mapped to a unique value",e);const s=Object.keys(e).filter(u=>e[u]===r),a=[n,...s];return i(we.MAPPING,t,a),!0}return!1}function eC({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>c.jsx(Wo,{id:r.mapToName,children:c.jsx(Ha,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function tC(){var y,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Qt(),{isError:r,removeError:i,setError:o}=sn(),s=((y=t==null?void 0:t.read)==null?void 0:y.allFields)||[],{fieldMapping:a}=lt(),u=(w=t==null?void 0:t.read)==null?void 0:w.selectedFieldMappings,f=g=>{const{value:O,name:p}=g.target;!O||hf({selectedFieldMappings:u,selectedObjectName:e,fieldName:p,fieldValue:O,setError:o})||(e&&Ei(e,n,[{field:p,value:O}]),r(we.MAPPING,p)&&i(we.MAPPING,p),e&&r(we.MAPPING,e)&&i(we.MAPPING,e))},l=I.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(g=>!g.fieldName),[a,e]),d=I.useMemo(()=>{var p;return(((p=t==null?void 0:t.read)==null?void 0:p.optionalMapFields)||[]).filter(b=>!l.some(v=>v.mapToName===b.mapToName))},[t,l]),h=l.length>0;return d.length>0||h?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Map the following optional fields"}),c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d==null?void 0:d.map(g=>c.jsx(Wo,{id:g.mapToName,children:c.jsx(Ha,{allFields:s,field:g,onSelectChange:f})},g.mapToName)),h&&c.jsx(eC,{dynamicFieldMappings:l,onSelectChange:f,allFields:s})]})]}):null}function nC(){var f;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Qt(),{isError:r,removeError:i,setError:o}=sn(),s=(f=t==null?void 0:t.read)==null?void 0:f.selectedFieldMappings,a=l=>{const{value:d,name:h}=l.target;!d||hf({selectedFieldMappings:s,selectedObjectName:e,fieldName:h,fieldValue:d,setError:o})||(e&&Ei(e,n,[{field:h,value:d}]),r(we.MAPPING,h)&&i(we.MAPPING,h),e&&r(we.MAPPING,e)&&i(we.MAPPING,e))},u=I.useMemo(()=>{var l;return((l=t==null?void 0:t.read)==null?void 0:l.requiredMapFields)||[]},[t]);return u!=null&&u.length?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Map the following fields"}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:u.map(l=>{var d;return c.jsx(Wo,{id:l.mapToName,isInvalid:r(we.MAPPING,l.mapToName),errorMessage:"* required",children:c.jsx(Ha,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:l,onSelectChange:a})},l.mapToName)})})]}):null}const rC=(e,t)=>e.filter(n=>!t.has(n));function iC(){var h,m,y;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Qt(),{fieldMapping:r}=lt(),i=((h=t==null?void 0:t.read)==null?void 0:h.selectedFieldMappings)||{},o=Object.keys(i),s=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],a=((y=t==null?void 0:t.read)==null?void 0:y.optionalMapFields)||[],u=e&&r?Object.values(r[e]||{}).flat().filter(w=>!w.fieldName):[],f=s.concat(u,a).map(w=>w.mapToName),l=new Set(f),d=rC(o,l);I.useEffect(()=>{e&&d.length&&Ei(e,n,d.map(w=>({field:w,value:null})))},[e,n,d])}const oC={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function sC({children:e,style:t}){return c.jsx(_n,{style:{...oC,...t},children:e})}function aC(){var f,l,d;const{data:e}=Yn(),{hydratedRevision:t}=ci(),{selectedObjectName:n}=Qt(),{providerName:r}=dt(),i=e==null?void 0:e.appName,o=(d=(l=(f=t==null?void 0:t.content)==null?void 0:f.read)==null?void 0:l.objects)==null?void 0:d.find(h=>h.objectName===n),s=(o==null?void 0:o.displayName)||n&&rn(n),a=o==null?void 0:o.mapToName,u=(o==null?void 0:o.mapToDisplayName)||a&&rn(a);return u&&i&&r?c.jsx(sC,{style:{marginTop:"1rem"},children:c.jsxs("p",{style:{margin:"1rem 0"},children:[c.jsx("b",{children:u})," in ",i," is mapped to"," ",c.jsx("b",{children:s})," in ",r,"."]})}):null}function bu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mf(...e){return t=>{let n=!1;const r=e.map(i=>{const o=bu(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():bu(e[i],null)}}}}function ni(...e){return B.useCallback(mf(...e),e)}function zo(e,t=[]){let n=[];function r(o,s){const a=B.createContext(s),u=n.length;n=[...n,s];const f=d=>{var O;const{scope:h,children:m,...y}=d,w=((O=h==null?void 0:h[e])==null?void 0:O[u])||a,g=B.useMemo(()=>y,Object.values(y));return c.jsx(w.Provider,{value:g,children:m})};f.displayName=o+"Provider";function l(d,h){var w;const m=((w=h==null?void 0:h[e])==null?void 0:w[u])||a,y=B.useContext(m);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[f,l]}const i=()=>{const o=n.map(s=>B.createContext(s));return function(a){const u=(a==null?void 0:a[e])||o;return B.useMemo(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return i.scopeName=e,[r,cC(i,...t)]}function cC(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:u,scopeName:f})=>{const d=u(o)[`__scope${f}`];return{...a,...d}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Ht(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}var Ni=globalThis!=null&&globalThis.document?B.useLayoutEffect:()=>{},uC=B[" useInsertionEffect ".trim().toString()]||Ni;function Wa({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,s]=lC({defaultProp:t,onChange:n}),a=e!==void 0,u=a?e:i;{const l=B.useRef(e!==void 0);B.useEffect(()=>{const d=l.current;d!==a&&console.warn(`${r} is changing from ${d?"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.`),l.current=a},[a,r])}const f=B.useCallback(l=>{var d;if(a){const h=dC(l)?l(e):l;h!==e&&((d=s.current)==null||d.call(s,h))}else o(l)},[a,e,o,s]);return[u,f]}function lC({defaultProp:e,onChange:t}){const[n,r]=B.useState(e),i=B.useRef(n),o=B.useRef(t);return uC(()=>{o.current=t},[t]),B.useEffect(()=>{var s;i.current!==n&&((s=o.current)==null||s.call(o,n),i.current=n)},[n,i]),[n,r,o]}function dC(e){return typeof e=="function"}function fC(e){const t=B.useRef({value:e,previous:e});return B.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function pC(e){const[t,n]=B.useState(void 0);return Ni(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const u=o.borderBoxSize,f=Array.isArray(u)?u[0]:u;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 hC(e,t){return B.useReducer((n,r)=>t[n][r]??n,e)}var za=e=>{const{present:t,children:n}=e,r=mC(t),i=typeof n=="function"?n({present:r.isPresent}):B.Children.only(n),o=ni(r.ref,gC(i));return typeof n=="function"||r.isPresent?B.cloneElement(i,{ref:o}):null};za.displayName="Presence";function mC(e){const[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),o=B.useRef("none"),s=e?"mounted":"unmounted",[a,u]=hC(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return B.useEffect(()=>{const f=so(r.current);o.current=a==="mounted"?f:"none"},[a]),Ni(()=>{const f=r.current,l=i.current;if(l!==e){const h=o.current,m=so(f);e?u("MOUNT"):m==="none"||(f==null?void 0:f.display)==="none"?u("UNMOUNT"):u(l&&h!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Ni(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,d=m=>{const w=so(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&w&&(u("ANIMATION_END"),!i.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=m=>{m.target===t&&(o.current=so(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:B.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function so(e){return(e==null?void 0:e.animationName)||"none"}function gC(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function na(e){const t=yC(e),n=B.forwardRef((r,i)=>{const{children:o,...s}=r,a=B.Children.toArray(o),u=a.find(wC);if(u){const f=u.props.children,l=a.map(d=>d===u?B.Children.count(f)>1?B.Children.only(null):B.isValidElement(f)?f.props.children:null:d);return c.jsx(t,{...s,ref:i,children:B.isValidElement(f)?B.cloneElement(f,void 0,l):null})}return c.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function yC(e){const t=B.forwardRef((n,r)=>{const{children:i,...o}=n;if(B.isValidElement(i)){const s=IC(i),a=bC(o,i.props);return i.type!==B.Fragment&&(a.ref=r?mf(r,s):s),B.cloneElement(i,a)}return B.Children.count(i)>1?B.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vC=Symbol("radix.slottable");function wC(e){return B.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vC}function bC(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const u=o(...a);return i(...a),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function IC(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var CC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Sn=CC.reduce((e,t)=>{const n=na(`Primitive.${t}`),r=B.forwardRef((i,o)=>{const{asChild:s,...a}=i,u=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Qo="Checkbox",[xC,WO]=zo(Qo),[OC,Qa]=xC(Qo);function _C(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:o,form:s,name:a,onCheckedChange:u,required:f,value:l="on",internal_do_not_use_render:d}=e,[h,m]=Wa({prop:n,defaultProp:i??!1,onChange:u,caller:Qo}),[y,w]=B.useState(null),[g,O]=B.useState(null),p=B.useRef(!1),b=y?!!s||!!y.closest("form"):!0,v={checked:h,disabled:o,setChecked:m,control:y,setControl:w,name:a,form:s,value:l,hasConsumerStoppedPropagationRef:p,required:f,defaultChecked:Qn(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:O};return c.jsx(OC,{scope:t,...v,children:SC(d)?d(v):r})}var gf="CheckboxTrigger",yf=B.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{const{control:o,value:s,disabled:a,checked:u,required:f,setControl:l,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:y}=Qa(gf,e),w=ni(i,l),g=B.useRef(u);return B.useEffect(()=>{const O=o==null?void 0:o.form;if(O){const p=()=>d(g.current);return O.addEventListener("reset",p),()=>O.removeEventListener("reset",p)}},[o,d]),c.jsx(Sn.button,{type:"button",role:"checkbox","aria-checked":Qn(u)?"mixed":u,"aria-required":f,"data-state":If(u),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:w,onKeyDown:Ht(t,O=>{O.key==="Enter"&&O.preventDefault()}),onClick:Ht(n,O=>{d(p=>Qn(p)?!0:!p),y&&m&&(h.current=O.isPropagationStopped(),h.current||O.stopPropagation())})})});yf.displayName=gf;var Ga=B.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:u,onCheckedChange:f,form:l,...d}=e;return c.jsx(_C,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:a,required:s,onCheckedChange:f,name:r,form:l,value:u,internal_do_not_use_render:({isFormControl:h})=>c.jsxs(c.Fragment,{children:[c.jsx(yf,{...d,ref:t,__scopeCheckbox:n}),h&&c.jsx(bf,{__scopeCheckbox:n})]})})});Ga.displayName=Qo;var vf="CheckboxIndicator",Xa=B.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=Qa(vf,n);return c.jsx(za,{present:r||Qn(o.checked)||o.checked===!0,children:c.jsx(Sn.span,{"data-state":If(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Xa.displayName=vf;var wf="CheckboxBubbleInput",bf=B.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:s,required:a,disabled:u,name:f,value:l,form:d,bubbleInput:h,setBubbleInput:m}=Qa(wf,e),y=ni(n,m),w=fC(o),g=pC(r);B.useEffect(()=>{const p=h;if(!p)return;const b=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(b,"checked").set,S=!i.current;if(w!==o&&x){const A=new Event("click",{bubbles:S});p.indeterminate=Qn(o),x.call(p,Qn(o)?!1:o),p.dispatchEvent(A)}},[h,w,o,i]);const O=B.useRef(Qn(o)?!1:o);return c.jsx(Sn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??O.current,required:a,disabled:u,name:f,value:l,form:d,...t,tabIndex:-1,ref:y,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});bf.displayName=wf;function SC(e){return typeof e=="function"}function Qn(e){return e==="indeterminate"}function If(e){return Qn(e)?"indeterminate":e?"checked":"unchecked"}function Ya(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var EC=["color"],Cf=I.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Ya(e,EC);return I.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),I.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"}))}),NC=["color"],TC=I.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Ya(e,NC);return I.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),I.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"}))}),RC=["color"],AC=I.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Ya(e,RC);return I.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),I.createElement("path",{d:"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const FC="_checkboxGroupContainer_hqfeu_1",PC="_stack_hqfeu_6",DC="_selectAllContainer_hqfeu_10",MC="_fieldContainer_hqfeu_17",kC="_checkbox_hqfeu_1",ri={checkboxGroupContainer:FC,stack:PC,selectAllContainer:DC,fieldContainer:MC,checkbox:kC};function jC({id:e,isChecked:t,label:n,onCheckedChange:r}){return c.jsxs("div",{className:ri.fieldContainer,children:[c.jsx(Ga,{className:ri.checkbox,id:e,onCheckedChange:r,checked:t,children:c.jsx(Xa,{children:c.jsx(Cf,{})})}),c.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function LC({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return c.jsxs("div",{className:ri.selectAllContainer,children:[c.jsx(Ga,{className:ri.checkbox,id:e,onCheckedChange:r,checked:i?"indeterminate":t,children:c.jsxs(Xa,{children:[i&&c.jsx(TC,{}),t===!0&&c.jsx(Cf,{})]})}),c.jsx("label",{htmlFor:e,children:n})]})}function VC({children:e}){return c.jsx("div",{className:ri.checkboxGroupContainer,children:e})}function $C({children:e}){return c.jsx("div",{className:ri.stack,children:e})}const KC="_paginationContainer_1p51x_1",UC="_pageInfo_1p51x_7",qC="_searchContainer_1p51x_13",BC="_searchInput_1p51x_17",JC="_noResults_1p51x_21",mi={paginationContainer:KC,pageInfo:UC,searchContainer:qC,searchInput:BC,noResults:JC};function xf({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:i=!0,searchPlaceholder:o="Search fields...",itemName:s="fields"}){const[a,u]=I.useState(1),[f,l]=I.useState(""),d=e.filter(v=>v.label.toLowerCase().includes(f.toLowerCase())),h=Math.ceil(d.length/n),m=(a-1)*n,y=m+n,w=d.slice(m,y),g=v=>{l(v),u(1)},O=v=>{d.forEach(x=>{t(x.id,v)})},p=d.length>0&&d.every(v=>v.isChecked),b=d.some(v=>v.isChecked);return c.jsxs(VC,{children:[i&&c.jsx("div",{className:mi.searchContainer,children:c.jsx(sd,{id:"field-search",type:"text",placeholder:o,value:f,onChange:v=>g(v.target.value),className:mi.searchInput})}),r&&e.length>=2&&c.jsx(LC,{id:"select-all-fields",isChecked:p,label:`Select all ${d.length} ${f?"matching ":""}${s}`,onCheckedChange:O,isIndeterminate:b&&!p}),c.jsx($C,{children:w.map(v=>c.jsx(jC,{id:v.id,isChecked:v.isChecked,label:v.label,onCheckedChange:x=>t(v.id,x===!0)},v.id))}),h>1&&c.jsxs("div",{className:mi.paginationContainer,children:[c.jsx(He,{type:"button",onClick:()=>u(v=>Math.max(1,v-1)),disabled:a===1,variant:"ghost",children:"<"}),c.jsxs("span",{className:mi.pageInfo,children:[a," of ",h]}),c.jsx(He,{type:"button",onClick:()=>u(v=>Math.min(h,v+1)),disabled:a===h,variant:"ghost",children:">"})]}),d.length===0&&f&&c.jsxs("div",{className:mi.noResults,children:["No ",s,' found matching "',f,'"']})]})}function HC(e,t,n){var i;const r=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};r[t]=n,n||delete r[t]}function WC(e,t,n,r){t(e,i=>HC(i,n,r))}function zC(){var f,l;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Qt(),i=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,o=(l=t==null?void 0:t.read)==null?void 0:l.optionalFields,s=(d,h)=>{r&&t&&WC(r,n,d,h)},a=I.useMemo(()=>(o==null?void 0:o.filter(d=>!Zn(d)&&"fieldName"in d&&"displayName"in d).map(d=>({id:d.fieldName,label:d.displayName,isChecked:!!(i!=null&&i[d.fieldName])})).sort((d,h)=>d.label.localeCompare(h.label)))||[],[o,i]);return!!(o&&o.length>0)&&c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:`${e} reads the following optional fields`}),c.jsx(xf,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${o==null?void 0:o.length}`)]})}function QC(){return c.jsx(zC,{})}const GC={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 XC({children:e,style:t,...n}){return c.jsx("span",{style:{...GC,...t},...n,children:e})}const YC="_errorAlert_1tcao_1",ZC="_errorHeader_1tcao_11",ex="_errorIcon_1tcao_17",tx="_errorTitle_1tcao_24",nx="_errorMessage_1tcao_30",gi={errorAlert:YC,errorHeader:ZC,errorIcon:ex,errorTitle:tx,errorMessage:nx};function rx({error:e}){return c.jsxs("div",{className:gi.errorAlert,children:[c.jsxs("div",{className:gi.errorHeader,children:[c.jsx(AC,{className:gi.errorIcon}),c.jsx("span",{className:gi.errorTitle,children:"Unable to load object"})]}),c.jsx("div",{className:gi.errorMessage,children:e})]})}function ix(){var s,a,u;const{data:e}=Lo(),{selectedObjectName:t}=Qt(),{appName:n}=Yn(),r=(u=(a=(s=e==null?void 0:e.content)==null?void 0:s.read)==null?void 0:a.objects)==null?void 0:u.find(f=>f.objectName===t),i=r==null?void 0:r.error,o=r==null?void 0:r.requiredFields;return i?c.jsx(rx,{error:i}):c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:`${n} reads the following fields`}),c.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:o!=null&&o.length?o.map(f=>Zn(f)?null:c.jsx(XC,{children:f.displayName},f.fieldName)):"There are no required fields."})]})}function ox(e,t,n,r,i){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[i]||(e.read.selectedValueMappings[i]={}),r===""&&e.read.selectedValueMappings[i][n]?delete e.read.selectedValueMappings[i][n]:e.read.selectedValueMappings[i][n]=r)}function Of(e,t,n,r,i){t(e,o=>ox(o,e,n,r,i))}function vs(e){return e.mapToDisplayName||e.mapToName||e.fieldName||""}function sx(e,t){if(!e.fieldName)return{isValid:!1,errorMessage:"Field name is missing"};const n=t==null?void 0:t.valueType;if(!["singleSelect","multiSelect"].includes(n||""))return{isValid:!1,errorMessage:"fieldName is not a singleSelect or multiSelect"};const r=t==null?void 0:t.values;if(!r)return{isValid:!1,errorMessage:"Field values array is missing"};const i=Object.keys(r).length,o=Object.keys((e==null?void 0:e.mappedValues)||[]).length;return i!==o?{isValid:!1,errorMessage:"field values and the values to be mapped are not of the same length"}:{isValid:!0}}function ax(e,t,n){const r=Object.values(t).filter(Boolean),i=t[n];return e.filter(o=>{const s=o.value===i,a=r.includes(o.value);return s||!a})}function cx({string:e,fieldName:t}){return c.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[c.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,c.jsx("b",{children:t})]}),c.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:c.jsx(Uo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function ux({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r}){var m;const{configureState:i,selectedObjectName:o,setConfigureState:s}=Qt(),a=I.useMemo(()=>{var y,w;return((w=(y=i==null?void 0:i.read)==null?void 0:y.selectedValueMappings)==null?void 0:w[n])||{}},[(m=i==null?void 0:i.read)==null?void 0:m.selectedValueMappings,n]),u=I.useMemo(()=>a==null?void 0:a[e.mappedValue],[a,e.mappedValue]),f=I.useMemo(()=>r.map(y=>({id:y.value,label:y.displayValue,value:y.value})),[r]),l=I.useCallback(y=>{y&&t({target:{name:e.mappedValue,value:y.value,fieldName:n}})},[t,n,e.mappedValue]),d=I.useMemo(()=>c.jsx(tf,{items:f,selectedValue:u||null,onSelectedItemChange:l,placeholder:"Please select one",style:{borderRadius:"8px",width:"100%"}},u),[u,f,l]),h=I.useCallback(()=>{o&&Of(o,s,e.mappedValue,"",n)},[o,s,e.mappedValue,n]);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[c.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:c.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[d,c.jsx(He,{type:"button",variant:"ghost",onClick:h,children:"Clear"})]})]},e.mappedValue)}function lx(){var u,f;const{fieldMapping:e}=lt(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Qt(),i=(u=n==null?void 0:n.read)==null?void 0:u.selectedFieldMappings,o=(f=n==null?void 0:n.read)==null?void 0:f.selectedValueMappings,s=I.useMemo(()=>{const l=t&&e?Object.values(e[t]||{}).flat().filter(d=>d.mappedValues).map(d=>({...d})):[];if(i)for(let d=0;d<l.length;d+=1){const{mapToName:h}=l[d];i!=null&&i[h]&&(l[d].fieldName=i[h])}return l},[t,e,i]),a=I.useCallback(l=>{const{value:d,name:h,fieldName:m}=l.target;d&&t&&Of(t,r,h,d,m)},[t,r]);return s!=null&&s.length?c.jsx(c.Fragment,{children:s.map(l=>{var m,y,w;const d=(y=(m=n==null?void 0:n.read)==null?void 0:m.allFieldsMetadata)==null?void 0:y[l.fieldName],h=sx(l,d);return h.isValid?c.jsxs(c.Fragment,{children:[c.jsx(cx,{string:"Map the values for ",fieldName:vs(l)}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.jsx(Wo,{id:vs(l),children:(w=l==null?void 0:l.mappedValues)==null?void 0:w.map(g=>{const O=(d==null?void 0:d.values)||[],p=(o==null?void 0:o[l.fieldName])||{},b=ax(O,p,g.mappedValue);return c.jsx(ux,{allValueOptions:b,mappedValue:g,onSelectChange:a,fieldName:(l==null?void 0:l.fieldName)||""},`${g.mappedValue}-${l.fieldName}`)})},vs(l))})]}):(console.error(h.errorMessage,l),null)})}):null}const dx=!1;function fx(){return iC(),c.jsxs(c.Fragment,{children:[c.jsx(aC,{}),c.jsx(ix,{}),c.jsx(nC,{}),c.jsx(tC,{}),c.jsx(lx,{}),c.jsx(QC,{}),dx]})}function px(e,t,n){var r;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const i=e.write.selectedWriteObjects;n&&(i[t]={objectName:t}),n||delete i[t]}}function hx(e,t,n,r){t(e,i=>{px(i,n,r)})}function mx(){var f,l;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Qt(),i=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,o=(l=n==null?void 0:n.write)==null?void 0:l.writeObjects,s=(d,h)=>{t&&n&&hx(t,r,d,h)},a=!!o,u=(o==null?void 0:o.map(d=>({id:d.objectName,label:d.displayName,isChecked:!!(i!=null&&i[d.objectName])})))||[];return a&&c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:`Allow ${e} to write to these objects`}),c.jsx(xf,{items:u,onItemChange:s,showSelectAll:o.length>=2,searchPlaceholder:"Search objects...",itemName:"objects"})]})}function gx(){return c.jsx(c.Fragment,{children:c.jsx(mx,{})})}function _f({resetComponent:e,onDisconnectSuccess:t}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[c.jsx(Ft,{string:"Remove connection"}),c.jsx("p",{children:"Click to disconnect your connection from the provider."}),c.jsx(dd,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const yx="_authenticationRow_1g2ms_1",vx="_field_1g2ms_8",wx="_value_1g2ms_12",ws={authenticationRow:yx,field:vx,value:wx};function Iu({label:e,value:t}){return c.jsxs("div",{className:ws.authenticationRow,children:[c.jsx("div",{className:ws.field,children:e}),c.jsx("div",{className:ws.value,children:t})]})}function bx(){const{selectedConnection:e}=an(),{providerName:t}=dt(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",i=`${t} ${r}`;return c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Connection details"}),c.jsxs("div",{style:{paddingBottom:"1rem"},children:[c.jsx(Iu,{label:i,value:e==null?void 0:e.providerWorkspaceRef}),c.jsx(Iu,{label:"Status",value:rn((e==null?void 0:e.status)||"")})]})]})}const Ix=()=>{const e=ut(),t=We();return On({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:i})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:i}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),Je(n)}})};function Sf({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=Ke(),{integrationId:i,installation:o,setIntegrationDeleted:s,onUninstallSuccess:a}=lt(),[u,f]=I.useState(!1),l=!r||!i||!(o!=null&&o.id)||u,d=Ix(),h=async()=>{l||(f(!0),console.warn("uninstalling installation",{projectIdOrName:r,integrationId:i,installationId:o.id}),d.mutate({projectIdOrName:r,integrationId:i,installationId:o.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",o.id),a==null||a(o==null?void 0:o.id),s()},onSettled:()=>f(!1)}))},m=u?"Uninstalling...":e,y=c.jsx(He,{type:"button",onClick:h,disabled:l,variant:t,style:n,children:m});return o!=null&&o.id?y:null}function Cx(){const{installation:e}=lt(),{providerName:t}=dt();return e?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Uninstall entire integration"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?c.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."]}):c.jsx("p",{children:"You've successfully uninstalled the integration."}),c.jsx(Sf,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function xx(){const{installation:e,resetComponent:t}=lt();return c.jsxs(c.Fragment,{children:[c.jsx(bx,{}),c.jsx(Ia,{}),e&&c.jsx(Cx,{}),!e&&c.jsx(_f,{resetComponent:t})]})}function Ef({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var de,be,P,$,H,U,q,V,G,Z,Y,ee,ne,ce;const{installation:o}=Nr(),{hydratedRevision:s,loading:a}=ci(),{configureState:u,selectedObjectName:f}=Qt(),l=o==null?void 0:o.config,d=l&&f&&!!Ul(l,f)||!1,h=f?nd(l,f):void 0,m=(de=u==null?void 0:u.read)==null?void 0:de.selectedFieldMappings,y=!Wl(h,m),w=s&&f?va(l,s,f):void 0,g=(be=u==null?void 0:u.read)==null?void 0:be.selectedOptionalFields,O=!Hl(w,g),p=f?(U=(H=($=(P=l==null?void 0:l.content)==null?void 0:P.read)==null?void 0:$.objects)==null?void 0:H[f])==null?void 0:U.selectedValueMappings:void 0,b=(q=u==null?void 0:u.read)==null?void 0:q.selectedValueMappings,v=!zl(p,b),x=(G=(V=l==null?void 0:l.content)==null?void 0:V.write)==null?void 0:G.objects,S=(Z=u==null?void 0:u.write)==null?void 0:Z.selectedWriteObjects,A=!Ql(x||{},S||{}),D=O||y||v||A||r||f!==Qr&&!d,K=!!((ce=(ne=(ee=(Y=s==null?void 0:s.content)==null?void 0:Y.read)==null?void 0:ee.objects)==null?void 0:ne.find(k=>k.objectName===f))!=null&&ce.error),j=a||n||!u||!f||!D||K,L=f===Qr,se=f===Co,re=c.jsx(He,{type:"submit",disabled:j,children:r?"Install":"Save"}),ge=c.jsx(He,{type:"button",onClick:t,disabled:j,variant:"ghost",children:"Reset"});return n?c.jsx(_i,{}):c.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[c.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!se&&c.jsxs(c.Fragment,{children:[re,ge]})}),c.jsxs(_n,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&c.jsx(ki,{children:typeof i=="string"?i:"Installation Failed."}),a&&c.jsx(_i,{}),s&&!L&&!se&&c.jsx(fx,{}),s&&L&&!se&&c.jsx(gx,{}),!a&&se&&c.jsx(xx,{})]})]})}const Nf=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o,fieldMapping:s}=lt(),{hydratedRevision:a,loading:u}=ci(),{selectedObjectName:f}=hd(),{selectedConnection:l}=an(),d=Qu(),{projectIdOrName:h}=Ke(),{resetBoundary:m,setErrors:y,setError:w,getError:g}=sn(),{resetConfigureState:O,objectConfigurationsState:p}=Ca(),b=rd(f||"",p),{onNextIncompleteTab:v}=$b(),x=I.useCallback(()=>{m(we.INSTALLATION_MUTATION)},[m]),S=I.useCallback(N=>N?F=>{w(we.INSTALLATION_MUTATION,N,F)}:F=>{console.error("objectName is required to set installation error: ",F)},[w]),A=I.useCallback(N=>N?g(we.INSTALLATION_MUTATION,N):"",[g]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:a,loading:u,selectedObjectName:f,selectedConnection:l,apiKey:d,projectIdOrName:h,resetBoundary:m,setErrors:y,setMutateInstallationError:S,getMutateInstallationError:A,resetMutateInstallationErrorState:x,resetConfigureState:O,objectConfigurationsState:p,configureState:b,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:v,fieldMapping:s}},Ox=void 0;function _x(){const{consumerRef:e,setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:i,selectedConnection:o,resetBoundary:s,setErrors:a,setMutateInstallationError:u,getMutateInstallationError:f,resetMutateInstallationErrorState:l,resetConfigureState:d,objectConfigurationsState:h,configureState:m,onInstallSuccess:y,onNextIncompleteTab:w,fieldMapping:g}=Nf(),[O,p]=I.useState(!1),{createInstallation:b}=jl(),v=i===Qr,x=f(i),S=I.useCallback(()=>{s(we.MAPPING),n!=null&&n.content&&!r&&i&&Xl(n,Ox,i,d)},[s,n,r,i,d]);I.useEffect(()=>{!m&&(n!=null&&n.content)&&!r&&S()},[m,h,n,r,S]);const A=()=>{l();const{requiredMapFields:R,selectedFieldMappings:D}=(m==null?void 0:m.read)||{},{errorList:K}=Jl(R,D,a);if(!(K.length>0))if(i&&(o!=null&&o.id)&&e&&n){p(!0);const j=eb(m,i,n,e,g);if(!j){console.error("Error when generating createConfig from configureState"),p(!1);return}b({config:j.content,onSuccess:L=>{t(L),y==null||y(L.id,L.config),p(!1),w()},onError:L=>{u(i)(L.message),p(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},N=()=>{if(l(),i&&(o!=null&&o.id)&&e&&n){p(!0);const R=nb(m,n,e);if(!R){console.error("Error when generating createConfig from configureState"),p(!1);return}b({config:R.content,onSuccess:D=>{t(D),y==null||y(D.id,D.config),p(!1),w()},onError:D=>{u(i)(D.message),p(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},F=R=>{R.preventDefault(),v?N():A()};return c.jsx(Ef,{errorMsg:x,isCreateMode:!0,isLoading:O,onSave:F,onReset:S})}const Sx=(e,t,n,r,i)=>{const o=Yl(e),s=Zl(e),a=ed(t,i),u=td(e),f={content:{read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:u||{},backfill:r}}}}};return Mi(n)&&(f.content||(f.content={}),f.content.proxy={enabled:!0}),f},Ex=(e,t)=>{const r={content:{write:{objects:id(e)}}};return Mi(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r};function Nx({installation:e}){const{setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:i,resetBoundary:o,setErrors:s,setMutateInstallationError:a,getMutateInstallationError:u,resetConfigureState:f,configureState:l,onUpdateSuccess:d,onNextIncompleteTab:h,fieldMapping:m}=Nf(),{updateInstallation:y}=Ll(),[w,g]=I.useState(!1),O=i===Qr,p=u(i),{config:b}=e,v=I.useCallback(()=>{o(we.MAPPING),n!=null&&n.content&&!r&&i&&Xl(n,b,i,f)},[o,n,r,i,b,f]);I.useEffect(()=>{l||v()},[l,v]);const x=I.useMemo(()=>{var R,D,K;return(K=(D=(R=n==null?void 0:n.content)==null?void 0:R.read)==null?void 0:D.objects)==null?void 0:K.find(j=>(j==null?void 0:j.objectName)===i)},[n,i]),S=()=>{const{requiredMapFields:F,selectedFieldMappings:R}=(l==null?void 0:l.read)||{},{errorList:D}=Jl(F,R,s);if(!(D.length>0))if(n&&l&&i&&x){g(!0);const K=Sx(l,i,n,x.backfill,m);if(!K){console.error("Error when generating updateConfig from configureState"),g(!1);return}y({config:K.content,onSuccess:j=>{t(j),d==null||d(j.id,j.config),g(!1),h()},onError:j=>{a(i)(j.message),g(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},A=()=>{if(l&&n){g(!0);const F=Ex(l,n);if(!F){console.error("Error when generating write updateConfig from configureState"),g(!1);return}y({config:F.content,onSuccess:R=>{t(R),d==null||d(R.id,R.config),g(!1),h()},onError:R=>{a(i)(R.message),g(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},N=F=>{F.preventDefault(),O?A():S()};return c.jsx(Ef,{errorMsg:p,onSave:N,onReset:v,isLoading:w})}function Tx(){const{integrationObj:e,installation:t}=lt();return e?t&&e?c.jsx(Nx,{installation:t}):c.jsx(_x,{}):c.jsx(Al,{message:"We can't load the integration"})}class Za extends I.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){var r,i;console.error("Ampersand Error Boundary caught an error:",t),console.error("[Error Info]:",n),(i=(r=this.props).onError)==null||i.call(r,t,n)}render(){var t;return this.state.hasError?this.props.fallback?this.props.fallback:c.jsx(_t,{message:((t=this.state.error)==null?void 0:t.message)||"Something went wrong. Please try again later."}):this.props.children}}function Rx(){return c.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),c.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function ec({text:e,children:t}){return c.jsx(si,{children:c.jsxs(_n,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[c.jsx(Rx,{}),c.jsx("p",{children:e}),t]})})}function Ax({provider:e}){const{providerName:t}=dt(e),n=`You have successfully installed your ${t} integration.`;return c.jsx(ec,{text:n,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:c.jsx(Sf,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Fx=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function Px({children:e}){var x;const t=I.useRef(!1),{projectIdOrName:n}=Ke(),{hydratedRevision:r,loading:i}=ci(),{integrationObj:o,installation:s,groupRef:a,consumerRef:u,onInstallSuccess:f,isIntegrationDeleted:l}=lt(),{mutate:d,isIdle:h,isPending:m,error:y,errorMsg:w}=kl(),{selectedConnection:g,isConnectionsLoading:O}=an(),p=i||m||O,b=(x=r==null?void 0:r.content)==null?void 0:x.provider,v=Fx(r);return I.useEffect(()=>{var S;if(!p&&!O&&r&&v&&!s&&g&&(o!=null&&o.id)&&!l&&b){const A={projectIdOrName:n,integrationId:o==null?void 0:o.id,installation:{groupRef:a,connectionId:g==null?void 0:g.id,config:{content:{provider:b}}}};Mi(r)===!0&&(A.installation.config.content.proxy=(S=r==null?void 0:r.content)==null?void 0:S.proxy),h&&!t.current&&d(A,{onSuccess:N=>{t.current||(f==null||f(N==null?void 0:N.id,N.config),t.current=!0)}})}},[r,v,s,g,n,o==null?void 0:o.id,a,u,p,f,l,O,b,d,h]),v&&b&&s?c.jsx(Ax,{provider:b}):y?c.jsx(_t,{message:w??"Create installation failed"}):o?p?c.jsx(ai,{}):c.jsx("div",{children:e}):c.jsx(_t,{message:"We can't load the integration"})}function $i(){const e=ut(),t=We();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"),Je(n)}})}function Dx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a}){const{projectIdOrName:u}=Ke(),f=$i(),l=I.useCallback(d=>{var w;const{apiKey:h,providerMetadata:m}=d,y={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:(w=m==null?void 0:m.workspace)==null?void 0:w.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:h,...m&&{providerMetadata:m}}};f.mutate(y)},[u,o,i,r,n,e,f]);return a===null?c.jsx(Ib,{provider:e,providerInfo:t,handleSubmit:l,error:null}):s}function Mx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a}){const{projectIdOrName:u}=Ke(),f=$i(),l=I.useCallback(d=>{var g;const{user:h,pass:m,providerMetadata:y}=d,w={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:(g=y==null?void 0:y.workspace)==null?void 0:g.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:h,password:m},...y&&{providerMetadata:y}}};f.mutate(w)},[u,o,i,r,n,e,f]);return a===null?c.jsx(Sb,{provider:e,providerInfo:t,handleSubmit:l,error:null}):s}function Cu({url:e,prompt:t,inputName:n}){return c.jsx("p",{style:{color:"var(--amp-colors-text-muted)",display:"flex",justifyContent:"space-between"},children:c.jsxs("span",{children:[e?c.jsx(wa,{href:e,newTab:!0,children:c.jsx("span",{style:{textDecoration:"underline"},children:n})}):c.jsx("span",{children:n})," ",t&&c.jsx(pf,{id:`docs-helper-text-${Mw(n||(t==null?void 0:t.slice(0,50)))}`,tooltipText:t})]})})}function kx({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r}){var h,m;const[i,o]=I.useState({}),s=((h=e.metadata)==null?void 0:h.input)||[],a=y=>{const{name:w,value:g}=y.currentTarget;o(O=>({...O,[w]:g.trim()}))},u=Gr(s,i),f=n||!u,l=((m=e.customOpts)==null?void 0:m.inputs)||[],d=()=>{const y=$o(s,i),w=Object.fromEntries(l.map(g=>[g.name,i[g.name]]));t({customAuth:w,providerMetadata:y})};return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[l.map(y=>c.jsxs("div",{children:[c.jsx(Cu,{url:y.docsURL,prompt:y.prompt,inputName:y.displayName}),c.jsx(Ot.PasswordInput,{id:y.name,name:y.name,onChange:a,placeholder:""})]},y.name)),s.map(y=>c.jsxs("div",{children:[y.docsURL&&c.jsx(Cu,{url:y.docsURL,prompt:y.displayName||y.name,inputName:y.displayName||rn(y.name.toLowerCase())}),c.jsx(Ot.Input,{id:y.name,name:y.name,type:"text",placeholder:"",onChange:a})]},y.name)),c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"submit",onClick:d,variant:r,children:"Next"})]})}function jx({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r}){return c.jsxs(er,{children:[c.jsx(tr,{children:`Set up ${e.displayName} integration`}),c.jsx(cn,{error:n}),c.jsx(kx,{providerInfo:e,handleSubmit:t,isButtonDisabled:r})]})}function Lx({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s}){const{projectIdOrName:a}=Ke(),u=$i(),[f,l]=I.useState(null),d=I.useCallback(h=>{var g;const{customAuth:m,providerMetadata:y}=h;l(null);const w={projectIdOrName:a,generateConnectionParams:{providerWorkspaceRef:(g=y==null?void 0:y.workspace)==null?void 0:g.value,groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:m,...y&&{providerMetadata:y}}};u.mutate(w,{onError:O=>{Je(O,l)},onSuccess:()=>{l(null)}})},[a,i,r,n,t,e.name,u]);return s===null?c.jsx(jx,{providerInfo:e,handleSubmit:d,error:f}):o}function Vx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:i,title:o}){if(!o&&!r)throw new Error("Either title or providerName is required");return c.jsxs(er,{children:[c.jsx(tr,{children:o||`Set up ${r} integration`}),c.jsx(cn,{error:t}),i,c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function $x({...e}){return c.jsx(Vx,{...e})}function Kx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,providerName:a}){const{projectIdOrName:u}=Ke(),f=$i(),l=I.useCallback(()=>{const d={projectIdOrName:u,generateConnectionParams:{groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e}};f.mutate(d)},[u,i,r,n,t,e,f]);return s===null?c.jsx($x,{handleSubmit:l,error:null,providerName:a}):o}const Ux=()=>{const e=ut(),t=We();return On({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function qx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs(er,{children:[c.jsx(tr,{children:`Set up ${r} integration`}),c.jsx(yb,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),c.jsx(cn,{error:t}),c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const Bx="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Jx({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return c.jsxs(er,{children:[c.jsx(tr,{children:"Enter your Salesforce subdomain"}),c.jsx(wa,{href:Bx,newTab:!0,children:"What is my Salesforce subdomain?"}),c.jsx(cn,{error:n}),c.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[c.jsx(Ot.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:i=>t(i.currentTarget.value)}),c.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function Hx({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:i,metadataFields:o}){return c.jsxs(er,{children:[c.jsxs(tr,{children:["Enter your ",i," workspace"]}),c.jsx(cn,{error:n}),c.jsx("br",{}),o.map(s=>c.jsx(Ot.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),c.jsx("br",{}),c.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const xu=600,Ou=600,_u="salesforce";function Wx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){var D;const{projectId:s}=Yn(),a=We(),u=I.useRef(null),[f,l]=I.useState(null),[d,h]=I.useState(""),[m,y]=I.useState({}),[w,g]=I.useState({}),{data:O}=Vo(e),p=((D=O==null?void 0:O.metadata)==null?void 0:D.input)||[],{mutateAsync:b,isPending:v}=Ux(),{isFetching:x,refetch:S}=ga({groupRef:r,provider:e});I.useEffect(()=>{const K=j=>{var L,se,re;j.origin===Nl&&(((L=j.data)==null?void 0:L.eventType)==="AUTHORIZATION_SUCCEEDED"?(l(null),console.debug("New connection:",j.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((se=j.data)==null?void 0:se.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",j.data.data.error),a.invalidateQueries({queryKey:["amp","connections"]}),l(j.data.data.error||"An error occurred. Please try again.")),(re=u.current)==null||re.close())};return window.addEventListener("message",K),()=>window.removeEventListener("message",K)},[a]);const A=K=>{h(K),y(j=>({...j,workspace:K})),g(j=>({...j,workspace:{value:K,source:"input"}}))},N=(K,j)=>{y(L=>({...L,[K]:j})),g(L=>({...L,[K]:{value:j,source:"input"}}))},F=async()=>{var K;l(null);try{const{data:j}=await S();if(j&&j.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(p.length>0&&!Gr(p,m)){l("Please fill in all required fields");return}try{const j=await b({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s||"",consumerName:n,groupName:i,providerWorkspaceRef:e===_u?d:(K=w==null?void 0:w.workspace)==null?void 0:K.value,providerMetadata:w}});if(j){const L=window.screenX+(window.outerWidth-xu)/2,se=window.screenY+(window.outerHeight-Ou)/2.5,re=`width=${xu},height=${Ou},left=${L},top=${se}`;u.current=window.open(j,"OAuthPopup",re)}}catch(j){console.error(j),l(j instanceof Error?j.message:String(j)||"An error occurred. Please try again.")}},R=e===_u?c.jsx(Jx,{handleSubmit:F,setWorkspace:A,error:f,isButtonDisabled:d.length===0||v||x}):p.length>0?c.jsx(Hx,{handleSubmit:F,setFormData:N,error:f,isButtonDisabled:!Gr(p,m)||v||x,providerName:o,metadataFields:p}):c.jsx(qx,{handleSubmit:F,error:f,providerName:o,isButtonDisabled:v||x});return c.jsx("div",{children:R})}function zx({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:u}=Ke(),f=$i(),[l,d]=I.useState(null),h=I.useCallback(m=>{var w,g;d(null);const y={projectIdOrName:u,generateConnectionParams:{groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(g=(w=m.providerMetadata)==null?void 0:w.workspace)==null?void 0:g.value,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes},...m.providerMetadata&&{providerMetadata:m.providerMetadata}}};f.mutate(y,{onError:()=>d("Error loading provider info")})},[u,o,i,r,n,e,f]);return a===null?c.jsx(Nb,{provider:e,providerName:t,handleSubmit:h,error:l,explicitScopesRequired:s}):c.jsx(_i,{})}function Qx({...e}){return c.jsx(zx,{...e})}const Gx="authorizationCode",Xx="authorizationCodePKCE",Yx="clientCredentials";function Zx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:a}){const{providerName:u}=dt(e);if(t.oauth2Opts===void 0)return c.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:f,explicitScopesRequired:l}=t.oauth2Opts,d={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:u};return f===Gx||f===Xx?c.jsx(Wx,{...d}):f===Yx?c.jsx(Qx,{...d,explicitScopesRequired:l,selectedConnection:s,setSelectedConnection:a}):f==="password"?c.jsx("em",{children:"Password flow not supported yet"}):c.jsxs("em",{children:["Unsupported grant type: ",f]})}function eO(e){const{selectedConnection:t}=an();I.useEffect(()=>{e&&t&&e(t)},[e,t])}function tO({onSuccess:e}){eO(e)}function Tf({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s,onDisconnectSuccess:a,resetComponent:u}){const{data:f,isLoading:l,isError:d,error:h,providerName:m,selectedProvider:y}=dt(e),{provider:w,isIntegrationDeleted:g}=lt(),{selectedConnection:O,setSelectedConnection:p}=an();tO({onSuccess:s});const b=We(),v=f;I.useEffect(()=>{d&&(console.error("Error loading provider info."),Je(h))},[d,h]);const x=I.useCallback(()=>{b.clear(),u()},[u,b]);if(!e&&!w)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(g)return c.jsx(ec,{text:"Integration successfully uninstalled.",children:c.jsx(He,{type:"button",onClick:x,style:{width:"100%"},children:"Reinstall Integration"})});if(O)return o;if(l)return c.jsx(ai,{});if(v==null)return c.jsx(_t,{message:"Provider info was not found."});const S={provider:y,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:O,setSelectedConnection:p,providerName:m,providerInfo:v,onDisconnectSuccess:a};return v.authType==="none"?c.jsx(Kx,{...S,children:o}):v.authType==="basic"?c.jsx(Mx,{...S,children:o}):v.authType==="apiKey"?c.jsx(Dx,{...S,children:o}):v.authType==="custom"?c.jsx(Lx,{...S,children:o}):c.jsx(Zx,{...S})}function nO(e){const t=e+"CollectionProvider",[n,r]=zo(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=w=>{const{scope:g,children:O}=w,p=I.useRef(null),b=I.useRef(new Map).current;return c.jsx(i,{scope:g,itemMap:b,collectionRef:p,children:O})};s.displayName=t;const a=e+"CollectionSlot",u=na(a),f=I.forwardRef((w,g)=>{const{scope:O,children:p}=w,b=o(a,O),v=ni(g,b.collectionRef);return c.jsx(u,{ref:v,children:p})});f.displayName=a;const l=e+"CollectionItemSlot",d="data-radix-collection-item",h=na(l),m=I.forwardRef((w,g)=>{const{scope:O,children:p,...b}=w,v=I.useRef(null),x=ni(g,v),S=o(l,O);return I.useEffect(()=>(S.itemMap.set(v,{ref:v,...b}),()=>void S.itemMap.delete(v))),c.jsx(h,{[d]:"",ref:x,children:p})});m.displayName=l;function y(w){const g=o(e+"CollectionConsumer",w);return I.useCallback(()=>{const p=g.collectionRef.current;if(!p)return[];const b=Array.from(p.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((S,A)=>b.indexOf(S.ref.current)-b.indexOf(A.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:f,ItemSlot:m},y,r]}var rO=B[" useId ".trim().toString()]||(()=>{}),iO=0;function Rf(e){const[t,n]=B.useState(rO());return Ni(()=>{n(r=>r??String(iO++))},[e]),e||(t?`radix-${t}`:"")}function oO(e){const t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var sO=B.createContext(void 0);function Af(e){const t=B.useContext(sO);return e||t||"ltr"}var bs="rovingFocusGroup.onEntryFocus",aO={bubbles:!1,cancelable:!0},Ki="RovingFocusGroup",[ra,Ff,cO]=nO(Ki),[uO,Pf]=zo(Ki,[cO]),[lO,dO]=uO(Ki),Df=B.forwardRef((e,t)=>c.jsx(ra.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(ra.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(fO,{...e,ref:t})})}));Df.displayName=Ki;var fO=B.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...d}=e,h=B.useRef(null),m=ni(t,h),y=Af(o),[w,g]=Wa({prop:s,defaultProp:a??null,onChange:u,caller:Ki}),[O,p]=B.useState(!1),b=oO(f),v=Ff(n),x=B.useRef(!1),[S,A]=B.useState(0);return B.useEffect(()=>{const N=h.current;if(N)return N.addEventListener(bs,b),()=>N.removeEventListener(bs,b)},[b]),c.jsx(lO,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:w,onItemFocus:B.useCallback(N=>g(N),[g]),onItemShiftTab:B.useCallback(()=>p(!0),[]),onFocusableItemAdd:B.useCallback(()=>A(N=>N+1),[]),onFocusableItemRemove:B.useCallback(()=>A(N=>N-1),[]),children:c.jsx(Sn.div,{tabIndex:O||S===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:Ht(e.onMouseDown,()=>{x.current=!0}),onFocus:Ht(e.onFocus,N=>{const F=!x.current;if(N.target===N.currentTarget&&F&&!O){const R=new CustomEvent(bs,aO);if(N.currentTarget.dispatchEvent(R),!R.defaultPrevented){const D=v().filter(re=>re.focusable),K=D.find(re=>re.active),j=D.find(re=>re.id===w),se=[K,j,...D].filter(Boolean).map(re=>re.ref.current);jf(se,l)}}x.current=!1}),onBlur:Ht(e.onBlur,()=>p(!1))})})}),Mf="RovingFocusGroupItem",kf=B.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=e,u=Rf(),f=o||u,l=dO(Mf,n),d=l.currentTabStopId===f,h=Ff(n),{onFocusableItemAdd:m,onFocusableItemRemove:y,currentTabStopId:w}=l;return B.useEffect(()=>{if(r)return m(),()=>y()},[r,m,y]),c.jsx(ra.ItemSlot,{scope:n,id:f,focusable:r,active:i,children:c.jsx(Sn.span,{tabIndex:d?0:-1,"data-orientation":l.orientation,...a,ref:t,onMouseDown:Ht(e.onMouseDown,g=>{r?l.onItemFocus(f):g.preventDefault()}),onFocus:Ht(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:Ht(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){l.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const O=mO(g,l.orientation,l.dir);if(O!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=h().filter(v=>v.focusable).map(v=>v.ref.current);if(O==="last")b.reverse();else if(O==="prev"||O==="next"){O==="prev"&&b.reverse();const v=b.indexOf(g.currentTarget);b=l.loop?gO(b,v+1):b.slice(v+1)}setTimeout(()=>jf(b))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:w!=null}):s})})});kf.displayName=Mf;var pO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mO(e,t,n){const r=hO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return pO[r]}function jf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function gO(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var yO=Df,vO=kf,Go="Tabs",[wO,zO]=zo(Go,[Pf]),Lf=Pf(),[bO,tc]=wO(Go),Vf=B.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:u="automatic",...f}=e,l=Af(a),[d,h]=Wa({prop:r,onChange:i,defaultProp:o??"",caller:Go});return c.jsx(bO,{scope:n,baseId:Rf(),value:d,onValueChange:h,orientation:s,dir:l,activationMode:u,children:c.jsx(Sn.div,{dir:l,"data-orientation":s,...f,ref:t})})});Vf.displayName=Go;var $f="TabsList",Kf=B.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=tc($f,n),s=Lf(n);return c.jsx(yO,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:c.jsx(Sn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});Kf.displayName=$f;var Uf="TabsTrigger",qf=B.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=tc(Uf,n),a=Lf(n),u=Jf(s.baseId,r),f=Hf(s.baseId,r),l=r===s.value;return c.jsx(vO,{asChild:!0,...a,focusable:!i,active:l,children:c.jsx(Sn.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":f,"data-state":l?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:u,...o,ref:t,onMouseDown:Ht(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Ht(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Ht(e.onFocus,()=>{const d=s.activationMode!=="manual";!l&&!i&&d&&s.onValueChange(r)})})})});qf.displayName=Uf;var Bf="TabsContent",IO=B.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=tc(Bf,n),u=Jf(a.baseId,r),f=Hf(a.baseId,r),l=r===a.value,d=B.useRef(l);return B.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),c.jsx(za,{present:i||l,children:({present:h})=>c.jsx(Sn.div,{"data-state":l?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":u,hidden:!h,id:f,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&o})})});IO.displayName=Bf;function Jf(e,t){return`${e}-trigger-${t}`}function Hf(e,t){return`${e}-content-${t}`}var CO=Vf,xO=Kf,Wf=qf;const OO=c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[c.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),c.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function _O(e,t){return t?I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},I.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?OO:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:c.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function SO(){return c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.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"}),c.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 EO="_tabsRoot_ktpr0_1",NO="_tabsList_ktpr0_6",TO="_tabTrigger_ktpr0_12",Ao={tabsRoot:EO,tabsList:NO,tabTrigger:TO};function RO(){return c.jsxs(c.Fragment,{children:[c.jsx(Uo,{style:{margin:"1rem 0"}}),c.jsx(Wf,{value:Co,className:Ao.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[c.jsx(SO,{}),c.jsx("span",{children:"Manage"})]})})]})}function zf({objectName:e,completed:t,pending:n,displayName:r}){return c.jsx(Wf,{value:e,className:Ao.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[_O(t,n),c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsx("span",{children:r||e}),n&&c.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function AO({completed:e,pending:t,displayName:n}){return c.jsxs(c.Fragment,{children:[c.jsx(Uo,{style:{margin:"1rem 0"}}),c.jsx(zf,{objectName:Qr,completed:e,pending:t,displayName:n},"other-write")]})}function FO({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i}){var l,d,h,m;const{data:o}=Ol(),{installation:s}=Nr(),a=s==null?void 0:s.config,u=(d=(l=a==null?void 0:a.content)==null?void 0:l.write)==null?void 0:d.objects,f=(m=(h=r==null?void 0:r.other)==null?void 0:h.write)==null?void 0:m.selectedWriteObjects;return c.jsx(CO,{value:e,className:Ao.tabsRoot,onValueChange:n,children:c.jsxs(xO,{className:Ao.tabsList,children:[t.map(y=>{var D,K,j,L,se,re;const w=(j=(K=(D=a==null?void 0:a.content)==null?void 0:D.read)==null?void 0:K.objects)==null?void 0:j[y.name],g=r==null?void 0:r[y.name],O=nd(a,y.name),p=(L=g==null?void 0:g.read)==null?void 0:L.selectedFieldMappings,b=!Wl(O,p),v=o?va(a,o,y.name):void 0,x=(se=g==null?void 0:g.read)==null?void 0:se.selectedOptionalFields,S=!Hl(v,x),A=w==null?void 0:w.selectedValueMappings,N=(re=g==null?void 0:g.read)==null?void 0:re.selectedValueMappings,F=!zl(A,N),R=S||b||F||!1;return c.jsx(zf,{objectName:y.name,displayName:y.displayName,completed:y.completed,pending:R},y.name)}),i&&(()=>{const y=!Ql(u||{},f||{});return c.jsx(AO,{completed:i.completed,pending:y,displayName:"Write"})})(),c.jsx(RO,{})]})})}function PO(e,t){return t===Co?{name:Co,completed:!1}:e.find(n=>n.name===t)}function DO({children:e}){var O;const{data:t}=Yn(),{installation:n}=lt(),{providerName:r}=dt(),{hydratedRevision:i}=ci(),{objectConfigurationsState:o}=Ca(),[s,a]=I.useState(""),u=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,l=i&&ql(f,i),d=l!==null,h=!!((O=i==null?void 0:i.content)!=null&&O.write),m=h?Bl(f):void 0,y=I.useMemo(()=>{const p=[...l||[]];return m&&h&&p.push(m),p},[l,m,h]),w=PO(y,s),g=I.useCallback(()=>{const p=y.find(b=>w!==b&&!b.completed);p&&a(p.name)},[y,w]);return I.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,g]),c.jsx(md.Provider,{value:g,children:c.jsx(pd.Provider,{value:w==null?void 0:w.name,children:c.jsxs(si,{style:{maxWidth:"55rem"},children:[c.jsxs(_n,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[c.jsxs("div",{style:{width:"20rem"},children:[c.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),c.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:u}),d&&c.jsx(FO,{value:s,readNavObjects:l,onValueChange:p=>a(p),objectConfigurationsState:o,writeNavObject:m})]}),e]}),c.jsx(ad,{})]})})})}function MO({...e}){return c.jsx(DO,{...e})}const kO="_resetContainer_lkwv9_4",Qf={resetContainer:kO},jO=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u})=>{var g;const{projectIdOrName:f,isLoading:l}=Yn(),{isLoading:d}=jo(),{isError:h,errorState:m}=sn(),{seed:y,reset:w}=Vl();return l||d?c.jsx(ai,{}):h(we.PROJECT,f)?c.jsx(_t,{message:`Error loading project ${f}`}):h(we.INTEGRATION_LIST,f)?c.jsx(_t,{message:"Error retrieving integrations for the project, double check the API key"}):(g=m[we.INTEGRATION_LIST])!=null&&g.apiError?c.jsx(_t,{message:"Something went wrong, couldn't find integration information"}):c.jsx("div",{className:Qf.resetContainer,children:c.jsx(jw,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u,resetComponent:w,children:c.jsx(Ml,{children:c.jsx(Tf,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,resetComponent:w,children:c.jsx(Vb,{resetComponent:w,children:c.jsx(Px,{children:c.jsx(Ub,{children:c.jsx(MO,{children:c.jsx(Tx,{})})})})})})})},y)})};function LO({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u}){const f={integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u};return c.jsx(Za,{fallback:c.jsx(_t,{message:"Something went wrong, couldn't find integration information"}),children:c.jsx(ma,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:c.jsx(jO,{...f})})})}function VO(){return c.jsxs(si,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[c.jsx(_i,{}),c.jsx("p",{children:"Redirecting"})]})}function $O({redirectURL:e,children:t}){return I.useEffect(()=>{e&&window.location.replace(e)},[e]),e?c.jsx(VO,{}):t}function KO({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,i]=I.useState(!1);return c.jsxs(c.Fragment,{children:[r===!1&&c.jsxs(c.Fragment,{children:[c.jsx(Ft,{string:"Manage connection"}),c.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[c.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),c.jsx(He,{type:"button",onClick:()=>i(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&c.jsxs(c.Fragment,{children:[c.jsx(Ia,{provider:n}),c.jsx(_f,{resetComponent:e,onDisconnectSuccess:t})]})]})}function UO({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Yn(),{providerName:i}=dt(e),o=`You have successfully connected your ${i} account to ${r}.`;return c.jsx(ec,{text:o,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:c.jsx(KO,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function qO({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:u}){const{seed:f,reset:l}=Vl(),d=I.useCallback(h=>{s?s(h.id):u&&u(h)},[s,u]);return c.jsx(Za,{fallback:c.jsx(_t,{message:"Something went wrong with the connection. Please try again."}),children:c.jsx("div",{className:Qf.resetContainer,children:c.jsx(ma,{integration:"connect-provider-dummy-string",consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:c.jsx(Ml,{groupRef:r,provider:e,children:c.jsx(Tf,{resetComponent:l,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:d,onDisconnectSuccess:a,children:c.jsx($O,{redirectURL:o,children:c.jsx(UO,{resetComponent:l,provider:e,onDisconnectSuccess:a})})})})})},f)})}const BO=(e,t)=>{const{data:n,isLoading:r,isError:i,error:o}=fa(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,u=n==null?void 0:n[0],f=u==null?void 0:u.config;return I.useEffect(()=>{i&&Je(o)},[i,o]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:f}};exports.AmpersandContext=aa;exports.AmpersandErrorBoundary=Za;exports.AmpersandProvider=Ih;exports.ConnectProvider=qO;exports.FieldSettingWriteOnCreateEnum=fm;exports.FieldSettingWriteOnUpdateEnum=pm;exports.InstallIntegration=LO;exports.InstallationProvider=ma;exports.useAmpersandProviderProps=Ke;exports.useConfig=mw;exports.useConnection=pa;exports.useCreateInstallation=jl;exports.useDeleteInstallation=Uw;exports.useInstallation=Nr;exports.useIsIntegrationInstalled=BO;exports.useLocalConfig=hw;exports.useManifest=Lo;exports.useUpdateInstallation=Ll;
|
|
52
52
|
//# sourceMappingURL=amp-react.cjs.js.map
|