@amp-labs/react 2.5.3 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/amp-react.cjs.js +14 -14
- package/build/amp-react.es.js +5570 -5071
- package/build/style.css +1 -1
- package/package.json +1 -1
package/build/amp-react.cjs.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";var Sa=e=>{throw TypeError(e)};var No=(e,t,n)=>t.has(e)||Sa("Cannot "+n);var C=(e,t,n)=>(No(e,t,"read from private field"),n?n.call(e):t.get(e)),oe=(e,t,n)=>t.has(e)?Sa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),J=(e,t,n,r)=>(No(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(No(e,t,"access private method"),n);var Ri=(e,t,n,r)=>({set _(o){J(e,t,o,n)},get _(){return C(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),w=require("react");require("react-dom");function Ef(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 V=Ef(w);var Vr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ir=typeof window>"u"||"Deno"in globalThis;function Tt(){}function Sf(e,t){return typeof e=="function"?e(t):e}function Wo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Hc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function mr(e,t){return typeof e=="function"?e(t):e}function $t(e,t){return typeof e=="function"?e(t):e}function Na(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Ns(s,t.options))return!1}else if(!ti(t.queryKey,s))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function Ta(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(or(t.options.mutationKey)!==or(i))return!1}else if(!ti(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Ns(e,t){return((t==null?void 0:t.queryKeyHashFn)||or)(e)}function or(e){return JSON.stringify(e,(t,n)=>zo(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function ti(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!ti(e[n],t[n])):!1}function Jo(e,t){if(e===t)return e;const n=Ra(e)&&Ra(t);if(n||zo(e)&&zo(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let c=0;for(let u=0;u<s;u++){const f=n?u:i[u];(!n&&r.includes(f)||n)&&e[f]===void 0&&t[f]===void 0?(a[f]=void 0,c++):(a[f]=Jo(e[f],t[f]),a[f]===e[f]&&e[f]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function Wi(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 Ra(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function zo(e){if(!Aa(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Aa(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Aa(e){return Object.prototype.toString.call(e)==="[object Object]"}function Nf(e){return new Promise(t=>{setTimeout(t,e)})}function Go(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 Jo(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return Jo(e,t)}return t}function Tf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Rf(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ji=Symbol();function Bc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ji&&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===Ji?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Gn,xn,yr,Fc,Af=(Fc=class extends Vr{constructor(){super();oe(this,Gn);oe(this,xn);oe(this,yr);J(this,yr,t=>{if(!ir&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){C(this,xn)||this.setEventListener(C(this,yr))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,xn))==null||t.call(this),J(this,xn,void 0))}setEventListener(t){var n;J(this,yr,t),(n=C(this,xn))==null||n.call(this),J(this,xn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){C(this,Gn)!==t&&(J(this,Gn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof C(this,Gn)=="boolean"?C(this,Gn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Gn=new WeakMap,xn=new WeakMap,yr=new WeakMap,Fc),Ts=new Af,vr,On,wr,Mc,Pf=(Mc=class extends Vr{constructor(){super();oe(this,vr,!0);oe(this,On);oe(this,wr);J(this,wr,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(){C(this,On)||this.setEventListener(C(this,wr))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,On))==null||t.call(this),J(this,On,void 0))}setEventListener(t){var n;J(this,wr,t),(n=C(this,On))==null||n.call(this),J(this,On,t(this.setOnline.bind(this)))}setOnline(t){C(this,vr)!==t&&(J(this,vr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return C(this,vr)}},vr=new WeakMap,On=new WeakMap,wr=new WeakMap,Mc),zi=new Pf;function Qo(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function Df(e){return Math.min(1e3*2**e,3e4)}function Wc(e){return(e??"online")==="online"?zi.isOnline():!0}var Jc=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function To(e){return e instanceof Jc}function zc(e){let t=!1,n=0,r=!1,o;const i=Qo(),s=v=>{var p;r||(h(new Jc(v)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},c=()=>{t=!1},u=()=>Ts.isFocused()&&(e.networkMode==="always"||zi.isOnline())&&e.canRun(),f=()=>Wc(e.networkMode)&&e.canRun(),d=v=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,v),o==null||o(),i.resolve(v))},h=v=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,v),o==null||o(),i.reject(v))},m=()=>new Promise(v=>{var p;o=x=>{(r||u())&&v(x)},(p=e.onPause)==null||p.call(e)}).then(()=>{var v;o=void 0,r||(v=e.onContinue)==null||v.call(e)}),y=()=>{if(r)return;let v;const p=n===0?e.initialPromise:void 0;try{v=p??e.fn()}catch(x){v=Promise.reject(x)}Promise.resolve(v).then(d).catch(x=>{var T;if(r)return;const g=e.retry??(ir?0:3),b=e.retryDelay??Df,O=typeof b=="function"?b(n,x):b,_=g===!0||typeof g=="number"&&n<g||typeof g=="function"&&g(n,x);if(t||!_){h(x);return}n++,(T=e.onFail)==null||T.call(e,n,x),Nf(O).then(()=>u()?void 0:m()).then(()=>{t?h(x):y()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:f,start:()=>(f()?y():m().then(y),i)}}function Ff(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||s()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Be=Ff(),Qn,kc,Gc=(kc=class{constructor(){oe(this,Qn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Wo(this.gcTime)&&J(this,Qn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ir?1/0:5*60*1e3))}clearGcTimeout(){C(this,Qn)&&(clearTimeout(C(this,Qn)),J(this,Qn,void 0))}},Qn=new WeakMap,kc),Ir,br,Nt,Xn,it,li,Yn,Kt,cn,jc,Mf=(jc=class extends Gc{constructor(t){super();oe(this,Kt);oe(this,Ir);oe(this,br);oe(this,Nt);oe(this,Xn);oe(this,it);oe(this,li);oe(this,Yn);J(this,Yn,!1),J(this,li,t.defaultOptions),this.setOptions(t.options),this.observers=[],J(this,Xn,t.client),J(this,Nt,C(this,Xn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,J(this,Ir,kf(this.options)),this.state=t.state??C(this,Ir),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=C(this,it))==null?void 0:t.promise}setOptions(t){this.options={...C(this,li),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,Nt).remove(this)}setData(t,n){const r=Go(this.state.data,t,this.options);return pe(this,Kt,cn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){pe(this,Kt,cn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=C(this,it))==null?void 0:r.promise;return(o=C(this,it))==null||o.cancel(t),n?n.then(Tt).catch(Tt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(C(this,Ir))}isActive(){return this.observers.some(t=>$t(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ji||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Hc(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=C(this,it))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=C(this,it))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),C(this,Nt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(C(this,it)&&(C(this,Yn)?C(this,it).cancel({revert:!0}):C(this,it).cancelRetry()),this.scheduleGc()),C(this,Nt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,Kt,cn).call(this,{type:"invalidate"})}fetch(t,n){var c,u,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(C(this,it))return C(this,it).continueRetry(),C(this,it).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(h=>h.options.queryFn);d&&this.setOptions(d.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=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(J(this,Yn,!0),r.signal)})},i=()=>{const d=Bc(this.options,n),h={client:C(this,Xn),queryKey:this.queryKey,meta:this.meta};return o(h),J(this,Yn,!1),this.options.persister?this.options.persister(d,h,this):d(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:C(this,Xn),state:this.state,fetchFn:i};o(s),(c=this.options.behavior)==null||c.onFetch(s,this),J(this,br,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&pe(this,Kt,cn).call(this,{type:"fetch",meta:(f=s.fetchOptions)==null?void 0:f.meta});const a=d=>{var h,m,y,v;To(d)&&d.silent||pe(this,Kt,cn).call(this,{type:"error",error:d}),To(d)||((m=(h=C(this,Nt).config).onError)==null||m.call(h,d,this),(v=(y=C(this,Nt).config).onSettled)==null||v.call(y,this.state.data,d,this)),this.scheduleGc()};return J(this,it,zc({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var h,m,y,v;if(d===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(d)}catch(p){a(p);return}(m=(h=C(this,Nt).config).onSuccess)==null||m.call(h,d,this),(v=(y=C(this,Nt).config).onSettled)==null||v.call(y,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,h)=>{pe(this,Kt,cn).call(this,{type:"failed",failureCount:d,error:h})},onPause:()=>{pe(this,Kt,cn).call(this,{type:"pause"})},onContinue:()=>{pe(this,Kt,cn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),C(this,it).start()}},Ir=new WeakMap,br=new WeakMap,Nt=new WeakMap,Xn=new WeakMap,it=new WeakMap,li=new WeakMap,Yn=new WeakMap,Kt=new WeakSet,cn=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,...Qc(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return To(o)&&o.revert&&C(this,br)?{...C(this,br),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Be.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),C(this,Nt).notify({query:this,type:"updated",action:t})})},jc);function Qc(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Wc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function kf(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 zt,Lc,jf=(Lc=class extends Vr{constructor(t={}){super();oe(this,zt);this.config=t,J(this,zt,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Ns(o,n);let s=this.get(i);return s||(s=new Mf({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){C(this,zt).has(t.queryHash)||(C(this,zt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=C(this,zt).get(t.queryHash);n&&(t.destroy(),n===t&&C(this,zt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Be.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return C(this,zt).get(t)}getAll(){return[...C(this,zt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Na(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Na(t,r)):n}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Be.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Be.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},zt=new WeakMap,Lc),Gt,st,Zn,Qt,_n,Kc,Lf=(Kc=class extends Gc{constructor(t){super();oe(this,Qt);oe(this,Gt);oe(this,st);oe(this,Zn);this.mutationId=t.mutationId,J(this,st,t.mutationCache),J(this,Gt,[]),this.state=t.state||Xc(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){C(this,Gt).includes(t)||(C(this,Gt).push(t),this.clearGcTimeout(),C(this,st).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){J(this,Gt,C(this,Gt).filter(n=>n!==t)),this.scheduleGc(),C(this,st).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){C(this,Gt).length||(this.state.status==="pending"?this.scheduleGc():C(this,st).remove(this))}continue(){var t;return((t=C(this,Zn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,c,u,f,d,h,m,y,v,p,x,g,b,O,_,T,S;J(this,Zn,zc({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(N,D)=>{pe(this,Qt,_n).call(this,{type:"failed",failureCount:N,error:D})},onPause:()=>{pe(this,Qt,_n).call(this,{type:"pause"})},onContinue:()=>{pe(this,Qt,_n).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,st).canRun(this)}));const n=this.state.status==="pending",r=!C(this,Zn).canStart();try{if(!n){pe(this,Qt,_n).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=C(this,st).config).onMutate)==null?void 0:i.call(o,t,this));const D=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));D!==this.state.context&&pe(this,Qt,_n).call(this,{type:"pending",context:D,variables:t,isPaused:r})}const N=await C(this,Zn).start();return await((u=(c=C(this,st).config).onSuccess)==null?void 0:u.call(c,N,t,this.state.context,this)),await((d=(f=this.options).onSuccess)==null?void 0:d.call(f,N,t,this.state.context)),await((m=(h=C(this,st).config).onSettled)==null?void 0:m.call(h,N,null,this.state.variables,this.state.context,this)),await((v=(y=this.options).onSettled)==null?void 0:v.call(y,N,null,t,this.state.context)),pe(this,Qt,_n).call(this,{type:"success",data:N}),N}catch(N){try{throw await((x=(p=C(this,st).config).onError)==null?void 0:x.call(p,N,t,this.state.context,this)),await((b=(g=this.options).onError)==null?void 0:b.call(g,N,t,this.state.context)),await((_=(O=C(this,st).config).onSettled)==null?void 0:_.call(O,void 0,N,this.state.variables,this.state.context,this)),await((S=(T=this.options).onSettled)==null?void 0:S.call(T,void 0,N,t,this.state.context)),N}finally{pe(this,Qt,_n).call(this,{type:"error",error:N})}}finally{C(this,st).runNext(this)}}},Gt=new WeakMap,st=new WeakMap,Zn=new WeakMap,Qt=new WeakSet,_n=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Be.batch(()=>{C(this,Gt).forEach(r=>{r.onMutationUpdate(t)}),C(this,st).notify({mutation:this,type:"updated",action:t})})},Kc);function Xc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ln,Vt,ui,Vc,Kf=(Vc=class extends Vr{constructor(t={}){super();oe(this,ln);oe(this,Vt);oe(this,ui);this.config=t,J(this,ln,new Set),J(this,Vt,new Map),J(this,ui,0)}build(t,n,r){const o=new Lf({mutationCache:this,mutationId:++Ri(this,ui)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){C(this,ln).add(t);const n=Ai(t);if(typeof n=="string"){const r=C(this,Vt).get(n);r?r.push(t):C(this,Vt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(C(this,ln).delete(t)){const n=Ai(t);if(typeof n=="string"){const r=C(this,Vt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&C(this,Vt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ai(t);if(typeof n=="string"){const r=C(this,Vt).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=Ai(t);if(typeof n=="string"){const o=(r=C(this,Vt).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Be.batch(()=>{C(this,ln).forEach(t=>{this.notify({type:"removed",mutation:t})}),C(this,ln).clear(),C(this,Vt).clear()})}getAll(){return Array.from(C(this,ln))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ta(n,r))}findAll(t={}){return this.getAll().filter(n=>Ta(t,n))}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Be.batch(()=>Promise.all(t.map(n=>n.continue().catch(Tt))))}},ln=new WeakMap,Vt=new WeakMap,ui=new WeakMap,Vc);function Ai(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Pa(e){return{onFetch:(t,n)=>{var f,d,h,m,y;const r=t.options,o=(h=(d=(f=t.fetchOptions)==null?void 0:f.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:[]},c=0;const u=async()=>{let v=!1;const p=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(t.signal.aborted?v=!0:t.signal.addEventListener("abort",()=>{v=!0}),t.signal)})},x=Bc(t.options,t.fetchOptions),g=async(b,O,_)=>{if(v)return Promise.reject();if(O==null&&b.pages.length)return Promise.resolve(b);const T={client:t.client,queryKey:t.queryKey,pageParam:O,direction:_?"backward":"forward",meta:t.options.meta};p(T);const S=await x(T),{maxPages:N}=t.options,D=_?Rf:Tf;return{pages:D(b.pages,S,N),pageParams:D(b.pageParams,O,N)}};if(o&&i.length){const b=o==="backward",O=b?Vf:Da,_={pages:i,pageParams:s},T=O(r,_);a=await g(_,T,b)}else{const b=e??i.length;do{const O=c===0?s[0]??r.initialPageParam:Da(r,a);if(c>0&&O==null)break;a=await g(a,O),c++}while(c<b)}return a};t.options.persister?t.fetchFn=()=>{var v,p;return(p=(v=t.options).persister)==null?void 0:p.call(v,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function Da(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 Vf(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var ke,Cn,En,_r,xr,Sn,Or,Cr,$c,$f=($c=class{constructor(e={}){oe(this,ke);oe(this,Cn);oe(this,En);oe(this,_r);oe(this,xr);oe(this,Sn);oe(this,Or);oe(this,Cr);J(this,ke,e.queryCache||new jf),J(this,Cn,e.mutationCache||new Kf),J(this,En,e.defaultOptions||{}),J(this,_r,new Map),J(this,xr,new Map),J(this,Sn,0)}mount(){Ri(this,Sn)._++,C(this,Sn)===1&&(J(this,Or,Ts.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,ke).onFocus())})),J(this,Cr,zi.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,ke).onOnline())})))}unmount(){var e,t;Ri(this,Sn)._--,C(this,Sn)===0&&((e=C(this,Or))==null||e.call(this),J(this,Or,void 0),(t=C(this,Cr))==null||t.call(this),J(this,Cr,void 0))}isFetching(e){return C(this,ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return C(this,Cn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=C(this,ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=C(this,ke).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(mr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return C(this,ke).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=C(this,ke).get(r.queryHash),i=o==null?void 0:o.state.data,s=Sf(t,i);if(s!==void 0)return C(this,ke).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Be.batch(()=>C(this,ke).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=C(this,ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=C(this,ke);Be.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=C(this,ke),r={type:"active",...e};return Be.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Be.batch(()=>C(this,ke).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Tt).catch(Tt)}invalidateQueries(e,t={}){return Be.batch(()=>{if(C(this,ke).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none")return Promise.resolve();const n={...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"};return this.refetchQueries(n,t)})}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Be.batch(()=>C(this,ke).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Tt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Tt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=C(this,ke).build(this,t);return n.isStaleByTime(mr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Tt).catch(Tt)}fetchInfiniteQuery(e){return e.behavior=Pa(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Tt).catch(Tt)}ensureInfiniteQueryData(e){return e.behavior=Pa(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return zi.isOnline()?C(this,Cn).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,ke)}getMutationCache(){return C(this,Cn)}getDefaultOptions(){return C(this,En)}setDefaultOptions(e){J(this,En,e)}setQueryDefaults(e,t){C(this,_r).set(or(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...C(this,_r).values()],n={};return t.forEach(r=>{ti(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){C(this,xr).set(or(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...C(this,xr).values()];let n={};return t.forEach(r=>{ti(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...C(this,En).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ns(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ji&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...C(this,En).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){C(this,ke).clear(),C(this,Cn).clear()}},ke=new WeakMap,Cn=new WeakMap,En=new WeakMap,_r=new WeakMap,xr=new WeakMap,Sn=new WeakMap,Or=new WeakMap,Cr=new WeakMap,$c),ft,ye,di,at,er,Er,Nn,Xt,fi,Sr,Nr,tr,nr,Tn,Tr,Ce,Qr,Xo,Yo,Zo,es,ts,ns,rs,Yc,Uc,Uf=(Uc=class extends Vr{constructor(t,n){super();oe(this,Ce);oe(this,ft);oe(this,ye);oe(this,di);oe(this,at);oe(this,er);oe(this,Er);oe(this,Nn);oe(this,Xt);oe(this,fi);oe(this,Sr);oe(this,Nr);oe(this,tr);oe(this,nr);oe(this,Tn);oe(this,Tr,new Set);this.options=n,J(this,ft,t),J(this,Xt,null),J(this,Nn,Qo()),this.options.experimental_prefetchInRender||C(this,Nn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,ye).addObserver(this),Fa(C(this,ye),this.options)?pe(this,Ce,Qr).call(this):this.updateResult(),pe(this,Ce,es).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return is(C(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return is(C(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,Ce,ts).call(this),pe(this,Ce,ns).call(this),C(this,ye).removeObserver(this)}setOptions(t,n){const r=this.options,o=C(this,ye);if(this.options=C(this,ft).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof $t(this.options.enabled,C(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,Ce,rs).call(this),C(this,ye).setOptions(this.options),r._defaulted&&!Wi(this.options,r)&&C(this,ft).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,ye),observer:this});const i=this.hasListeners();i&&Ma(C(this,ye),o,this.options,r)&&pe(this,Ce,Qr).call(this),this.updateResult(n),i&&(C(this,ye)!==o||$t(this.options.enabled,C(this,ye))!==$t(r.enabled,C(this,ye))||mr(this.options.staleTime,C(this,ye))!==mr(r.staleTime,C(this,ye)))&&pe(this,Ce,Xo).call(this);const s=pe(this,Ce,Yo).call(this);i&&(C(this,ye)!==o||$t(this.options.enabled,C(this,ye))!==$t(r.enabled,C(this,ye))||s!==C(this,Tn))&&pe(this,Ce,Zo).call(this,s)}getOptimisticResult(t){const n=C(this,ft).getQueryCache().build(C(this,ft),t),r=this.createResult(n,t);return Hf(this,r)&&(J(this,at,r),J(this,Er,this.options),J(this,er,C(this,ye).state)),r}getCurrentResult(){return C(this,at)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){C(this,Tr).add(t)}getCurrentQuery(){return C(this,ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=C(this,ft).defaultQueryOptions(t),r=C(this,ft).getQueryCache().build(C(this,ft),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,Ce,Qr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,at)))}createResult(t,n){var N;const r=C(this,ye),o=this.options,i=C(this,at),s=C(this,er),a=C(this,Er),u=t!==r?t.state:C(this,di),{state:f}=t;let d={...f},h=!1,m;if(n._optimisticResults){const D=this.hasListeners(),U=!D&&Fa(t,n),G=D&&Ma(t,r,n,o);(U||G)&&(d={...d,...Qc(f.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:y,errorUpdatedAt:v,status:p}=d;if(n.select&&d.data!==void 0)if(i&&d.data===(s==null?void 0:s.data)&&n.select===C(this,fi))m=C(this,Sr);else try{J(this,fi,n.select),m=n.select(d.data),m=Go(i==null?void 0:i.data,m,n),J(this,Sr,m),J(this,Xt,null)}catch(D){J(this,Xt,D)}else m=d.data;if(n.placeholderData!==void 0&&m===void 0&&p==="pending"){let D;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))D=i.data;else if(D=typeof n.placeholderData=="function"?n.placeholderData((N=C(this,Nr))==null?void 0:N.state.data,C(this,Nr)):n.placeholderData,n.select&&D!==void 0)try{D=n.select(D),J(this,Xt,null)}catch(U){J(this,Xt,U)}D!==void 0&&(p="success",m=Go(i==null?void 0:i.data,D,n),h=!0)}C(this,Xt)&&(y=C(this,Xt),m=C(this,Sr),v=Date.now(),p="error");const x=d.fetchStatus==="fetching",g=p==="pending",b=p==="error",O=g&&x,_=m!==void 0,S={status:p,fetchStatus:d.fetchStatus,isPending:g,isSuccess:p==="success",isError:b,isInitialLoading:O,isLoading:O,data:m,dataUpdatedAt:d.dataUpdatedAt,error:y,errorUpdatedAt:v,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:x,isRefetching:x&&!g,isLoadingError:b&&!_,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:b&&_,isStale:Rs(t,n),refetch:this.refetch,promise:C(this,Nn)};if(this.options.experimental_prefetchInRender){const D=z=>{S.status==="error"?z.reject(S.error):S.data!==void 0&&z.resolve(S.data)},U=()=>{const z=J(this,Nn,S.promise=Qo());D(z)},G=C(this,Nn);switch(G.status){case"pending":t.queryHash===r.queryHash&&D(G);break;case"fulfilled":(S.status==="error"||S.data!==G.value)&&U();break;case"rejected":(S.status!=="error"||S.error!==G.reason)&&U();break}}return S}updateResult(t){const n=C(this,at),r=this.createResult(C(this,ye),this.options);if(J(this,er,C(this,ye).state),J(this,Er,this.options),C(this,er).data!==void 0&&J(this,Nr,C(this,ye)),Wi(r,n))return;J(this,at,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!C(this,Tr).size)return!0;const c=new Set(a??C(this,Tr));return this.options.throwOnError&&c.add("error"),Object.keys(C(this,at)).some(u=>{const f=u;return C(this,at)[f]!==n[f]&&c.has(f)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),pe(this,Ce,Yc).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,Ce,es).call(this)}},ft=new WeakMap,ye=new WeakMap,di=new WeakMap,at=new WeakMap,er=new WeakMap,Er=new WeakMap,Nn=new WeakMap,Xt=new WeakMap,fi=new WeakMap,Sr=new WeakMap,Nr=new WeakMap,tr=new WeakMap,nr=new WeakMap,Tn=new WeakMap,Tr=new WeakMap,Ce=new WeakSet,Qr=function(t){pe(this,Ce,rs).call(this);let n=C(this,ye).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Tt)),n},Xo=function(){pe(this,Ce,ts).call(this);const t=mr(this.options.staleTime,C(this,ye));if(ir||C(this,at).isStale||!Wo(t))return;const r=Hc(C(this,at).dataUpdatedAt,t)+1;J(this,tr,setTimeout(()=>{C(this,at).isStale||this.updateResult()},r))},Yo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,ye)):this.options.refetchInterval)??!1},Zo=function(t){pe(this,Ce,ns).call(this),J(this,Tn,t),!(ir||$t(this.options.enabled,C(this,ye))===!1||!Wo(C(this,Tn))||C(this,Tn)===0)&&J(this,nr,setInterval(()=>{(this.options.refetchIntervalInBackground||Ts.isFocused())&&pe(this,Ce,Qr).call(this)},C(this,Tn)))},es=function(){pe(this,Ce,Xo).call(this),pe(this,Ce,Zo).call(this,pe(this,Ce,Yo).call(this))},ts=function(){C(this,tr)&&(clearTimeout(C(this,tr)),J(this,tr,void 0))},ns=function(){C(this,nr)&&(clearInterval(C(this,nr)),J(this,nr,void 0))},rs=function(){const t=C(this,ft).getQueryCache().build(C(this,ft),this.options);if(t===C(this,ye))return;const n=C(this,ye);J(this,ye,t),J(this,di,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Yc=function(t){Be.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(C(this,at))}),C(this,ft).getQueryCache().notify({query:C(this,ye),type:"observerResultsUpdated"})})},Uc);function qf(e,t){return $t(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Fa(e,t){return qf(e,t)||e.state.data!==void 0&&is(e,t,t.refetchOnMount)}function is(e,t,n){if($t(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Rs(e,t)}return!1}function Ma(e,t,n,r){return(e!==t||$t(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Rs(e,n)}function Rs(e,t){return $t(t.enabled,e)!==!1&&e.isStaleByTime(mr(t.staleTime,e))}function Hf(e,t){return!Wi(e.getCurrentResult(),t)}var Rn,An,pt,un,pn,$i,os,qc,Bf=(qc=class extends Vr{constructor(n,r){super();oe(this,pn);oe(this,Rn);oe(this,An);oe(this,pt);oe(this,un);J(this,Rn,n),this.setOptions(r),this.bindMethods(),pe(this,pn,$i).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=C(this,Rn).defaultMutationOptions(n),Wi(this.options,r)||C(this,Rn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,pt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&or(r.mutationKey)!==or(this.options.mutationKey)?this.reset():((o=C(this,pt))==null?void 0:o.state.status)==="pending"&&C(this,pt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=C(this,pt))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,pn,$i).call(this),pe(this,pn,os).call(this,n)}getCurrentResult(){return C(this,An)}reset(){var n;(n=C(this,pt))==null||n.removeObserver(this),J(this,pt,void 0),pe(this,pn,$i).call(this),pe(this,pn,os).call(this)}mutate(n,r){var o;return J(this,un,r),(o=C(this,pt))==null||o.removeObserver(this),J(this,pt,C(this,Rn).getMutationCache().build(C(this,Rn),this.options)),C(this,pt).addObserver(this),C(this,pt).execute(n)}},Rn=new WeakMap,An=new WeakMap,pt=new WeakMap,un=new WeakMap,pn=new WeakSet,$i=function(){var r;const n=((r=C(this,pt))==null?void 0:r.state)??Xc();J(this,An,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},os=function(n){Be.batch(()=>{var r,o,i,s,a,c,u,f;if(C(this,un)&&this.hasListeners()){const d=C(this,An).variables,h=C(this,An).context;(n==null?void 0:n.type)==="success"?((o=(r=C(this,un)).onSuccess)==null||o.call(r,n.data,d,h),(s=(i=C(this,un)).onSettled)==null||s.call(i,n.data,null,d,h)):(n==null?void 0:n.type)==="error"&&((c=(a=C(this,un)).onError)==null||c.call(a,n.error,d,h),(f=(u=C(this,un)).onSettled)==null||f.call(u,void 0,n.error,d,h))}this.listeners.forEach(d=>{d(C(this,An))})})},qc),Zc=V.createContext(void 0),Wt=e=>{const t=V.useContext(Zc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Wf=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Zc.Provider,{value:e,children:t})),el=V.createContext(!1),Jf=()=>V.useContext(el);el.Provider;function zf(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Gf=V.createContext(zf()),Qf=()=>V.useContext(Gf);function tl(e,t){return typeof e=="function"?e(...t):!!e}function ss(){}var Xf=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Yf=e=>{V.useEffect(()=>{e.clearReset()},[e])},Zf=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||tl(n,[e.error,r])),ep=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},tp=(e,t)=>e.isLoading&&e.isFetching&&!t,np=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,ka=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function rp(e,t,n){var d,h,m,y,v;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=Wt(),o=Jf(),i=Qf(),s=r.defaultQueryOptions(e);(h=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||h.call(d,s),s._optimisticResults=o?"isRestoring":"optimistic",ep(s),Xf(s,i),Yf(i);const a=!r.getQueryCache().get(s.queryHash),[c]=V.useState(()=>new t(r,s)),u=c.getOptimisticResult(s),f=!o&&e.subscribed!==!1;if(V.useSyncExternalStore(V.useCallback(p=>{const x=f?c.subscribe(Be.batchCalls(p)):ss;return c.updateResult(),x},[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),V.useEffect(()=>{c.setOptions(s,{listeners:!1})},[s,c]),np(s,u))throw ka(s,c,i);if(Zf({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw u.error;if((y=(m=r.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||y.call(m,s,u),s.experimental_prefetchInRender&&!ir&&tp(u,o)){const p=a?ka(s,c,i):(v=r.getQueryCache().get(s.queryHash))==null?void 0:v.promise;p==null||p.catch(ss).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?u:c.trackResult(u)}function hn(e,t){return rp(e,Uf)}function uo(e,t){const n=Wt(),[r]=V.useState(()=>new Bf(n,e));V.useEffect(()=>{r.setOptions(e)},[r,e]);const o=V.useSyncExternalStore(V.useCallback(s=>r.subscribe(Be.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=V.useCallback((s,a)=>{r.mutate(s,a).catch(ss)},[r]);if(o.error&&tl(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const nl=w.createContext(null),ip=nl.Provider,rl=()=>{const e=w.useContext(nl);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var ue=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e.VALUE_MAPPING="valueMappingError",e))(ue||{});const il=w.createContext(void 0);function Rt(){const e=w.useContext(il);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const op=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function sp({children:e}){const[t,n]=w.useState(op),r=w.useCallback((f,d,h=!0)=>{n(m=>{const y={...m};return y[f]=y[f]||{},y[f][d]=h,y})},[n]),o=w.useCallback((f,d)=>{var h;return!!((h=t[f])!=null&&h[d])},[t]),i=w.useCallback((f,d)=>{var h;return(h=t[f])==null?void 0:h[d]},[t]),s=w.useCallback((f,d)=>{n(h=>{var y;const m={...h};return(y=m[f])==null||delete y[d],m})},[n]),a=w.useCallback(f=>{n(d=>{const h={...d};return h[f]={},h})},[n]),c=w.useCallback((f,d)=>{n(h=>{const m={...h};return m[f]=m[f]||{},d.forEach(y=>{m[f][y]=!0}),m})},[n]),u=w.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:c,getError:i}),[t,n,r,o,s,a,c,i]);return l.jsx(il.Provider,{value:u,children:e})}const ap="https://api.withampersand.com/v1".replace(/\/+$/,"");class As{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:ap}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||sl}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const cp=new As,lo=class lo{constructor(t=cp){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 dp(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?lo.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:o}=await this.createFetchParams(t,n),i=await this.fetchApi(r,o);if(i&&i.status>=200&&i.status<300)return i;throw new ol(i,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const o=Object.assign({},this.configuration.headers,t.headers);Object.keys(o).forEach(u=>o[u]===void 0?delete o[u]:{});const i=typeof n=="function"?n:async()=>n,s={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},a={...s,...await i({init:s,context:t})},c={...a,body:up(a.body)||a.body instanceof URLSearchParams||lp(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};lo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Yt=lo;function lp(e){return typeof Blob<"u"&&e instanceof Blob}function up(e){return typeof FormData<"u"&&e instanceof FormData}class ol extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class dp extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class re extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function R(e,t){const n=e[t];return n!=null}function sl(e,t=""){return Object.keys(e).map(n=>al(n,e[n],t)).filter(n=>n.length>0).join("&")}function al(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const o=t.map(i=>encodeURIComponent(String(i))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${o}`}if(t instanceof Set){const o=Array.from(t);return al(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?sl(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Rr(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class je{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class sr{constructor(t){this.raw=t}async value(){}}class ja{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function fp(e){return pp(e)}function pp(e,t){return e==null?e:{fieldUsed:R(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:R(e,"keyFormat")?e.keyFormat:void 0}}function hp(e){return mp(e)}function mp(e,t){return e==null?e:{name:e.name,valuePrefix:R(e,"valuePrefix")?e.valuePrefix:void 0}}function gp(e){return yp(e)}function yp(e,t){return e==null?e:{name:e.name}}function vp(e){return wp(e)}function wp(e,t){return e==null?e:{attachmentType:e.attachmentType,query:R(e,"query")?gp(e.query):void 0,header:R(e,"header")?hp(e.header):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function Ip(e){return bp(e)}function bp(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0,includeFullRecords:R(e,"includeFullRecords")?e.includeFullRecords:void 0}}function _p(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function xp(e){return Op(e)}function Op(e,t){return e}function Cp(e){return Ep(e)}function Ep(e,t){return e==null?e:{days:R(e,"days")?e.days:void 0,fullHistory:R(e,"fullHistory")?e.fullHistory:void 0}}function Sp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function cl(e){return Np(e)}function Np(e,t){return e==null?e:{defaultPeriod:Cp(e.defaultPeriod)}}function Tp(e){if(e!==void 0)return e===null?null:{defaultPeriod:Sp(e.defaultPeriod)}}function Rp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Ap(e){if(e!==void 0)return e===null?null:{defaultPeriod:Rp(e.defaultPeriod)}}function Pp(e){return Dp(e)}function Dp(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function ll(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fp(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Ap(e.backfill)}}function Mp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Rr(e.objects,Fp)}}function kp(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}function jp(e){if(e!==void 0)return e===null?null:{default:kp(e._default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function Lp(e){let t=!0;return t=t&&"value"in e,t}function Kp(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Vp(e){let t=!0;return t=t&&"value"in e,t}function $p(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Up(e){let t=!0;return t=t&&"value"in e,t}function qp(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Hp(e){if(e!==void 0)return e===null?null:Lp(e)?Kp(e):Vp(e)?$p(e):Up(e)?qp(e):{}}function Bp(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Rr(e.selectedValueDefaults,Hp),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Rr(e.selectedFieldSettings,jp)}}function Wp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Rr(e.objects,Bp)}}function Jp(e){return zp(e)}function zp(e,t){return e==null?e:{apiKeyAsBasic:R(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:R(e,"apiKeyAsBasicOpts")?fp(e.apiKeyAsBasicOpts):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function Gp(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Qp(e){return Xp(e)}function Xp(e,t){return e==null?e:{value:e.value}}function Yp(e){return Zp(e)}function Zp(e,t){return e==null?e:{brandingRemoval:R(e,"brandingRemoval")?Qp(e.brandingRemoval):void 0}}function Pi(e){return eh(e)}function eh(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:R(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:R(e,"entitlements")?Yp(e.entitlements):void 0}}function th(e){return nh(e)}function nh(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function rh(e){return ih(e)}function ih(e,t){return e==null?e:{provider:e.provider,read:R(e,"read")?e.read:void 0,write:R(e,"write")?e.write:void 0,proxy:R(e,"proxy")?Pp(e.proxy):void 0}}function oh(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:ll(e.proxy)}}function sh(e){return ah(e)}function ah(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:rh(e.content)}}function ch(e){return lh(e)}function lh(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function ul(e){return uh(e)}function uh(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function dh(e){return fh(e)}function fh(e,t){return e==null?e:{token:e.token,issuedAt:R(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:R(e,"expiresAt")?new Date(e.expiresAt):void 0}}function ph(e){return hh(e)}function hh(e,t){return e==null?e:{token:e.token,issuedAt:R(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:R(e,"expiresAt")?new Date(e.expiresAt):void 0}}function mh(e){return gh(e)}function gh(e,t){return e==null?e:{accessToken:R(e,"accessToken")?dh(e.accessToken):void 0,refreshToken:R(e,"refreshToken")?ph(e.refreshToken):void 0,scopes:R(e,"scopes")?e.scopes:void 0}}function Ui(e){return yh(e)}function yh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:R(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:R(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Xr(e){return vh(e)}function vh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:R(e,"providerApp")?Ui(e.providerApp):void 0,group:ul(e.group),consumer:ch(e.consumer),providerWorkspaceRef:R(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:R(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:R(e,"oauth2AuthorizationCode")?mh(e.oauth2AuthorizationCode):void 0,apiKey:R(e,"apiKey")?e.apiKey:void 0}}function wh(e){return Ih(e)}function Ih(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function bh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function _h(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:oh(e.content)}}function xh(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:_h(e.config)}}function Oh(e){return Ch(e)}function Ch(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Eh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Sh(e){return Nh(e)}function Nh(e,t){return e==null?e:{mode:R(e,"mode")?e.mode:void 0,pageSize:R(e,"pageSize")?e.pageSize:void 0}}function Th(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Rh(e){let t=!0;return t=t&&"fieldName"in e,t}function Ah(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Ph(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Dh(e){let t=!0;return t=t&&"mapToName"in e,t}function dl(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:R(e,"default")?e.default:void 0,prompt:R(e,"prompt")?e.prompt:void 0}}function Fh(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function La(e){return Mh(e)}function Mh(e,t){return e==null?e:{...Ah(e),...dl(e)}}function Ka(e){if(e!==void 0)return e===null?null:Rh(e)?Ph(e):Dh(e)?Fh(e):{}}function fl(e){return kh(e)}function kh(e,t){return e}function jh(e){return Lh(e)}function Lh(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:R(e,"requiredFields")?e.requiredFields.map(La):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(La):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?fl(e.optionalFieldsAuto):void 0,backfill:R(e,"backfill")?cl(e.backfill):void 0,delivery:R(e,"delivery")?Sh(e.delivery):void 0}}function Kh(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(Ka),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Ka),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Tp(e.backfill),delivery:Th(e.delivery)}}function Vh(e){return $h(e)}function $h(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(jh):void 0}}function Uh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Kh)}}function qh(e){return Hh(e)}function Hh(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Bh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Wh(e){return Jh(e)}function Jh(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0,watchFieldsAuto:R(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:R(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function zh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Gh(e){return Qh(e)}function Qh(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:R(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:R(e,"createEvent")?wh(e.createEvent):void 0,updateEvent:R(e,"updateEvent")?Wh(e.updateEvent):void 0,deleteEvent:R(e,"deleteEvent")?qh(e.deleteEvent):void 0,associationChangeEvent:R(e,"associationChangeEvent")?Ip(e.associationChangeEvent):void 0,otherEvents:R(e,"otherEvents")?e.otherEvents:void 0}}function Xh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:bh(e.createEvent),updateEvent:zh(e.updateEvent),deleteEvent:Bh(e.deleteEvent),associationChangeEvent:_p(e.associationChangeEvent),otherEvents:e.otherEvents}}function Yh(e){return Zh(e)}function Zh(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Gh):void 0}}function em(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Xh)}}function pl(e){return tm(e)}function tm(e,t){return e==null?e:{allowAnyFields:R(e,"allowAnyFields")?e.allowAnyFields:void 0}}function nm(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function rm(e){return im(e)}function im(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:R(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:R(e,"valueDefaults")?pl(e.valueDefaults):void 0}}function om(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:nm(e.valueDefaults)}}function sm(e){return am(e)}function am(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(rm):void 0}}function cm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(om)}}function lm(e){return um(e)}function um(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?Vh(e.read):void 0,write:R(e,"write")?sm(e.write):void 0,proxy:R(e,"proxy")?Oh(e.proxy):void 0,subscribe:R(e,"subscribe")?Yh(e.subscribe):void 0}}function dm(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:Uh(e.read),write:cm(e.write),proxy:Eh(e.proxy),subscribe:em(e.subscribe)}}function fm(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:dm(e.content)}}function pm(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:fm(e.latestRevision)}}function hm(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function mm(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 gm(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function ym(e){return vm(e)}function vm(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function wm(e){return Im(e)}function Im(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:R(e,"valueType")?e.valueType:void 0,providerType:R(e,"providerType")?e.providerType:void 0,readOnly:R(e,"readOnly")?e.readOnly:void 0,values:R(e,"values")?e.values.map(ym):void 0}}function bm(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 _m(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 hl(e){if(e!==void 0)return e===null?null:{accessToken:bm(e.accessToken),refreshToken:_m(e.refreshToken),scopes:e.scopes}}function ml(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function gl(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function yl(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 xm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:ml(e.basicAuth),oauth2ClientCredentials:gl(e.oauth2ClientCredentials),oauth2Password:yl(e.oauth2Password),oauth2AuthorizationCode:hl(e.oauth2AuthorizationCode)}}function Om(e){return Cm(e)}function Cm(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Em(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Ro(e){return Sm(e)}function Sm(e,t){return e==null?e:{...Em(e),...dl(e)}}function Nm(e){return Tm(e)}function Tm(e,t){return e==null?e:{error:R(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:R(e,"requiredFields")?e.requiredFields.map(Ro):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(Ro):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?fl(e.optionalFieldsAuto):void 0,allFields:R(e,"allFields")?e.allFields.map(Ro):void 0,allFieldsMetadata:R(e,"allFieldsMetadata")?Rr(e.allFieldsMetadata,wm):void 0,backfill:R(e,"backfill")?cl(e.backfill):void 0}}function Rm(e){return Am(e)}function Am(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Nm):void 0}}function Pm(e){return Dm(e)}function Dm(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:R(e,"valueDefaults")?pl(e.valueDefaults):void 0}}function Fm(e){return Mm(e)}function Mm(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Pm):void 0}}function km(e){return jm(e)}function jm(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?Rm(e.read):void 0,write:R(e,"write")?Fm(e.write):void 0,proxy:R(e,"proxy")?Om(e.proxy):void 0}}function Lm(e){return Km(e)}function Km(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:km(e.content)}}function Di(e){return Vm(e)}function Vm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:R(e,"group")?ul(e.group):void 0,healthStatus:e.healthStatus,connection:Xr(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,config:sh(e.config)}}function $m(e){return Um(e)}function Um(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:lm(e.content)}}function Va(e){return qm(e)}function qm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:$m(e.latestRevision)}}function Hm(e){return Bm(e)}function Bm(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function Wm(e){return Jm(e)}function Jm(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function zm(e){return Gm(e)}function Gm(e,t){return e==null?e:{regular:R(e,"regular")?Wm(e.regular):void 0,darkMode:R(e,"darkMode")?Hm(e.darkMode):void 0}}function Qm(e){return Xm(e)}function Xm(e,t){return e==null?e:{workspaceRefField:R(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:R(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:R(e,"scopesField")?e.scopesField:void 0}}function Ym(e){return Zm(e)}function Zm(e,t){return e==null?e:{grantType:e.grantType,authURL:R(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:R(e,"audience")?e.audience:void 0,tokenMetadataFields:Qm(e.tokenMetadataFields),docsURL:R(e,"docsURL")?e.docsURL:void 0,authURLParams:R(e,"authURLParams")?e.authURLParams:void 0}}function eg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function tg(e){return ng(e)}function ng(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function rg(e){return ig(e)}function ig(e,t){return e==null?e:{create:R(e,"create")?e.create:void 0,update:R(e,"update")?e.update:void 0,_delete:R(e,"delete")?e.delete:void 0,passThrough:R(e,"passThrough")?e.passThrough:void 0}}function og(e){return sg(e)}function sg(e,t){return e==null?e:{bulkWrite:th(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:R(e,"subscribeSupport")?rg(e.subscribeSupport):void 0}}function $a(e){return ag(e)}function ag(e,t){return e==null?e:{name:e.name,authType:xp(e.authType),baseURL:e.baseURL,oauth2Opts:R(e,"oauth2Opts")?Ym(e.oauth2Opts):void 0,apiKeyOpts:R(e,"apiKeyOpts")?vp(e.apiKeyOpts):void 0,basicOpts:R(e,"basicOpts")?Jp(e.basicOpts):void 0,support:og(e.support),providerOpts:e.providerOpts,displayName:R(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:R(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:R(e,"media")?zm(e.media):void 0,labels:R(e,"labels")?e.labels:void 0,subscribeOpts:R(e,"subscribeOpts")?tg(e.subscribeOpts):void 0}}function cg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:ml(e.basicAuth),oauth2ClientCredentials:gl(e.oauth2ClientCredentials),oauth2Password:yl(e.oauth2Password),oauth2AuthorizationCode:hl(e.oauth2AuthorizationCode)}}function lg(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Mp(e.read),write:Wp(e.write),proxy:ll(e.proxy)}}function ug(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:lg(e.content)}}function dg(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:ug(e.config)}}function fg(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:dg(e.installation)}}function pg(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function hg(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:pg(e.project)}}function mg(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 gg(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:mg(e.providerApp)}}class yg extends Yt{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new sr(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:xm(t.generateConnectionParams)},n);return new je(i,s=>Xr(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new je(i,s=>Xr(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Xr))}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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new re("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:cg(t.updateConnectionRequest)},n);return new je(i,s=>Xr(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class vg extends Yt{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new re("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:xh(t.installation)},n);return new je(i,s=>Di(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:o,query:r},n);return new sr(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:r},n);return new je(i,s=>Di(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Di))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new re("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:o,query:r,body:fg(t.installationUpdate)},n);return new je(i,s=>Di(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class wg extends Yt{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new re("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:Gp(t.batchUpsertIntegrationsRequest)},n);return new je(i,s=>s.map(Va))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new re("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:pm(t.integration)},n);return new sr(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new sr(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Va))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Ig extends Yt{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new re("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:eg(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new ja(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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}/oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"POST",headers:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new ja(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class bg extends Yt{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new re("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:hm(t.project)},n);return new je(i,s=>Pi(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:o,query:r},n);return new sr(i)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>Pi(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new je(o,i=>i.map(Pi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new re("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:hg(t.projectUpdate)},n);return new je(i,s=>Pi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class _g extends Yt{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new re("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new je(i,s=>$a(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new je(o,i=>Rr(i,$a))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class xg extends Yt{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new re("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:mm(t.providerApp)},n);return new je(i,s=>Ui(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new sr(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Ui))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new re("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:gg(t.providerAppUpdate)},n);return new je(i,s=>Ui(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Og extends Yt{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new re("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:gm(t.revision)},n);return new sr(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new re("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:o,query:r},n);return new je(i,s=>Lm(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class vl{constructor(t){this.connectionApi=new yg(t),this.installationApi=new vg(t),this.integrationApi=new wg(t),this.oAuthApi=new Ig(t),this.projectApi=new bg(t),this.providerApi=new _g(t),this.providerAppApi=new xg(t),this.revisionApi=new Og(t)}}const wl="2.5.3",Cg="v1",Fi="https://api.withampersand.com";function Il(){try{const e=process.env.REACT_APP_AMP_SERVER;switch(e){case"local":return"http://localhost:8080";case"dev":return"https://dev-api.withampersand.com";case"staging":return"https://staging-api.withampersand.com";case"prod":return Fi;case"mock":return"http://127.0.0.1:4010";case"":return Fi;default:return e??Fi}}catch{return Fi}}const Eg=(e,t)=>`${e}/${t}`;function Sg(){return Eg(Il(),Cg)}const Ng=Il(),bl=Sg(),Tg=new As({basePath:bl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":wl}});let Rg=new vl(Tg);const Ps=()=>Rg;function xt(){const e=rl();return w.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new As({basePath:bl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":wl,"X-Api-Key":e}});return new vl(n)},[e])}const Ag=e=>{const t=xt();return hn({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},_l=w.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Fe=()=>{const e=w.useContext(_l);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Pg({projectIdOrName:e,children:t}){const{setError:n}=Rt(),{data:r,isLoading:o,isError:i}=Ag(e);w.useEffect(()=>{i&&n(ue.PROJECT,e)},[i,e,n]);const s=w.useMemo(()=>({projectId:(r==null?void 0:r.id)||"",projectIdOrName:e,project:r||null,appName:(r==null?void 0:r.appName)||"",isLoading:o}),[e,r,o]);return l.jsx(_l.Provider,{value:s,children:t})}function xl(){const e=xt(),{projectIdOrName:t}=Fe();return hn({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})}const ot=async(e,t)=>{var n;if(e instanceof ol){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
|
|
2
|
-
`))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const
|
|
1
|
+
"use strict";var Ma=e=>{throw TypeError(e)};var Po=(e,t,n)=>t.has(e)||Ma("Cannot "+n);var O=(e,t,n)=>(Po(e,t,"read from private field"),n?n.call(e):t.get(e)),oe=(e,t,n)=>t.has(e)?Ma("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),J=(e,t,n,r)=>(Po(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(Po(e,t,"access private method"),n);var Fi=(e,t,n,r)=>({set _(o){J(e,t,o,n)},get _(){return O(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),v=require("react");require("react-dom");function Mf(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 V=Mf(v);var Wr=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(){}},ar=typeof window>"u"||"Deno"in globalThis;function At(){}function kf(e,t){return typeof e=="function"?e(t):e}function Yo(e){return typeof e=="number"&&e>=0&&e!==1/0}function el(e,t){return Math.max(e+(t||0)-Date.now(),0)}function br(e,t){return typeof e=="function"?e(t):e}function qt(e,t){return typeof e=="function"?e(t):e}function ka(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Ds(s,t.options))return!1}else if(!ci(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function ja(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(cr(t.options.mutationKey)!==cr(i))return!1}else if(!ci(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Ds(e,t){return((t==null?void 0:t.queryKeyHashFn)||cr)(e)}function cr(e){return JSON.stringify(e,(t,n)=>es(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).some(n=>!ci(e[n],t[n])):!1}function Zo(e,t){if(e===t)return e;const n=La(e)&&La(t);if(n||es(e)&&es(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=0;for(let u=0;u<s;u++){const f=n?u:i[u];(!n&&r.includes(f)||n)&&e[f]===void 0&&t[f]===void 0?(a[f]=void 0,l++):(a[f]=Zo(e[f],t[f]),a[f]===e[f]&&e[f]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function Qi(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 La(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function es(e){if(!Ka(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Ka(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ka(e){return Object.prototype.toString.call(e)==="[object Object]"}function jf(e){return new Promise(t=>{setTimeout(t,e)})}function ts(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Zo(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return Zo(e,t)}return t}function Lf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Kf(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xi=Symbol();function tl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Xi&&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===Xi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Yn,Sn,xr,Hc,Vf=(Hc=class extends Wr{constructor(){super();oe(this,Yn);oe(this,Sn);oe(this,xr);J(this,xr,t=>{if(!ar&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,Sn)||this.setEventListener(O(this,xr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Sn))==null||t.call(this),J(this,Sn,void 0))}setEventListener(t){var n;J(this,xr,t),(n=O(this,Sn))==null||n.call(this),J(this,Sn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,Yn)!==t&&(J(this,Yn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof O(this,Yn)=="boolean"?O(this,Yn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Yn=new WeakMap,Sn=new WeakMap,xr=new WeakMap,Hc),Fs=new Vf,Cr,Nn,Or,Bc,Uf=(Bc=class extends Wr{constructor(){super();oe(this,Cr,!0);oe(this,Nn);oe(this,Or);J(this,Or,t=>{if(!ar&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){O(this,Nn)||this.setEventListener(O(this,Or))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Nn))==null||t.call(this),J(this,Nn,void 0))}setEventListener(t){var n;J(this,Or,t),(n=O(this,Nn))==null||n.call(this),J(this,Nn,t(this.setOnline.bind(this)))}setOnline(t){O(this,Cr)!==t&&(J(this,Cr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,Cr)}},Cr=new WeakMap,Nn=new WeakMap,Or=new WeakMap,Bc),Yi=new Uf;function ns(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function $f(e){return Math.min(1e3*2**e,3e4)}function nl(e){return(e??"online")==="online"?Yi.isOnline():!0}var rl=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Do(e){return e instanceof rl}function il(e){let t=!1,n=0,r=!1,o;const i=ns(),s=w=>{var p;r||(m(new rl(w)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},l=()=>{t=!1},u=()=>Fs.isFocused()&&(e.networkMode==="always"||Yi.isOnline())&&e.canRun(),f=()=>nl(e.networkMode)&&e.canRun(),d=w=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,w),o==null||o(),i.resolve(w))},m=w=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,w),o==null||o(),i.reject(w))},h=()=>new Promise(w=>{var p;o=b=>{(r||u())&&w(b)},(p=e.onPause)==null||p.call(e)}).then(()=>{var w;o=void 0,r||(w=e.onContinue)==null||w.call(e)}),y=()=>{if(r)return;let w;const p=n===0?e.initialPromise:void 0;try{w=p??e.fn()}catch(b){w=Promise.reject(b)}Promise.resolve(w).then(d).catch(b=>{var T;if(r)return;const g=e.retry??(ar?0:3),_=e.retryDelay??$f,x=typeof _=="function"?_(n,b):_,C=g===!0||typeof g=="number"&&n<g||typeof g=="function"&&g(n,b);if(t||!C){m(b);return}n++,(T=e.onFail)==null||T.call(e,n,b),jf(x).then(()=>u()?void 0:h()).then(()=>{t?m(b):y()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:l,canStart:f,start:()=>(f()?y():h().then(y),i)}}function qf(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var We=qf(),Zn,Wc,ol=(Wc=class{constructor(){oe(this,Zn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Yo(this.gcTime)&&J(this,Zn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ar?1/0:5*60*1e3))}clearGcTimeout(){O(this,Zn)&&(clearTimeout(O(this,Zn)),J(this,Zn,void 0))}},Zn=new WeakMap,Wc),Er,Sr,Rt,er,st,mi,tr,Ut,dn,Jc,Hf=(Jc=class extends ol{constructor(t){super();oe(this,Ut);oe(this,Er);oe(this,Sr);oe(this,Rt);oe(this,er);oe(this,st);oe(this,mi);oe(this,tr);J(this,tr,!1),J(this,mi,t.defaultOptions),this.setOptions(t.options),this.observers=[],J(this,er,t.client),J(this,Rt,O(this,er).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,J(this,Er,Bf(this.options)),this.state=t.state??O(this,Er),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,st))==null?void 0:t.promise}setOptions(t){this.options={...O(this,mi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Rt).remove(this)}setData(t,n){const r=ts(this.state.data,t,this.options);return pe(this,Ut,dn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){pe(this,Ut,dn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=O(this,st))==null?void 0:r.promise;return(o=O(this,st))==null||o.cancel(t),n?n.then(At).catch(At):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Er))}isActive(){return this.observers.some(t=>qt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Xi||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!el(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,st))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,st))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Rt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(O(this,st)&&(O(this,tr)?O(this,st).cancel({revert:!0}):O(this,st).cancelRetry()),this.scheduleGc()),O(this,Rt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,Ut,dn).call(this,{type:"invalidate"})}fetch(t,n){var l,u,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,st))return O(this,st).continueRetry(),O(this,st).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(m=>m.options.queryFn);d&&this.setOptions(d.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=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(J(this,tr,!0),r.signal)})},i=()=>{const d=tl(this.options,n),m={client:O(this,er),queryKey:this.queryKey,meta:this.meta};return o(m),J(this,tr,!1),this.options.persister?this.options.persister(d,m,this):d(m)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,er),state:this.state,fetchFn:i};o(s),(l=this.options.behavior)==null||l.onFetch(s,this),J(this,Sr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&pe(this,Ut,dn).call(this,{type:"fetch",meta:(f=s.fetchOptions)==null?void 0:f.meta});const a=d=>{var m,h,y,w;Do(d)&&d.silent||pe(this,Ut,dn).call(this,{type:"error",error:d}),Do(d)||((h=(m=O(this,Rt).config).onError)==null||h.call(m,d,this),(w=(y=O(this,Rt).config).onSettled)==null||w.call(y,this.state.data,d,this)),this.scheduleGc()};return J(this,st,il({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var m,h,y,w;if(d===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(d)}catch(p){a(p);return}(h=(m=O(this,Rt).config).onSuccess)==null||h.call(m,d,this),(w=(y=O(this,Rt).config).onSettled)==null||w.call(y,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,m)=>{pe(this,Ut,dn).call(this,{type:"failed",failureCount:d,error:m})},onPause:()=>{pe(this,Ut,dn).call(this,{type:"pause"})},onContinue:()=>{pe(this,Ut,dn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),O(this,st).start()}},Er=new WeakMap,Sr=new WeakMap,Rt=new WeakMap,er=new WeakMap,st=new WeakMap,mi=new WeakMap,tr=new WeakMap,Ut=new WeakSet,dn=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,...sl(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Do(o)&&o.revert&&O(this,Sr)?{...O(this,Sr),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),We.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,Rt).notify({query:this,type:"updated",action:t})})},Jc);function sl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:nl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Bf(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 Xt,zc,Wf=(zc=class extends Wr{constructor(t={}){super();oe(this,Xt);this.config=t,J(this,Xt,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Ds(o,n);let s=this.get(i);return s||(s=new Hf({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){O(this,Xt).has(t.queryHash)||(O(this,Xt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,Xt).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,Xt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){We.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,Xt).get(t)}getAll(){return[...O(this,Xt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ka(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>ka(t,r)):n}notify(t){We.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){We.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){We.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Xt=new WeakMap,zc),Yt,at,nr,Zt,En,Gc,Jf=(Gc=class extends ol{constructor(t){super();oe(this,Zt);oe(this,Yt);oe(this,at);oe(this,nr);this.mutationId=t.mutationId,J(this,at,t.mutationCache),J(this,Yt,[]),this.state=t.state||al(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,Yt).includes(t)||(O(this,Yt).push(t),this.clearGcTimeout(),O(this,at).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){J(this,Yt,O(this,Yt).filter(n=>n!==t)),this.scheduleGc(),O(this,at).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,Yt).length||(this.state.status==="pending"?this.scheduleGc():O(this,at).remove(this))}continue(){var t;return((t=O(this,nr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,u,f,d,m,h,y,w,p,b,g,_,x,C,T,S;J(this,nr,il({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(N,D)=>{pe(this,Zt,En).call(this,{type:"failed",failureCount:N,error:D})},onPause:()=>{pe(this,Zt,En).call(this,{type:"pause"})},onContinue:()=>{pe(this,Zt,En).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,at).canRun(this)}));const n=this.state.status==="pending",r=!O(this,nr).canStart();try{if(!n){pe(this,Zt,En).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=O(this,at).config).onMutate)==null?void 0:i.call(o,t,this));const D=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));D!==this.state.context&&pe(this,Zt,En).call(this,{type:"pending",context:D,variables:t,isPaused:r})}const N=await O(this,nr).start();return await((u=(l=O(this,at).config).onSuccess)==null?void 0:u.call(l,N,t,this.state.context,this)),await((d=(f=this.options).onSuccess)==null?void 0:d.call(f,N,t,this.state.context)),await((h=(m=O(this,at).config).onSettled)==null?void 0:h.call(m,N,null,this.state.variables,this.state.context,this)),await((w=(y=this.options).onSettled)==null?void 0:w.call(y,N,null,t,this.state.context)),pe(this,Zt,En).call(this,{type:"success",data:N}),N}catch(N){try{throw await((b=(p=O(this,at).config).onError)==null?void 0:b.call(p,N,t,this.state.context,this)),await((_=(g=this.options).onError)==null?void 0:_.call(g,N,t,this.state.context)),await((C=(x=O(this,at).config).onSettled)==null?void 0:C.call(x,void 0,N,this.state.variables,this.state.context,this)),await((S=(T=this.options).onSettled)==null?void 0:S.call(T,void 0,N,t,this.state.context)),N}finally{pe(this,Zt,En).call(this,{type:"error",error:N})}}finally{O(this,at).runNext(this)}}},Yt=new WeakMap,at=new WeakMap,nr=new WeakMap,Zt=new WeakSet,En=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),We.batch(()=>{O(this,Yt).forEach(r=>{r.onMutationUpdate(t)}),O(this,at).notify({mutation:this,type:"updated",action:t})})},Gc);function al(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var fn,$t,gi,Qc,zf=(Qc=class extends Wr{constructor(t={}){super();oe(this,fn);oe(this,$t);oe(this,gi);this.config=t,J(this,fn,new Set),J(this,$t,new Map),J(this,gi,0)}build(t,n,r){const o=new Jf({mutationCache:this,mutationId:++Fi(this,gi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,fn).add(t);const n=Mi(t);if(typeof n=="string"){const r=O(this,$t).get(n);r?r.push(t):O(this,$t).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,fn).delete(t)){const n=Mi(t);if(typeof n=="string"){const r=O(this,$t).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&O(this,$t).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Mi(t);if(typeof n=="string"){const r=O(this,$t).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=Mi(t);if(typeof n=="string"){const o=(r=O(this,$t).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(){We.batch(()=>{O(this,fn).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,fn).clear(),O(this,$t).clear()})}getAll(){return Array.from(O(this,fn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ja(n,r))}findAll(t={}){return this.getAll().filter(n=>ja(t,n))}notify(t){We.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return We.batch(()=>Promise.all(t.map(n=>n.continue().catch(At))))}},fn=new WeakMap,$t=new WeakMap,gi=new WeakMap,Qc);function Mi(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Va(e){return{onFetch:(t,n)=>{var f,d,m,h,y;const r=t.options,o=(m=(d=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:d.fetchMore)==null?void 0:m.direction,i=((h=t.state.data)==null?void 0:h.pages)||[],s=((y=t.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let w=!1;const p=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},b=tl(t.options,t.fetchOptions),g=async(_,x,C)=>{if(w)return Promise.reject();if(x==null&&_.pages.length)return Promise.resolve(_);const T={client:t.client,queryKey:t.queryKey,pageParam:x,direction:C?"backward":"forward",meta:t.options.meta};p(T);const S=await b(T),{maxPages:N}=t.options,D=C?Kf:Lf;return{pages:D(_.pages,S,N),pageParams:D(_.pageParams,x,N)}};if(o&&i.length){const _=o==="backward",x=_?Gf:Ua,C={pages:i,pageParams:s},T=x(r,C);a=await g(C,T,_)}else{const _=e??i.length;do{const x=l===0?s[0]??r.initialPageParam:Ua(r,a);if(l>0&&x==null)break;a=await g(a,x),l++}while(l<_)}return a};t.options.persister?t.fetchFn=()=>{var w,p;return(p=(w=t.options).persister)==null?void 0:p.call(w,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function Ua(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 Gf(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var ke,Tn,Rn,Nr,Tr,An,Rr,Ar,Xc,Qf=(Xc=class{constructor(e={}){oe(this,ke);oe(this,Tn);oe(this,Rn);oe(this,Nr);oe(this,Tr);oe(this,An);oe(this,Rr);oe(this,Ar);J(this,ke,e.queryCache||new Wf),J(this,Tn,e.mutationCache||new zf),J(this,Rn,e.defaultOptions||{}),J(this,Nr,new Map),J(this,Tr,new Map),J(this,An,0)}mount(){Fi(this,An)._++,O(this,An)===1&&(J(this,Rr,Fs.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ke).onFocus())})),J(this,Ar,Yi.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ke).onOnline())})))}unmount(){var e,t;Fi(this,An)._--,O(this,An)===0&&((e=O(this,Rr))==null||e.call(this),J(this,Rr,void 0),(t=O(this,Ar))==null||t.call(this),J(this,Ar,void 0))}isFetching(e){return O(this,ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Tn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,ke).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(br(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(this,ke).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=O(this,ke).get(r.queryHash),i=o==null?void 0:o.state.data,s=kf(t,i);if(s!==void 0)return O(this,ke).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return We.batch(()=>O(this,ke).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,ke);We.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,ke),r={type:"active",...e};return We.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=We.batch(()=>O(this,ke).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(At).catch(At)}invalidateQueries(e,t={}){return We.batch(()=>{if(O(this,ke).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none")return Promise.resolve();const n={...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"};return this.refetchQueries(n,t)})}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=We.batch(()=>O(this,ke).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(At)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(At)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=O(this,ke).build(this,t);return n.isStaleByTime(br(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(At).catch(At)}fetchInfiniteQuery(e){return e.behavior=Va(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(At).catch(At)}ensureInfiniteQueryData(e){return e.behavior=Va(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Yi.isOnline()?O(this,Tn).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,ke)}getMutationCache(){return O(this,Tn)}getDefaultOptions(){return O(this,Rn)}setDefaultOptions(e){J(this,Rn,e)}setQueryDefaults(e,t){O(this,Nr).set(cr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,Nr).values()],n={};return t.forEach(r=>{ci(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,Tr).set(cr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Tr).values()];let n={};return t.forEach(r=>{ci(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,Rn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ds(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===Xi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Rn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,ke).clear(),O(this,Tn).clear()}},ke=new WeakMap,Tn=new WeakMap,Rn=new WeakMap,Nr=new WeakMap,Tr=new WeakMap,An=new WeakMap,Rr=new WeakMap,Ar=new WeakMap,Xc),pt,ye,yi,ct,rr,Pr,Pn,en,vi,Dr,Fr,ir,or,Dn,Mr,Oe,ri,rs,is,os,ss,as,cs,ls,cl,Yc,Xf=(Yc=class extends Wr{constructor(t,n){super();oe(this,Oe);oe(this,pt);oe(this,ye);oe(this,yi);oe(this,ct);oe(this,rr);oe(this,Pr);oe(this,Pn);oe(this,en);oe(this,vi);oe(this,Dr);oe(this,Fr);oe(this,ir);oe(this,or);oe(this,Dn);oe(this,Mr,new Set);this.options=n,J(this,pt,t),J(this,en,null),J(this,Pn,ns()),this.options.experimental_prefetchInRender||O(this,Pn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,ye).addObserver(this),$a(O(this,ye),this.options)?pe(this,Oe,ri).call(this):this.updateResult(),pe(this,Oe,ss).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return us(O(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return us(O(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,Oe,as).call(this),pe(this,Oe,cs).call(this),O(this,ye).removeObserver(this)}setOptions(t,n){const r=this.options,o=O(this,ye);if(this.options=O(this,pt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof qt(this.options.enabled,O(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,Oe,ls).call(this),O(this,ye).setOptions(this.options),r._defaulted&&!Qi(this.options,r)&&O(this,pt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ye),observer:this});const i=this.hasListeners();i&&qa(O(this,ye),o,this.options,r)&&pe(this,Oe,ri).call(this),this.updateResult(n),i&&(O(this,ye)!==o||qt(this.options.enabled,O(this,ye))!==qt(r.enabled,O(this,ye))||br(this.options.staleTime,O(this,ye))!==br(r.staleTime,O(this,ye)))&&pe(this,Oe,rs).call(this);const s=pe(this,Oe,is).call(this);i&&(O(this,ye)!==o||qt(this.options.enabled,O(this,ye))!==qt(r.enabled,O(this,ye))||s!==O(this,Dn))&&pe(this,Oe,os).call(this,s)}getOptimisticResult(t){const n=O(this,pt).getQueryCache().build(O(this,pt),t),r=this.createResult(n,t);return Zf(this,r)&&(J(this,ct,r),J(this,Pr,this.options),J(this,rr,O(this,ye).state)),r}getCurrentResult(){return O(this,ct)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){O(this,Mr).add(t)}getCurrentQuery(){return O(this,ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=O(this,pt).defaultQueryOptions(t),r=O(this,pt).getQueryCache().build(O(this,pt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,Oe,ri).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,ct)))}createResult(t,n){var N;const r=O(this,ye),o=this.options,i=O(this,ct),s=O(this,rr),a=O(this,Pr),u=t!==r?t.state:O(this,yi),{state:f}=t;let d={...f},m=!1,h;if(n._optimisticResults){const D=this.hasListeners(),$=!D&&$a(t,n),G=D&&qa(t,r,n,o);($||G)&&(d={...d,...sl(f.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:y,errorUpdatedAt:w,status:p}=d;if(n.select&&d.data!==void 0)if(i&&d.data===(s==null?void 0:s.data)&&n.select===O(this,vi))h=O(this,Dr);else try{J(this,vi,n.select),h=n.select(d.data),h=ts(i==null?void 0:i.data,h,n),J(this,Dr,h),J(this,en,null)}catch(D){J(this,en,D)}else h=d.data;if(n.placeholderData!==void 0&&h===void 0&&p==="pending"){let D;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))D=i.data;else if(D=typeof n.placeholderData=="function"?n.placeholderData((N=O(this,Fr))==null?void 0:N.state.data,O(this,Fr)):n.placeholderData,n.select&&D!==void 0)try{D=n.select(D),J(this,en,null)}catch($){J(this,en,$)}D!==void 0&&(p="success",h=ts(i==null?void 0:i.data,D,n),m=!0)}O(this,en)&&(y=O(this,en),h=O(this,Dr),w=Date.now(),p="error");const b=d.fetchStatus==="fetching",g=p==="pending",_=p==="error",x=g&&b,C=h!==void 0,S={status:p,fetchStatus:d.fetchStatus,isPending:g,isSuccess:p==="success",isError:_,isInitialLoading:x,isLoading:x,data:h,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>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:b,isRefetching:b&&!g,isLoadingError:_&&!C,isPaused:d.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:_&&C,isStale:Ms(t,n),refetch:this.refetch,promise:O(this,Pn)};if(this.options.experimental_prefetchInRender){const D=z=>{S.status==="error"?z.reject(S.error):S.data!==void 0&&z.resolve(S.data)},$=()=>{const z=J(this,Pn,S.promise=ns());D(z)},G=O(this,Pn);switch(G.status){case"pending":t.queryHash===r.queryHash&&D(G);break;case"fulfilled":(S.status==="error"||S.data!==G.value)&&$();break;case"rejected":(S.status!=="error"||S.error!==G.reason)&&$();break}}return S}updateResult(t){const n=O(this,ct),r=this.createResult(O(this,ye),this.options);if(J(this,rr,O(this,ye).state),J(this,Pr,this.options),O(this,rr).data!==void 0&&J(this,Fr,O(this,ye)),Qi(r,n))return;J(this,ct,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!O(this,Mr).size)return!0;const l=new Set(a??O(this,Mr));return this.options.throwOnError&&l.add("error"),Object.keys(O(this,ct)).some(u=>{const f=u;return O(this,ct)[f]!==n[f]&&l.has(f)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),pe(this,Oe,cl).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,Oe,ss).call(this)}},pt=new WeakMap,ye=new WeakMap,yi=new WeakMap,ct=new WeakMap,rr=new WeakMap,Pr=new WeakMap,Pn=new WeakMap,en=new WeakMap,vi=new WeakMap,Dr=new WeakMap,Fr=new WeakMap,ir=new WeakMap,or=new WeakMap,Dn=new WeakMap,Mr=new WeakMap,Oe=new WeakSet,ri=function(t){pe(this,Oe,ls).call(this);let n=O(this,ye).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(At)),n},rs=function(){pe(this,Oe,as).call(this);const t=br(this.options.staleTime,O(this,ye));if(ar||O(this,ct).isStale||!Yo(t))return;const r=el(O(this,ct).dataUpdatedAt,t)+1;J(this,ir,setTimeout(()=>{O(this,ct).isStale||this.updateResult()},r))},is=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ye)):this.options.refetchInterval)??!1},os=function(t){pe(this,Oe,cs).call(this),J(this,Dn,t),!(ar||qt(this.options.enabled,O(this,ye))===!1||!Yo(O(this,Dn))||O(this,Dn)===0)&&J(this,or,setInterval(()=>{(this.options.refetchIntervalInBackground||Fs.isFocused())&&pe(this,Oe,ri).call(this)},O(this,Dn)))},ss=function(){pe(this,Oe,rs).call(this),pe(this,Oe,os).call(this,pe(this,Oe,is).call(this))},as=function(){O(this,ir)&&(clearTimeout(O(this,ir)),J(this,ir,void 0))},cs=function(){O(this,or)&&(clearInterval(O(this,or)),J(this,or,void 0))},ls=function(){const t=O(this,pt).getQueryCache().build(O(this,pt),this.options);if(t===O(this,ye))return;const n=O(this,ye);J(this,ye,t),J(this,yi,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},cl=function(t){We.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,ct))}),O(this,pt).getQueryCache().notify({query:O(this,ye),type:"observerResultsUpdated"})})},Yc);function Yf(e,t){return qt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function $a(e,t){return Yf(e,t)||e.state.data!==void 0&&us(e,t,t.refetchOnMount)}function us(e,t,n){if(qt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Ms(e,t)}return!1}function qa(e,t,n,r){return(e!==t||qt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ms(e,n)}function Ms(e,t){return qt(t.enabled,e)!==!1&&e.isStaleByTime(br(t.staleTime,e))}function Zf(e,t){return!Qi(e.getCurrentResult(),t)}var Fn,Mn,ht,pn,gn,Bi,ds,Zc,ep=(Zc=class extends Wr{constructor(n,r){super();oe(this,gn);oe(this,Fn);oe(this,Mn);oe(this,ht);oe(this,pn);J(this,Fn,n),this.setOptions(r),this.bindMethods(),pe(this,gn,Bi).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=O(this,Fn).defaultMutationOptions(n),Qi(this.options,r)||O(this,Fn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,ht),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&cr(r.mutationKey)!==cr(this.options.mutationKey)?this.reset():((o=O(this,ht))==null?void 0:o.state.status)==="pending"&&O(this,ht).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=O(this,ht))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,gn,Bi).call(this),pe(this,gn,ds).call(this,n)}getCurrentResult(){return O(this,Mn)}reset(){var n;(n=O(this,ht))==null||n.removeObserver(this),J(this,ht,void 0),pe(this,gn,Bi).call(this),pe(this,gn,ds).call(this)}mutate(n,r){var o;return J(this,pn,r),(o=O(this,ht))==null||o.removeObserver(this),J(this,ht,O(this,Fn).getMutationCache().build(O(this,Fn),this.options)),O(this,ht).addObserver(this),O(this,ht).execute(n)}},Fn=new WeakMap,Mn=new WeakMap,ht=new WeakMap,pn=new WeakMap,gn=new WeakSet,Bi=function(){var r;const n=((r=O(this,ht))==null?void 0:r.state)??al();J(this,Mn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ds=function(n){We.batch(()=>{var r,o,i,s,a,l,u,f;if(O(this,pn)&&this.hasListeners()){const d=O(this,Mn).variables,m=O(this,Mn).context;(n==null?void 0:n.type)==="success"?((o=(r=O(this,pn)).onSuccess)==null||o.call(r,n.data,d,m),(s=(i=O(this,pn)).onSettled)==null||s.call(i,n.data,null,d,m)):(n==null?void 0:n.type)==="error"&&((l=(a=O(this,pn)).onError)==null||l.call(a,n.error,d,m),(f=(u=O(this,pn)).onSettled)==null||f.call(u,void 0,n.error,d,m))}this.listeners.forEach(d=>{d(O(this,Mn))})})},Zc),ll=V.createContext(void 0),Ot=e=>{const t=V.useContext(ll);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},tp=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(ll.Provider,{value:e,children:t})),ul=V.createContext(!1),np=()=>V.useContext(ul);ul.Provider;function rp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ip=V.createContext(rp()),op=()=>V.useContext(ip);function dl(e,t){return typeof e=="function"?e(...t):!!e}function fs(){}var sp=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},ap=e=>{V.useEffect(()=>{e.clearReset()},[e])},cp=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||dl(n,[e.error,r])),lp=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},up=(e,t)=>e.isLoading&&e.isFetching&&!t,dp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ha=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function fp(e,t,n){var d,m,h,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=Ot(),o=np(),i=op(),s=r.defaultQueryOptions(e);(m=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||m.call(d,s),s._optimisticResults=o?"isRestoring":"optimistic",lp(s),sp(s,i),ap(i);const a=!r.getQueryCache().get(s.queryHash),[l]=V.useState(()=>new t(r,s)),u=l.getOptimisticResult(s),f=!o&&e.subscribed!==!1;if(V.useSyncExternalStore(V.useCallback(p=>{const b=f?l.subscribe(We.batchCalls(p)):fs;return l.updateResult(),b},[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),V.useEffect(()=>{l.setOptions(s,{listeners:!1})},[s,l]),dp(s,u))throw Ha(s,l,i);if(cp({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw u.error;if((y=(h=r.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,s,u),s.experimental_prefetchInRender&&!ar&&up(u,o)){const p=a?Ha(s,l,i):(w=r.getQueryCache().get(s.queryHash))==null?void 0:w.promise;p==null||p.catch(fs).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?u:l.trackResult(u)}function yn(e,t){return fp(e,Xf)}function Jr(e,t){const n=Ot(),[r]=V.useState(()=>new ep(n,e));V.useEffect(()=>{r.setOptions(e)},[r,e]);const o=V.useSyncExternalStore(V.useCallback(s=>r.subscribe(We.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=V.useCallback((s,a)=>{r.mutate(s,a).catch(fs)},[r]);if(o.error&&dl(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const fl=v.createContext(null),pp=fl.Provider,pl=()=>{const e=v.useContext(fl);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var ue=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e.VALUE_MAPPING="valueMappingError",e))(ue||{});const hl=v.createContext(void 0);function Pt(){const e=v.useContext(hl);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const hp=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function mp({children:e}){const[t,n]=v.useState(hp),r=v.useCallback((f,d,m=!0)=>{n(h=>{const y={...h};return y[f]=y[f]||{},y[f][d]=m,y})},[n]),o=v.useCallback((f,d)=>{var m;return!!((m=t[f])!=null&&m[d])},[t]),i=v.useCallback((f,d)=>{var m;return(m=t[f])==null?void 0:m[d]},[t]),s=v.useCallback((f,d)=>{n(m=>{var y;const h={...m};return(y=h[f])==null||delete y[d],h})},[n]),a=v.useCallback(f=>{n(d=>{const m={...d};return m[f]={},m})},[n]),l=v.useCallback((f,d)=>{n(m=>{const h={...m};return h[f]=h[f]||{},d.forEach(y=>{h[f][y]=!0}),h})},[n]),u=v.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:l,getError:i}),[t,n,r,o,s,a,l,i]);return c.jsx(hl.Provider,{value:u,children:e})}const gp="https://api.withampersand.com/v1".replace(/\/+$/,"");class ks{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:gp}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||gl}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 yp=new ks,mo=class mo{constructor(t=yp){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 Ip(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(i=await s.post({fetch:this.fetchApi,url:o.url,init:o.init,response:i.clone()})||i);return i},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?mo.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:o}=await this.createFetchParams(t,n),i=await this.fetchApi(r,o);if(i&&i.status>=200&&i.status<300)return i;throw new ml(i,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const o=Object.assign({},this.configuration.headers,t.headers);Object.keys(o).forEach(u=>o[u]===void 0?delete o[u]:{});const i=typeof n=="function"?n:async()=>n,s={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},a={...s,...await i({init:s,context:t})},l={...a,body:wp(a.body)||a.body instanceof URLSearchParams||vp(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:l}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};mo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let tn=mo;function vp(e){return typeof Blob<"u"&&e instanceof Blob}function wp(e){return typeof FormData<"u"&&e instanceof FormData}class ml extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Ip extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class re extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function R(e,t){const n=e[t];return n!=null}function gl(e,t=""){return Object.keys(e).map(n=>yl(n,e[n],t)).filter(n=>n.length>0).join("&")}function yl(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 yl(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?gl(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function lr(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class je{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class ur{constructor(t){this.raw=t}async value(){}}class Ba{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function bp(e){return _p(e)}function _p(e,t){return e==null?e:{fieldUsed:R(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:R(e,"keyFormat")?e.keyFormat:void 0}}function xp(e){return Cp(e)}function Cp(e,t){return e==null?e:{name:e.name,valuePrefix:R(e,"valuePrefix")?e.valuePrefix:void 0}}function Op(e){return Ep(e)}function Ep(e,t){return e==null?e:{name:e.name}}function Sp(e){return Np(e)}function Np(e,t){return e==null?e:{attachmentType:e.attachmentType,query:R(e,"query")?Op(e.query):void 0,header:R(e,"header")?xp(e.header):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function Tp(e){return Rp(e)}function Rp(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0,includeFullRecords:R(e,"includeFullRecords")?e.includeFullRecords:void 0}}function Ap(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}const Wa={Oauth2:"oauth2",ApiKey:"apiKey",Basic:"basic",Jwt:"jwt",None:"none"};function Pp(e){return Dp(e)}function Dp(e,t){return e}function Fp(e){return Mp(e)}function Mp(e,t){return e==null?e:{days:R(e,"days")?e.days:void 0,fullHistory:R(e,"fullHistory")?e.fullHistory:void 0}}function kp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function vl(e){return jp(e)}function jp(e,t){return e==null?e:{defaultPeriod:Fp(e.defaultPeriod)}}function Lp(e){if(e!==void 0)return e===null?null:{defaultPeriod:kp(e.defaultPeriod)}}function Kp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Vp(e){if(e!==void 0)return e===null?null:{defaultPeriod:Kp(e.defaultPeriod)}}function Up(e){return $p(e)}function $p(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function wl(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function qp(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Vp(e.backfill)}}function Hp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:lr(e.objects,qp)}}function Bp(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}function Wp(e){if(e!==void 0)return e===null?null:{default:Bp(e._default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function Jp(e){let t=!0;return t=t&&"value"in e,t}function zp(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Gp(e){let t=!0;return t=t&&"value"in e,t}function Qp(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Xp(e){let t=!0;return t=t&&"value"in e,t}function Yp(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Zp(e){if(e!==void 0)return e===null?null:Jp(e)?zp(e):Gp(e)?Qp(e):Xp(e)?Yp(e):{}}function eh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:lr(e.selectedValueDefaults,Zp),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:lr(e.selectedFieldSettings,Wp)}}function th(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:lr(e.objects,eh)}}function nh(e){return rh(e)}function rh(e,t){return e==null?e:{apiKeyAsBasic:R(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:R(e,"apiKeyAsBasicOpts")?bp(e.apiKeyAsBasicOpts):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function ih(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function oh(e){return sh(e)}function sh(e,t){return e==null?e:{value:e.value}}function ah(e){return ch(e)}function ch(e,t){return e==null?e:{brandingRemoval:R(e,"brandingRemoval")?oh(e.brandingRemoval):void 0}}function ki(e){return lh(e)}function lh(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:R(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:R(e,"entitlements")?ah(e.entitlements):void 0}}function uh(e){return dh(e)}function dh(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function fh(e){return ph(e)}function ph(e,t){return e==null?e:{provider:e.provider,read:R(e,"read")?e.read:void 0,write:R(e,"write")?e.write:void 0,proxy:R(e,"proxy")?Up(e.proxy):void 0}}function hh(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:wl(e.proxy)}}function mh(e){return gh(e)}function gh(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:fh(e.content)}}function yh(e){return vh(e)}function vh(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Il(e){return wh(e)}function wh(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Ih(e){return bh(e)}function bh(e,t){return e==null?e:{token:e.token,issuedAt:R(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:R(e,"expiresAt")?new Date(e.expiresAt):void 0}}function _h(e){return xh(e)}function xh(e,t){return e==null?e:{token:e.token,issuedAt:R(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:R(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Ch(e){return Oh(e)}function Oh(e,t){return e==null?e:{accessToken:R(e,"accessToken")?Ih(e.accessToken):void 0,refreshToken:R(e,"refreshToken")?_h(e.refreshToken):void 0,scopes:R(e,"scopes")?e.scopes:void 0}}function Wi(e){return Eh(e)}function Eh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:R(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:R(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function ii(e){return Sh(e)}function Sh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:R(e,"providerApp")?Wi(e.providerApp):void 0,group:Il(e.group),consumer:yh(e.consumer),providerWorkspaceRef:R(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:R(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:R(e,"oauth2AuthorizationCode")?Ch(e.oauth2AuthorizationCode):void 0,apiKey:R(e,"apiKey")?e.apiKey:void 0}}function bl(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function _l(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function xl(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 Nh(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 Th(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 Cl(e){if(e!==void 0)return e===null?null:{accessToken:Nh(e.accessToken),refreshToken:Th(e.refreshToken),scopes:e.scopes}}function Rh(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:bl(e.basicAuth),oauth2ClientCredentials:_l(e.oauth2ClientCredentials),oauth2PasswordCredentials:xl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Cl(e.oauth2AuthorizationCode)}}function Ah(e){return Ph(e)}function Ph(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Dh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fh(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:hh(e.content)}}function Mh(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Fh(e.config)}}function kh(e){return jh(e)}function jh(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Lh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Kh(e){return Vh(e)}function Vh(e,t){return e==null?e:{mode:R(e,"mode")?e.mode:void 0,pageSize:R(e,"pageSize")?e.pageSize:void 0}}function Uh(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function $h(e){let t=!0;return t=t&&"fieldName"in e,t}function qh(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Hh(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Bh(e){let t=!0;return t=t&&"mapToName"in e,t}function Ol(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:R(e,"default")?e.default:void 0,prompt:R(e,"prompt")?e.prompt:void 0}}function Wh(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ja(e){return Jh(e)}function Jh(e,t){return e==null?e:{...qh(e),...Ol(e)}}function za(e){if(e!==void 0)return e===null?null:$h(e)?Hh(e):Bh(e)?Wh(e):{}}function El(e){return zh(e)}function zh(e,t){return e}function Gh(e){return Qh(e)}function Qh(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:R(e,"requiredFields")?e.requiredFields.map(Ja):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(Ja):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?El(e.optionalFieldsAuto):void 0,backfill:R(e,"backfill")?vl(e.backfill):void 0,delivery:R(e,"delivery")?Kh(e.delivery):void 0}}function Xh(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(za),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(za),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Lp(e.backfill),delivery:Uh(e.delivery)}}function Yh(e){return Zh(e)}function Zh(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Gh):void 0}}function em(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Xh)}}function tm(e){return nm(e)}function nm(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function rm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function im(e){return om(e)}function om(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0,watchFieldsAuto:R(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:R(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function sm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function am(e){return cm(e)}function cm(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:R(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:R(e,"createEvent")?Ah(e.createEvent):void 0,updateEvent:R(e,"updateEvent")?im(e.updateEvent):void 0,deleteEvent:R(e,"deleteEvent")?tm(e.deleteEvent):void 0,associationChangeEvent:R(e,"associationChangeEvent")?Tp(e.associationChangeEvent):void 0,otherEvents:R(e,"otherEvents")?e.otherEvents:void 0}}function lm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:Dh(e.createEvent),updateEvent:sm(e.updateEvent),deleteEvent:rm(e.deleteEvent),associationChangeEvent:Ap(e.associationChangeEvent),otherEvents:e.otherEvents}}function um(e){return dm(e)}function dm(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(am):void 0}}function fm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(lm)}}function Sl(e){return pm(e)}function pm(e,t){return e==null?e:{allowAnyFields:R(e,"allowAnyFields")?e.allowAnyFields:void 0}}function hm(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function mm(e){return gm(e)}function gm(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:R(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:R(e,"valueDefaults")?Sl(e.valueDefaults):void 0}}function ym(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:hm(e.valueDefaults)}}function vm(e){return wm(e)}function wm(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(mm):void 0}}function Im(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ym)}}function bm(e){return _m(e)}function _m(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?Yh(e.read):void 0,write:R(e,"write")?vm(e.write):void 0,proxy:R(e,"proxy")?kh(e.proxy):void 0,subscribe:R(e,"subscribe")?um(e.subscribe):void 0}}function xm(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:em(e.read),write:Im(e.write),proxy:Lh(e.proxy),subscribe:fm(e.subscribe)}}function Cm(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:xm(e.content)}}function Om(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Cm(e.latestRevision)}}function Em(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Sm(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 Nm(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Tm(e){return Rm(e)}function Rm(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Am(e){return Pm(e)}function Pm(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:R(e,"valueType")?e.valueType:void 0,providerType:R(e,"providerType")?e.providerType:void 0,readOnly:R(e,"readOnly")?e.readOnly:void 0,values:R(e,"values")?e.values.map(Tm):void 0}}function Dm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:bl(e.basicAuth),oauth2ClientCredentials:_l(e.oauth2ClientCredentials),oauth2PasswordCredentials:xl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Cl(e.oauth2AuthorizationCode)}}function Fm(e){return Mm(e)}function Mm(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function km(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Fo(e){return jm(e)}function jm(e,t){return e==null?e:{...km(e),...Ol(e)}}function Lm(e){return Km(e)}function Km(e,t){return e==null?e:{error:R(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:R(e,"requiredFields")?e.requiredFields.map(Fo):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(Fo):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?El(e.optionalFieldsAuto):void 0,allFields:R(e,"allFields")?e.allFields.map(Fo):void 0,allFieldsMetadata:R(e,"allFieldsMetadata")?lr(e.allFieldsMetadata,Am):void 0,backfill:R(e,"backfill")?vl(e.backfill):void 0}}function Vm(e){return Um(e)}function Um(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Lm):void 0}}function $m(e){return qm(e)}function qm(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:R(e,"valueDefaults")?Sl(e.valueDefaults):void 0}}function Hm(e){return Bm(e)}function Bm(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map($m):void 0}}function Wm(e){return Jm(e)}function Jm(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?Vm(e.read):void 0,write:R(e,"write")?Hm(e.write):void 0,proxy:R(e,"proxy")?Fm(e.proxy):void 0}}function zm(e){return Gm(e)}function Gm(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Wm(e.content)}}function ji(e){return Qm(e)}function Qm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:R(e,"group")?Il(e.group):void 0,healthStatus:e.healthStatus,connection:ii(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,config:mh(e.config)}}function Xm(e){return Ym(e)}function Ym(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:bm(e.content)}}function Ga(e){return Zm(e)}function Zm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Xm(e.latestRevision)}}function eg(e){return tg(e)}function tg(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function ng(e){return rg(e)}function rg(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function ig(e){return og(e)}function og(e,t){return e==null?e:{regular:R(e,"regular")?ng(e.regular):void 0,darkMode:R(e,"darkMode")?eg(e.darkMode):void 0}}function sg(e){return ag(e)}function ag(e,t){return e==null?e:{create:R(e,"create")?e.create:void 0,update:R(e,"update")?e.update:void 0,_delete:R(e,"delete")?e.delete:void 0,passThrough:R(e,"passThrough")?e.passThrough:void 0}}function Nl(e){return cg(e)}function cg(e,t){return e==null?e:{bulkWrite:uh(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:R(e,"subscribeSupport")?sg(e.subscribeSupport):void 0}}function lg(e){return ug(e)}function ug(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Nl(e.support)}}function dg(e){return fg(e)}function fg(e,t){return e==null?e:{workspaceRefField:R(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:R(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:R(e,"scopesField")?e.scopesField:void 0}}const Mo={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials",Password:"password"};function pg(e){return hg(e)}function hg(e,t){return e==null?e:{grantType:e.grantType,authURL:R(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:R(e,"audience")?e.audience:void 0,tokenMetadataFields:dg(e.tokenMetadataFields),docsURL:R(e,"docsURL")?e.docsURL:void 0,authURLParams:R(e,"authURLParams")?e.authURLParams:void 0}}function mg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function gg(e){return yg(e)}function yg(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Qa(e){return vg(e)}function vg(e,t){return e==null?e:{name:e.name,authType:Pp(e.authType),baseURL:e.baseURL,oauth2Opts:R(e,"oauth2Opts")?pg(e.oauth2Opts):void 0,apiKeyOpts:R(e,"apiKeyOpts")?Sp(e.apiKeyOpts):void 0,basicOpts:R(e,"basicOpts")?nh(e.basicOpts):void 0,support:Nl(e.support),providerOpts:e.providerOpts,displayName:R(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:R(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:R(e,"media")?ig(e.media):void 0,labels:R(e,"labels")?e.labels:void 0,subscribeOpts:R(e,"subscribeOpts")?gg(e.subscribeOpts):void 0,modules:R(e,"modules")?lr(e.modules,lg):void 0}}function wg(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:Rh(e.connection)}}function Ig(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Hp(e.read),write:th(e.write),proxy:wl(e.proxy)}}function bg(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Ig(e.content)}}function _g(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:bg(e.config)}}function xg(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:_g(e.installation)}}function Cg(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function Og(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Cg(e.project)}}function Eg(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Sg(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Eg(e.providerApp)}}class Ng extends tn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new ur(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Dm(t.generateConnectionParams)},n);return new je(i,s=>ii(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new je(i,s=>ii(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(ii))}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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new re("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:wg(t.updateConnectionRequest)},n);return new je(i,s=>ii(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Tg extends tn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new re("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:Mh(t.installation)},n);return new je(i,s=>ji(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:o,query:r},n);return new ur(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:r},n);return new je(i,s=>ji(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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(ji))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new re("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:o,query:r,body:xg(t.installationUpdate)},n);return new je(i,s=>ji(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Rg extends tn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new re("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:ih(t.batchUpsertIntegrationsRequest)},n);return new je(i,s=>s.map(Ga))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new re("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Om(t.integration)},n);return new ur(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new ur(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Ga))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Ag extends tn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new re("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:mg(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new Ba(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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}: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 je(i):new Ba(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Pg extends tn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new re("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:Em(t.project)},n);return new je(i,s=>ki(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:o,query:r},n);return new ur(i)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>ki(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new je(o,i=>i.map(ki))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new re("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:Og(t.projectUpdate)},n);return new je(i,s=>ki(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Dg extends tn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new re("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new je(i,s=>Qa(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new je(o,i=>lr(i,Qa))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Fg extends tn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new re("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Sm(t.providerApp)},n);return new je(i,s=>Wi(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new ur(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Wi))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new re("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:Sg(t.providerAppUpdate)},n);return new je(i,s=>Wi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Mg extends tn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new re("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:Nm(t.revision)},n);return new ur(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new re("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:o,query:r},n);return new je(i,s=>zm(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Tl{constructor(t){this.connectionApi=new Ng(t),this.installationApi=new Tg(t),this.integrationApi=new Rg(t),this.oAuthApi=new Ag(t),this.projectApi=new Pg(t),this.providerApi=new Dg(t),this.providerAppApi=new Fg(t),this.revisionApi=new Mg(t)}}const Rl="2.6.0",kg="v1",Li="https://api.withampersand.com";function Al(){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 Li;case"mock":return"http://127.0.0.1:4010";case"":return Li;default:return e??Li}}catch{return Li}}const jg=(e,t)=>`${e}/${t}`;function Lg(){return jg(Al(),kg)}const Kg=Al(),Pl=Lg(),Vg=new ks({basePath:Pl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Rl}});let Ug=new Tl(Vg);const js=()=>Ug;function lt(){const e=pl();return v.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new ks({basePath:Pl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Rl,"X-Api-Key":e}});return new Tl(n)},[e])}const $g=e=>{const t=lt();return yn({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},Dl=v.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Ne=()=>{const e=v.useContext(Dl);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function qg({projectIdOrName:e,children:t}){const{setError:n}=Pt(),{data:r,isLoading:o,isError:i}=$g(e);v.useEffect(()=>{i&&n(ue.PROJECT,e)},[i,e,n]);const s=v.useMemo(()=>({projectId:(r==null?void 0:r.id)||"",projectIdOrName:e,project:r||null,appName:(r==null?void 0:r.appName)||"",isLoading:o}),[e,r,o]);return c.jsx(Dl.Provider,{value:s,children:t})}function Fl(){const e=lt(),{projectIdOrName:t}=Ne();return 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})}const Le=async(e,t)=>{var n;if(e instanceof ml){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
|
|
2
|
+
`))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const l=`${a} ${s!=null&&s.remedy?`
|
|
3
3
|
|
|
4
|
-
[Remedy] ${s.remedy}`:""}`;t&&t(
|
|
5
|
-
component is wrapped with AmpersandProvider`);return e}const
|
|
6
|
-
`).filter(n=>n.trim()!==""),Yg=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Zg=e=>e.replace(/[.:/\\]/g,"\\$&"),ey=()=>{const[e,t]=w.useState(!1),n=w.useCallback(()=>{t(!0)},[t]),r=w.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},Al=w.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function et(){const e=w.useContext(Al);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function ty({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:u}){const{integrations:f}=Ds(),{setError:d,isError:h,removeError:m}=Rt(),{isIntegrationDeleted:y,setIntegrationDeleted:v,resetIntegrationDeleted:p}=ey(),x=w.useMemo(()=>Yg(t,f||[]),[t,f]),{data:g,isLoading:b,isError:O,error:_}=Tl(t,o),T=(g==null?void 0:g[0])||null;w.useEffect(()=>{p()},[t,n,r,o,i,u]),w.useEffect(()=>{x===null&&(f!=null&&f.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,x,f]),w.useEffect(()=>{O?(d(ue.INSTALLATION_LIST,(x==null?void 0:x.id)||""),ot(_)):m(ue.INSTALLATION_LIST,(x==null?void 0:x.id)||"")},[O,x,d,m,_]);const S=Wt(),N=w.useCallback(()=>{S.invalidateQueries({queryKey:["amp","installations"]})},[S]),D=w.useCallback(z=>{S.setQueryData(["amp","installations"],[z]),S.invalidateQueries({queryKey:["amp","installations"]})},[S]),U=(x==null?void 0:x.id)||"",G=w.useMemo(()=>({integrationId:(x==null?void 0:x.id)||"",provider:(x==null?void 0:x.provider)||"",integrationObj:x,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:T||void 0,setInstallation:D,resetInstallations:N,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:y,setIntegrationDeleted:v,fieldMapping:u}),[x,n,r,o,i,T,D,N,s,a,c,y,v,u]);if(b)return l.jsx(Ur,{});if(x===null)return l.jsx(Ut,{message:`Integration "${t}" not found`});if(h(ue.INSTALLATION_LIST,U)){const z=`Error retrieving installation information for integration "${(x==null?void 0:x.name)||"unknown"}"`;return l.jsx(Ut,{message:z})}return l.jsx(Al.Provider,{value:G,children:e})}const Pl=w.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),qr=()=>{const e=w.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=Wt(),{setError:o,isError:i}=Rt(),{projectId:s,isLoading:a}=Fe(),{integrationId:c,groupRef:u}=et(),{provider:f}=Lg(c),{data:d,isLoading:h,isError:m,error:y}=jg({groupRef:e||u,provider:f||t}),v=d==null?void 0:d[0],p=w.useCallback(b=>{r.setQueryData(["amp","connections"],()=>b),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),x=w.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);w.useEffect(()=>{m?(o(ue.CONNECTION_LIST,s,!0),ot(y)):o(ue.CONNECTION_LIST,s,!1)},[m,o,s,y]);const g=w.useMemo(()=>({connections:d||null,isConnectionsLoading:h,selectedConnection:v||null,setConnections:p,setSelectedConnection:x}),[d,h,v,p,x]);if(h||a)return l.jsx(Ur,{});if(i(ue.PROJECT,s))return l.jsx(Ut,{message:`Error loading project ${s}`});if(i(ue.CONNECTION_LIST,s))return l.jsx(Ut,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx(Pl.Provider,{value:g,children:n})}function Fl(){const[e,t]=w.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const ny="_resetContainer_lkwv9_4",Ml={resetContainer:ny};var Mi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ms(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gi={exports:{}};Gi.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",u="[object AsyncFunction]",f="[object Boolean]",d="[object Date]",h="[object Error]",m="[object Function]",y="[object GeneratorFunction]",v="[object Map]",p="[object Number]",x="[object Null]",g="[object Object]",b="[object Promise]",O="[object Proxy]",_="[object RegExp]",T="[object Set]",S="[object String]",N="[object Symbol]",D="[object Undefined]",U="[object WeakMap]",G="[object ArrayBuffer]",z="[object DataView]",ne="[object Float32Array]",B="[object Float64Array]",ce="[object Int8Array]",se="[object Int16Array]",te="[object Int32Array]",ge="[object Uint8Array]",we="[object Uint8ClampedArray]",A="[object Uint16Array]",k="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,L=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,F={};F[ne]=F[B]=F[ce]=F[se]=F[te]=F[ge]=F[we]=F[A]=F[k]=!0,F[a]=F[c]=F[G]=F[f]=F[z]=F[d]=F[h]=F[m]=F[v]=F[p]=F[g]=F[_]=F[T]=F[S]=F[U]=!1;var Y=typeof Mi=="object"&&Mi&&Mi.Object===Object&&Mi,Z=typeof self=="object"&&self&&self.Object===Object&&self,q=Y||Z||Function("return this")(),ee=t&&!t.nodeType&&t,Q=ee&&!0&&e&&!e.nodeType&&e,de=Q&&Q.exports===ee,M=de&&Y.process,ve=function(){try{return M&&M.binding&&M.binding("util")}catch{}}(),H=ve&&ve.isTypedArray;function Ee(I,E){for(var P=-1,X=I==null?0:I.length,Te=0,fe=[];++P<X;){var Me=I[P];E(Me,P,I)&&(fe[Te++]=Me)}return fe}function Ke(I,E){for(var P=-1,X=E.length,Te=I.length;++P<X;)I[Te+P]=E[P];return I}function Ge(I,E){for(var P=-1,X=I==null?0:I.length;++P<X;)if(E(I[P],P,I))return!0;return!1}function Ve(I,E){for(var P=-1,X=Array(I);++P<I;)X[P]=E(P);return X}function Ie(I){return function(E){return I(E)}}function At(I,E){return I.has(E)}function Qe(I,E){return I==null?void 0:I[E]}function mt(I){var E=-1,P=Array(I.size);return I.forEach(function(X,Te){P[++E]=[Te,X]}),P}function Pt(I,E){return function(P){return I(E(P))}}function Dt(I){var E=-1,P=Array(I.size);return I.forEach(function(X){P[++E]=X}),P}var Xe=Array.prototype,We=Function.prototype,$e=Object.prototype,Ae=q["__core-js_shared__"],Ft=We.toString,tt=$e.hasOwnProperty,tn=function(){var I=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||"");return I?"Symbol(src)_1."+I:""}(),mn=$e.toString,gt=RegExp("^"+Ft.call(tt).replace($,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pe=de?q.Buffer:void 0,nn=q.Symbol,gn=q.Uint8Array,rn=$e.propertyIsEnumerable,Vn=Xe.splice,lt=nn?nn.toStringTag:void 0,on=Object.getOwnPropertySymbols,yn=Pe?Pe.isBuffer:void 0,$n=Pt(Object.keys,Object),vn=fr(q,"DataView"),Re=fr(q,"Map"),nt=fr(q,"Promise"),ie=fr(q,"Set"),me=fr(q,"WeakMap"),Ue=fr(Object,"create"),sn=Hn(vn),W=Hn(Re),ae=Hn(nt),le=Hn(ie),Le=Hn(me),qe=nn?nn.prototype:void 0,ut=qe?qe.valueOf:void 0;function Je(I){var E=-1,P=I==null?0:I.length;for(this.clear();++E<P;){var X=I[E];this.set(X[0],X[1])}}function Ye(){this.__data__=Ue?Ue(null):{},this.size=0}function dt(I){var E=this.has(I)&&delete this.__data__[I];return this.size-=E?1:0,E}function Ne(I){var E=this.__data__;if(Ue){var P=E[I];return P===r?void 0:P}return tt.call(E,I)?E[I]:void 0}function Un(I){var E=this.__data__;return Ue?E[I]!==void 0:tt.call(E,I)}function Co(I,E){var P=this.__data__;return this.size+=this.has(I)?0:1,P[I]=Ue&&E===void 0?r:E,this}Je.prototype.clear=Ye,Je.prototype.delete=dt,Je.prototype.get=Ne,Je.prototype.has=Un,Je.prototype.set=Co;function Ot(I){var E=-1,P=I==null?0:I.length;for(this.clear();++E<P;){var X=I[E];this.set(X[0],X[1])}}function bi(){this.__data__=[],this.size=0}function _i(I){var E=this.__data__,P=Ci(E,I);if(P<0)return!1;var X=E.length-1;return P==X?E.pop():Vn.call(E,P,1),--this.size,!0}function xi(I){var E=this.__data__,P=Ci(E,I);return P<0?void 0:E[P][1]}function Se(I){return Ci(this.__data__,I)>-1}function Mt(I,E){var P=this.__data__,X=Ci(P,I);return X<0?(++this.size,P.push([I,E])):P[X][1]=E,this}Ot.prototype.clear=bi,Ot.prototype.delete=_i,Ot.prototype.get=xi,Ot.prototype.has=Se,Ot.prototype.set=Mt;function kt(I){var E=-1,P=I==null?0:I.length;for(this.clear();++E<P;){var X=I[E];this.set(X[0],X[1])}}function qn(){this.size=0,this.__data__={hash:new Je,map:new(Re||Ot),string:new Je}}function Eo(I){var E=Ei(this,I).delete(I);return this.size-=E?1:0,E}function Wr(I){return Ei(this,I).get(I)}function Gd(I){return Ei(this,I).has(I)}function Qd(I,E){var P=Ei(this,I),X=P.size;return P.set(I,E),this.size+=P.size==X?0:1,this}kt.prototype.clear=qn,kt.prototype.delete=Eo,kt.prototype.get=Wr,kt.prototype.has=Gd,kt.prototype.set=Qd;function Oi(I){var E=-1,P=I==null?0:I.length;for(this.__data__=new kt;++E<P;)this.add(I[E])}function Xd(I){return this.__data__.set(I,r),this}function Yd(I){return this.__data__.has(I)}Oi.prototype.add=Oi.prototype.push=Xd,Oi.prototype.has=Yd;function wn(I){var E=this.__data__=new Ot(I);this.size=E.size}function Zd(){this.__data__=new Ot,this.size=0}function ef(I){var E=this.__data__,P=E.delete(I);return this.size=E.size,P}function tf(I){return this.__data__.get(I)}function nf(I){return this.__data__.has(I)}function rf(I,E){var P=this.__data__;if(P instanceof Ot){var X=P.__data__;if(!Re||X.length<n-1)return X.push([I,E]),this.size=++P.size,this;P=this.__data__=new kt(X)}return P.set(I,E),this.size=P.size,this}wn.prototype.clear=Zd,wn.prototype.delete=ef,wn.prototype.get=tf,wn.prototype.has=nf,wn.prototype.set=rf;function of(I,E){var P=Si(I),X=!P&&If(I),Te=!P&&!X&&So(I),fe=!P&&!X&&!Te&&Ca(I),Me=P||X||Te||fe,ze=Me?Ve(I.length,String):[],Ze=ze.length;for(var De in I)tt.call(I,De)&&!(Me&&(De=="length"||Te&&(De=="offset"||De=="parent")||fe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||mf(De,Ze)))&&ze.push(De);return ze}function Ci(I,E){for(var P=I.length;P--;)if(ba(I[P][0],E))return P;return-1}function sf(I,E,P){var X=E(I);return Si(I)?X:Ke(X,P(I))}function Jr(I){return I==null?I===void 0?D:x:lt&< in Object(I)?pf(I):wf(I)}function ya(I){return zr(I)&&Jr(I)==a}function va(I,E,P,X,Te){return I===E?!0:I==null||E==null||!zr(I)&&!zr(E)?I!==I&&E!==E:af(I,E,P,X,va,Te)}function af(I,E,P,X,Te,fe){var Me=Si(I),ze=Si(E),Ze=Me?c:In(I),De=ze?c:In(E);Ze=Ze==a?g:Ze,De=De==a?g:De;var yt=Ze==g,jt=De==g,rt=Ze==De;if(rt&&So(I)){if(!So(E))return!1;Me=!0,yt=!1}if(rt&&!yt)return fe||(fe=new wn),Me||Ca(I)?wa(I,E,P,X,Te,fe):df(I,E,Ze,P,X,Te,fe);if(!(P&o)){var Ct=yt&&tt.call(I,"__wrapped__"),Et=jt&&tt.call(E,"__wrapped__");if(Ct||Et){var bn=Ct?I.value():I,an=Et?E.value():E;return fe||(fe=new wn),Te(bn,an,P,X,fe)}}return rt?(fe||(fe=new wn),ff(I,E,P,X,Te,fe)):!1}function cf(I){if(!Oa(I)||yf(I))return!1;var E=_a(I)?gt:L;return E.test(Hn(I))}function lf(I){return zr(I)&&xa(I.length)&&!!F[Jr(I)]}function uf(I){if(!vf(I))return $n(I);var E=[];for(var P in Object(I))tt.call(I,P)&&P!="constructor"&&E.push(P);return E}function wa(I,E,P,X,Te,fe){var Me=P&o,ze=I.length,Ze=E.length;if(ze!=Ze&&!(Me&&Ze>ze))return!1;var De=fe.get(I);if(De&&fe.get(E))return De==E;var yt=-1,jt=!0,rt=P&i?new Oi:void 0;for(fe.set(I,E),fe.set(E,I);++yt<ze;){var Ct=I[yt],Et=E[yt];if(X)var bn=Me?X(Et,Ct,yt,E,I,fe):X(Ct,Et,yt,I,E,fe);if(bn!==void 0){if(bn)continue;jt=!1;break}if(rt){if(!Ge(E,function(an,Bn){if(!At(rt,Bn)&&(Ct===an||Te(Ct,an,P,X,fe)))return rt.push(Bn)})){jt=!1;break}}else if(!(Ct===Et||Te(Ct,Et,P,X,fe))){jt=!1;break}}return fe.delete(I),fe.delete(E),jt}function df(I,E,P,X,Te,fe,Me){switch(P){case z:if(I.byteLength!=E.byteLength||I.byteOffset!=E.byteOffset)return!1;I=I.buffer,E=E.buffer;case G:return!(I.byteLength!=E.byteLength||!fe(new gn(I),new gn(E)));case f:case d:case p:return ba(+I,+E);case h:return I.name==E.name&&I.message==E.message;case _:case S:return I==E+"";case v:var ze=mt;case T:var Ze=X&o;if(ze||(ze=Dt),I.size!=E.size&&!Ze)return!1;var De=Me.get(I);if(De)return De==E;X|=i,Me.set(I,E);var yt=wa(ze(I),ze(E),X,Te,fe,Me);return Me.delete(I),yt;case N:if(ut)return ut.call(I)==ut.call(E)}return!1}function ff(I,E,P,X,Te,fe){var Me=P&o,ze=Ia(I),Ze=ze.length,De=Ia(E),yt=De.length;if(Ze!=yt&&!Me)return!1;for(var jt=Ze;jt--;){var rt=ze[jt];if(!(Me?rt in E:tt.call(E,rt)))return!1}var Ct=fe.get(I);if(Ct&&fe.get(E))return Ct==E;var Et=!0;fe.set(I,E),fe.set(E,I);for(var bn=Me;++jt<Ze;){rt=ze[jt];var an=I[rt],Bn=E[rt];if(X)var Ea=Me?X(Bn,an,rt,E,I,fe):X(an,Bn,rt,I,E,fe);if(!(Ea===void 0?an===Bn||Te(an,Bn,P,X,fe):Ea)){Et=!1;break}bn||(bn=rt=="constructor")}if(Et&&!bn){var Ni=I.constructor,Ti=E.constructor;Ni!=Ti&&"constructor"in I&&"constructor"in E&&!(typeof Ni=="function"&&Ni instanceof Ni&&typeof Ti=="function"&&Ti instanceof Ti)&&(Et=!1)}return fe.delete(I),fe.delete(E),Et}function Ia(I){return sf(I,xf,hf)}function Ei(I,E){var P=I.__data__;return gf(E)?P[typeof E=="string"?"string":"hash"]:P.map}function fr(I,E){var P=Qe(I,E);return cf(P)?P:void 0}function pf(I){var E=tt.call(I,lt),P=I[lt];try{I[lt]=void 0;var X=!0}catch{}var Te=mn.call(I);return X&&(E?I[lt]=P:delete I[lt]),Te}var hf=on?function(I){return I==null?[]:(I=Object(I),Ee(on(I),function(E){return rn.call(I,E)}))}:Of,In=Jr;(vn&&In(new vn(new ArrayBuffer(1)))!=z||Re&&In(new Re)!=v||nt&&In(nt.resolve())!=b||ie&&In(new ie)!=T||me&&In(new me)!=U)&&(In=function(I){var E=Jr(I),P=E==g?I.constructor:void 0,X=P?Hn(P):"";if(X)switch(X){case sn:return z;case W:return v;case ae:return b;case le:return T;case Le:return U}return E});function mf(I,E){return E=E??s,!!E&&(typeof I=="number"||j.test(I))&&I>-1&&I%1==0&&I<E}function gf(I){var E=typeof I;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?I!=="__proto__":I===null}function yf(I){return!!tn&&tn in I}function vf(I){var E=I&&I.constructor,P=typeof E=="function"&&E.prototype||$e;return I===P}function wf(I){return mn.call(I)}function Hn(I){if(I!=null){try{return Ft.call(I)}catch{}try{return I+""}catch{}}return""}function ba(I,E){return I===E||I!==I&&E!==E}var If=ya(function(){return arguments}())?ya:function(I){return zr(I)&&tt.call(I,"callee")&&!rn.call(I,"callee")},Si=Array.isArray;function bf(I){return I!=null&&xa(I.length)&&!_a(I)}var So=yn||Cf;function _f(I,E){return va(I,E)}function _a(I){if(!Oa(I))return!1;var E=Jr(I);return E==m||E==y||E==u||E==O}function xa(I){return typeof I=="number"&&I>-1&&I%1==0&&I<=s}function Oa(I){var E=typeof I;return I!=null&&(E=="object"||E=="function")}function zr(I){return I!=null&&typeof I=="object"}var Ca=H?Ie(H):lf;function xf(I){return bf(I)?of(I):uf(I)}function Of(){return[]}function Cf(){return!1}e.exports=_f})(Gi,Gi.exports);var ry=Gi.exports;const kl=Ms(ry),ar="other",Qi="uninstall-installation",cs="manage-tab";function Fn(e){return!e.fieldName}function iy(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function oy(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Fn(n)&&!!n.fieldName))||null}function sy(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Fn(r)&&!!r.mapToName))||[]}function ay(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Fn(r)&&!!r.mapToName))||[]}function cy(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Fn(n)&&!!n.fieldName))||null}const jl=(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 ly(e){return Fn(e)?e.mapToName:e.fieldName}const Ll=(e,t)=>{var r,o,i;const n=[];return(i=(o=(r=t.content)==null?void 0:r.read)==null?void 0:o.objects)==null||i.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Ar(s==null?void 0:s.objectName),completed:e?!!jl(e,s.objectName):!1})}),n},Kl=e=>{var n;return{name:ar,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function uy(e,t){var i;const n=Ll(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?Kl(e):void 0;return o&&n.push(o),n}function Vl(e,t,n){const r=(e==null?void 0:e.filter(i=>!(t!=null&&t[i==null?void 0:i.mapToName])))||[],o=r.map(i=>i.mapToName);return n(ue.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function dy(e,t){return kl(e,t)}function $l(e,t){return kl(e,t)}const fy=(e,t,n)=>{var p,x,g,b,O,_,T,S,N;if(!e)return null;const r=iy(e,t),o=r&&oy(r),i=r&&cy(r),s=r&&sy(r),a=r&&ay(r),c=(r==null?void 0:r.allFields)||[],u=(r==null?void 0:r.allFieldsMetadata)||{},f=n==null?void 0:n.content,d=((g=(x=(p=f==null?void 0:f.read)==null?void 0:p.objects)==null?void 0:x[t])==null?void 0:g.selectedFields)||{},h=((_=(O=(b=f==null?void 0:f.read)==null?void 0:b.objects)==null?void 0:O[t])==null?void 0:_.selectedValueMappings)||{},m=((N=(S=(T=f==null?void 0:f.read)==null?void 0:T.objects)==null?void 0:S[t])==null?void 0:N.selectedFieldMappings)||{},y={...d},v={...m};return{allFields:c,allFieldsMetadata:u,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:d,selectedFieldMappings:m,selectedValueMappings:h,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:y,requiredMapFields:v,selectedValueMappings:h}}},py=(e,t)=>{var r,o;if(!e)return null;const n=(o=(r=t==null?void 0:t.content)==null?void 0:r.write)==null?void 0:o.objects;return{writeObjects:(e==null?void 0:e.objects)||[],selectedWriteObjects:n||{},isWriteModified:!1,savedConfig:{selectedWriteObjects:n||{}}}};function Ul(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:fy(r,t,n),write:py(o,n)}}const ql=(e,t,n,r)=>{const o=Ul(e,n,t);r(n,o)},hy=(e,t,n)=>{const r=uy(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=Ul(e,i,t))}),n(o)},Hl=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(ly(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},Bl=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},Wl=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function Jl(e,t){return t[e]||void 0}async function zl({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:c}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const f=await Ps().installationApi.createInstallation(u,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(f),c==null||c(f.id,f.config)}catch(f){ot(f,s)}}function pi(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const my=(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)},gy=(e,t,n,r)=>{const o=Hl(e),i=Bl(e),s=Wl(e),a=my(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:a.schedule,destination:a.destination,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return pi(n)&&(c.content.proxy={enabled:!0}),c},yy=(e,t,n,r,o,i,s,a,c,u,f,d)=>{const h=gy(c,i,a,r);return h?zl({createConfig:h,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:s,setError:u,setInstallation:f,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Gl=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},vy=e=>{const t=e.content.write;return t==null?void 0:t.objects},wy=(e,t,n)=>{if(!vy(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=Gl(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return pi(t)&&(i.content.proxy={enabled:!0}),i},Iy=(e,t,n,r,o,i,s,a,c,u,f)=>{const d=wy(a,s,r);return d?zl({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:c,setInstallation:u,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},by={backgroundColor:"var(--amp-colors-status-critical-muted)",borderColor:"var(--amp-colors-status-critical-muted)",color:"var(--amp-colors-status-critical-dark)",padding:".5rem 1rem"};function Ql({children:e,style:t}){return l.jsx(jn,{style:{...by,...t},children:e})}var Xl={exports:{}};/*!
|
|
4
|
+
[Remedy] ${s.remedy}`:""}`;t&&t(l)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)},Ml=v.createContext({integrations:null,isLoading:!0}),Ls=()=>{const e=v.useContext(Ml);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Hg({children:e}){const{projectIdOrName:t}=Ne(),{setError:n,removeError:r}=Pt(),{data:o,isLoading:i,isError:s}=Fl();v.useEffect(()=>{s?(Le(s),n(ue.INTEGRATION_LIST,t)):r(ue.INTEGRATION_LIST,t)},[s,t,r,n]);const a=v.useMemo(()=>({integrations:o||null,isLoading:i}),[o,i]);return c.jsx(Ml.Provider,{value:a,children:e})}const Bg=new Qf;function Wg(e){const{options:{apiKey:t,projectId:n,project:r},children:o}=e,i=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!i)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return c.jsx(tp,{client:Bg,children:c.jsx(mp,{children:c.jsx(pp,{value:t,children:c.jsx(qg,{projectIdOrName:i,children:c.jsx(Hg,{children:o})})})})})}const kl=v.createContext(null);function Jg(){const e=v.useContext(kl);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
5
|
+
component is wrapped with AmpersandProvider`);return e}const zg=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Ne(),r=lt();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})},Gg=e=>{const t=Fl(),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}};function Qg(){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 Xg="_box_1p7c5_1",Xa={box:Xg};function vn({children:e,className:t,style:n}){return c.jsx("div",{className:t?`${Xa.box} ${t}`:Xa.box,style:n,children:e})}const Yg="_container_1wvzr_1",Ya={container:Yg};function zr({children:e,className:t,style:n}){return c.jsx("div",{className:t?`${Ya.container} ${t}`:Ya.container,style:n,children:e})}const Zg="_errorBoxContainer_4sdb2_1",ey="_errorBox_4sdb2_1",ty="_errorText_4sdb2_20",ps={errorBoxContainer:Zg,errorBox:ey,errorText:ty};function jl({message:e}){return c.jsx(vn,{className:ps.errorBox,children:c.jsx("p",{className:ps.errorText,children:e})})}function Ll({message:e,children:t}){return c.jsxs(zr,{className:ps.errorBoxContainer,children:[c.jsx(Qg,{}),c.jsx(jl,{message:e}),t]})}const ny="_loader_6ubm6_1",ry="_rotate_6ubm6_1",iy="_ball1_6ubm6_1",oy="_ball2_6ubm6_1",sy={loader:ny,rotate:ry,ball1:iy,ball2:oy};function ay(){return c.jsx("span",{className:sy.loader})}function li(){return c.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:c.jsx(ay,{})})}function Kl({children:e}){return c.jsx(zr,{style:{maxWidth:"55rem"},children:c.jsx(vn,{children:e})})}function Gr(){return c.jsx(Kl,{children:c.jsx(li,{})})}function Ht({message:e,children:t}){return c.jsx(Kl,{children:c.jsx(Ll,{message:e,children:t})})}const Vl=(e,t)=>{var s;const n=lt(),{projectIdOrName:r}=Ne(),{integrations:o}=Ls(),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})};function Qr(e,t){try{return process.env[e]}catch{return t}}function kr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ul(e,t){return(t==null?void 0:t.displayName)??kr(e)}const cy=e=>e.split(`
|
|
6
|
+
`).filter(n=>n.trim()!==""),ly=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,uy=e=>e.replace(/[.:/\\]/g,"\\$&"),dy=()=>{const[e,t]=v.useState(!1),n=v.useCallback(()=>{t(!0)},[t]),r=v.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},$l=v.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function Xe(){const e=v.useContext($l);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function fy({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,fieldMapping:u}){const{integrations:f}=Ls(),{setError:d,isError:m,removeError:h}=Pt(),{isIntegrationDeleted:y,setIntegrationDeleted:w,resetIntegrationDeleted:p}=dy(),b=v.useMemo(()=>ly(t,f||[]),[t,f]),{data:g,isLoading:_,isError:x,error:C}=Vl(t,o),T=(g==null?void 0:g[0])||null;v.useEffect(()=>{p()},[t,n,r,o,i,u]),v.useEffect(()=>{b===null&&(f!=null&&f.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,b,f]),v.useEffect(()=>{x?(d(ue.INSTALLATION_LIST,(b==null?void 0:b.id)||""),Le(C)):h(ue.INSTALLATION_LIST,(b==null?void 0:b.id)||"")},[x,b,d,h,C]);const S=Ot(),N=v.useCallback(()=>{S.invalidateQueries({queryKey:["amp","installations"]})},[S]),D=v.useCallback(z=>{S.setQueryData(["amp","installations"],[z]),S.invalidateQueries({queryKey:["amp","installations"]})},[S]),$=(b==null?void 0:b.id)||"",G=v.useMemo(()=>({integrationId:(b==null?void 0:b.id)||"",provider:(b==null?void 0:b.provider)||"",integrationObj:b,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:T||void 0,setInstallation:D,resetInstallations:N,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,isIntegrationDeleted:y,setIntegrationDeleted:w,fieldMapping:u}),[b,n,r,o,i,T,D,N,s,a,l,y,w,u]);if(_)return c.jsx(Gr,{});if(b===null)return c.jsx(Ht,{message:`Integration "${t}" not found`});if(m(ue.INSTALLATION_LIST,$)){const z=`Error retrieving installation information for integration "${(b==null?void 0:b.name)||"unknown"}"`;return c.jsx(Ht,{message:z})}return c.jsx($l.Provider,{value:G,children:e})}const ql=v.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),zt=()=>{const e=v.useContext(ql);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Hl({groupRef:e,provider:t,children:n}){const r=Ot(),{setError:o,isError:i}=Pt(),{projectId:s,isLoading:a}=Ne(),{integrationId:l,groupRef:u}=Xe(),{provider:f}=Gg(l),{data:d,isLoading:m,isError:h,error:y}=zg({groupRef:e||u,provider:f||t}),w=d==null?void 0:d[0],p=v.useCallback(_=>{r.setQueryData(["amp","connections"],()=>_),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),b=v.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);v.useEffect(()=>{h?(o(ue.CONNECTION_LIST,s,!0),Le(y)):o(ue.CONNECTION_LIST,s,!1)},[h,o,s,y]);const g=v.useMemo(()=>({connections:d||null,isConnectionsLoading:m,selectedConnection:w||null,setConnections:p,setSelectedConnection:b}),[d,m,w,p,b]);if(m||a)return c.jsx(Gr,{});if(i(ue.PROJECT,s))return c.jsx(Ht,{message:`Error loading project ${s}`});if(i(ue.CONNECTION_LIST,s))return c.jsx(Ht,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return c.jsx(ql.Provider,{value:g,children:n})}function Bl(){const[e,t]=v.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const py="_resetContainer_lkwv9_4",Wl={resetContainer:py};var Ki=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ks(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zi={exports:{}};Zi.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",f="[object Boolean]",d="[object Date]",m="[object Error]",h="[object Function]",y="[object GeneratorFunction]",w="[object Map]",p="[object Number]",b="[object Null]",g="[object Object]",_="[object Promise]",x="[object Proxy]",C="[object RegExp]",T="[object Set]",S="[object String]",N="[object Symbol]",D="[object Undefined]",$="[object WeakMap]",G="[object ArrayBuffer]",z="[object DataView]",ne="[object Float32Array]",B="[object Float64Array]",ce="[object Int8Array]",se="[object Int16Array]",te="[object Int32Array]",ge="[object Uint8Array]",we="[object Uint8ClampedArray]",A="[object Uint16Array]",k="[object Uint32Array]",U=/[\\^$.*+?()[\]{}|]/g,L=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,F={};F[ne]=F[B]=F[ce]=F[se]=F[te]=F[ge]=F[we]=F[A]=F[k]=!0,F[a]=F[l]=F[G]=F[f]=F[z]=F[d]=F[m]=F[h]=F[w]=F[p]=F[g]=F[C]=F[T]=F[S]=F[$]=!1;var Y=typeof Ki=="object"&&Ki&&Ki.Object===Object&&Ki,Z=typeof self=="object"&&self&&self.Object===Object&&self,q=Y||Z||Function("return this")(),ee=t&&!t.nodeType&&t,Q=ee&&!0&&e&&!e.nodeType&&e,de=Q&&Q.exports===ee,M=de&&Y.process,ve=function(){try{return M&&M.binding&&M.binding("util")}catch{}}(),H=ve&&ve.isTypedArray;function Ee(I,E){for(var P=-1,X=I==null?0:I.length,Re=0,fe=[];++P<X;){var Me=I[P];E(Me,P,I)&&(fe[Re++]=Me)}return fe}function Ve(I,E){for(var P=-1,X=E.length,Re=I.length;++P<X;)I[Re+P]=E[P];return I}function Ye(I,E){for(var P=-1,X=I==null?0:I.length;++P<X;)if(E(I[P],P,I))return!0;return!1}function Ue(I,E){for(var P=-1,X=Array(I);++P<I;)X[P]=E(P);return X}function Ie(I){return function(E){return I(E)}}function Dt(I,E){return I.has(E)}function Ze(I,E){return I==null?void 0:I[E]}function yt(I){var E=-1,P=Array(I.size);return I.forEach(function(X,Re){P[++E]=[Re,X]}),P}function Ft(I,E){return function(P){return I(E(P))}}function Mt(I){var E=-1,P=Array(I.size);return I.forEach(function(X){P[++E]=X}),P}var et=Array.prototype,Je=Function.prototype,$e=Object.prototype,Pe=q["__core-js_shared__"],kt=Je.toString,rt=$e.hasOwnProperty,on=function(){var I=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||"");return I?"Symbol(src)_1."+I:""}(),wn=$e.toString,vt=RegExp("^"+kt.call(rt).replace(U,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),De=de?q.Buffer:void 0,sn=q.Symbol,In=q.Uint8Array,an=$e.propertyIsEnumerable,qn=et.splice,ut=sn?sn.toStringTag:void 0,cn=Object.getOwnPropertySymbols,bn=De?De.isBuffer:void 0,Hn=Ft(Object.keys,Object),_n=vr(q,"DataView"),Ae=vr(q,"Map"),it=vr(q,"Promise"),ie=vr(q,"Set"),me=vr(q,"WeakMap"),qe=vr(Object,"create"),ln=Jn(_n),W=Jn(Ae),ae=Jn(it),le=Jn(ie),Ke=Jn(me),He=sn?sn.prototype:void 0,dt=He?He.valueOf:void 0;function ze(I){var E=-1,P=I==null?0:I.length;for(this.clear();++E<P;){var X=I[E];this.set(X[0],X[1])}}function tt(){this.__data__=qe?qe(null):{},this.size=0}function ft(I){var E=this.has(I)&&delete this.__data__[I];return this.size-=E?1:0,E}function Te(I){var E=this.__data__;if(qe){var P=E[I];return P===r?void 0:P}return rt.call(E,I)?E[I]:void 0}function Bn(I){var E=this.__data__;return qe?E[I]!==void 0:rt.call(E,I)}function To(I,E){var P=this.__data__;return this.size+=this.has(I)?0:1,P[I]=qe&&E===void 0?r:E,this}ze.prototype.clear=tt,ze.prototype.delete=ft,ze.prototype.get=Te,ze.prototype.has=Bn,ze.prototype.set=To;function Et(I){var E=-1,P=I==null?0:I.length;for(this.clear();++E<P;){var X=I[E];this.set(X[0],X[1])}}function Oi(){this.__data__=[],this.size=0}function Ei(I){var E=this.__data__,P=Ti(E,I);if(P<0)return!1;var X=E.length-1;return P==X?E.pop():qn.call(E,P,1),--this.size,!0}function Si(I){var E=this.__data__,P=Ti(E,I);return P<0?void 0:E[P][1]}function Se(I){return Ti(this.__data__,I)>-1}function jt(I,E){var P=this.__data__,X=Ti(P,I);return X<0?(++this.size,P.push([I,E])):P[X][1]=E,this}Et.prototype.clear=Oi,Et.prototype.delete=Ei,Et.prototype.get=Si,Et.prototype.has=Se,Et.prototype.set=jt;function Lt(I){var E=-1,P=I==null?0:I.length;for(this.clear();++E<P;){var X=I[E];this.set(X[0],X[1])}}function Wn(){this.size=0,this.__data__={hash:new ze,map:new(Ae||Et),string:new ze}}function Ro(I){var E=Ri(this,I).delete(I);return this.size-=E?1:0,E}function Zr(I){return Ri(this,I).get(I)}function of(I){return Ri(this,I).has(I)}function sf(I,E){var P=Ri(this,I),X=P.size;return P.set(I,E),this.size+=P.size==X?0:1,this}Lt.prototype.clear=Wn,Lt.prototype.delete=Ro,Lt.prototype.get=Zr,Lt.prototype.has=of,Lt.prototype.set=sf;function Ni(I){var E=-1,P=I==null?0:I.length;for(this.__data__=new Lt;++E<P;)this.add(I[E])}function af(I){return this.__data__.set(I,r),this}function cf(I){return this.__data__.has(I)}Ni.prototype.add=Ni.prototype.push=af,Ni.prototype.has=cf;function xn(I){var E=this.__data__=new Et(I);this.size=E.size}function lf(){this.__data__=new Et,this.size=0}function uf(I){var E=this.__data__,P=E.delete(I);return this.size=E.size,P}function df(I){return this.__data__.get(I)}function ff(I){return this.__data__.has(I)}function pf(I,E){var P=this.__data__;if(P instanceof Et){var X=P.__data__;if(!Ae||X.length<n-1)return X.push([I,E]),this.size=++P.size,this;P=this.__data__=new Lt(X)}return P.set(I,E),this.size=P.size,this}xn.prototype.clear=lf,xn.prototype.delete=uf,xn.prototype.get=df,xn.prototype.has=ff,xn.prototype.set=pf;function hf(I,E){var P=Ai(I),X=!P&&Tf(I),Re=!P&&!X&&Ao(I),fe=!P&&!X&&!Re&&Da(I),Me=P||X||Re||fe,Ge=Me?Ue(I.length,String):[],nt=Ge.length;for(var Fe in I)rt.call(I,Fe)&&!(Me&&(Fe=="length"||Re&&(Fe=="offset"||Fe=="parent")||fe&&(Fe=="buffer"||Fe=="byteLength"||Fe=="byteOffset")||Cf(Fe,nt)))&&Ge.push(Fe);return Ge}function Ti(I,E){for(var P=I.length;P--;)if(Ta(I[P][0],E))return P;return-1}function mf(I,E,P){var X=E(I);return Ai(I)?X:Ve(X,P(I))}function ei(I){return I==null?I===void 0?D:b:ut&&ut in Object(I)?_f(I):Nf(I)}function Oa(I){return ti(I)&&ei(I)==a}function Ea(I,E,P,X,Re){return I===E?!0:I==null||E==null||!ti(I)&&!ti(E)?I!==I&&E!==E:gf(I,E,P,X,Ea,Re)}function gf(I,E,P,X,Re,fe){var Me=Ai(I),Ge=Ai(E),nt=Me?l:Cn(I),Fe=Ge?l:Cn(E);nt=nt==a?g:nt,Fe=Fe==a?g:Fe;var wt=nt==g,Kt=Fe==g,ot=nt==Fe;if(ot&&Ao(I)){if(!Ao(E))return!1;Me=!0,wt=!1}if(ot&&!wt)return fe||(fe=new xn),Me||Da(I)?Sa(I,E,P,X,Re,fe):If(I,E,nt,P,X,Re,fe);if(!(P&o)){var St=wt&&rt.call(I,"__wrapped__"),Nt=Kt&&rt.call(E,"__wrapped__");if(St||Nt){var On=St?I.value():I,un=Nt?E.value():E;return fe||(fe=new xn),Re(On,un,P,X,fe)}}return ot?(fe||(fe=new xn),bf(I,E,P,X,Re,fe)):!1}function yf(I){if(!Pa(I)||Ef(I))return!1;var E=Ra(I)?vt:L;return E.test(Jn(I))}function vf(I){return ti(I)&&Aa(I.length)&&!!F[ei(I)]}function wf(I){if(!Sf(I))return Hn(I);var E=[];for(var P in Object(I))rt.call(I,P)&&P!="constructor"&&E.push(P);return E}function Sa(I,E,P,X,Re,fe){var Me=P&o,Ge=I.length,nt=E.length;if(Ge!=nt&&!(Me&&nt>Ge))return!1;var Fe=fe.get(I);if(Fe&&fe.get(E))return Fe==E;var wt=-1,Kt=!0,ot=P&i?new Ni:void 0;for(fe.set(I,E),fe.set(E,I);++wt<Ge;){var St=I[wt],Nt=E[wt];if(X)var On=Me?X(Nt,St,wt,E,I,fe):X(St,Nt,wt,I,E,fe);if(On!==void 0){if(On)continue;Kt=!1;break}if(ot){if(!Ye(E,function(un,zn){if(!Dt(ot,zn)&&(St===un||Re(St,un,P,X,fe)))return ot.push(zn)})){Kt=!1;break}}else if(!(St===Nt||Re(St,Nt,P,X,fe))){Kt=!1;break}}return fe.delete(I),fe.delete(E),Kt}function If(I,E,P,X,Re,fe,Me){switch(P){case z:if(I.byteLength!=E.byteLength||I.byteOffset!=E.byteOffset)return!1;I=I.buffer,E=E.buffer;case G:return!(I.byteLength!=E.byteLength||!fe(new In(I),new In(E)));case f:case d:case p:return Ta(+I,+E);case m:return I.name==E.name&&I.message==E.message;case C:case S:return I==E+"";case w:var Ge=yt;case T:var nt=X&o;if(Ge||(Ge=Mt),I.size!=E.size&&!nt)return!1;var Fe=Me.get(I);if(Fe)return Fe==E;X|=i,Me.set(I,E);var wt=Sa(Ge(I),Ge(E),X,Re,fe,Me);return Me.delete(I),wt;case N:if(dt)return dt.call(I)==dt.call(E)}return!1}function bf(I,E,P,X,Re,fe){var Me=P&o,Ge=Na(I),nt=Ge.length,Fe=Na(E),wt=Fe.length;if(nt!=wt&&!Me)return!1;for(var Kt=nt;Kt--;){var ot=Ge[Kt];if(!(Me?ot in E:rt.call(E,ot)))return!1}var St=fe.get(I);if(St&&fe.get(E))return St==E;var Nt=!0;fe.set(I,E),fe.set(E,I);for(var On=Me;++Kt<nt;){ot=Ge[Kt];var un=I[ot],zn=E[ot];if(X)var Fa=Me?X(zn,un,ot,E,I,fe):X(un,zn,ot,I,E,fe);if(!(Fa===void 0?un===zn||Re(un,zn,P,X,fe):Fa)){Nt=!1;break}On||(On=ot=="constructor")}if(Nt&&!On){var Pi=I.constructor,Di=E.constructor;Pi!=Di&&"constructor"in I&&"constructor"in E&&!(typeof Pi=="function"&&Pi instanceof Pi&&typeof Di=="function"&&Di instanceof Di)&&(Nt=!1)}return fe.delete(I),fe.delete(E),Nt}function Na(I){return mf(I,Pf,xf)}function Ri(I,E){var P=I.__data__;return Of(E)?P[typeof E=="string"?"string":"hash"]:P.map}function vr(I,E){var P=Ze(I,E);return yf(P)?P:void 0}function _f(I){var E=rt.call(I,ut),P=I[ut];try{I[ut]=void 0;var X=!0}catch{}var Re=wn.call(I);return X&&(E?I[ut]=P:delete I[ut]),Re}var xf=cn?function(I){return I==null?[]:(I=Object(I),Ee(cn(I),function(E){return an.call(I,E)}))}:Df,Cn=ei;(_n&&Cn(new _n(new ArrayBuffer(1)))!=z||Ae&&Cn(new Ae)!=w||it&&Cn(it.resolve())!=_||ie&&Cn(new ie)!=T||me&&Cn(new me)!=$)&&(Cn=function(I){var E=ei(I),P=E==g?I.constructor:void 0,X=P?Jn(P):"";if(X)switch(X){case ln:return z;case W:return w;case ae:return _;case le:return T;case Ke:return $}return E});function Cf(I,E){return E=E??s,!!E&&(typeof I=="number"||j.test(I))&&I>-1&&I%1==0&&I<E}function Of(I){var E=typeof I;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?I!=="__proto__":I===null}function Ef(I){return!!on&&on in I}function Sf(I){var E=I&&I.constructor,P=typeof E=="function"&&E.prototype||$e;return I===P}function Nf(I){return wn.call(I)}function Jn(I){if(I!=null){try{return kt.call(I)}catch{}try{return I+""}catch{}}return""}function Ta(I,E){return I===E||I!==I&&E!==E}var Tf=Oa(function(){return arguments}())?Oa:function(I){return ti(I)&&rt.call(I,"callee")&&!an.call(I,"callee")},Ai=Array.isArray;function Rf(I){return I!=null&&Aa(I.length)&&!Ra(I)}var Ao=bn||Ff;function Af(I,E){return Ea(I,E)}function Ra(I){if(!Pa(I))return!1;var E=ei(I);return E==h||E==y||E==u||E==x}function Aa(I){return typeof I=="number"&&I>-1&&I%1==0&&I<=s}function Pa(I){var E=typeof I;return I!=null&&(E=="object"||E=="function")}function ti(I){return I!=null&&typeof I=="object"}var Da=H?Ie(H):vf;function Pf(I){return Rf(I)?hf(I):wf(I)}function Df(){return[]}function Ff(){return!1}e.exports=Af})(Zi,Zi.exports);var hy=Zi.exports;const Jl=Ks(hy),dr="other",eo="uninstall-installation",to="manage-tab";function Ln(e){return!e.fieldName}function my(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function gy(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Ln(n)&&!!n.fieldName))||null}function yy(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Ln(r)&&!!r.mapToName))||[]}function vy(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Ln(r)&&!!r.mapToName))||[]}function wy(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Ln(n)&&!!n.fieldName))||null}const zl=(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 Iy(e){return Ln(e)?e.mapToName:e.fieldName}const Gl=(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)&&kr(s==null?void 0:s.objectName),completed:e?!!zl(e,s.objectName):!1})}),n},Ql=e=>{var n;return{name:dr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function by(e,t){var i;const n=Gl(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?Ql(e):void 0;return o&&n.push(o),n}function Xl(e,t,n){const r=(e==null?void 0:e.filter(i=>!(t!=null&&t[i==null?void 0:i.mapToName])))||[],o=r.map(i=>i.mapToName);return n(ue.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function _y(e,t){return Jl(e,t)}function Yl(e,t){return Jl(e,t)}const xy=(e,t,n)=>{var p,b,g,_,x,C,T,S,N;if(!e)return null;const r=my(e,t),o=r&&gy(r),i=r&&wy(r),s=r&&yy(r),a=r&&vy(r),l=(r==null?void 0:r.allFields)||[],u=(r==null?void 0:r.allFieldsMetadata)||{},f=n==null?void 0:n.content,d=((g=(b=(p=f==null?void 0:f.read)==null?void 0:p.objects)==null?void 0:b[t])==null?void 0:g.selectedFields)||{},m=((C=(x=(_=f==null?void 0:f.read)==null?void 0:_.objects)==null?void 0:x[t])==null?void 0:C.selectedValueMappings)||{},h=((N=(S=(T=f==null?void 0:f.read)==null?void 0:T.objects)==null?void 0:S[t])==null?void 0:N.selectedFieldMappings)||{},y={...d},w={...h};return{allFields:l,allFieldsMetadata:u,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:d,selectedFieldMappings:h,selectedValueMappings:m,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:y,requiredMapFields:w,selectedValueMappings:m}}},Cy=(e,t)=>{var r,o;if(!e)return null;const n=(o=(r=t==null?void 0:t.content)==null?void 0:r.write)==null?void 0:o.objects;return{writeObjects:(e==null?void 0:e.objects)||[],selectedWriteObjects:n||{},isWriteModified:!1,savedConfig:{selectedWriteObjects:n||{}}}};function Zl(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:xy(r,t,n),write:Cy(o,n)}}const eu=(e,t,n,r)=>{const o=Zl(e,n,t);r(n,o)},Oy=(e,t,n)=>{const r=by(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=Zl(e,i,t))}),n(o)},tu=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(Iy(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},nu=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},ru=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function iu(e,t){return t[e]||void 0}async function ou({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:l}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const f=await js().installationApi.createInstallation(u,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(f),l==null||l(f.id,f.config)}catch(f){Le(f,s)}}function wi(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Ey=(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)},Sy=(e,t,n,r)=>{const o=tu(e),i=nu(e),s=ru(e),a=Ey(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const l={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:a.schedule,destination:a.destination,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return wi(n)&&(l.content.proxy={enabled:!0}),l},Ny=(e,t,n,r,o,i,s,a,l,u,f,d)=>{const m=Sy(l,i,a,r);return m?ou({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:s,setError:u,setInstallation:f,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},su=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},Ty=e=>{const t=e.content.write;return t==null?void 0:t.objects},Ry=(e,t,n)=>{if(!Ty(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=su(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return wi(t)&&(i.content.proxy={enabled:!0}),i},Ay=(e,t,n,r,o,i,s,a,l,u,f)=>{const d=Ry(a,s,r);return d?ou({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:l,setInstallation:u,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Py={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 Ii({children:e,style:t}){return c.jsx(vn,{style:{...Py,...t},children:e})}var au={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})()})(Xl);var _y=Xl.exports;const wt=Ms(_y),xy="_button_kwfiu_1",Oy="_buttonError_kwfiu_28",Cy="_danger_kwfiu_42",Ey="_ghost_kwfiu_47",Ao={button:xy,buttonError:Oy,danger:Cy,ghost:Ey};function ct({className:e,style:t,type:n,children:r,variant:o,...i}){const s=wt(Ao.button,{[Ao.danger]:o==="danger",[Ao.ghost]:o==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...i,children:r})}const Sy=()=>{const e=xt(),t=Wt();return uo({mutationKey:["deleteConnection"],mutationFn:async({projectIdOrName:n,connectionId:r})=>(await e()).connectionApi.deleteConnection({projectIdOrName:n,connectionId:r}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error deleting connection.",{error:n})}})};function Yl({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectId:s}=Fe(),{selectedConnection:a}=qr(),c=Sy(),[u,f]=w.useState(!1),d=!s||!a||!a.id||u,h=async()=>{d||(f(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id}),c.mutate({projectIdOrName:s,connectionId:a==null?void 0:a.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),o()},onError:v=>{ot(v,i)},onSettled:()=>f(!1)}))},m=u?"Disconnecting...":e;return l.jsx(ct,{type:"button",onClick:h,disabled:d,variant:t,style:n,children:m})}const Zl=w.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),Hr=()=>{const e=w.useContext(Zl);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},Ny=()=>{var u;const e=Wt(),t=xt(),{selectedConnection:n,isConnectionsLoading:r}=qr(),{projectIdOrName:o}=Fe(),{integrationId:i,integrationObj:s}=et(),a=n==null?void 0:n.id,c=(u=s==null?void 0:s.latestRevision)==null?void 0:u.id;return w.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),hn({queryKey:["amp","hydratedRevision",o,i,c,a],queryFn:async()=>{if(!o)throw new Error("projectIdOrName is required");if(!i)throw new Error("integrationId is required");if(!c)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:o,integrationId:i,revisionId:c,connectionId:a})},retry:3,enabled:!!o&&!!i&&!!c&&!!a&&!r})};function Ty({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=et(),{isError:o,removeError:i,setError:s}=Rt(),a=(r==null?void 0:r.name)||n,[c,u]=w.useState(null),[f,d]=w.useState(null),{data:h,isLoading:m,isError:y,error:v}=Ny();w.useEffect(()=>{y?(s(ue.HYDRATED_REVISION,a),ot(v,u)):(i(ue.HYDRATED_REVISION,a),u(null),d(null))},[y,a,s,i,v,u]);const p=w.useMemo(()=>{var g,b,O;return{hydratedRevision:h||null,loading:m,readAction:(g=h==null?void 0:h.content)==null?void 0:g.read,writeObjects:((O=(b=h==null?void 0:h.content)==null?void 0:b.write)==null?void 0:O.objects)||[]}},[h,m]);if(m)return l.jsx(Ur,{});const x=(r==null?void 0:r.provider)||"provider";if(o(ue.HYDRATED_REVISION,a)){const g=(r==null?void 0:r.name)||n||"unknown integration",b=`${c?`: ${c}`:`Error retrieving objects from ${x} or integration details for ${g}`}`;return l.jsx(Ut,{message:b,children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem"},children:[f&&l.jsx(El,{message:f}),l.jsx(Yl,{buttonText:"Try again",resetComponent:t,buttonVariant:"danger",onDisconnectError:O=>d(O)})]})})}return l.jsx(Zl.Provider,{value:p,children:e})}const eu=w.createContext(null);function tu(){const e=w.useContext(eu);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const nu=w.createContext(()=>{});function Ry(){const e=w.useContext(nu);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var ru=Symbol.for("immer-nothing"),Ha=Symbol.for("immer-draftable"),bt=Symbol.for("immer-state"),Ay=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 ht(e,...t){if(process.env.NODE_ENV!=="production"){const n=Ay[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Pr=Object.getPrototypeOf;function Dr(e){return!!e&&!!e[bt]}function cr(e){var t;return e?iu(e)||Array.isArray(e)||!!e[Ha]||!!((t=e.constructor)!=null&&t[Ha])||po(e)||ho(e):!1}var Py=Object.prototype.constructor.toString();function iu(e){if(!e||typeof e!="object")return!1;const t=Pr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Py}function Xi(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[bt];return t?t.type_:Array.isArray(e)?1:po(e)?2:ho(e)?3:0}function ls(e,t){return fo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ou(e,t,n){const r=fo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Dy(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function po(e){return e instanceof Map}function ho(e){return e instanceof Set}function Jn(e){return e.copy_||e.base_}function us(e,t){if(po(e))return new Map(e);if(ho(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=iu(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[bt];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){const s=o[i],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Pr(e),r)}else{const r=Pr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function ks(e,t=!1){return mo(e)||Dr(e)||!cr(e)||(fo(e)>1&&(e.set=e.add=e.clear=e.delete=Fy),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>ks(r,!0))),e}function Fy(){ht(2)}function mo(e){return Object.isFrozen(e)}var My={};function lr(e){const t=My[e];return t||ht(0,e),t}var ri;function su(){return ri}function ky(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ba(e,t){t&&(lr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ds(e){fs(e),e.drafts_.forEach(jy),e.drafts_=null}function fs(e){e===ri&&(ri=e.parent_)}function Wa(e){return ri=ky(ri,e)}function jy(e){const t=e[bt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ja(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[bt].modified_&&(ds(t),ht(4)),cr(e)&&(e=Yi(t,e),t.parent_||Zi(t,e)),t.patches_&&lr("Patches").generateReplacementPatches_(n[bt].base_,e,t.patches_,t.inversePatches_)):e=Yi(t,n,[]),ds(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ru?e:void 0}function Yi(e,t,n){if(mo(t))return t;const r=t[bt];if(!r)return Xi(t,(o,i)=>za(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Zi(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),Xi(i,(a,c)=>za(e,r,o,a,c,n,s)),Zi(e,o,!1),n&&e.patches_&&lr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function za(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&ht(5),Dr(o)){const a=i&&t&&t.type_!==3&&!ls(t.assigned_,r)?i.concat(r):void 0,c=Yi(e,o,a);if(ou(n,r,c),Dr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(cr(o)&&!mo(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Yi(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Zi(e,o)}}function Zi(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ks(t,n)}function Ly(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:su(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=js;n&&(o=[r],i=ii);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var js={get(e,t){if(t===bt)return e;const n=Jn(e);if(!ls(n,t))return Ky(e,n,t);const r=n[t];return e.finalized_||!cr(r)?r:r===Po(e.base_,t)?(Do(e),e.copy_[t]=hs(r,e)):r},has(e,t){return t in Jn(e)},ownKeys(e){return Reflect.ownKeys(Jn(e))},set(e,t,n){const r=au(Jn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Po(Jn(e),t),i=o==null?void 0:o[bt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Dy(n,o)&&(n!==void 0||ls(e.base_,t)))return!0;Do(e),ps(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Po(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Do(e),ps(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Jn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){ht(11)},getPrototypeOf(e){return Pr(e.base_)},setPrototypeOf(){ht(12)}},ii={};Xi(js,(e,t)=>{ii[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ii.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&ht(13),ii.set.call(this,e,t,void 0)};ii.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&ht(14),js.set.call(this,e[0],t,n,e[0])};function Po(e,t){const n=e[bt];return(n?Jn(n):e)[t]}function Ky(e,t,n){var o;const r=au(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function au(e,t){if(!(t in e))return;let n=Pr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Pr(n)}}function ps(e){e.modified_||(e.modified_=!0,e.parent_&&ps(e.parent_))}function Do(e){e.copy_||(e.copy_=us(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Vy=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(c=i,...u){return s.produce(c,f=>n.call(this,f,...u))}}typeof n!="function"&&ht(6),r!==void 0&&typeof r!="function"&&ht(7);let o;if(cr(t)){const i=Wa(this),s=hs(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?ds(i):fs(i)}return Ba(i,r),Ja(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===ru&&(o=void 0),this.autoFreeze_&&ks(o,!0),r){const i=[],s=[];lr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else ht(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){cr(e)||ht(8),Dr(e)&&(e=$y(e));const t=Wa(this),n=hs(e,void 0);return n[bt].isManual_=!0,fs(t),n}finishDraft(e,t){const n=e&&e[bt];(!n||!n.isManual_)&&ht(9);const{scope_:r}=n;return Ba(r,t),Ja(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=lr("Patches").applyPatches_;return Dr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function hs(e,t){const n=po(e)?lr("MapSet").proxyMap_(e,t):ho(e)?lr("MapSet").proxySet_(e,t):Ly(e,t);return(t?t.scope_:su()).drafts_.push(n),n}function $y(e){return Dr(e)||ht(10,e),cu(e)}function cu(e){if(!cr(e)||mo(e))return e;const t=e[bt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=us(e,t.scope_.immer_.useStrictShallowCopy_)}else n=us(e,!0);return Xi(n,(r,o)=>{ou(n,r,cu(o))}),t&&(t.finalized_=!1),n}var _t=new Vy,Gr=_t.produce;_t.produceWithPatches.bind(_t);_t.setAutoFreeze.bind(_t);_t.setUseStrictShallowCopy.bind(_t);_t.applyPatches.bind(_t);_t.createDraft.bind(_t);_t.finishDraft.bind(_t);const lu=w.createContext(void 0),Uy={};function Ls(){const e=w.useContext(lu);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function qy({children:e}){const{installation:t}=et(),{hydratedRevision:n,loading:r}=Hr(),[o,i]=w.useState(Uy),s=t==null?void 0:t.config;w.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&hy(n,s,i)},[n,r,s,o]);const a=w.useCallback((m,y)=>{i(v=>Gr(v,p=>{p[m]=Gr(p[m],y)}))},[i]),c=w.useCallback((m,y)=>{i(v=>Gr(v,p=>{p[m]=y}))},[i]),u=w.useCallback(()=>{i(Gr(m=>{const y=m.other.write;y&&(y.isWriteModified=!1)}))},[i]),f=w.useCallback(m=>{i(Gr(y=>{var p;const v=(p=y[m])==null?void 0:p.read;v&&(v.isOptionalFieldsModified=!1,v.isRequiredMapFieldsModified=!1,v.isValueMappingsModified=!1)}))},[i]),d=w.useCallback(m=>{m===ar?u():f(m)},[f,u]),h=w.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:d}),[o,c,d,a]);return l.jsx(lu.Provider,{value:h,children:e})}const Jt=()=>{const{appName:e}=Fe(),{objectConfigurationsState:t,setConfigureState:n}=Ls(),{selectedObjectName:r}=tu(),o=Jl(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function Hy(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};if(t.forEach(o=>{const{field:i,value:s}=o;s===null?delete n[i]:n[i]=s}),e!=null&&e.read){const o=e.read.savedConfig.requiredMapFields,s=!$l(o,n);e.read.isRequiredMapFieldsModified=s}}function oi(e,t,n){t(e,r=>Hy(r,n))}const By=(e,t)=>e.filter(n=>!t.has(n));function Wy(){var h,m,y;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Jt(),{fieldMapping:r}=et(),o=((h=t==null?void 0:t.read)==null?void 0:h.selectedFieldMappings)||{},i=Object.keys(o),s=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],a=((y=t==null?void 0:t.read)==null?void 0:y.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(v=>!v.fieldName):[],u=s.concat(c,a).map(v=>v.mapToName),f=new Set(u),d=By(i,f);w.useEffect(()=>{e&&d.length&&oi(e,n,d.map(v=>({field:v,value:null})))},[e,n,d])}function dn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},he.apply(null,arguments)}function ms(e,t){return ms=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ms(e,t)}function Jy(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ms(e,t)}var gs={exports:{}},ki={exports:{}},be={};/** @license React v16.13.1
|
|
10
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)t.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(au);var Dy=au.exports;const bt=Ks(Dy),Fy="_button_kwfiu_1",My="_buttonError_kwfiu_28",ky="_danger_kwfiu_42",jy="_ghost_kwfiu_47",ko={button:Fy,buttonError:My,danger:ky,ghost:jy};function Qe({className:e,style:t,type:n,children:r,variant:o,...i}){const s=bt(ko.button,{[ko.danger]:o==="danger",[ko.ghost]:o==="ghost",[e||""]:!!e});return c.jsx("button",{type:n,className:s,style:t,...i,children:r})}const Ly=()=>{const e=lt(),t=Ot();return Jr({mutationKey:["deleteConnection"],mutationFn:async({projectIdOrName:n,connectionId:r})=>(await e()).connectionApi.deleteConnection({projectIdOrName:n,connectionId:r}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error deleting connection.",{error:n})}})};function cu({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectId:s}=Ne(),{selectedConnection:a}=zt(),l=Ly(),[u,f]=v.useState(!1),d=!s||!a||!a.id||u,m=async()=>{d||(f(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id}),l.mutate({projectIdOrName:s,connectionId:a==null?void 0:a.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),o()},onError:w=>{Le(w,i)},onSettled:()=>f(!1)}))},h=u?"Disconnecting...":e;return c.jsx(Qe,{type:"button",onClick:m,disabled:d,variant:t,style:n,children:h})}const lu=v.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),Xr=()=>{const e=v.useContext(lu);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},Ky=()=>{var u;const e=Ot(),t=lt(),{selectedConnection:n,isConnectionsLoading:r}=zt(),{projectIdOrName:o}=Ne(),{integrationId:i,integrationObj:s}=Xe(),a=n==null?void 0:n.id,l=(u=s==null?void 0:s.latestRevision)==null?void 0:u.id;return v.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),yn({queryKey:["amp","hydratedRevision",o,i,l,a],queryFn:async()=>{if(!o)throw new Error("projectIdOrName is required");if(!i)throw new Error("integrationId is required");if(!l)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:o,integrationId:i,revisionId:l,connectionId:a})},retry:3,enabled:!!o&&!!i&&!!l&&!!a&&!r})};function Vy({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=Xe(),{isError:o,removeError:i,setError:s}=Pt(),a=(r==null?void 0:r.name)||n,[l,u]=v.useState(null),[f,d]=v.useState(null),{data:m,isLoading:h,isError:y,error:w}=Ky();v.useEffect(()=>{y?(s(ue.HYDRATED_REVISION,a),Le(w,u)):(i(ue.HYDRATED_REVISION,a),u(null),d(null))},[y,a,s,i,w,u]);const p=v.useMemo(()=>{var g,_,x;return{hydratedRevision:m||null,loading:h,readAction:(g=m==null?void 0:m.content)==null?void 0:g.read,writeObjects:((x=(_=m==null?void 0:m.content)==null?void 0:_.write)==null?void 0:x.objects)||[]}},[m,h]);if(h)return c.jsx(Gr,{});const b=(r==null?void 0:r.provider)||"provider";if(o(ue.HYDRATED_REVISION,a)){const g=(r==null?void 0:r.name)||n||"unknown integration",_=`${l?`: ${l}`:`Error retrieving objects from ${b} or integration details for ${g}`}`;return c.jsx(Ht,{message:_,children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem"},children:[f&&c.jsx(jl,{message:f}),c.jsx(cu,{buttonText:"Try again",resetComponent:t,buttonVariant:"danger",onDisconnectError:x=>d(x)})]})})}return c.jsx(lu.Provider,{value:p,children:e})}const uu=v.createContext(null);function du(){const e=v.useContext(uu);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const fu=v.createContext(()=>{});function Uy(){const e=v.useContext(fu);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var pu=Symbol.for("immer-nothing"),Za=Symbol.for("immer-draftable"),xt=Symbol.for("immer-state"),$y=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 mt(e,...t){if(process.env.NODE_ENV!=="production"){const n=$y[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 jr=Object.getPrototypeOf;function Lr(e){return!!e&&!!e[xt]}function fr(e){var t;return e?hu(e)||Array.isArray(e)||!!e[Za]||!!((t=e.constructor)!=null&&t[Za])||yo(e)||vo(e):!1}var qy=Object.prototype.constructor.toString();function hu(e){if(!e||typeof e!="object")return!1;const t=jr(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)===qy}function no(e,t){go(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function go(e){const t=e[xt];return t?t.type_:Array.isArray(e)?1:yo(e)?2:vo(e)?3:0}function hs(e,t){return go(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function mu(e,t,n){const r=go(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Hy(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function yo(e){return e instanceof Map}function vo(e){return e instanceof Set}function Qn(e){return e.copy_||e.base_}function ms(e,t){if(yo(e))return new Map(e);if(vo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=hu(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[xt];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(jr(e),r)}else{const r=jr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function Vs(e,t=!1){return wo(e)||Lr(e)||!fr(e)||(go(e)>1&&(e.set=e.add=e.clear=e.delete=By),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Vs(r,!0))),e}function By(){mt(2)}function wo(e){return Object.isFrozen(e)}var Wy={};function pr(e){const t=Wy[e];return t||mt(0,e),t}var ui;function gu(){return ui}function Jy(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ec(e,t){t&&(pr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function gs(e){ys(e),e.drafts_.forEach(zy),e.drafts_=null}function ys(e){e===ui&&(ui=e.parent_)}function tc(e){return ui=Jy(ui,e)}function zy(e){const t=e[xt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function nc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[xt].modified_&&(gs(t),mt(4)),fr(e)&&(e=ro(t,e),t.parent_||io(t,e)),t.patches_&&pr("Patches").generateReplacementPatches_(n[xt].base_,e,t.patches_,t.inversePatches_)):e=ro(t,n,[]),gs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==pu?e:void 0}function ro(e,t,n){if(wo(t))return t;const r=t[xt];if(!r)return no(t,(o,i)=>rc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return io(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),no(i,(a,l)=>rc(e,r,o,a,l,n,s)),io(e,o,!1),n&&e.patches_&&pr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function rc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&mt(5),Lr(o)){const a=i&&t&&t.type_!==3&&!hs(t.assigned_,r)?i.concat(r):void 0,l=ro(e,o,a);if(mu(n,r,l),Lr(l))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(fr(o)&&!wo(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ro(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&io(e,o)}}function io(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Vs(t,n)}function Gy(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:gu(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Us;n&&(o=[r],i=di);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var Us={get(e,t){if(t===xt)return e;const n=Qn(e);if(!hs(n,t))return Qy(e,n,t);const r=n[t];return e.finalized_||!fr(r)?r:r===jo(e.base_,t)?(Lo(e),e.copy_[t]=ws(r,e)):r},has(e,t){return t in Qn(e)},ownKeys(e){return Reflect.ownKeys(Qn(e))},set(e,t,n){const r=yu(Qn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=jo(Qn(e),t),i=o==null?void 0:o[xt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Hy(n,o)&&(n!==void 0||hs(e.base_,t)))return!0;Lo(e),vs(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 jo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Lo(e),vs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Qn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){mt(11)},getPrototypeOf(e){return jr(e.base_)},setPrototypeOf(){mt(12)}},di={};no(Us,(e,t)=>{di[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});di.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&mt(13),di.set.call(this,e,t,void 0)};di.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&mt(14),Us.set.call(this,e[0],t,n,e[0])};function jo(e,t){const n=e[xt];return(n?Qn(n):e)[t]}function Qy(e,t,n){var o;const r=yu(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function yu(e,t){if(!(t in e))return;let n=jr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=jr(n)}}function vs(e){e.modified_||(e.modified_=!0,e.parent_&&vs(e.parent_))}function Lo(e){e.copy_||(e.copy_=ms(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Xy=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(l=i,...u){return s.produce(l,f=>n.call(this,f,...u))}}typeof n!="function"&&mt(6),r!==void 0&&typeof r!="function"&&mt(7);let o;if(fr(t)){const i=tc(this),s=ws(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?gs(i):ys(i)}return ec(i,r),nc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===pu&&(o=void 0),this.autoFreeze_&&Vs(o,!0),r){const i=[],s=[];pr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else mt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,l=>t(l,...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){fr(e)||mt(8),Lr(e)&&(e=Yy(e));const t=tc(this),n=ws(e,void 0);return n[xt].isManual_=!0,ys(t),n}finishDraft(e,t){const n=e&&e[xt];(!n||!n.isManual_)&&mt(9);const{scope_:r}=n;return ec(r,t),nc(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=pr("Patches").applyPatches_;return Lr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function ws(e,t){const n=yo(e)?pr("MapSet").proxyMap_(e,t):vo(e)?pr("MapSet").proxySet_(e,t):Gy(e,t);return(t?t.scope_:gu()).drafts_.push(n),n}function Yy(e){return Lr(e)||mt(10,e),vu(e)}function vu(e){if(!fr(e)||wo(e))return e;const t=e[xt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ms(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ms(e,!0);return no(n,(r,o)=>{mu(n,r,vu(o))}),t&&(t.finalized_=!1),n}var Ct=new Xy,ni=Ct.produce;Ct.produceWithPatches.bind(Ct);Ct.setAutoFreeze.bind(Ct);Ct.setUseStrictShallowCopy.bind(Ct);Ct.applyPatches.bind(Ct);Ct.createDraft.bind(Ct);Ct.finishDraft.bind(Ct);const wu=v.createContext(void 0),Zy={};function $s(){const e=v.useContext(wu);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function ev({children:e}){const{installation:t}=Xe(),{hydratedRevision:n,loading:r}=Xr(),[o,i]=v.useState(Zy),s=t==null?void 0:t.config;v.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&Oy(n,s,i)},[n,r,s,o]);const a=v.useCallback((h,y)=>{i(w=>ni(w,p=>{p[h]=ni(p[h],y)}))},[i]),l=v.useCallback((h,y)=>{i(w=>ni(w,p=>{p[h]=y}))},[i]),u=v.useCallback(()=>{i(ni(h=>{const y=h.other.write;y&&(y.isWriteModified=!1)}))},[i]),f=v.useCallback(h=>{i(ni(y=>{var p;const w=(p=y[h])==null?void 0:p.read;w&&(w.isOptionalFieldsModified=!1,w.isRequiredMapFieldsModified=!1,w.isValueMappingsModified=!1)}))},[i]),d=v.useCallback(h=>{h===dr?u():f(h)},[f,u]),m=v.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:l,resetPendingConfigurationState:d}),[o,l,d,a]);return c.jsx(wu.Provider,{value:m,children:e})}const Gt=()=>{const{appName:e}=Ne(),{objectConfigurationsState:t,setConfigureState:n}=$s(),{selectedObjectName:r}=du(),o=iu(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function tv(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};if(t.forEach(o=>{const{field:i,value:s}=o;s===null?delete n[i]:n[i]=s}),e!=null&&e.read){const o=e.read.savedConfig.requiredMapFields,s=!Yl(o,n);e.read.isRequiredMapFieldsModified=s}}function fi(e,t,n){t(e,r=>tv(r,n))}const nv=(e,t)=>e.filter(n=>!t.has(n));function rv(){var m,h,y;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Gt(),{fieldMapping:r}=Xe(),o=((m=t==null?void 0:t.read)==null?void 0:m.selectedFieldMappings)||{},i=Object.keys(o),s=((h=t==null?void 0:t.read)==null?void 0:h.requiredMapFields)||[],a=((y=t==null?void 0:t.read)==null?void 0:y.optionalMapFields)||[],l=e&&r?Object.values(r[e]||{}).flat().filter(w=>!w.fieldName):[],u=s.concat(l,a).map(w=>w.mapToName),f=new Set(u),d=nv(i,f);v.useEffect(()=>{e&&d.length&&fi(e,n,d.map(w=>({field:w,value:null})))},[e,n,d])}function hn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},he.apply(null,arguments)}function Is(e,t){return Is=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Is(e,t)}function iv(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Is(e,t)}var bs={exports:{}},Vi={exports:{}},be={};/** @license React v16.13.1
|
|
11
11
|
* react-is.production.min.js
|
|
12
12
|
*
|
|
13
13
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var ic;function ov(){if(ic)return be;ic=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function _(C){if(typeof C=="object"&&C!==null){var T=C.$$typeof;switch(T){case t:switch(C=C.type,C){case l:case u:case r:case i:case o:case d:return C;default:switch(C=C&&C.$$typeof,C){case a:case f:case y:case h:case s:return C;default:return T}}case n:return T}}}function x(C){return _(C)===u}return be.AsyncMode=l,be.ConcurrentMode=u,be.ContextConsumer=a,be.ContextProvider=s,be.Element=t,be.ForwardRef=f,be.Fragment=r,be.Lazy=y,be.Memo=h,be.Portal=n,be.Profiler=i,be.StrictMode=o,be.Suspense=d,be.isAsyncMode=function(C){return x(C)||_(C)===l},be.isConcurrentMode=x,be.isContextConsumer=function(C){return _(C)===a},be.isContextProvider=function(C){return _(C)===s},be.isElement=function(C){return typeof C=="object"&&C!==null&&C.$$typeof===t},be.isForwardRef=function(C){return _(C)===f},be.isFragment=function(C){return _(C)===r},be.isLazy=function(C){return _(C)===y},be.isMemo=function(C){return _(C)===h},be.isPortal=function(C){return _(C)===n},be.isProfiler=function(C){return _(C)===i},be.isStrictMode=function(C){return _(C)===o},be.isSuspense=function(C){return _(C)===d},be.isValidElementType=function(C){return typeof C=="string"||typeof C=="function"||C===r||C===u||C===i||C===o||C===d||C===m||typeof C=="object"&&C!==null&&(C.$$typeof===y||C.$$typeof===h||C.$$typeof===s||C.$$typeof===a||C.$$typeof===f||C.$$typeof===p||C.$$typeof===b||C.$$typeof===g||C.$$typeof===w)},be.typeOf=_,be}var _e={};/** @license React v16.13.1
|
|
18
18
|
* react-is.development.js
|
|
19
19
|
*
|
|
20
20
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
21
21
|
*
|
|
22
22
|
* This source code is licensed under the MIT license found in the
|
|
23
23
|
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*/var
|
|
24
|
+
*/var oc;function sv(){return oc||(oc=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function _(M){return typeof M=="string"||typeof M=="function"||M===r||M===u||M===i||M===o||M===d||M===m||typeof M=="object"&&M!==null&&(M.$$typeof===y||M.$$typeof===h||M.$$typeof===s||M.$$typeof===a||M.$$typeof===f||M.$$typeof===p||M.$$typeof===b||M.$$typeof===g||M.$$typeof===w)}function x(M){if(typeof M=="object"&&M!==null){var ve=M.$$typeof;switch(ve){case t:var H=M.type;switch(H){case l:case u:case r:case i:case o:case d:return H;default:var Ee=H&&H.$$typeof;switch(Ee){case a:case f:case y:case h:case s:return Ee;default:return ve}}case n:return ve}}}var C=l,T=u,S=a,N=s,D=t,$=f,G=r,z=y,ne=h,B=n,ce=i,se=o,te=d,ge=!1;function we(M){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),A(M)||x(M)===l}function A(M){return x(M)===u}function k(M){return x(M)===a}function U(M){return x(M)===s}function L(M){return typeof M=="object"&&M!==null&&M.$$typeof===t}function j(M){return x(M)===f}function F(M){return x(M)===r}function Y(M){return x(M)===y}function Z(M){return x(M)===h}function q(M){return x(M)===n}function ee(M){return x(M)===i}function Q(M){return x(M)===o}function de(M){return x(M)===d}_e.AsyncMode=C,_e.ConcurrentMode=T,_e.ContextConsumer=S,_e.ContextProvider=N,_e.Element=D,_e.ForwardRef=$,_e.Fragment=G,_e.Lazy=z,_e.Memo=ne,_e.Portal=B,_e.Profiler=ce,_e.StrictMode=se,_e.Suspense=te,_e.isAsyncMode=we,_e.isConcurrentMode=A,_e.isContextConsumer=k,_e.isContextProvider=U,_e.isElement=L,_e.isForwardRef=j,_e.isFragment=F,_e.isLazy=Y,_e.isMemo=Z,_e.isPortal=q,_e.isProfiler=ee,_e.isStrictMode=Q,_e.isSuspense=de,_e.isValidElementType=_,_e.typeOf=x}()),_e}var sc;function Iu(){return sc||(sc=1,process.env.NODE_ENV==="production"?Vi.exports=ov():Vi.exports=sv()),Vi.exports}/*
|
|
25
25
|
object-assign
|
|
26
26
|
(c) Sindre Sorhus
|
|
27
27
|
@license MIT
|
|
28
|
-
*/var
|
|
29
|
-
Valid keys: `+JSON.stringify(Object.keys(A),null," "));var M=de(Z,Q,j,F,Y+"."+Q,n);if(M)return M}return null}return p(k)}function B(A){switch(typeof A){case"number":case"string":case"undefined":return!0;case"boolean":return!A;case"object":if(Array.isArray(A))return A.every(B);if(A===null||a(A))return!0;var k=d(A);if(k){var
|
|
28
|
+
*/var Ko,ac;function av(){if(ac)return Ko;ac=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var l=Object.getOwnPropertyNames(s).map(function(f){return s[f]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(f){u[f]=f}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ko=o()?Object.assign:function(i,s){for(var a,l=r(i),u,f=1;f<arguments.length;f++){a=Object(arguments[f]);for(var d in a)t.call(a,d)&&(l[d]=a[d]);if(e){u=e(a);for(var m=0;m<u.length;m++)n.call(a,u[m])&&(l[u[m]]=a[u[m]])}}return l},Ko}var Vo,cc;function qs(){if(cc)return Vo;cc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Vo=e,Vo}var Uo,lc;function bu(){return lc||(lc=1,Uo=Function.call.bind(Object.prototype.hasOwnProperty)),Uo}var $o,uc;function cv(){if(uc)return $o;uc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=qs(),n={},r=bu();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function o(i,s,a,l,u){if(process.env.NODE_ENV!=="production"){for(var f in i)if(r(i,f)){var d;try{if(typeof i[f]!="function"){var m=Error((l||"React class")+": "+a+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}d=i[f](s,f,l,a,null,t)}catch(y){d=y}if(d&&!(d instanceof Error)&&e((l||"React class")+": type specification of "+a+" `"+f+"` 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 h=u?u():"";e("Failed "+a+" type: "+d.message+(h??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},$o=o,$o}var qo,dc;function lv(){if(dc)return qo;dc=1;var e=Iu(),t=av(),n=qs(),r=bu(),o=cv(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return qo=function(a,l){var u=typeof Symbol=="function"&&Symbol.iterator,f="@@iterator";function d(A){var k=A&&(u&&A[u]||A[f]);if(typeof k=="function")return k}var m="<<anonymous>>",h={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:g(),arrayOf:_,element:x(),elementType:C(),instanceOf:T,node:$(),objectOf:N,oneOf:S,oneOfType:D,shape:z,exact:ne};function y(A,k){return A===k?A!==0||1/A===1/k:A!==A&&k!==k}function w(A,k){this.message=A,this.data=k&&typeof k=="object"?k:{},this.stack=""}w.prototype=Error.prototype;function p(A){if(process.env.NODE_ENV!=="production")var k={},U=0;function L(F,Y,Z,q,ee,Q,de){if(q=q||m,Q=Q||Z,de!==n){if(l){var M=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw M.name="Invariant Violation",M}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=q+":"+Z;!k[ve]&&U<3&&(i("You are manually calling a React.PropTypes validation function for the `"+Q+"` prop on `"+q+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),k[ve]=!0,U++)}}return Y[Z]==null?F?Y[Z]===null?new w("The "+ee+" `"+Q+"` is marked as required "+("in `"+q+"`, but its value is `null`.")):new w("The "+ee+" `"+Q+"` is marked as required in "+("`"+q+"`, but its value is `undefined`.")):null:A(Y,Z,q,ee,Q)}var j=L.bind(null,!1);return j.isRequired=L.bind(null,!0),j}function b(A){function k(U,L,j,F,Y,Z){var q=U[L],ee=se(q);if(ee!==A){var Q=te(q);return new w("Invalid "+F+" `"+Y+"` of type "+("`"+Q+"` supplied to `"+j+"`, expected ")+("`"+A+"`."),{expectedType:A})}return null}return p(k)}function g(){return p(s)}function _(A){function k(U,L,j,F,Y){if(typeof A!="function")return new w("Property `"+Y+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var Z=U[L];if(!Array.isArray(Z)){var q=se(Z);return new w("Invalid "+F+" `"+Y+"` of type "+("`"+q+"` supplied to `"+j+"`, expected an array."))}for(var ee=0;ee<Z.length;ee++){var Q=A(Z,ee,j,F,Y+"["+ee+"]",n);if(Q instanceof Error)return Q}return null}return p(k)}function x(){function A(k,U,L,j,F){var Y=k[U];if(!a(Y)){var Z=se(Y);return new w("Invalid "+j+" `"+F+"` of type "+("`"+Z+"` supplied to `"+L+"`, expected a single ReactElement."))}return null}return p(A)}function C(){function A(k,U,L,j,F){var Y=k[U];if(!e.isValidElementType(Y)){var Z=se(Y);return new w("Invalid "+j+" `"+F+"` of type "+("`"+Z+"` supplied to `"+L+"`, expected a single ReactElement type."))}return null}return p(A)}function T(A){function k(U,L,j,F,Y){if(!(U[L]instanceof A)){var Z=A.name||m,q=we(U[L]);return new w("Invalid "+F+" `"+Y+"` of type "+("`"+q+"` supplied to `"+j+"`, expected ")+("instance of `"+Z+"`."))}return null}return p(k)}function S(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function k(U,L,j,F,Y){for(var Z=U[L],q=0;q<A.length;q++)if(y(Z,A[q]))return null;var ee=JSON.stringify(A,function(de,M){var ve=te(M);return ve==="symbol"?String(M):M});return new w("Invalid "+F+" `"+Y+"` of value `"+String(Z)+"` "+("supplied to `"+j+"`, expected one of "+ee+"."))}return p(k)}function N(A){function k(U,L,j,F,Y){if(typeof A!="function")return new w("Property `"+Y+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var Z=U[L],q=se(Z);if(q!=="object")return new w("Invalid "+F+" `"+Y+"` of type "+("`"+q+"` supplied to `"+j+"`, expected an object."));for(var ee in Z)if(r(Z,ee)){var Q=A(Z,ee,j,F,Y+"."+ee,n);if(Q instanceof Error)return Q}return null}return p(k)}function D(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var k=0;k<A.length;k++){var U=A[k];if(typeof U!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ge(U)+" at index "+k+"."),s}function L(j,F,Y,Z,q){for(var ee=[],Q=0;Q<A.length;Q++){var de=A[Q],M=de(j,F,Y,Z,q,n);if(M==null)return null;M.data&&r(M.data,"expectedType")&&ee.push(M.data.expectedType)}var ve=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new w("Invalid "+Z+" `"+q+"` supplied to "+("`"+Y+"`"+ve+"."))}return p(L)}function $(){function A(k,U,L,j,F){return B(k[U])?null:new w("Invalid "+j+" `"+F+"` supplied to "+("`"+L+"`, expected a ReactNode."))}return p(A)}function G(A,k,U,L,j){return new w((A||"React class")+": "+k+" type `"+U+"."+L+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function z(A){function k(U,L,j,F,Y){var Z=U[L],q=se(Z);if(q!=="object")return new w("Invalid "+F+" `"+Y+"` of type `"+q+"` "+("supplied to `"+j+"`, expected `object`."));for(var ee in A){var Q=A[ee];if(typeof Q!="function")return G(j,F,Y,ee,te(Q));var de=Q(Z,ee,j,F,Y+"."+ee,n);if(de)return de}return null}return p(k)}function ne(A){function k(U,L,j,F,Y){var Z=U[L],q=se(Z);if(q!=="object")return new w("Invalid "+F+" `"+Y+"` of type `"+q+"` "+("supplied to `"+j+"`, expected `object`."));var ee=t({},U[L],A);for(var Q in ee){var de=A[Q];if(r(A,Q)&&typeof de!="function")return G(j,F,Y,Q,te(de));if(!de)return new w("Invalid "+F+" `"+Y+"` key `"+Q+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify(U[L],null," ")+`
|
|
29
|
+
Valid keys: `+JSON.stringify(Object.keys(A),null," "));var M=de(Z,Q,j,F,Y+"."+Q,n);if(M)return M}return null}return p(k)}function B(A){switch(typeof A){case"number":case"string":case"undefined":return!0;case"boolean":return!A;case"object":if(Array.isArray(A))return A.every(B);if(A===null||a(A))return!0;var k=d(A);if(k){var U=k.call(A),L;if(k!==A.entries){for(;!(L=U.next()).done;)if(!B(L.value))return!1}else for(;!(L=U.next()).done;){var j=L.value;if(j&&!B(j[1]))return!1}}else return!1;return!0;default:return!1}}function ce(A,k){return A==="symbol"?!0:k?k["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&k instanceof Symbol:!1}function se(A){var k=typeof A;return Array.isArray(A)?"array":A instanceof RegExp?"object":ce(k,A)?"symbol":k}function te(A){if(typeof A>"u"||A===null)return""+A;var k=se(A);if(k==="object"){if(A instanceof Date)return"date";if(A instanceof RegExp)return"regexp"}return k}function ge(A){var k=te(A);switch(k){case"array":case"object":return"an "+k;case"boolean":case"date":case"regexp":return"a "+k;default:return k}}function we(A){return!A.constructor||!A.constructor.name?m:A.constructor.name}return h.checkPropTypes=o,h.resetWarningCache=o.resetWarningCache,h.PropTypes=h,h},qo}var Ho,fc;function uv(){if(fc)return Ho;fc=1;var e=qs();function t(){}function n(){}return n.resetWarningCache=t,Ho=function(){function r(s,a,l,u,f,d){if(d!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Ho}if(process.env.NODE_ENV!=="production"){var dv=Iu(),fv=!0;bs.exports=lv()(dv.isElement,fv)}else bs.exports=uv()();var pv=bs.exports;const K=Ks(pv);var _s={exports:{}},xe={};/**
|
|
30
30
|
* @license React
|
|
31
31
|
* react-is.production.min.js
|
|
32
32
|
*
|
|
@@ -34,7 +34,7 @@ Valid keys: `+JSON.stringify(Object.keys(A),null," "));var M=de(Z,Q,j,F,Y+"."+Q
|
|
|
34
34
|
*
|
|
35
35
|
* This source code is licensed under the MIT license found in the
|
|
36
36
|
* LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/var
|
|
37
|
+
*/var pc;function hv(){if(pc)return xe;pc=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function w(p){if(typeof p=="object"&&p!==null){var b=p.$$typeof;switch(b){case e:switch(p=p.type,p){case n:case o:case r:case u:case f:return p;default:switch(p=p&&p.$$typeof,p){case a:case s:case l:case m:case d:case i:return p;default:return b}}case t:return b}}}return xe.ContextConsumer=s,xe.ContextProvider=i,xe.Element=e,xe.ForwardRef=l,xe.Fragment=n,xe.Lazy=m,xe.Memo=d,xe.Portal=t,xe.Profiler=o,xe.StrictMode=r,xe.Suspense=u,xe.SuspenseList=f,xe.isAsyncMode=function(){return!1},xe.isConcurrentMode=function(){return!1},xe.isContextConsumer=function(p){return w(p)===s},xe.isContextProvider=function(p){return w(p)===i},xe.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===e},xe.isForwardRef=function(p){return w(p)===l},xe.isFragment=function(p){return w(p)===n},xe.isLazy=function(p){return w(p)===m},xe.isMemo=function(p){return w(p)===d},xe.isPortal=function(p){return w(p)===t},xe.isProfiler=function(p){return w(p)===o},xe.isStrictMode=function(p){return w(p)===r},xe.isSuspense=function(p){return w(p)===u},xe.isSuspenseList=function(p){return w(p)===f},xe.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===o||p===r||p===u||p===f||p===h||typeof p=="object"&&p!==null&&(p.$$typeof===m||p.$$typeof===d||p.$$typeof===i||p.$$typeof===s||p.$$typeof===l||p.$$typeof===y||p.getModuleId!==void 0)},xe.typeOf=w,xe}var Ce={};/**
|
|
38
38
|
* @license React
|
|
39
39
|
* react-is.development.js
|
|
40
40
|
*
|
|
@@ -42,10 +42,10 @@ Valid keys: `+JSON.stringify(Object.keys(A),null," "));var M=de(Z,Q,j,F,Y+"."+Q
|
|
|
42
42
|
*
|
|
43
43
|
* This source code is licensed under the MIT license found in the
|
|
44
44
|
* LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/var oc;function iv(){return oc||(oc=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),y=!1,v=!1,p=!1,x=!1,g=!1,b;b=Symbol.for("react.module.reference");function O(H){return!!(typeof H=="string"||typeof H=="function"||H===n||H===o||g||H===r||H===u||H===f||x||H===m||y||v||p||typeof H=="object"&&H!==null&&(H.$$typeof===h||H.$$typeof===d||H.$$typeof===i||H.$$typeof===s||H.$$typeof===c||H.$$typeof===b||H.getModuleId!==void 0))}function _(H){if(typeof H=="object"&&H!==null){var Ee=H.$$typeof;switch(Ee){case e:var Ke=H.type;switch(Ke){case n:case o:case r:case u:case f:return Ke;default:var Ge=Ke&&Ke.$$typeof;switch(Ge){case a:case s:case c:case h:case d:case i:return Ge;default:return Ee}}case t:return Ee}}}var T=s,S=i,N=e,D=c,U=n,G=h,z=d,ne=t,B=o,ce=r,se=u,te=f,ge=!1,we=!1;function A(H){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function k(H){return we||(we=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function $(H){return _(H)===s}function L(H){return _(H)===i}function j(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function F(H){return _(H)===c}function Y(H){return _(H)===n}function Z(H){return _(H)===h}function q(H){return _(H)===d}function ee(H){return _(H)===t}function Q(H){return _(H)===o}function de(H){return _(H)===r}function M(H){return _(H)===u}function ve(H){return _(H)===f}Oe.ContextConsumer=T,Oe.ContextProvider=S,Oe.Element=N,Oe.ForwardRef=D,Oe.Fragment=U,Oe.Lazy=G,Oe.Memo=z,Oe.Portal=ne,Oe.Profiler=B,Oe.StrictMode=ce,Oe.Suspense=se,Oe.SuspenseList=te,Oe.isAsyncMode=A,Oe.isConcurrentMode=k,Oe.isContextConsumer=$,Oe.isContextProvider=L,Oe.isElement=j,Oe.isForwardRef=F,Oe.isFragment=Y,Oe.isLazy=Z,Oe.isMemo=q,Oe.isPortal=ee,Oe.isProfiler=Q,Oe.isStrictMode=de,Oe.isSuspense=M,Oe.isSuspenseList=ve,Oe.isValidElementType=O,Oe.typeOf=_}()),Oe}process.env.NODE_ENV==="production"?ys.exports=rv():ys.exports=iv();var sc=ys.exports;const ac=e=>typeof e=="object"&&e!=null&&e.nodeType===1,cc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Vo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return cc(n.overflowY,t)||cc(n.overflowX,t)||(r=>{const o=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!o&&(o.clientHeight<r.scrollHeight||o.clientWidth<r.scrollWidth)})(e)}return!1},ji=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,ov=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},sv=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:u,skipOverflowHiddenElements:f}=t,d=typeof u=="function"?u:se=>se!==u;if(!ac(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,m=[];let y=e;for(;ac(y)&&d(y);){if(y=ov(y),y===h){m.push(y);break}y!=null&&y===document.body&&Vo(y)&&!Vo(document.documentElement)||y!=null&&Vo(y,f)&&m.push(y)}const v=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,p=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:x,scrollY:g}=window,{height:b,width:O,top:_,right:T,bottom:S,left:N}=e.getBoundingClientRect(),{top:D,right:U,bottom:G,left:z}=(se=>{const te=window.getComputedStyle(se);return{top:parseFloat(te.scrollMarginTop)||0,right:parseFloat(te.scrollMarginRight)||0,bottom:parseFloat(te.scrollMarginBottom)||0,left:parseFloat(te.scrollMarginLeft)||0}})(e);let ne=a==="start"||a==="nearest"?_-D:a==="end"?S+G:_+b/2-D+G,B=c==="center"?N+O/2-z+U:c==="end"?T+U:N-z;const ce=[];for(let se=0;se<m.length;se++){const te=m[se],{height:ge,width:we,top:A,right:k,bottom:$,left:L}=te.getBoundingClientRect();if(s==="if-needed"&&_>=0&&N>=0&&S<=p&&T<=v&&_>=A&&S<=$&&N>=L&&T<=k)return ce;const j=getComputedStyle(te),F=parseInt(j.borderLeftWidth,10),Y=parseInt(j.borderTopWidth,10),Z=parseInt(j.borderRightWidth,10),q=parseInt(j.borderBottomWidth,10);let ee=0,Q=0;const de="offsetWidth"in te?te.offsetWidth-te.clientWidth-F-Z:0,M="offsetHeight"in te?te.offsetHeight-te.clientHeight-Y-q:0,ve="offsetWidth"in te?te.offsetWidth===0?0:we/te.offsetWidth:0,H="offsetHeight"in te?te.offsetHeight===0?0:ge/te.offsetHeight:0;if(h===te)ee=a==="start"?ne:a==="end"?ne-p:a==="nearest"?ji(g,g+p,p,Y,q,g+ne,g+ne+b,b):ne-p/2,Q=c==="start"?B:c==="center"?B-v/2:c==="end"?B-v:ji(x,x+v,v,F,Z,x+B,x+B+O,O),ee=Math.max(0,ee+g),Q=Math.max(0,Q+x);else{ee=a==="start"?ne-A-Y:a==="end"?ne-$+q+M:a==="nearest"?ji(A,$,ge,Y,q+M,ne,ne+b,b):ne-(A+ge/2)+M/2,Q=c==="start"?B-L-F:c==="center"?B-(L+we/2)+de/2:c==="end"?B-k+Z+de:ji(L,k,we,F,Z+de,B,B+O,O);const{scrollLeft:Ee,scrollTop:Ke}=te;ee=H===0?0:Math.max(0,Math.min(Ke+ee/H,te.scrollHeight-ge/H+M)),Q=ve===0?0:Math.max(0,Math.min(Ee+Q/ve,te.scrollWidth-we/ve+de)),ne+=Ke-ee,B+=Ee-Q}ce.push({el:te,top:ee,left:Q})}return ce};var Fr=function(){return Fr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Fr.apply(this,arguments)};var av=0;function lc(e){return typeof e=="function"?e:vt}function vt(){}function fu(e,t){if(e){var n=sv(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function uc(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Vs(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return o.cancel=r,o}function He(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(i)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function hr(){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 pu(){return String(av++)}function cv(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(n===1?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function dc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function hu(e){return typeof e.type=="string"}function mu(e){return e.props}function lv(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var uv=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Li(e){e===void 0&&(e={});var t={};return uv.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function eo(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=to(t,r)?t[r]:e[r],n},{})}function to(e,t){return e[t]!==void 0}function vs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function dv(e){return Object.prototype.toString.call(e)==="[object Object]"}function zn(e,t,n,r,o){var i=n.length;if(i===0)return-1;var s=i-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var c=Mr(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function Mr(e,t,n,r,o){o===void 0&&(o=!1);var i=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<i;a++)if(!r(n[a],a))return a;return o?Mr(t?i-1:0,t,n,r):-1}function no(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(uc(o,e,n)||r&&uc(o,n.document.activeElement,n))})}var $s=vt;process.env.NODE_ENV!=="production"&&($s=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 fv=Vs(function(e){gu(e).textContent=""},500);function gu(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 yu(e,t){if(!(!e||!t)){var n=gu(t);n.textContent=e,fv(t)}}function pv(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var vu=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,wu=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Iu=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,qi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Hi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,bu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,_u=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,xu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Ou=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Cu=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Eu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Su=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Nu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,ws=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Tu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Ru=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Au=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,hv=Object.freeze({__proto__:null,blurButton:Tu,blurInput:Eu,changeInput:Su,clickButton:ws,clickItem:Cu,controlledPropUpdatedSelectedItem:Ru,itemMouseEnter:Iu,keyDownArrowDown:Hi,keyDownArrowUp:qi,keyDownEnd:Ou,keyDownEnter:_u,keyDownEscape:bu,keyDownHome:xu,keyDownSpaceButton:Nu,mouseUp:wu,touchEnd:Au,unknown:vu}),mv=["refKey","ref"],gv=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],yv=["onKeyDown","onBlur","onChange","onInput","onChangeText"],vv=["refKey","ref"],wv=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Iv=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+pu(),i.menuId=i.props.menuId||i.id+"-menu",i.labelId=i.props.labelId||i.id+"-label",i.inputId=i.props.inputId||i.id+"-input",i.getItemId=i.props.getItemId||function(g){return i.id+"-item-"+g},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(g,b){var O=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(_){return _!==O}),g()},b);i.timeoutIds.push(O)},i.setItemCount=function(g){i.itemCount=g},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(g,b){var O=i.getItemNodeFromIndex(b);return O&&O.hasAttribute("disabled")},i.setHighlightedIndex=function(g,b){g===void 0&&(g=i.props.defaultHighlightedIndex),b===void 0&&(b={}),b=Li(b),i.internalSetState(he({highlightedIndex:g},b))},i.clearSelection=function(g){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},g)},i.selectItem=function(g,b,O){b=Li(b),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:g,inputValue:i.props.itemToString(g)},b),O)},i.selectItemAtIndex=function(g,b,O){var _=i.items[g];_!=null&&i.selectItem(_,b,O)},i.selectHighlightedItem=function(g,b){return i.selectItemAtIndex(i.getState().highlightedIndex,g,b)},i.internalSetState=function(g,b){var O,_,T={},S=typeof g=="function";return!S&&g.hasOwnProperty("inputValue")&&i.props.onInputValueChange(g.inputValue,he({},i.getStateAndHelpers(),g)),i.setState(function(N){var D;N=i.getState(N);var U=S?g(N):g;U=i.props.stateReducer(N,U),O=U.hasOwnProperty("selectedItem");var G={};return O&&U.selectedItem!==N.selectedItem&&(_=U.selectedItem),(D=U).type||(D.type=vu),Object.keys(U).forEach(function(z){N[z]!==U[z]&&(T[z]=U[z]),z!=="type"&&(U[z],to(i.props,z)||(G[z]=U[z]))}),S&&U.hasOwnProperty("inputValue")&&i.props.onInputValueChange(U.inputValue,he({},i.getStateAndHelpers(),U)),G},function(){lc(b)();var N=Object.keys(T).length>1;N&&i.props.onStateChange(T,i.getStateAndHelpers()),O&&i.props.onSelect(g.selectedItem,i.getStateAndHelpers()),_!==void 0&&i.props.onChange(_,i.getStateAndHelpers()),i.props.onUserAction(T,i.getStateAndHelpers())})},i.rootRef=function(g){return i._rootNode=g},i.getRootProps=function(g,b){var O,_=g===void 0?{}:g,T=_.refKey,S=T===void 0?"ref":T,N=_.ref,D=dn(_,mv),U=b===void 0?{}:b,G=U.suppressRefError,z=G===void 0?!1:G;i.getRootProps.called=!0,i.getRootProps.refKey=S,i.getRootProps.suppressRefError=z;var ne=i.getState(),B=ne.isOpen;return he((O={},O[S]=hr(N,i.rootRef),O.role="combobox",O["aria-expanded"]=B,O["aria-haspopup"]="listbox",O["aria-owns"]=B?i.menuId:void 0,O["aria-labelledby"]=i.labelId,O),D)},i.keyDownHandlers={ArrowDown:function(b){var O=this;if(b.preventDefault(),this.getState().isOpen){var _=b.shiftKey?5:1;this.moveHighlightedIndex(_,{type:Hi})}else this.internalSetState({isOpen:!0,type:Hi},function(){var T=O.getItemCount();if(T>0){var S=O.getState(),N=S.highlightedIndex,D=zn(N,1,{length:T},O.isItemDisabled,!0);O.setHighlightedIndex(D,{type:Hi})}})},ArrowUp:function(b){var O=this;if(b.preventDefault(),this.getState().isOpen){var _=b.shiftKey?-5:-1;this.moveHighlightedIndex(_,{type:qi})}else this.internalSetState({isOpen:!0,type:qi},function(){var T=O.getItemCount();if(T>0){var S=O.getState(),N=S.highlightedIndex,D=zn(N,-1,{length:T},O.isItemDisabled,!0);O.setHighlightedIndex(D,{type:qi})}})},Enter:function(b){if(b.which!==229){var O=this.getState(),_=O.isOpen,T=O.highlightedIndex;if(_&&T!=null){b.preventDefault();var S=this.items[T],N=this.getItemNodeFromIndex(T);if(S==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:_u})}}},Escape:function(b){b.preventDefault(),this.reset(he({type:bu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(b){b.preventDefault(),this.toggleMenu({type:Nu})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(b){var O=this.getState(),_=O.isOpen;if(_){b.preventDefault();var T=this.getItemCount();if(!(T<=0||!_)){var S=Mr(0,!1,{length:T},this.isItemDisabled);this.setHighlightedIndex(S,{type:xu})}}},End:function(b){var O=this.getState(),_=O.isOpen;if(_){b.preventDefault();var T=this.getItemCount();if(!(T<=0||!_)){var S=Mr(T-1,!0,{length:T},this.isItemDisabled);this.setHighlightedIndex(S,{type:Ou})}}}}),i.getToggleButtonProps=function(g){var b=g===void 0?{}:g,O=b.onClick;b.onPress;var _=b.onKeyDown,T=b.onKeyUp,S=b.onBlur,N=dn(b,gv),D=i.getState(),U=D.isOpen,G={onClick:He(O,i.buttonHandleClick),onKeyDown:He(_,i.buttonHandleKeyDown),onKeyUp:He(T,i.buttonHandleKeyUp),onBlur:He(S,i.buttonHandleBlur)},z=N.disabled?{}:G;return he({type:"button",role:"button","aria-label":U?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},z,N)},i.buttonHandleKeyUp=function(g){g.preventDefault()},i.buttonHandleKeyDown=function(g){var b=vs(g);i.buttonKeyDownHandlers[b]&&i.buttonKeyDownHandlers[b].call(i,g)},i.buttonHandleClick=function(g){if(g.preventDefault(),i.props.environment){var b=i.props.environment.document,O=b.body,_=b.activeElement;O&&O===_&&g.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:ws}):i.internalSetTimeout(function(){return i.toggleMenu({type:ws})})},i.buttonHandleBlur=function(g){var b=g.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var O=i.props.environment.document.activeElement;(O==null||O.id!==i.inputId)&&O!==b&&i.reset({type:Tu})}})},i.getLabelProps=function(g){return he({htmlFor:i.inputId,id:i.labelId},g)},i.getInputProps=function(g){var b=g===void 0?{}:g,O=b.onKeyDown,_=b.onBlur,T=b.onChange,S=b.onInput;b.onChangeText;var N=dn(b,yv),D,U={};D="onChange";var G=i.getState(),z=G.inputValue,ne=G.isOpen,B=G.highlightedIndex;if(!N.disabled){var ce;U=(ce={},ce[D]=He(T,S,i.inputHandleChange),ce.onKeyDown=He(O,i.inputHandleKeyDown),ce.onBlur=He(_,i.inputHandleBlur),ce)}return he({"aria-autocomplete":"list","aria-activedescendant":ne&&typeof B=="number"&&B>=0?i.getItemId(B):void 0,"aria-controls":ne?i.menuId:void 0,"aria-labelledby":N&&N["aria-label"]?void 0:i.labelId,autoComplete:"off",value:z,id:i.inputId},U,N)},i.inputHandleKeyDown=function(g){var b=vs(g);b&&i.inputKeyDownHandlers[b]&&i.inputKeyDownHandlers[b].call(i,g)},i.inputHandleChange=function(g){i.internalSetState({type:Su,isOpen:!0,inputValue:g.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var g;if(!(i.isMouseDown||!i.props.environment)){var b=i.props.environment.document.activeElement,O=(b==null||(g=b.dataset)==null?void 0:g.toggle)&&i._rootNode&&i._rootNode.contains(b);O||i.reset({type:Eu})}})},i.menuRef=function(g){i._menuNode=g},i.getMenuProps=function(g,b){var O,_=g===void 0?{}:g,T=_.refKey,S=T===void 0?"ref":T,N=_.ref,D=dn(_,vv),U=b===void 0?{}:b,G=U.suppressRefError,z=G===void 0?!1:G;return i.getMenuProps.called=!0,i.getMenuProps.refKey=S,i.getMenuProps.suppressRefError=z,he((O={},O[S]=hr(N,i.menuRef),O.role="listbox",O["aria-labelledby"]=D&&D["aria-label"]?void 0:i.labelId,O.id=i.menuId,O),D)},i.getItemProps=function(g){var b,O=g===void 0?{}:g,_=O.onMouseMove,T=O.onMouseDown,S=O.onClick;O.onPress;var N=O.index,D=O.item,U=D===void 0?process.env.NODE_ENV==="production"?void 0:lv("getItemProps","item"):D,G=dn(O,wv);N===void 0?(i.items.push(U),N=i.items.indexOf(U)):i.items[N]=U;var z="onClick",ne=S,B=(b={onMouseMove:He(_,function(){N!==i.getState().highlightedIndex&&(i.setHighlightedIndex(N,{type:Iu}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:He(T,function(se){se.preventDefault()})},b[z]=He(ne,function(){i.selectItemAtIndex(N,{type:Cu})}),b),ce=G.disabled?{onMouseDown:B.onMouseDown}:B;return he({id:i.getItemId(N),role:"option","aria-selected":i.getState().highlightedIndex===N},ce,G)},i.clearItems=function(){i.items=[]},i.reset=function(g,b){g===void 0&&(g={}),g=Li(g),i.internalSetState(function(O){var _=O.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(_)},g)},b)},i.toggleMenu=function(g,b){g===void 0&&(g={}),g=Li(g),i.internalSetState(function(O){var _=O.isOpen;return he({isOpen:!_},_&&{highlightedIndex:i.props.defaultHighlightedIndex},g)},function(){var O=i.getState(),_=O.isOpen,T=O.highlightedIndex;_&&i.getItemCount()>0&&typeof T=="number"&&i.setHighlightedIndex(T,g),lc(b)()})},i.openMenu=function(g){i.internalSetState({isOpen:!0},g)},i.closeMenu=function(g){i.internalSetState({isOpen:!1},g)},i.updateStatus=Vs(function(){var g;if((g=i.props)!=null&&(g=g.environment)!=null&&g.document){var b=i.getState(),O=i.items[b.highlightedIndex],_=i.getItemCount(),T=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:_,highlightedItem:O},b));i.previousResultCount=_,yu(T,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,u=c===void 0?a:c,f=s.defaultIsOpen,d=s.initialIsOpen,h=d===void 0?f:d,m=s.initialInputValue,y=m===void 0?"":m,v=s.initialSelectedItem,p=v===void 0?null:v,x=i.getState({highlightedIndex:u,isOpen:h,inputValue:y,selectedItem:p});return x.selectedItem!=null&&i.props.initialInputValue===void 0&&(x.inputValue=i.props.itemToString(x.selectedItem)),i.state=x,i}Jy(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),eo(i,this.props)},r.getItemCount=function(){var i=this.items.length;return this.itemCount!=null?i=this.itemCount:this.props.itemCount!==void 0&&(i=this.props.itemCount),i},r.getItemNodeFromIndex=function(i){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(i)):null},r.scrollHighlightedItemIntoView=function(){{var i=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(i,this._menuNode)}},r.moveHighlightedIndex=function(i,s){var a=this.getItemCount(),c=this.getState(),u=c.highlightedIndex;if(a>0){var f=zn(u,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(f,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,u=i.isOpen,f=this.props.itemToString,d=this.id,h=this.getRootProps,m=this.getToggleButtonProps,y=this.getLabelProps,v=this.getMenuProps,p=this.getInputProps,x=this.getItemProps,g=this.openMenu,b=this.closeMenu,O=this.toggleMenu,_=this.selectItem,T=this.selectItemAtIndex,S=this.selectHighlightedItem,N=this.setHighlightedIndex,D=this.clearSelection,U=this.clearItems,G=this.reset,z=this.setItemCount,ne=this.unsetItemCount,B=this.internalSetState;return{getRootProps:h,getToggleButtonProps:m,getLabelProps:y,getMenuProps:v,getInputProps:p,getItemProps:x,reset:G,openMenu:g,closeMenu:b,toggleMenu:O,selectItem:_,selectItemAtIndex:T,selectHighlightedItem:S,setHighlightedIndex:N,clearSelection:D,clearItems:U,setItemCount:z,unsetItemCount:ne,setState:B,itemToString:f,id:d,highlightedIndex:s,inputValue:a,isOpen:u,selectedItem:c}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&fc(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(m){i.isMouseDown=!1;var y=no(m.target,[i._rootNode,i._menuNode],i.props.environment);!y&&i.getState().isOpen&&i.reset({type:wu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},u=function(){i.isTouchMove=!0},f=function(m){var y=no(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!y&&i.getState().isOpen&&i.reset({type:Au},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},d=this.props.environment;d.addEventListener("mousedown",s),d.addEventListener("mouseup",a),d.addEventListener("touchstart",c),d.addEventListener("touchmove",u),d.addEventListener("touchend",f),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),d.removeEventListener("mousedown",s),d.removeEventListener("mouseup",a),d.removeEventListener("touchstart",c),d.removeEventListener("touchmove",u),d.removeEventListener("touchend",f)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,u=s.highlightedIndex===void 0?i:s,f=u.highlightedIndex,d=c&&this.getState().isOpen&&!i.isOpen,h=c!==f;return d||h},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&($s(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&fc(this._menuNode,this.getMenuProps)),to(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Ru,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,i)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var i=dc(this.props.children,vt);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var s=dc(i(this.getStateAndHelpers()));if(!s)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&bv(s,this.getRootProps),s;if(hu(s))return w.cloneElement(s,this.getRootProps(mu(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:cv,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&dv(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:vt,onInputValueChange:vt,onUserAction:vt,onChange:vt,onSelect:vt,onOuterClick:vt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:fu},e.stateChangeTypes=hv,e}();process.env.NODE_ENV!=="production"&&(Iv.propTypes={children:K.func,defaultHighlightedIndex:K.number,defaultIsOpen:K.bool,initialHighlightedIndex:K.number,initialSelectedItem:K.any,initialInputValue:K.string,initialIsOpen:K.bool,getA11yStatusMessage:K.func,itemToString:K.func,onChange:K.func,onSelect:K.func,onStateChange:K.func,onInputValueChange:K.func,onUserAction:K.func,onOuterClick:K.func,selectedItemChanged:K.func,stateReducer:K.func,itemCount:K.number,id:K.string,environment:K.shape({addEventListener:K.func.isRequired,removeEventListener:K.func.isRequired,document:K.shape({createElement:K.func.isRequired,getElementById:K.func.isRequired,activeElement:K.any.isRequired,body:K.any.isRequired}).isRequired,Node:K.func.isRequired}),suppressRefError:K.bool,scrollIntoView:K.func,selectedItem:K.any,isOpen:K.bool,inputValue:K.string,highlightedIndex:K.number,labelId:K.string,inputId:K.string,menuId:K.string,getItemId:K.func});function fc(e,t){var n=t.refKey;e||console.error('downshift: The ref prop "'+n+'" from getMenuProps was not applied correctly on your menu element.')}function bv(e,t){var n=t.refKey,r=n!=="ref",o=!hu(e);o&&!r&&!sc.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!o&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!sc.isForwardRef(e)&&!mu(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Pu={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function _v(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){xv(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(he({type:o},i))}function xv(e,t,n,r){var o=t.props,i=t.type,s="on"+Us(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function Ov(e,t){return t.changes}var pc=Vs(function(e,t){yu(e,t)},200),Cv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,Ev="useId"in w?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+w.useId();n||(n=c);var u=w.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(f){return n+"-item-"+f},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return u.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+pu():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,u=w.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(f){return r+"-item-"+f},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return u.current};function Sv(e,t,n,r){var o,i;if(e===void 0){if(t===void 0)throw new Error(r);o=n[t],i=t}else i=t===void 0?n.indexOf(e):t,o=e;return[o,i]}function Us(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Du(e){var t=w.useRef(e);return t.current=e,t}function Nv(e,t,n,r){var o=w.useRef(),i=w.useRef(),s=w.useCallback(function(m,y){i.current=y,m=eo(m,y.props);var v=e(m,y),p=y.props.stateReducer(m,he({},y,{changes:v}));return p},[e]),a=w.useReducer(s,t,n),c=a[0],u=a[1],f=Du(t),d=w.useCallback(function(m){return u(he({props:f.current},m))},[f]),h=i.current;return w.useEffect(function(){var m=eo(o.current,h==null?void 0:h.props),y=h&&o.current&&!r(m,c);y&&_v(h,m,c),o.current=c},[c,h,r]),[c,d]}var Yr={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:Ov,scrollIntoView:fu,environment:typeof window>"u"?void 0:window};function Pn(e,t,n){n===void 0&&(n=Pu);var r=e["default"+Us(t)];return r!==void 0?r:n[t]}function Zr(e,t,n){n===void 0&&(n=Pu);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Us(t)];return o!==void 0?o:Pn(e,t,n)}function Tv(e){var t=Zr(e,"selectedItem"),n=Zr(e,"isOpen"),r=Fv(e),o=Zr(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(i){return e.itemToKey(i)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:o}}function ei(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,u=t.highlightedIndex;return r.length===0?-1:o!==void 0&&u===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:c?r.findIndex(function(f){return a(c)===a(f)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function Rv(e,t,n){var r=w.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return w.useEffect(function(){if(!e)return vt;var o=n.map(function(f){return f.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(f){r.current.isMouseDown=!1,no(f.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function u(f){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!no(f.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",u),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",u)}},[n,e,t]),r.current}var Fu=function(){return vt};process.env.NODE_ENV!=="production"&&(Fu=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=w.useRef(n.reduce(function(s,a){return s[a]={},s},{}));w.useEffect(function(){Object.keys(o.current).forEach(function(s){var a=o.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var c=a.suppressRefError,u=a.refKey,f=a.elementRef;c||f!=null&&f.current||console.error('downshift: The ref prop "'+u+'" from '+s+" was not applied correctly on your element.")})},[]);var i=w.useCallback(function(s,a,c,u){o.current[s]={suppressRefError:a,refKey:c,elementRef:u}},[]);return i});function Av(e,t,n,r){r===void 0&&(r={});var o=r.document,i=go();w.useEffect(function(){if(!(!e||i||!o)){var s=e(t);pc(s,o)}},n),w.useEffect(function(){return function(){pc.cancel(),pv(o)}},[o])}function Pv(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=w.useRef(!0);return Cv(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Mu=vt;process.env.NODE_ENV!=="production"&&(Mu=function(t){var n=t.props,r=t.state,o=w.useRef(n),i=go();w.useEffect(function(){i||($s(r,o.current,n),o.current=n)},[r,n,i])});function hc(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return he({isOpen:!1,highlightedIndex:-1},o&&he({selectedItem:e.items[t],isOpen:Pn(e,"isOpen"),highlightedIndex:Pn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Dv(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function go(){var e=w.useRef(!0);return w.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Is(e){var t=Pn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function Fv(e){var t=Zr(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Bi={environment:K.shape({addEventListener:K.func.isRequired,removeEventListener:K.func.isRequired,document:K.shape({createElement:K.func.isRequired,getElementById:K.func.isRequired,activeElement:K.any.isRequired,body:K.any.isRequired}).isRequired,Node:K.func.isRequired}),itemToString:K.func,itemToKey:K.func,stateReducer:K.func},ku=he({},Bi,{getA11yStatusMessage:K.func,highlightedIndex:K.number,defaultHighlightedIndex:K.number,initialHighlightedIndex:K.number,isOpen:K.bool,defaultIsOpen:K.bool,initialIsOpen:K.bool,selectedItem:K.any,initialSelectedItem:K.any,defaultSelectedItem:K.any,id:K.string,labelId:K.string,menuId:K.string,getItemId:K.func,toggleButtonId:K.string,onSelectedItemChange:K.func,onHighlightedIndexChange:K.func,onStateChange:K.func,onIsOpenChange:K.func,scrollIntoView:K.func});function Mv(e,t,n){var r=t.type,o=t.props,i;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ei(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:ei(o,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:o.isItemDisabled(o.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:Is(o),isOpen:Pn(o,"isOpen"),selectedItem:Pn(o,"selectedItem"),inputValue:Pn(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}Fr(Fr({},ku),{items:K.array.isRequired,isItemDisabled:K.func});Fr(Fr({},Yr),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var qs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Hs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Bs=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Ws=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Js=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,zs=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Gs=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Qs=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Xs=process.env.NODE_ENV!=="production"?"__input_change__":8,ro=process.env.NODE_ENV!=="production"?"__input_blur__":9,Ys=process.env.NODE_ENV!=="production"?"__input_click__":10,ju=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Lu=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,Zs=process.env.NODE_ENV!=="production"?"__item_click__":13,Ku=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Vu=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,$u=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Uu=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,qu=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,ea=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Hu=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Bu=process.env.NODE_ENV!=="production"?"__function_reset__":21,ta=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Wu=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ta,FunctionCloseMenu:Uu,FunctionOpenMenu:$u,FunctionReset:Bu,FunctionSelectItem:ea,FunctionSetHighlightedIndex:qu,FunctionSetInputValue:Hu,FunctionToggleMenu:Vu,InputBlur:ro,InputChange:Xs,InputClick:Ys,InputKeyDownArrowDown:qs,InputKeyDownArrowUp:Hs,InputKeyDownEnd:Js,InputKeyDownEnter:Qs,InputKeyDownEscape:Bs,InputKeyDownHome:Ws,InputKeyDownPageDown:Gs,InputKeyDownPageUp:zs,ItemClick:Zs,ItemMouseMove:Lu,MenuMouseLeave:ju,ToggleButtonClick:Ku});function kv(e){var t=Tv(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),he({},t,{inputValue:r})}var jv=he({},ku,{items:K.array.isRequired,isItemDisabled:K.func,inputValue:K.string,defaultInputValue:K.string,initialInputValue:K.string,inputId:K.string,onInputValueChange:K.func});function Lv(e,t,n,r){var o=w.useRef(),i=Nv(e,t,n,r),s=i[0],a=i[1],c=go();return w.useEffect(function(){if(to(t,"selectedItem")){if(!c){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);u&&a({type:ta,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[eo(s,t),a]}var Ju=vt;process.env.NODE_ENV!=="production"&&(Ju=function(t,n){K.checkPropTypes(jv,t,"prop",n.name)});var Kv=he({},Yr,{isItemDisabled:function(){return!1}});function Vv(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case Zs:s={isOpen:Pn(o,"isOpen"),highlightedIndex:Is(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case qs:e.isOpen?s={highlightedIndex:zn(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:ei(o,e,1),isOpen:o.items.length>=0};break;case Hs:e.isOpen?i?s=hc(o,e.highlightedIndex):s={highlightedIndex:zn(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:ei(o,e,-1),isOpen:o.items.length>=0};break;case Qs:s=hc(o,e.highlightedIndex);break;case Bs:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case zs:s={highlightedIndex:zn(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Gs:s={highlightedIndex:zn(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case Ws:s={highlightedIndex:Mr(0,!1,o.items,o.isItemDisabled)};break;case Js:s={highlightedIndex:Mr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case ro:s=he({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=o.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case Xs:s={isOpen:!0,highlightedIndex:Is(o),inputValue:t.inputValue};break;case Ys:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ei(o,e,0)};break;case ea:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case ta:s={inputValue:t.inputValue};break;default:return Mv(e,t,Wu)}return he({},e,s)}var $v=["onMouseLeave","refKey","ref"],Uv=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],qv=["onClick","onPress","refKey","ref"],Hv=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];na.stateChangeTypes=Wu;function na(e){e===void 0&&(e={}),Ju(e,na);var t=he({},Kv,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=Lv(Vv,t,kv,Dv),a=s[0],c=s[1],u=a.isOpen,f=a.highlightedIndex,d=a.selectedItem,h=a.inputValue,m=w.useRef(null),y=w.useRef({}),v=w.useRef(null),p=w.useRef(null),x=go(),g=Ev(t),b=w.useRef(),O=Du({state:a,props:t}),_=w.useCallback(function($){return y.current[g.getItemId($)]},[g]);Av(i,a,[u,f,d,h],o);var T=Pv({menuElement:m.current,highlightedIndex:f,isOpen:u,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:_});Mu({props:t,state:a}),w.useEffect(function(){var $=Zr(t,"isOpen");$&&v.current&&v.current.focus()},[]),w.useEffect(function(){x||(b.current=n.length)});var S=Rv(o,w.useCallback(function(){O.current.state.isOpen&&c({type:ro,selectItem:!1})},[c,O]),w.useMemo(function(){return[m,p,v]},[m.current,p.current,v.current])),N=Fu("getInputProps","getMenuProps");w.useEffect(function(){u||(y.current={})},[u]),w.useEffect(function(){var $;!u||!(o!=null&&o.document)||!(v!=null&&($=v.current)!=null&&$.focus)||o.document.activeElement!==v.current&&v.current.focus()},[u,o]);var D=w.useMemo(function(){return{ArrowDown:function(L){L.preventDefault(),c({type:qs,altKey:L.altKey})},ArrowUp:function(L){L.preventDefault(),c({type:Hs,altKey:L.altKey})},Home:function(L){O.current.state.isOpen&&(L.preventDefault(),c({type:Ws}))},End:function(L){O.current.state.isOpen&&(L.preventDefault(),c({type:Js}))},Escape:function(L){var j=O.current.state;(j.isOpen||j.inputValue||j.selectedItem||j.highlightedIndex>-1)&&(L.preventDefault(),c({type:Bs}))},Enter:function(L){var j=O.current.state;!j.isOpen||L.which===229||(L.preventDefault(),c({type:Qs}))},PageUp:function(L){O.current.state.isOpen&&(L.preventDefault(),c({type:zs}))},PageDown:function(L){O.current.state.isOpen&&(L.preventDefault(),c({type:Gs}))}}},[c,O]),U=w.useCallback(function($){return he({id:g.labelId,htmlFor:g.inputId},$)},[g]),G=w.useCallback(function($,L){var j,F=$===void 0?{}:$,Y=F.onMouseLeave,Z=F.refKey,q=Z===void 0?"ref":Z,ee=F.ref,Q=dn(F,$v),de=L===void 0?{}:L,M=de.suppressRefError,ve=M===void 0?!1:M;return N("getMenuProps",ve,q,m),he((j={},j[q]=hr(ee,function(H){m.current=H}),j.id=g.menuId,j.role="listbox",j["aria-labelledby"]=Q&&Q["aria-label"]?void 0:""+g.labelId,j.onMouseLeave=He(Y,function(){c({type:ju})}),j),Q)},[c,N,g]),z=w.useCallback(function($){var L,j,F=$===void 0?{}:$,Y=F.item,Z=F.index,q=F.refKey,ee=q===void 0?"ref":q,Q=F.ref,de=F.onMouseMove,M=F.onMouseDown,ve=F.onClick;F.onPress;var H=F.disabled,Ee=dn(F,Uv);H!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ke=O.current,Ge=Ke.props,Ve=Ke.state,Ie=Sv(Y,Z,Ge.items,"Pass either item or index to getItemProps!"),At=Ie[0],Qe=Ie[1],mt=Ge.isItemDisabled(At,Qe),Pt="onClick",Dt=ve,Xe=function(){S.isTouchEnd||Qe===Ve.highlightedIndex||(T.current=!1,c({type:Lu,index:Qe,disabled:mt}))},We=function(){c({type:Zs,index:Qe})},$e=function(Ft){return Ft.preventDefault()};return he((L={},L[ee]=hr(Q,function(Ae){Ae&&(y.current[g.getItemId(Qe)]=Ae)}),L["aria-disabled"]=mt,L["aria-selected"]=Qe===Ve.highlightedIndex,L.id=g.getItemId(Qe),L.role="option",L),!mt&&(j={},j[Pt]=He(Dt,We),j),{onMouseMove:He(de,Xe),onMouseDown:He(M,$e)},Ee)},[c,g,O,S,T]),ne=w.useCallback(function($){var L,j=$===void 0?{}:$,F=j.onClick;j.onPress;var Y=j.refKey,Z=Y===void 0?"ref":Y,q=j.ref,ee=dn(j,qv),Q=O.current.state,de=function(){c({type:Ku})};return he((L={},L[Z]=hr(q,function(M){p.current=M}),L["aria-controls"]=g.menuId,L["aria-expanded"]=Q.isOpen,L.id=g.toggleButtonId,L.tabIndex=-1,L),!ee.disabled&&he({},{onClick:He(F,de)}),ee)},[c,O,g]),B=w.useCallback(function($,L){var j,F=$===void 0?{}:$,Y=F.onKeyDown,Z=F.onChange,q=F.onInput,ee=F.onBlur;F.onChangeText;var Q=F.onClick,de=F.refKey,M=de===void 0?"ref":de,ve=F.ref,H=dn(F,Hv),Ee=L===void 0?{}:L,Ke=Ee.suppressRefError,Ge=Ke===void 0?!1:Ke;N("getInputProps",Ge,M,v);var Ve=O.current.state,Ie=function($e){var Ae=vs($e);Ae&&D[Ae]&&D[Ae]($e)},At=function($e){c({type:Xs,inputValue:$e.target.value})},Qe=function($e){if(o!=null&&o.document&&Ve.isOpen&&!S.isMouseDown){var Ae=$e.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:ro,selectItem:!Ae})}},mt=function(){c({type:Ys})},Pt="onChange",Dt={};if(!H.disabled){var Xe;Dt=(Xe={},Xe[Pt]=He(Z,q,At),Xe.onKeyDown=He(Y,Ie),Xe.onBlur=He(ee,Qe),Xe.onClick=He(Q,mt),Xe)}return he((j={},j[M]=hr(ve,function(We){v.current=We}),j["aria-activedescendant"]=Ve.isOpen&&Ve.highlightedIndex>-1?g.getItemId(Ve.highlightedIndex):"",j["aria-autocomplete"]="list",j["aria-controls"]=g.menuId,j["aria-expanded"]=Ve.isOpen,j["aria-labelledby"]=H&&H["aria-label"]?void 0:g.labelId,j.autoComplete="off",j.id=g.inputId,j.role="combobox",j.value=Ve.inputValue,j),Dt,H)},[c,g,o,D,O,S,N]),ce=w.useCallback(function(){c({type:Vu})},[c]),se=w.useCallback(function(){c({type:Uu})},[c]),te=w.useCallback(function(){c({type:$u})},[c]),ge=w.useCallback(function($){c({type:qu,highlightedIndex:$})},[c]),we=w.useCallback(function($){c({type:ea,selectedItem:$})},[c]),A=w.useCallback(function($){c({type:Hu,inputValue:$})},[c]),k=w.useCallback(function(){c({type:Bu})},[c]);return{getItemProps:z,getLabelProps:U,getMenuProps:G,getInputProps:B,getToggleButtonProps:ne,toggleMenu:ce,openMenu:te,closeMenu:se,setHighlightedIndex:ge,setInputValue:A,selectItem:we,reset:k,highlightedIndex:f,isOpen:u,selectedItem:d,inputValue:h}}Bi.stateReducer,Bi.itemToKey,Bi.environment,K.array,K.array,K.array,K.func,K.number,K.number,K.number,K.func,K.func,K.string,K.string;Yr.itemToKey,Yr.stateReducer,Yr.environment;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;const Bv="_comboboxContainer_1lcc8_1",Wv="_label_1lcc8_8",Jv="_inputContainer_1lcc8_12",zv="_input_1lcc8_12",Gv="_toggleButton_1lcc8_33",Qv="_menu_1lcc8_39",Xv="_menuBottom_1lcc8_55",Yv="_menuTop_1lcc8_61",Zv="_menuItem_1lcc8_66",ew="_highlighted_1lcc8_73",tw="_selected_1lcc8_77",nw="_hidden_1lcc8_81",Lt={comboboxContainer:Bv,label:Wv,inputContainer:Jv,input:zv,toggleButton:Gv,menu:Qv,menuBottom:Xv,menuTop:Yv,menuItem:Zv,highlighted:ew,selected:tw,hidden:nw};function rw(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function zu({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,c]=w.useState(e),u=w.useRef(null);w.useEffect(()=>c(e),[e]);const f=w.useCallback(S=>{(S==null?void 0:S.length)>0?c(e.filter(rw(S))):c(e)},[e]),{isOpen:d,getToggleButtonProps:h,getMenuProps:m,getInputProps:y,highlightedIndex:v,getItemProps:p,setInputValue:x,selectedItem:g}=na({items:a,selectedItem:t?e.find(S=>S.value===t):null,itemToString:S=>(S==null?void 0:S.label)||"",onInputValueChange:({inputValue:S})=>f(S),onSelectedItemChange:({selectedItem:S})=>{var N;n(S),(N=u.current)==null||N.blur()}}),b=()=>{x(""),c(e)},O=()=>b(),_=w.useMemo(()=>{var S;return(S=e.find(N=>N.value===t))==null?void 0:S.label},[e,t]),T=()=>{t&&_&&t!==(g==null?void 0:g.value)&&x(_||"")};return l.jsxs("div",{style:{position:"relative",...i},children:[l.jsx("div",{className:Lt.comboboxContainer,children:l.jsxs("div",{className:Lt.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:Lt.input,...y({onFocus:O,onBlur:T,ref:u})}),l.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:Lt.toggleButton,type:"button",...h(),children:d?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${Lt.menu} ${d&&e.length?"":Lt.hidden} ${s==="top"?Lt.menuTop:Lt.menuBottom}`,...m(),children:d&&a.map((S,N)=>l.jsx("li",{className:`${Lt.menuItem} ${v===N?Lt.highlighted:""} ${t===(S==null?void 0:S.value)?Lt.selected:""}`,...p({item:S,index:N}),children:l.jsx("span",{children:S.label})},S.id))})]})}const kr=Math.min,rr=Math.max,io=Math.round,Ki=Math.floor,Mn=e=>({x:e,y:e}),iw={left:"right",right:"left",bottom:"top",top:"bottom"},ow={start:"end",end:"start"};function bs(e,t,n){return rr(e,kr(t,n))}function hi(e,t){return typeof e=="function"?e(t):e}function ur(e){return e.split("-")[0]}function mi(e){return e.split("-")[1]}function Gu(e){return e==="x"?"y":"x"}function ra(e){return e==="y"?"height":"width"}function jr(e){return["top","bottom"].includes(ur(e))?"y":"x"}function ia(e){return Gu(jr(e))}function sw(e,t,n){n===void 0&&(n=!1);const r=mi(e),o=ia(e),i=ra(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=oo(s)),[s,oo(s)]}function aw(e){const t=oo(e);return[_s(e),t,_s(t)]}function _s(e){return e.replace(/start|end/g,t=>ow[t])}function cw(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 lw(e,t,n,r){const o=mi(e);let i=cw(ur(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(_s)))),i}function oo(e){return e.replace(/left|right|bottom|top/g,t=>iw[t])}function uw(e){return{top:0,right:0,bottom:0,left:0,...e}}function Qu(e){return typeof e!="number"?uw(e):{top:e,right:e,bottom:e,left:e}}function so(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function mc(e,t,n){let{reference:r,floating:o}=e;const i=jr(t),s=ia(t),a=ra(s),c=ur(t),u=i==="y",f=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(c){case"top":m={x:f,y:r.y-o.height};break;case"bottom":m={x:f,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(mi(t)){case"start":m[s]-=h*(n&&u?-1:1);break;case"end":m[s]+=h*(n&&u?-1:1);break}return m}const dw=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:d}=mc(u,r,c),h=r,m={},y=0;for(let v=0;v<a.length;v++){const{name:p,fn:x}=a[v],{x:g,y:b,data:O,reset:_}=await x({x:f,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:t}});f=g??f,d=b??d,m={...m,[p]:{...m[p],...O}},_&&y<=50&&(y++,typeof _=="object"&&(_.placement&&(h=_.placement),_.rects&&(u=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):_.rects),{x:f,y:d}=mc(u,h,c)),v=-1)}return{x:f,y:d,placement:h,strategy:o,middlewareData:m}};async function Xu(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:h=!1,padding:m=0}=hi(t,e),y=Qu(m),p=a[h?d==="floating"?"reference":"floating":d],x=so(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:f,strategy:c})),g=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),O=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},_=so(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:b,strategy:c}):g);return{top:(x.top-_.top+y.top)/O.y,bottom:(_.bottom-x.bottom+y.bottom)/O.y,left:(x.left-_.left+y.left)/O.x,right:(_.right-x.right+y.right)/O.x}}const fw=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:c}=t,{element:u,padding:f=0}=hi(e,t)||{};if(u==null)return{};const d=Qu(f),h={x:n,y:r},m=ia(o),y=ra(m),v=await s.getDimensions(u),p=m==="y",x=p?"top":"left",g=p?"bottom":"right",b=p?"clientHeight":"clientWidth",O=i.reference[y]+i.reference[m]-h[m]-i.floating[y],_=h[m]-i.reference[m],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let S=T?T[b]:0;(!S||!await(s.isElement==null?void 0:s.isElement(T)))&&(S=a.floating[b]||i.floating[y]);const N=O/2-_/2,D=S/2-v[y]/2-1,U=kr(d[x],D),G=kr(d[g],D),z=U,ne=S-v[y]-G,B=S/2-v[y]/2+N,ce=bs(z,B,ne),se=!c.arrow&&mi(o)!=null&&B!==ce&&i.reference[y]/2-(B<z?U:G)-v[y]/2<0,te=se?B<z?B-z:B-ne:0;return{[m]:h[m]+te,data:{[m]:ce,centerOffset:B-ce-te,...se&&{alignmentOffset:te}},reset:se}}}),pw=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...p}=hi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=ur(o),g=jr(a),b=ur(a)===a,O=await(c.isRTL==null?void 0:c.isRTL(u.floating)),_=h||(b||!v?[oo(a)]:aw(a)),T=y!=="none";!h&&T&&_.push(...lw(a,v,y,O));const S=[a,..._],N=await Xu(t,p),D=[];let U=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&D.push(N[x]),d){const B=sw(o,s,O);D.push(N[B[0]],N[B[1]])}if(U=[...U,{placement:o,overflows:D}],!D.every(B=>B<=0)){var G,z;const B=(((G=i.flip)==null?void 0:G.index)||0)+1,ce=S[B];if(ce)return{data:{index:B,overflows:U},reset:{placement:ce}};let se=(z=U.filter(te=>te.overflows[0]<=0).sort((te,ge)=>te.overflows[1]-ge.overflows[1])[0])==null?void 0:z.placement;if(!se)switch(m){case"bestFit":{var ne;const te=(ne=U.filter(ge=>{if(T){const we=jr(ge.placement);return we===g||we==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(we=>we>0).reduce((we,A)=>we+A,0)]).sort((ge,we)=>ge[1]-we[1])[0])==null?void 0:ne[0];te&&(se=te);break}case"initialPlacement":se=a;break}if(o!==se)return{reset:{placement:se}}}return{}}}};async function hw(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=ur(n),a=mi(n),c=jr(n)==="y",u=["left","top"].includes(s)?-1:1,f=i&&c?-1:1,d=hi(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),c?{x:m*f,y:h*u}:{x:h*u,y:m*f}}const mw=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,c=await hw(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:s}}}}},gw=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:p=>{let{x,y:g}=p;return{x,y:g}}},...c}=hi(e,t),u={x:n,y:r},f=await Xu(t,c),d=jr(ur(o)),h=Gu(d);let m=u[h],y=u[d];if(i){const p=h==="y"?"top":"left",x=h==="y"?"bottom":"right",g=m+f[p],b=m-f[x];m=bs(g,m,b)}if(s){const p=d==="y"?"top":"left",x=d==="y"?"bottom":"right",g=y+f[p],b=y-f[x];y=bs(g,y,b)}const v=a.fn({...t,[h]:m,[d]:y});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[d]:s}}}}}};function yo(){return typeof window<"u"}function Br(e){return Yu(e)?(e.nodeName||"").toLowerCase():"#document"}function It(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function en(e){var t;return(t=(Yu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Yu(e){return yo()?e instanceof Node||e instanceof It(e).Node:!1}function Ht(e){return yo()?e instanceof Element||e instanceof It(e).Element:!1}function Zt(e){return yo()?e instanceof HTMLElement||e instanceof It(e).HTMLElement:!1}function gc(e){return!yo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof It(e).ShadowRoot}function gi(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Bt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function yw(e){return["table","td","th"].includes(Br(e))}function vo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function oa(e){const t=sa(),n=Ht(e)?Bt(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 vw(e){let t=kn(e);for(;Zt(t)&&!Lr(t);){if(oa(t))return t;if(vo(t))return null;t=kn(t)}return null}function sa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Lr(e){return["html","body","#document"].includes(Br(e))}function Bt(e){return It(e).getComputedStyle(e)}function wo(e){return Ht(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function kn(e){if(Br(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gc(e)&&e.host||en(e);return gc(t)?t.host:t}function Zu(e){const t=kn(e);return Lr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Zt(t)&&gi(t)?t:Zu(t)}function si(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Zu(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=It(o);if(i){const a=xs(s);return t.concat(s,s.visualViewport||[],gi(o)?o:[],a&&n?si(a):[])}return t.concat(o,si(o,[],n))}function xs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ed(e){const t=Bt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Zt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=io(n)!==i||io(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function aa(e){return Ht(e)?e:e.contextElement}function gr(e){const t=aa(e);if(!Zt(t))return Mn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ed(t);let s=(i?io(n.width):n.width)/r,a=(i?io(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const ww=Mn(0);function td(e){const t=It(e);return!sa()||!t.visualViewport?ww:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Iw(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==It(e)?!1:t}function dr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=aa(e);let s=Mn(1);t&&(r?Ht(r)&&(s=gr(r)):s=gr(e));const a=Iw(i,n,r)?td(i):Mn(0);let c=(o.left+a.x)/s.x,u=(o.top+a.y)/s.y,f=o.width/s.x,d=o.height/s.y;if(i){const h=It(i),m=r&&Ht(r)?It(r):r;let y=h,v=xs(y);for(;v&&r&&m!==y;){const p=gr(v),x=v.getBoundingClientRect(),g=Bt(v),b=x.left+(v.clientLeft+parseFloat(g.paddingLeft))*p.x,O=x.top+(v.clientTop+parseFloat(g.paddingTop))*p.y;c*=p.x,u*=p.y,f*=p.x,d*=p.y,c+=b,u+=O,y=It(v),v=xs(y)}}return so({width:f,height:d,x:c,y:u})}function bw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=en(r),a=t?vo(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Mn(1);const f=Mn(0),d=Zt(r);if((d||!d&&!i)&&((Br(r)!=="body"||gi(s))&&(c=wo(r)),Zt(r))){const h=dr(r);u=gr(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x,y:n.y*u.y-c.scrollTop*u.y+f.y}}function _w(e){return Array.from(e.getClientRects())}function Os(e,t){const n=wo(e).scrollLeft;return t?t.left+n:dr(en(e)).left+n}function xw(e){const t=en(e),n=wo(e),r=e.ownerDocument.body,o=rr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=rr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Os(e);const a=-n.scrollTop;return Bt(r).direction==="rtl"&&(s+=rr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function Ow(e,t){const n=It(e),r=en(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const u=sa();(!u||u&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function Cw(e,t){const n=dr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Zt(e)?gr(e):Mn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,u=r*i.y;return{width:s,height:a,x:c,y:u}}function yc(e,t,n){let r;if(t==="viewport")r=Ow(e,n);else if(t==="document")r=xw(en(e));else if(Ht(t))r=Cw(t,n);else{const o=td(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return so(r)}function nd(e,t){const n=kn(e);return n===t||!Ht(n)||Lr(n)?!1:Bt(n).position==="fixed"||nd(n,t)}function Ew(e,t){const n=t.get(e);if(n)return n;let r=si(e,[],!1).filter(a=>Ht(a)&&Br(a)!=="body"),o=null;const i=Bt(e).position==="fixed";let s=i?kn(e):e;for(;Ht(s)&&!Lr(s);){const a=Bt(s),c=oa(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||gi(s)&&!c&&nd(e,s))?r=r.filter(f=>f!==s):o=a,s=kn(s)}return t.set(e,r),r}function Sw(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?vo(t)?[]:Ew(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,f)=>{const d=yc(t,f,o);return u.top=rr(d.top,u.top),u.right=kr(d.right,u.right),u.bottom=kr(d.bottom,u.bottom),u.left=rr(d.left,u.left),u},yc(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Nw(e){const{width:t,height:n}=ed(e);return{width:t,height:n}}function Tw(e,t,n){const r=Zt(t),o=en(t),i=n==="fixed",s=dr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Mn(0);if(r||!r&&!i)if((Br(t)!=="body"||gi(o))&&(a=wo(t)),r){const m=dr(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&(c.x=Os(o));let u=0,f=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();f=m.top+a.scrollTop,u=m.left+a.scrollLeft-Os(o,m)}const d=s.left+a.scrollLeft-c.x-u,h=s.top+a.scrollTop-c.y-f;return{x:d,y:h,width:s.width,height:s.height}}function $o(e){return Bt(e).position==="static"}function vc(e,t){if(!Zt(e)||Bt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return en(e)===n&&(n=n.ownerDocument.body),n}function rd(e,t){const n=It(e);if(vo(e))return n;if(!Zt(e)){let o=kn(e);for(;o&&!Lr(o);){if(Ht(o)&&!$o(o))return o;o=kn(o)}return n}let r=vc(e,t);for(;r&&yw(r)&&$o(r);)r=vc(r,t);return r&&Lr(r)&&$o(r)&&!oa(r)?n:r||vw(e)||n}const Rw=async function(e){const t=this.getOffsetParent||rd,n=this.getDimensions,r=await n(e.floating);return{reference:Tw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Aw(e){return Bt(e).direction==="rtl"}const Pw={convertOffsetParentRelativeRectToViewportRelativeRect:bw,getDocumentElement:en,getClippingRect:Sw,getOffsetParent:rd,getElementRects:Rw,getClientRects:_w,getDimensions:Nw,getScale:gr,isElement:Ht,isRTL:Aw};function Dw(e,t){let n=null,r;const o=en(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const{left:u,top:f,width:d,height:h}=e.getBoundingClientRect();if(a||t(),!d||!h)return;const m=Ki(f),y=Ki(o.clientWidth-(u+d)),v=Ki(o.clientHeight-(f+h)),p=Ki(u),g={rootMargin:-m+"px "+-y+"px "+-v+"px "+-p+"px",threshold:rr(0,kr(1,c))||1};let b=!0;function O(_){const T=_[0].intersectionRatio;if(T!==c){if(!b)return s();T?s(!1,T):r=setTimeout(()=>{s(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(O,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(O,g)}n.observe(e)}return s(!0),i}function Fw(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=aa(e),f=o||i?[...u?si(u):[],...si(t)]:[];f.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const d=u&&a?Dw(u,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(x=>{let[g]=x;g&&g.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var b;(b=m)==null||b.observe(t)})),n()}),u&&!c&&m.observe(u),m.observe(t));let y,v=c?dr(e):null;c&&p();function p(){const x=dr(e);v&&(x.x!==v.x||x.y!==v.y||x.width!==v.width||x.height!==v.height)&&n(),v=x,y=requestAnimationFrame(p)}return n(),()=>{var x;f.forEach(g=>{o&&g.removeEventListener("scroll",n),i&&g.removeEventListener("resize",n)}),d==null||d(),(x=m)==null||x.disconnect(),m=null,c&&cancelAnimationFrame(y)}}const Mw=mw,kw=gw,jw=pw,Lw=fw,wc=(e,t,n)=>{const r=new Map,o={platform:Pw,...n},i={...o.platform,_c:r};return dw(e,t,{...o,platform:i})};/*
|
|
45
|
+
*/var hc;function mv(){return hc||(hc=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"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),y=!1,w=!1,p=!1,b=!1,g=!1,_;_=Symbol.for("react.module.reference");function x(H){return!!(typeof H=="string"||typeof H=="function"||H===n||H===o||g||H===r||H===u||H===f||b||H===h||y||w||p||typeof H=="object"&&H!==null&&(H.$$typeof===m||H.$$typeof===d||H.$$typeof===i||H.$$typeof===s||H.$$typeof===l||H.$$typeof===_||H.getModuleId!==void 0))}function C(H){if(typeof H=="object"&&H!==null){var Ee=H.$$typeof;switch(Ee){case e:var Ve=H.type;switch(Ve){case n:case o:case r:case u:case f:return Ve;default:var Ye=Ve&&Ve.$$typeof;switch(Ye){case a:case s:case l:case m:case d:case i:return Ye;default:return Ee}}case t:return Ee}}}var T=s,S=i,N=e,D=l,$=n,G=m,z=d,ne=t,B=o,ce=r,se=u,te=f,ge=!1,we=!1;function A(H){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function k(H){return we||(we=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function U(H){return C(H)===s}function L(H){return C(H)===i}function j(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function F(H){return C(H)===l}function Y(H){return C(H)===n}function Z(H){return C(H)===m}function q(H){return C(H)===d}function ee(H){return C(H)===t}function Q(H){return C(H)===o}function de(H){return C(H)===r}function M(H){return C(H)===u}function ve(H){return C(H)===f}Ce.ContextConsumer=T,Ce.ContextProvider=S,Ce.Element=N,Ce.ForwardRef=D,Ce.Fragment=$,Ce.Lazy=G,Ce.Memo=z,Ce.Portal=ne,Ce.Profiler=B,Ce.StrictMode=ce,Ce.Suspense=se,Ce.SuspenseList=te,Ce.isAsyncMode=A,Ce.isConcurrentMode=k,Ce.isContextConsumer=U,Ce.isContextProvider=L,Ce.isElement=j,Ce.isForwardRef=F,Ce.isFragment=Y,Ce.isLazy=Z,Ce.isMemo=q,Ce.isPortal=ee,Ce.isProfiler=Q,Ce.isStrictMode=de,Ce.isSuspense=M,Ce.isSuspenseList=ve,Ce.isValidElementType=x,Ce.typeOf=C}()),Ce}process.env.NODE_ENV==="production"?_s.exports=hv():_s.exports=mv();var mc=_s.exports;const gc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,yc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Bo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return yc(n.overflowY,t)||yc(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},Ui=(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,gv=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},yv=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:l,boundary:u,skipOverflowHiddenElements:f}=t,d=typeof u=="function"?u:se=>se!==u;if(!gc(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,h=[];let y=e;for(;gc(y)&&d(y);){if(y=gv(y),y===m){h.push(y);break}y!=null&&y===document.body&&Bo(y)&&!Bo(document.documentElement)||y!=null&&Bo(y,f)&&h.push(y)}const w=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,p=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:b,scrollY:g}=window,{height:_,width:x,top:C,right:T,bottom:S,left:N}=e.getBoundingClientRect(),{top:D,right:$,bottom:G,left:z}=(se=>{const te=window.getComputedStyle(se);return{top:parseFloat(te.scrollMarginTop)||0,right:parseFloat(te.scrollMarginRight)||0,bottom:parseFloat(te.scrollMarginBottom)||0,left:parseFloat(te.scrollMarginLeft)||0}})(e);let ne=a==="start"||a==="nearest"?C-D:a==="end"?S+G:C+_/2-D+G,B=l==="center"?N+x/2-z+$:l==="end"?T+$:N-z;const ce=[];for(let se=0;se<h.length;se++){const te=h[se],{height:ge,width:we,top:A,right:k,bottom:U,left:L}=te.getBoundingClientRect();if(s==="if-needed"&&C>=0&&N>=0&&S<=p&&T<=w&&C>=A&&S<=U&&N>=L&&T<=k)return ce;const j=getComputedStyle(te),F=parseInt(j.borderLeftWidth,10),Y=parseInt(j.borderTopWidth,10),Z=parseInt(j.borderRightWidth,10),q=parseInt(j.borderBottomWidth,10);let ee=0,Q=0;const de="offsetWidth"in te?te.offsetWidth-te.clientWidth-F-Z:0,M="offsetHeight"in te?te.offsetHeight-te.clientHeight-Y-q:0,ve="offsetWidth"in te?te.offsetWidth===0?0:we/te.offsetWidth:0,H="offsetHeight"in te?te.offsetHeight===0?0:ge/te.offsetHeight:0;if(m===te)ee=a==="start"?ne:a==="end"?ne-p:a==="nearest"?Ui(g,g+p,p,Y,q,g+ne,g+ne+_,_):ne-p/2,Q=l==="start"?B:l==="center"?B-w/2:l==="end"?B-w:Ui(b,b+w,w,F,Z,b+B,b+B+x,x),ee=Math.max(0,ee+g),Q=Math.max(0,Q+b);else{ee=a==="start"?ne-A-Y:a==="end"?ne-U+q+M:a==="nearest"?Ui(A,U,ge,Y,q+M,ne,ne+_,_):ne-(A+ge/2)+M/2,Q=l==="start"?B-L-F:l==="center"?B-(L+we/2)+de/2:l==="end"?B-k+Z+de:Ui(L,k,we,F,Z+de,B,B+x,x);const{scrollLeft:Ee,scrollTop:Ve}=te;ee=H===0?0:Math.max(0,Math.min(Ve+ee/H,te.scrollHeight-ge/H+M)),Q=ve===0?0:Math.max(0,Math.min(Ee+Q/ve,te.scrollWidth-we/ve+de)),ne+=Ve-ee,B+=Ee-Q}ce.push({el:te,top:ee,left:Q})}return ce};var Kr=function(){return Kr=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},Kr.apply(this,arguments)};var vv=0;function vc(e){return typeof e=="function"?e:It}function It(){}function _u(e,t){if(e){var n=yv(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function wc(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Hs(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 Be(){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 Ir(){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 xu(){return String(vv++)}function wv(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 Ic(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Cu(e){return typeof e.type=="string"}function Ou(e){return e.props}function Iv(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var bv=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function $i(e){e===void 0&&(e={});var t={};return bv.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]=so(t,r)?t[r]:e[r],n},{})}function so(e,t){return e[t]!==void 0}function xs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function _v(e){return Object.prototype.toString.call(e)==="[object Object]"}function Xn(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 l=Vr(a,t<0,n,r,o);return l===-1?e>=i?-1:e:l}function Vr(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?Vr(t?i-1:0,t,n,r):-1}function ao(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(wc(o,e,n)||r&&wc(o,n.document.activeElement,n))})}var Bs=It;process.env.NODE_ENV!=="production"&&(Bs=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 xv=Hs(function(e){Eu(e).textContent=""},500);function Eu(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 Su(e,t){if(!(!e||!t)){var n=Eu(t);n.textContent=e,xv(t)}}function Cv(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Nu=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Tu=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Ru=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Ji=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,zi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Au=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Pu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Du=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Fu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Mu=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,ku=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,ju=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Lu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Cs=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Ku=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Vu=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Uu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Ov=Object.freeze({__proto__:null,blurButton:Ku,blurInput:ku,changeInput:ju,clickButton:Cs,clickItem:Mu,controlledPropUpdatedSelectedItem:Vu,itemMouseEnter:Ru,keyDownArrowDown:zi,keyDownArrowUp:Ji,keyDownEnd:Fu,keyDownEnter:Pu,keyDownEscape:Au,keyDownHome:Du,keyDownSpaceButton:Lu,mouseUp:Tu,touchEnd:Uu,unknown:Nu}),Ev=["refKey","ref"],Sv=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Nv=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Tv=["refKey","ref"],Rv=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Av=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+xu(),i.menuId=i.props.menuId||i.id+"-menu",i.labelId=i.props.labelId||i.id+"-label",i.inputId=i.props.inputId||i.id+"-input",i.getItemId=i.props.getItemId||function(g){return i.id+"-item-"+g},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(g,_){var x=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(C){return C!==x}),g()},_);i.timeoutIds.push(x)},i.setItemCount=function(g){i.itemCount=g},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(g,_){var x=i.getItemNodeFromIndex(_);return x&&x.hasAttribute("disabled")},i.setHighlightedIndex=function(g,_){g===void 0&&(g=i.props.defaultHighlightedIndex),_===void 0&&(_={}),_=$i(_),i.internalSetState(he({highlightedIndex:g},_))},i.clearSelection=function(g){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},g)},i.selectItem=function(g,_,x){_=$i(_),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:g,inputValue:i.props.itemToString(g)},_),x)},i.selectItemAtIndex=function(g,_,x){var C=i.items[g];C!=null&&i.selectItem(C,_,x)},i.selectHighlightedItem=function(g,_){return i.selectItemAtIndex(i.getState().highlightedIndex,g,_)},i.internalSetState=function(g,_){var x,C,T={},S=typeof g=="function";return!S&&g.hasOwnProperty("inputValue")&&i.props.onInputValueChange(g.inputValue,he({},i.getStateAndHelpers(),g)),i.setState(function(N){var D;N=i.getState(N);var $=S?g(N):g;$=i.props.stateReducer(N,$),x=$.hasOwnProperty("selectedItem");var G={};return x&&$.selectedItem!==N.selectedItem&&(C=$.selectedItem),(D=$).type||(D.type=Nu),Object.keys($).forEach(function(z){N[z]!==$[z]&&(T[z]=$[z]),z!=="type"&&($[z],so(i.props,z)||(G[z]=$[z]))}),S&&$.hasOwnProperty("inputValue")&&i.props.onInputValueChange($.inputValue,he({},i.getStateAndHelpers(),$)),G},function(){vc(_)();var N=Object.keys(T).length>1;N&&i.props.onStateChange(T,i.getStateAndHelpers()),x&&i.props.onSelect(g.selectedItem,i.getStateAndHelpers()),C!==void 0&&i.props.onChange(C,i.getStateAndHelpers()),i.props.onUserAction(T,i.getStateAndHelpers())})},i.rootRef=function(g){return i._rootNode=g},i.getRootProps=function(g,_){var x,C=g===void 0?{}:g,T=C.refKey,S=T===void 0?"ref":T,N=C.ref,D=hn(C,Ev),$=_===void 0?{}:_,G=$.suppressRefError,z=G===void 0?!1:G;i.getRootProps.called=!0,i.getRootProps.refKey=S,i.getRootProps.suppressRefError=z;var ne=i.getState(),B=ne.isOpen;return he((x={},x[S]=Ir(N,i.rootRef),x.role="combobox",x["aria-expanded"]=B,x["aria-haspopup"]="listbox",x["aria-owns"]=B?i.menuId:void 0,x["aria-labelledby"]=i.labelId,x),D)},i.keyDownHandlers={ArrowDown:function(_){var x=this;if(_.preventDefault(),this.getState().isOpen){var C=_.shiftKey?5:1;this.moveHighlightedIndex(C,{type:zi})}else this.internalSetState({isOpen:!0,type:zi},function(){var T=x.getItemCount();if(T>0){var S=x.getState(),N=S.highlightedIndex,D=Xn(N,1,{length:T},x.isItemDisabled,!0);x.setHighlightedIndex(D,{type:zi})}})},ArrowUp:function(_){var x=this;if(_.preventDefault(),this.getState().isOpen){var C=_.shiftKey?-5:-1;this.moveHighlightedIndex(C,{type:Ji})}else this.internalSetState({isOpen:!0,type:Ji},function(){var T=x.getItemCount();if(T>0){var S=x.getState(),N=S.highlightedIndex,D=Xn(N,-1,{length:T},x.isItemDisabled,!0);x.setHighlightedIndex(D,{type:Ji})}})},Enter:function(_){if(_.which!==229){var x=this.getState(),C=x.isOpen,T=x.highlightedIndex;if(C&&T!=null){_.preventDefault();var S=this.items[T],N=this.getItemNodeFromIndex(T);if(S==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Pu})}}},Escape:function(_){_.preventDefault(),this.reset(he({type:Au},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(_){_.preventDefault(),this.toggleMenu({type:Lu})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(_){var x=this.getState(),C=x.isOpen;if(C){_.preventDefault();var T=this.getItemCount();if(!(T<=0||!C)){var S=Vr(0,!1,{length:T},this.isItemDisabled);this.setHighlightedIndex(S,{type:Du})}}},End:function(_){var x=this.getState(),C=x.isOpen;if(C){_.preventDefault();var T=this.getItemCount();if(!(T<=0||!C)){var S=Vr(T-1,!0,{length:T},this.isItemDisabled);this.setHighlightedIndex(S,{type:Fu})}}}}),i.getToggleButtonProps=function(g){var _=g===void 0?{}:g,x=_.onClick;_.onPress;var C=_.onKeyDown,T=_.onKeyUp,S=_.onBlur,N=hn(_,Sv),D=i.getState(),$=D.isOpen,G={onClick:Be(x,i.buttonHandleClick),onKeyDown:Be(C,i.buttonHandleKeyDown),onKeyUp:Be(T,i.buttonHandleKeyUp),onBlur:Be(S,i.buttonHandleBlur)},z=N.disabled?{}:G;return he({type:"button",role:"button","aria-label":$?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},z,N)},i.buttonHandleKeyUp=function(g){g.preventDefault()},i.buttonHandleKeyDown=function(g){var _=xs(g);i.buttonKeyDownHandlers[_]&&i.buttonKeyDownHandlers[_].call(i,g)},i.buttonHandleClick=function(g){if(g.preventDefault(),i.props.environment){var _=i.props.environment.document,x=_.body,C=_.activeElement;x&&x===C&&g.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:Cs}):i.internalSetTimeout(function(){return i.toggleMenu({type:Cs})})},i.buttonHandleBlur=function(g){var _=g.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var x=i.props.environment.document.activeElement;(x==null||x.id!==i.inputId)&&x!==_&&i.reset({type:Ku})}})},i.getLabelProps=function(g){return he({htmlFor:i.inputId,id:i.labelId},g)},i.getInputProps=function(g){var _=g===void 0?{}:g,x=_.onKeyDown,C=_.onBlur,T=_.onChange,S=_.onInput;_.onChangeText;var N=hn(_,Nv),D,$={};D="onChange";var G=i.getState(),z=G.inputValue,ne=G.isOpen,B=G.highlightedIndex;if(!N.disabled){var ce;$=(ce={},ce[D]=Be(T,S,i.inputHandleChange),ce.onKeyDown=Be(x,i.inputHandleKeyDown),ce.onBlur=Be(C,i.inputHandleBlur),ce)}return he({"aria-autocomplete":"list","aria-activedescendant":ne&&typeof B=="number"&&B>=0?i.getItemId(B):void 0,"aria-controls":ne?i.menuId:void 0,"aria-labelledby":N&&N["aria-label"]?void 0:i.labelId,autoComplete:"off",value:z,id:i.inputId},$,N)},i.inputHandleKeyDown=function(g){var _=xs(g);_&&i.inputKeyDownHandlers[_]&&i.inputKeyDownHandlers[_].call(i,g)},i.inputHandleChange=function(g){i.internalSetState({type:ju,isOpen:!0,inputValue:g.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var g;if(!(i.isMouseDown||!i.props.environment)){var _=i.props.environment.document.activeElement,x=(_==null||(g=_.dataset)==null?void 0:g.toggle)&&i._rootNode&&i._rootNode.contains(_);x||i.reset({type:ku})}})},i.menuRef=function(g){i._menuNode=g},i.getMenuProps=function(g,_){var x,C=g===void 0?{}:g,T=C.refKey,S=T===void 0?"ref":T,N=C.ref,D=hn(C,Tv),$=_===void 0?{}:_,G=$.suppressRefError,z=G===void 0?!1:G;return i.getMenuProps.called=!0,i.getMenuProps.refKey=S,i.getMenuProps.suppressRefError=z,he((x={},x[S]=Ir(N,i.menuRef),x.role="listbox",x["aria-labelledby"]=D&&D["aria-label"]?void 0:i.labelId,x.id=i.menuId,x),D)},i.getItemProps=function(g){var _,x=g===void 0?{}:g,C=x.onMouseMove,T=x.onMouseDown,S=x.onClick;x.onPress;var N=x.index,D=x.item,$=D===void 0?process.env.NODE_ENV==="production"?void 0:Iv("getItemProps","item"):D,G=hn(x,Rv);N===void 0?(i.items.push($),N=i.items.indexOf($)):i.items[N]=$;var z="onClick",ne=S,B=(_={onMouseMove:Be(C,function(){N!==i.getState().highlightedIndex&&(i.setHighlightedIndex(N,{type:Ru}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:Be(T,function(se){se.preventDefault()})},_[z]=Be(ne,function(){i.selectItemAtIndex(N,{type:Mu})}),_),ce=G.disabled?{onMouseDown:B.onMouseDown}:B;return he({id:i.getItemId(N),role:"option","aria-selected":i.getState().highlightedIndex===N},ce,G)},i.clearItems=function(){i.items=[]},i.reset=function(g,_){g===void 0&&(g={}),g=$i(g),i.internalSetState(function(x){var C=x.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(C)},g)},_)},i.toggleMenu=function(g,_){g===void 0&&(g={}),g=$i(g),i.internalSetState(function(x){var C=x.isOpen;return he({isOpen:!C},C&&{highlightedIndex:i.props.defaultHighlightedIndex},g)},function(){var x=i.getState(),C=x.isOpen,T=x.highlightedIndex;C&&i.getItemCount()>0&&typeof T=="number"&&i.setHighlightedIndex(T,g),vc(_)()})},i.openMenu=function(g){i.internalSetState({isOpen:!0},g)},i.closeMenu=function(g){i.internalSetState({isOpen:!1},g)},i.updateStatus=Hs(function(){var g;if((g=i.props)!=null&&(g=g.environment)!=null&&g.document){var _=i.getState(),x=i.items[_.highlightedIndex],C=i.getItemCount(),T=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:C,highlightedItem:x},_));i.previousResultCount=C,Su(T,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,l=s.initialHighlightedIndex,u=l===void 0?a:l,f=s.defaultIsOpen,d=s.initialIsOpen,m=d===void 0?f:d,h=s.initialInputValue,y=h===void 0?"":h,w=s.initialSelectedItem,p=w===void 0?null:w,b=i.getState({highlightedIndex:u,isOpen:m,inputValue:y,selectedItem:p});return b.selectedItem!=null&&i.props.initialInputValue===void 0&&(b.inputValue=i.props.itemToString(b.selectedItem)),i.state=b,i}iv(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),oo(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(),l=this.getState(),u=l.highlightedIndex;if(a>0){var f=Xn(u,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(f,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,l=i.selectedItem,u=i.isOpen,f=this.props.itemToString,d=this.id,m=this.getRootProps,h=this.getToggleButtonProps,y=this.getLabelProps,w=this.getMenuProps,p=this.getInputProps,b=this.getItemProps,g=this.openMenu,_=this.closeMenu,x=this.toggleMenu,C=this.selectItem,T=this.selectItemAtIndex,S=this.selectHighlightedItem,N=this.setHighlightedIndex,D=this.clearSelection,$=this.clearItems,G=this.reset,z=this.setItemCount,ne=this.unsetItemCount,B=this.internalSetState;return{getRootProps:m,getToggleButtonProps:h,getLabelProps:y,getMenuProps:w,getInputProps:p,getItemProps:b,reset:G,openMenu:g,closeMenu:_,toggleMenu:x,selectItem:C,selectItemAtIndex:T,selectHighlightedItem:S,setHighlightedIndex:N,clearSelection:D,clearItems:$,setItemCount:z,unsetItemCount:ne,setState:B,itemToString:f,id:d,highlightedIndex:s,inputValue:a,isOpen:u,selectedItem:l}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&bc(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(h){i.isMouseDown=!1;var y=ao(h.target,[i._rootNode,i._menuNode],i.props.environment);!y&&i.getState().isOpen&&i.reset({type:Tu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},l=function(){i.isTouchMove=!1},u=function(){i.isTouchMove=!0},f=function(h){var y=ao(h.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!y&&i.getState().isOpen&&i.reset({type:Uu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},d=this.props.environment;d.addEventListener("mousedown",s),d.addEventListener("mouseup",a),d.addEventListener("touchstart",l),d.addEventListener("touchmove",u),d.addEventListener("touchend",f),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),d.removeEventListener("mousedown",s),d.removeEventListener("mouseup",a),d.removeEventListener("touchstart",l),d.removeEventListener("touchmove",u),d.removeEventListener("touchend",f)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,l=a.highlightedIndex,u=s.highlightedIndex===void 0?i:s,f=u.highlightedIndex,d=l&&this.getState().isOpen&&!i.isOpen,m=l!==f;return d||m},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(Bs(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&bc(this._menuNode,this.getMenuProps)),so(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Vu,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=Ic(this.props.children,It);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var s=Ic(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&&Pv(s,this.getRootProps),s;if(Cu(s))return v.cloneElement(s,this.getRootProps(Ou(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(v.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:wv,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&_v(n)&&!n.hasOwnProperty("toString")&&console.warn("downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.","The object that was passed:",n),String(n))},onStateChange:It,onInputValueChange:It,onUserAction:It,onChange:It,onSelect:It,onOuterClick:It,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:_u},e.stateChangeTypes=Ov,e}();process.env.NODE_ENV!=="production"&&(Av.propTypes={children:K.func,defaultHighlightedIndex:K.number,defaultIsOpen:K.bool,initialHighlightedIndex:K.number,initialSelectedItem:K.any,initialInputValue:K.string,initialIsOpen:K.bool,getA11yStatusMessage:K.func,itemToString:K.func,onChange:K.func,onSelect:K.func,onStateChange:K.func,onInputValueChange:K.func,onUserAction:K.func,onOuterClick:K.func,selectedItemChanged:K.func,stateReducer:K.func,itemCount:K.number,id:K.string,environment:K.shape({addEventListener:K.func.isRequired,removeEventListener:K.func.isRequired,document:K.shape({createElement:K.func.isRequired,getElementById:K.func.isRequired,activeElement:K.any.isRequired,body:K.any.isRequired}).isRequired,Node:K.func.isRequired}),suppressRefError:K.bool,scrollIntoView:K.func,selectedItem:K.any,isOpen:K.bool,inputValue:K.string,highlightedIndex:K.number,labelId:K.string,inputId:K.string,menuId:K.string,getItemId:K.func});function bc(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 Pv(e,t){var n=t.refKey,r=n!=="ref",o=!Cu(e);o&&!r&&!mc.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+'"'),!mc.isForwardRef(e)&&!Ou(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var $u={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Dv(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){Fv(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(he({type:o},i))}function Fv(e,t,n,r){var o=t.props,i=t.type,s="on"+Ws(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function Mv(e,t){return t.changes}var _c=Hs(function(e,t){Su(e,t)},200),kv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?v.useLayoutEffect:v.useEffect,jv="useId"in v?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,l="downshift-"+v.useId();n||(n=l);var u=v.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(f){return n+"-item-"+f},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return u.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+xu():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,l=t.inputId,u=v.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(f){return r+"-item-"+f},toggleButtonId:a||r+"-toggle-button",inputId:l||r+"-input"});return u.current};function Lv(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 Ws(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function qu(e){var t=v.useRef(e);return t.current=e,t}function Kv(e,t,n,r){var o=v.useRef(),i=v.useRef(),s=v.useCallback(function(h,y){i.current=y,h=oo(h,y.props);var w=e(h,y),p=y.props.stateReducer(h,he({},y,{changes:w}));return p},[e]),a=v.useReducer(s,t,n),l=a[0],u=a[1],f=qu(t),d=v.useCallback(function(h){return u(he({props:f.current},h))},[f]),m=i.current;return v.useEffect(function(){var h=oo(o.current,m==null?void 0:m.props),y=m&&o.current&&!r(h,l);y&&Dv(m,h,l),o.current=l},[l,m,r]),[l,d]}var oi={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:Mv,scrollIntoView:_u,environment:typeof window>"u"?void 0:window};function kn(e,t,n){n===void 0&&(n=$u);var r=e["default"+Ws(t)];return r!==void 0?r:n[t]}function si(e,t,n){n===void 0&&(n=$u);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Ws(t)];return o!==void 0?o:kn(e,t,n)}function Vv(e){var t=si(e,"selectedItem"),n=si(e,"isOpen"),r=Bv(e),o=si(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 ai(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,l=t.selectedItem,u=t.highlightedIndex;return r.length===0?-1:o!==void 0&&u===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:l?r.findIndex(function(f){return a(l)===a(f)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function Uv(e,t,n){var r=v.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return v.useEffect(function(){if(!e)return It;var o=n.map(function(f){return f.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(f){r.current.isMouseDown=!1,ao(f.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function l(){r.current.isTouchMove=!0}function u(f){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!ao(f.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",l),e.addEventListener("touchend",u),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",l),e.removeEventListener("touchend",u)}},[n,e,t]),r.current}var Hu=function(){return It};process.env.NODE_ENV!=="production"&&(Hu=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=v.useRef(n.reduce(function(s,a){return s[a]={},s},{}));v.useEffect(function(){Object.keys(o.current).forEach(function(s){var a=o.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var l=a.suppressRefError,u=a.refKey,f=a.elementRef;l||f!=null&&f.current||console.error('downshift: The ref prop "'+u+'" from '+s+" was not applied correctly on your element.")})},[]);var i=v.useCallback(function(s,a,l,u){o.current[s]={suppressRefError:a,refKey:l,elementRef:u}},[]);return i});function $v(e,t,n,r){r===void 0&&(r={});var o=r.document,i=Io();v.useEffect(function(){if(!(!e||i||!o)){var s=e(t);_c(s,o)}},n),v.useEffect(function(){return function(){_c.cancel(),Cv(o)}},[o])}function qv(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=v.useRef(!0);return kv(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Bu=It;process.env.NODE_ENV!=="production"&&(Bu=function(t){var n=t.props,r=t.state,o=v.useRef(n),i=Io();v.useEffect(function(){i||(Bs(r,o.current,n),o.current=n)},[r,n,i])});function xc(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return he({isOpen:!1,highlightedIndex:-1},o&&he({selectedItem:e.items[t],isOpen:kn(e,"isOpen"),highlightedIndex:kn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Hv(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Io(){var e=v.useRef(!0);return v.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Os(e){var t=kn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function Bv(e){var t=si(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Gi={environment:K.shape({addEventListener:K.func.isRequired,removeEventListener:K.func.isRequired,document:K.shape({createElement:K.func.isRequired,getElementById:K.func.isRequired,activeElement:K.any.isRequired,body:K.any.isRequired}).isRequired,Node:K.func.isRequired}),itemToString:K.func,itemToKey:K.func,stateReducer:K.func},Wu=he({},Gi,{getA11yStatusMessage:K.func,highlightedIndex:K.number,defaultHighlightedIndex:K.number,initialHighlightedIndex:K.number,isOpen:K.bool,defaultIsOpen:K.bool,initialIsOpen:K.bool,selectedItem:K.any,initialSelectedItem:K.any,defaultSelectedItem:K.any,id:K.string,labelId:K.string,menuId:K.string,getItemId:K.func,toggleButtonId:K.string,onSelectedItemChange:K.func,onHighlightedIndexChange:K.func,onStateChange:K.func,onIsOpenChange:K.func,scrollIntoView:K.func});function Wv(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:ai(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:ai(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:Os(o),isOpen:kn(o,"isOpen"),selectedItem:kn(o,"selectedItem"),inputValue:kn(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}Kr(Kr({},Wu),{items:K.array.isRequired,isItemDisabled:K.func});Kr(Kr({},oi),{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 Js=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,zs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Gs=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Qs=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Xs=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Ys=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Zs=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,ea=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,ta=process.env.NODE_ENV!=="production"?"__input_change__":8,co=process.env.NODE_ENV!=="production"?"__input_blur__":9,na=process.env.NODE_ENV!=="production"?"__input_click__":10,Ju=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,zu=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ra=process.env.NODE_ENV!=="production"?"__item_click__":13,Gu=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Qu=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Xu=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Yu=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Zu=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,ia=process.env.NODE_ENV!=="production"?"__function_select_item__":19,ed=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,td=process.env.NODE_ENV!=="production"?"__function_reset__":21,oa=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,nd=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:oa,FunctionCloseMenu:Yu,FunctionOpenMenu:Xu,FunctionReset:td,FunctionSelectItem:ia,FunctionSetHighlightedIndex:Zu,FunctionSetInputValue:ed,FunctionToggleMenu:Qu,InputBlur:co,InputChange:ta,InputClick:na,InputKeyDownArrowDown:Js,InputKeyDownArrowUp:zs,InputKeyDownEnd:Xs,InputKeyDownEnter:ea,InputKeyDownEscape:Gs,InputKeyDownHome:Qs,InputKeyDownPageDown:Zs,InputKeyDownPageUp:Ys,ItemClick:ra,ItemMouseMove:zu,MenuMouseLeave:Ju,ToggleButtonClick:Gu});function Jv(e){var t=Vv(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),he({},t,{inputValue:r})}var zv=he({},Wu,{items:K.array.isRequired,isItemDisabled:K.func,inputValue:K.string,defaultInputValue:K.string,initialInputValue:K.string,inputId:K.string,onInputValueChange:K.func});function Gv(e,t,n,r){var o=v.useRef(),i=Kv(e,t,n,r),s=i[0],a=i[1],l=Io();return v.useEffect(function(){if(so(t,"selectedItem")){if(!l){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);u&&a({type:oa,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[oo(s,t),a]}var rd=It;process.env.NODE_ENV!=="production"&&(rd=function(t,n){K.checkPropTypes(zv,t,"prop",n.name)});var Qv=he({},oi,{isItemDisabled:function(){return!1}});function Xv(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case ra:s={isOpen:kn(o,"isOpen"),highlightedIndex:Os(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Js:e.isOpen?s={highlightedIndex:Xn(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:ai(o,e,1),isOpen:o.items.length>=0};break;case zs:e.isOpen?i?s=xc(o,e.highlightedIndex):s={highlightedIndex:Xn(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:ai(o,e,-1),isOpen:o.items.length>=0};break;case ea:s=xc(o,e.highlightedIndex);break;case Gs:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Ys:s={highlightedIndex:Xn(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Zs:s={highlightedIndex:Xn(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case Qs:s={highlightedIndex:Vr(0,!1,o.items,o.isItemDisabled)};break;case Xs:s={highlightedIndex:Vr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case co:s=he({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=o.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case ta:s={isOpen:!0,highlightedIndex:Os(o),inputValue:t.inputValue};break;case na:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ai(o,e,0)};break;case ia:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case oa:s={inputValue:t.inputValue};break;default:return Wv(e,t,nd)}return he({},e,s)}var Yv=["onMouseLeave","refKey","ref"],Zv=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],ew=["onClick","onPress","refKey","ref"],tw=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];sa.stateChangeTypes=nd;function sa(e){e===void 0&&(e={}),rd(e,sa);var t=he({},Qv,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=Gv(Xv,t,Jv,Hv),a=s[0],l=s[1],u=a.isOpen,f=a.highlightedIndex,d=a.selectedItem,m=a.inputValue,h=v.useRef(null),y=v.useRef({}),w=v.useRef(null),p=v.useRef(null),b=Io(),g=jv(t),_=v.useRef(),x=qu({state:a,props:t}),C=v.useCallback(function(U){return y.current[g.getItemId(U)]},[g]);$v(i,a,[u,f,d,m],o);var T=qv({menuElement:h.current,highlightedIndex:f,isOpen:u,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:C});Bu({props:t,state:a}),v.useEffect(function(){var U=si(t,"isOpen");U&&w.current&&w.current.focus()},[]),v.useEffect(function(){b||(_.current=n.length)});var S=Uv(o,v.useCallback(function(){x.current.state.isOpen&&l({type:co,selectItem:!1})},[l,x]),v.useMemo(function(){return[h,p,w]},[h.current,p.current,w.current])),N=Hu("getInputProps","getMenuProps");v.useEffect(function(){u||(y.current={})},[u]),v.useEffect(function(){var U;!u||!(o!=null&&o.document)||!(w!=null&&(U=w.current)!=null&&U.focus)||o.document.activeElement!==w.current&&w.current.focus()},[u,o]);var D=v.useMemo(function(){return{ArrowDown:function(L){L.preventDefault(),l({type:Js,altKey:L.altKey})},ArrowUp:function(L){L.preventDefault(),l({type:zs,altKey:L.altKey})},Home:function(L){x.current.state.isOpen&&(L.preventDefault(),l({type:Qs}))},End:function(L){x.current.state.isOpen&&(L.preventDefault(),l({type:Xs}))},Escape:function(L){var j=x.current.state;(j.isOpen||j.inputValue||j.selectedItem||j.highlightedIndex>-1)&&(L.preventDefault(),l({type:Gs}))},Enter:function(L){var j=x.current.state;!j.isOpen||L.which===229||(L.preventDefault(),l({type:ea}))},PageUp:function(L){x.current.state.isOpen&&(L.preventDefault(),l({type:Ys}))},PageDown:function(L){x.current.state.isOpen&&(L.preventDefault(),l({type:Zs}))}}},[l,x]),$=v.useCallback(function(U){return he({id:g.labelId,htmlFor:g.inputId},U)},[g]),G=v.useCallback(function(U,L){var j,F=U===void 0?{}:U,Y=F.onMouseLeave,Z=F.refKey,q=Z===void 0?"ref":Z,ee=F.ref,Q=hn(F,Yv),de=L===void 0?{}:L,M=de.suppressRefError,ve=M===void 0?!1:M;return N("getMenuProps",ve,q,h),he((j={},j[q]=Ir(ee,function(H){h.current=H}),j.id=g.menuId,j.role="listbox",j["aria-labelledby"]=Q&&Q["aria-label"]?void 0:""+g.labelId,j.onMouseLeave=Be(Y,function(){l({type:Ju})}),j),Q)},[l,N,g]),z=v.useCallback(function(U){var L,j,F=U===void 0?{}:U,Y=F.item,Z=F.index,q=F.refKey,ee=q===void 0?"ref":q,Q=F.ref,de=F.onMouseMove,M=F.onMouseDown,ve=F.onClick;F.onPress;var H=F.disabled,Ee=hn(F,Zv);H!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ve=x.current,Ye=Ve.props,Ue=Ve.state,Ie=Lv(Y,Z,Ye.items,"Pass either item or index to getItemProps!"),Dt=Ie[0],Ze=Ie[1],yt=Ye.isItemDisabled(Dt,Ze),Ft="onClick",Mt=ve,et=function(){S.isTouchEnd||Ze===Ue.highlightedIndex||(T.current=!1,l({type:zu,index:Ze,disabled:yt}))},Je=function(){l({type:ra,index:Ze})},$e=function(kt){return kt.preventDefault()};return he((L={},L[ee]=Ir(Q,function(Pe){Pe&&(y.current[g.getItemId(Ze)]=Pe)}),L["aria-disabled"]=yt,L["aria-selected"]=Ze===Ue.highlightedIndex,L.id=g.getItemId(Ze),L.role="option",L),!yt&&(j={},j[Ft]=Be(Mt,Je),j),{onMouseMove:Be(de,et),onMouseDown:Be(M,$e)},Ee)},[l,g,x,S,T]),ne=v.useCallback(function(U){var L,j=U===void 0?{}:U,F=j.onClick;j.onPress;var Y=j.refKey,Z=Y===void 0?"ref":Y,q=j.ref,ee=hn(j,ew),Q=x.current.state,de=function(){l({type:Gu})};return he((L={},L[Z]=Ir(q,function(M){p.current=M}),L["aria-controls"]=g.menuId,L["aria-expanded"]=Q.isOpen,L.id=g.toggleButtonId,L.tabIndex=-1,L),!ee.disabled&&he({},{onClick:Be(F,de)}),ee)},[l,x,g]),B=v.useCallback(function(U,L){var j,F=U===void 0?{}:U,Y=F.onKeyDown,Z=F.onChange,q=F.onInput,ee=F.onBlur;F.onChangeText;var Q=F.onClick,de=F.refKey,M=de===void 0?"ref":de,ve=F.ref,H=hn(F,tw),Ee=L===void 0?{}:L,Ve=Ee.suppressRefError,Ye=Ve===void 0?!1:Ve;N("getInputProps",Ye,M,w);var Ue=x.current.state,Ie=function($e){var Pe=xs($e);Pe&&D[Pe]&&D[Pe]($e)},Dt=function($e){l({type:ta,inputValue:$e.target.value})},Ze=function($e){if(o!=null&&o.document&&Ue.isOpen&&!S.isMouseDown){var Pe=$e.relatedTarget===null&&o.document.activeElement!==o.document.body;l({type:co,selectItem:!Pe})}},yt=function(){l({type:na})},Ft="onChange",Mt={};if(!H.disabled){var et;Mt=(et={},et[Ft]=Be(Z,q,Dt),et.onKeyDown=Be(Y,Ie),et.onBlur=Be(ee,Ze),et.onClick=Be(Q,yt),et)}return he((j={},j[M]=Ir(ve,function(Je){w.current=Je}),j["aria-activedescendant"]=Ue.isOpen&&Ue.highlightedIndex>-1?g.getItemId(Ue.highlightedIndex):"",j["aria-autocomplete"]="list",j["aria-controls"]=g.menuId,j["aria-expanded"]=Ue.isOpen,j["aria-labelledby"]=H&&H["aria-label"]?void 0:g.labelId,j.autoComplete="off",j.id=g.inputId,j.role="combobox",j.value=Ue.inputValue,j),Mt,H)},[l,g,o,D,x,S,N]),ce=v.useCallback(function(){l({type:Qu})},[l]),se=v.useCallback(function(){l({type:Yu})},[l]),te=v.useCallback(function(){l({type:Xu})},[l]),ge=v.useCallback(function(U){l({type:Zu,highlightedIndex:U})},[l]),we=v.useCallback(function(U){l({type:ia,selectedItem:U})},[l]),A=v.useCallback(function(U){l({type:ed,inputValue:U})},[l]),k=v.useCallback(function(){l({type:td})},[l]);return{getItemProps:z,getLabelProps:$,getMenuProps:G,getInputProps:B,getToggleButtonProps:ne,toggleMenu:ce,openMenu:te,closeMenu:se,setHighlightedIndex:ge,setInputValue:A,selectItem:we,reset:k,highlightedIndex:f,isOpen:u,selectedItem:d,inputValue:m}}Gi.stateReducer,Gi.itemToKey,Gi.environment,K.array,K.array,K.array,K.func,K.number,K.number,K.number,K.func,K.func,K.string,K.string;oi.itemToKey,oi.stateReducer,oi.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 nw="_comboboxContainer_1lcc8_1",rw="_label_1lcc8_8",iw="_inputContainer_1lcc8_12",ow="_input_1lcc8_12",sw="_toggleButton_1lcc8_33",aw="_menu_1lcc8_39",cw="_menuBottom_1lcc8_55",lw="_menuTop_1lcc8_61",uw="_menuItem_1lcc8_66",dw="_highlighted_1lcc8_73",fw="_selected_1lcc8_77",pw="_hidden_1lcc8_81",Vt={comboboxContainer:nw,label:rw,inputContainer:iw,input:ow,toggleButton:sw,menu:aw,menuBottom:cw,menuTop:lw,menuItem:uw,highlighted:dw,selected:fw,hidden:pw};function hw(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function id({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,l]=v.useState(e),u=v.useRef(null);v.useEffect(()=>l(e),[e]);const f=v.useCallback(S=>{(S==null?void 0:S.length)>0?l(e.filter(hw(S))):l(e)},[e]),{isOpen:d,getToggleButtonProps:m,getMenuProps:h,getInputProps:y,highlightedIndex:w,getItemProps:p,setInputValue:b,selectedItem:g}=sa({items:a,selectedItem:t?e.find(S=>S.value===t):null,itemToString:S=>(S==null?void 0:S.label)||"",onInputValueChange:({inputValue:S})=>f(S),onSelectedItemChange:({selectedItem:S})=>{var N;n(S),(N=u.current)==null||N.blur()}}),_=()=>{b(""),l(e)},x=()=>_(),C=v.useMemo(()=>{var S;return(S=e.find(N=>N.value===t))==null?void 0:S.label},[e,t]),T=()=>{t&&C&&t!==(g==null?void 0:g.value)&&b(C||"")};return c.jsxs("div",{style:{position:"relative",...i},children:[c.jsx("div",{className:Vt.comboboxContainer,children:c.jsxs("div",{className:Vt.inputContainer,children:[c.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:Vt.input,...y({onFocus:x,onBlur:T,ref:u})}),c.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:Vt.toggleButton,type:"button",...m(),children:d?c.jsx(c.Fragment,{children:"↑"}):c.jsx(c.Fragment,{children:"↓"})})]})}),c.jsx("ul",{className:`${Vt.menu} ${d&&e.length?"":Vt.hidden} ${s==="top"?Vt.menuTop:Vt.menuBottom}`,...h(),children:d&&a.map((S,N)=>c.jsx("li",{className:`${Vt.menuItem} ${w===N?Vt.highlighted:""} ${t===(S==null?void 0:S.value)?Vt.selected:""}`,...p({item:S,index:N}),children:c.jsx("span",{children:S.label})},S.id))})]})}const Ur=Math.min,sr=Math.max,lo=Math.round,qi=Math.floor,Kn=e=>({x:e,y:e}),mw={left:"right",right:"left",bottom:"top",top:"bottom"},gw={start:"end",end:"start"};function Es(e,t,n){return sr(e,Ur(t,n))}function bi(e,t){return typeof e=="function"?e(t):e}function hr(e){return e.split("-")[0]}function _i(e){return e.split("-")[1]}function od(e){return e==="x"?"y":"x"}function aa(e){return e==="y"?"height":"width"}function $r(e){return["top","bottom"].includes(hr(e))?"y":"x"}function ca(e){return od($r(e))}function yw(e,t,n){n===void 0&&(n=!1);const r=_i(e),o=ca(e),i=aa(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=uo(s)),[s,uo(s)]}function vw(e){const t=uo(e);return[Ss(e),t,Ss(t)]}function Ss(e){return e.replace(/start|end/g,t=>gw[t])}function ww(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 Iw(e,t,n,r){const o=_i(e);let i=ww(hr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Ss)))),i}function uo(e){return e.replace(/left|right|bottom|top/g,t=>mw[t])}function bw(e){return{top:0,right:0,bottom:0,left:0,...e}}function sd(e){return typeof e!="number"?bw(e):{top:e,right:e,bottom:e,left:e}}function fo(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Cc(e,t,n){let{reference:r,floating:o}=e;const i=$r(t),s=ca(t),a=aa(s),l=hr(t),u=i==="y",f=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:f,y:r.y-o.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(_i(t)){case"start":h[s]-=m*(n&&u?-1:1);break;case"end":h[s]+=m*(n&&u?-1:1);break}return h}const _w=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:d}=Cc(u,r,l),m=r,h={},y=0;for(let w=0;w<a.length;w++){const{name:p,fn:b}=a[w],{x:g,y:_,data:x,reset:C}=await b({x:f,y:d,initialPlacement:r,placement:m,strategy:o,middlewareData:h,rects:u,platform:s,elements:{reference:e,floating:t}});f=g??f,d=_??d,h={...h,[p]:{...h[p],...x}},C&&y<=50&&(y++,typeof C=="object"&&(C.placement&&(m=C.placement),C.rects&&(u=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:f,y:d}=Cc(u,m,l)),w=-1)}return{x:f,y:d,placement:m,strategy:o,middlewareData:h}};async function ad(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:m=!1,padding:h=0}=bi(t,e),y=sd(h),p=a[m?d==="floating"?"reference":"floating":d],b=fo(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:f,strategy:l})),g=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(_))?await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},C=fo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:_,strategy:l}):g);return{top:(b.top-C.top+y.top)/x.y,bottom:(C.bottom-b.bottom+y.bottom)/x.y,left:(b.left-C.left+y.left)/x.x,right:(C.right-b.right+y.right)/x.x}}const xw=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:u,padding:f=0}=bi(e,t)||{};if(u==null)return{};const d=sd(f),m={x:n,y:r},h=ca(o),y=aa(h),w=await s.getDimensions(u),p=h==="y",b=p?"top":"left",g=p?"bottom":"right",_=p?"clientHeight":"clientWidth",x=i.reference[y]+i.reference[h]-m[h]-i.floating[y],C=m[h]-i.reference[h],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let S=T?T[_]:0;(!S||!await(s.isElement==null?void 0:s.isElement(T)))&&(S=a.floating[_]||i.floating[y]);const N=x/2-C/2,D=S/2-w[y]/2-1,$=Ur(d[b],D),G=Ur(d[g],D),z=$,ne=S-w[y]-G,B=S/2-w[y]/2+N,ce=Es(z,B,ne),se=!l.arrow&&_i(o)!=null&&B!==ce&&i.reference[y]/2-(B<z?$:G)-w[y]/2<0,te=se?B<z?B-z:B-ne:0;return{[h]:m[h]+te,data:{[h]:ce,centerOffset:B-ce-te,...se&&{alignmentOffset:te}},reset:se}}}),Cw=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:l,elements:u}=t,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:w=!0,...p}=bi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=hr(o),g=$r(a),_=hr(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(u.floating)),C=m||(_||!w?[uo(a)]:vw(a)),T=y!=="none";!m&&T&&C.push(...Iw(a,w,y,x));const S=[a,...C],N=await ad(t,p),D=[];let $=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&D.push(N[b]),d){const B=yw(o,s,x);D.push(N[B[0]],N[B[1]])}if($=[...$,{placement:o,overflows:D}],!D.every(B=>B<=0)){var G,z;const B=(((G=i.flip)==null?void 0:G.index)||0)+1,ce=S[B];if(ce)return{data:{index:B,overflows:$},reset:{placement:ce}};let se=(z=$.filter(te=>te.overflows[0]<=0).sort((te,ge)=>te.overflows[1]-ge.overflows[1])[0])==null?void 0:z.placement;if(!se)switch(h){case"bestFit":{var ne;const te=(ne=$.filter(ge=>{if(T){const we=$r(ge.placement);return we===g||we==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(we=>we>0).reduce((we,A)=>we+A,0)]).sort((ge,we)=>ge[1]-we[1])[0])==null?void 0:ne[0];te&&(se=te);break}case"initialPlacement":se=a;break}if(o!==se)return{reset:{placement:se}}}return{}}}};async function Ow(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=hr(n),a=_i(n),l=$r(n)==="y",u=["left","top"].includes(s)?-1:1,f=i&&l?-1:1,d=bi(t,e);let{mainAxis:m,crossAxis:h,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"&&(h=a==="end"?y*-1:y),l?{x:h*f,y:m*u}:{x:m*u,y:h*f}}const Ew=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,l=await Ow(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},Sw=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:p=>{let{x:b,y:g}=p;return{x:b,y:g}}},...l}=bi(e,t),u={x:n,y:r},f=await ad(t,l),d=$r(hr(o)),m=od(d);let h=u[m],y=u[d];if(i){const p=m==="y"?"top":"left",b=m==="y"?"bottom":"right",g=h+f[p],_=h-f[b];h=Es(g,h,_)}if(s){const p=d==="y"?"top":"left",b=d==="y"?"bottom":"right",g=y+f[p],_=y-f[b];y=Es(g,y,_)}const w=a.fn({...t,[m]:h,[d]:y});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[m]:i,[d]:s}}}}}};function bo(){return typeof window<"u"}function Yr(e){return cd(e)?(e.nodeName||"").toLowerCase():"#document"}function _t(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function rn(e){var t;return(t=(cd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function cd(e){return bo()?e instanceof Node||e instanceof _t(e).Node:!1}function Wt(e){return bo()?e instanceof Element||e instanceof _t(e).Element:!1}function nn(e){return bo()?e instanceof HTMLElement||e instanceof _t(e).HTMLElement:!1}function Oc(e){return!bo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _t(e).ShadowRoot}function xi(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Jt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Nw(e){return["table","td","th"].includes(Yr(e))}function _o(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function la(e){const t=ua(),n=Wt(e)?Jt(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 Tw(e){let t=Vn(e);for(;nn(t)&&!qr(t);){if(la(t))return t;if(_o(t))return null;t=Vn(t)}return null}function ua(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function qr(e){return["html","body","#document"].includes(Yr(e))}function Jt(e){return _t(e).getComputedStyle(e)}function xo(e){return Wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Vn(e){if(Yr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Oc(e)&&e.host||rn(e);return Oc(t)?t.host:t}function ld(e){const t=Vn(e);return qr(t)?e.ownerDocument?e.ownerDocument.body:e.body:nn(t)&&xi(t)?t:ld(t)}function pi(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ld(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=_t(o);if(i){const a=Ns(s);return t.concat(s,s.visualViewport||[],xi(o)?o:[],a&&n?pi(a):[])}return t.concat(o,pi(o,[],n))}function Ns(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ud(e){const t=Jt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=nn(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=lo(n)!==i||lo(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function da(e){return Wt(e)?e:e.contextElement}function _r(e){const t=da(e);if(!nn(t))return Kn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ud(t);let s=(i?lo(n.width):n.width)/r,a=(i?lo(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Rw=Kn(0);function dd(e){const t=_t(e);return!ua()||!t.visualViewport?Rw:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Aw(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_t(e)?!1:t}function mr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=da(e);let s=Kn(1);t&&(r?Wt(r)&&(s=_r(r)):s=_r(e));const a=Aw(i,n,r)?dd(i):Kn(0);let l=(o.left+a.x)/s.x,u=(o.top+a.y)/s.y,f=o.width/s.x,d=o.height/s.y;if(i){const m=_t(i),h=r&&Wt(r)?_t(r):r;let y=m,w=Ns(y);for(;w&&r&&h!==y;){const p=_r(w),b=w.getBoundingClientRect(),g=Jt(w),_=b.left+(w.clientLeft+parseFloat(g.paddingLeft))*p.x,x=b.top+(w.clientTop+parseFloat(g.paddingTop))*p.y;l*=p.x,u*=p.y,f*=p.x,d*=p.y,l+=_,u+=x,y=_t(w),w=Ns(y)}}return fo({width:f,height:d,x:l,y:u})}function Pw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=rn(r),a=t?_o(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Kn(1);const f=Kn(0),d=nn(r);if((d||!d&&!i)&&((Yr(r)!=="body"||xi(s))&&(l=xo(r)),nn(r))){const m=mr(r);u=_r(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+f.x,y:n.y*u.y-l.scrollTop*u.y+f.y}}function Dw(e){return Array.from(e.getClientRects())}function Ts(e,t){const n=xo(e).scrollLeft;return t?t.left+n:mr(rn(e)).left+n}function Fw(e){const t=rn(e),n=xo(e),r=e.ownerDocument.body,o=sr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=sr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Ts(e);const a=-n.scrollTop;return Jt(r).direction==="rtl"&&(s+=sr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function Mw(e,t){const n=_t(e),r=rn(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const u=ua();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function kw(e,t){const n=mr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=nn(e)?_r(e):Kn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,u=r*i.y;return{width:s,height:a,x:l,y:u}}function Ec(e,t,n){let r;if(t==="viewport")r=Mw(e,n);else if(t==="document")r=Fw(rn(e));else if(Wt(t))r=kw(t,n);else{const o=dd(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return fo(r)}function fd(e,t){const n=Vn(e);return n===t||!Wt(n)||qr(n)?!1:Jt(n).position==="fixed"||fd(n,t)}function jw(e,t){const n=t.get(e);if(n)return n;let r=pi(e,[],!1).filter(a=>Wt(a)&&Yr(a)!=="body"),o=null;const i=Jt(e).position==="fixed";let s=i?Vn(e):e;for(;Wt(s)&&!qr(s);){const a=Jt(s),l=la(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||xi(s)&&!l&&fd(e,s))?r=r.filter(f=>f!==s):o=a,s=Vn(s)}return t.set(e,r),r}function Lw(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?_o(t)?[]:jw(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((u,f)=>{const d=Ec(t,f,o);return u.top=sr(d.top,u.top),u.right=Ur(d.right,u.right),u.bottom=Ur(d.bottom,u.bottom),u.left=sr(d.left,u.left),u},Ec(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Kw(e){const{width:t,height:n}=ud(e);return{width:t,height:n}}function Vw(e,t,n){const r=nn(t),o=rn(t),i=n==="fixed",s=mr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Kn(0);if(r||!r&&!i)if((Yr(t)!=="body"||xi(o))&&(a=xo(t)),r){const h=mr(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&(l.x=Ts(o));let u=0,f=0;if(o&&!r&&!i){const h=o.getBoundingClientRect();f=h.top+a.scrollTop,u=h.left+a.scrollLeft-Ts(o,h)}const d=s.left+a.scrollLeft-l.x-u,m=s.top+a.scrollTop-l.y-f;return{x:d,y:m,width:s.width,height:s.height}}function Wo(e){return Jt(e).position==="static"}function Sc(e,t){if(!nn(e)||Jt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return rn(e)===n&&(n=n.ownerDocument.body),n}function pd(e,t){const n=_t(e);if(_o(e))return n;if(!nn(e)){let o=Vn(e);for(;o&&!qr(o);){if(Wt(o)&&!Wo(o))return o;o=Vn(o)}return n}let r=Sc(e,t);for(;r&&Nw(r)&&Wo(r);)r=Sc(r,t);return r&&qr(r)&&Wo(r)&&!la(r)?n:r||Tw(e)||n}const Uw=async function(e){const t=this.getOffsetParent||pd,n=this.getDimensions,r=await n(e.floating);return{reference:Vw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $w(e){return Jt(e).direction==="rtl"}const qw={convertOffsetParentRelativeRectToViewportRelativeRect:Pw,getDocumentElement:rn,getClippingRect:Lw,getOffsetParent:pd,getElementRects:Uw,getClientRects:Dw,getDimensions:Kw,getScale:_r,isElement:Wt,isRTL:$w};function Hw(e,t){let n=null,r;const o=rn(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:u,top:f,width:d,height:m}=e.getBoundingClientRect();if(a||t(),!d||!m)return;const h=qi(f),y=qi(o.clientWidth-(u+d)),w=qi(o.clientHeight-(f+m)),p=qi(u),g={rootMargin:-h+"px "+-y+"px "+-w+"px "+-p+"px",threshold:sr(0,Ur(1,l))||1};let _=!0;function x(C){const T=C[0].intersectionRatio;if(T!==l){if(!_)return s();T?s(!1,T):r=setTimeout(()=>{s(!1,1e-7)},1e3)}_=!1}try{n=new IntersectionObserver(x,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(x,g)}n.observe(e)}return s(!0),i}function Bw(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:l=!1}=r,u=da(e),f=o||i?[...u?pi(u):[],...pi(t)]:[];f.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=u&&a?Hw(u,n):null;let m=-1,h=null;s&&(h=new ResizeObserver(b=>{let[g]=b;g&&g.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var _;(_=h)==null||_.observe(t)})),n()}),u&&!l&&h.observe(u),h.observe(t));let y,w=l?mr(e):null;l&&p();function p(){const b=mr(e);w&&(b.x!==w.x||b.y!==w.y||b.width!==w.width||b.height!==w.height)&&n(),w=b,y=requestAnimationFrame(p)}return n(),()=>{var b;f.forEach(g=>{o&&g.removeEventListener("scroll",n),i&&g.removeEventListener("resize",n)}),d==null||d(),(b=h)==null||b.disconnect(),h=null,l&&cancelAnimationFrame(y)}}const Ww=Ew,Jw=Sw,zw=Cw,Gw=xw,Nc=(e,t,n)=>{const r=new Map,o={platform:qw,...n},i={...o.platform,_c:r};return _w(e,t,{...o,platform:i})};/*
|
|
46
46
|
* React Tooltip
|
|
47
47
|
* {@link https://github.com/ReactTooltip/react-tooltip}
|
|
48
48
|
* @copyright ReactTooltip Team
|
|
49
49
|
* @license MIT
|
|
50
|
-
*/const Kw="react-tooltip-core-styles",Vw="react-tooltip-base-styles",Ic={core:!1,base:!1};function bc({css:e,id:t=Vw,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||Ic[n]||n==="core"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=Kw),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css",s==="top"&&a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),Ic[n]=!0}const _c=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[Mw(Number(o)),jw({fallbackAxisSideDirection:"start"}),kw({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(Lw({element:n,padding:5})),wc(e,t,{placement:r,strategy:i,middleware:c}).then(({x:u,y:f,placement:d,middlewareData:h})=>{var m,y;const v={left:`${u}px`,top:`${f}px`,border:a},{x:p,y:x}=(m=h.arrow)!==null&&m!==void 0?m:{x:0,y:0},g=(y={top:"bottom",right:"left",bottom:"top",left:"right"}[d.split("-")[0]])!==null&&y!==void 0?y:"bottom",b=a&&{borderBottom:a,borderRight:a};let O=0;if(a){const _=`${a}`.match(/(\d+)px/);O=_!=null&&_[1]?Number(_[1]):1}return{tooltipStyles:v,tooltipArrowStyles:{left:p!=null?`${p}px`:"",top:x!=null?`${x}px`:"",right:"",bottom:"",...b,[g]:`-${4+O}px`},place:d}})):wc(e,t,{placement:"bottom",strategy:i,middleware:c}).then(({x:u,y:f,placement:d})=>({tooltipStyles:{left:`${u}px`,top:`${f}px`},tooltipArrowStyles:{},place:d}))},xc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Oc=(e,t,n)=>{let r=null;const o=function(...i){const s=()=>{r=null};!r&&(e.apply(this,i),r=setTimeout(s,t))};return o.cancel=()=>{r&&(clearTimeout(r),r=null)},o},Cc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Cs=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>Cs(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Cc(e)||!Cc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Cs(e[o],t[o]))},$w=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some(n=>{const r=t.getPropertyValue(n);return r==="auto"||r==="scroll"})},Ec=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if($w(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Uw=typeof window<"u"?w.useLayoutEffect:w.useEffect,St=e=>{e.current&&(clearTimeout(e.current),e.current=null)},qw="DEFAULT_TOOLTIP_ID",Hw={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Bw=w.createContext({getTooltipData:()=>Hw});function id(e=qw){return w.useContext(Bw).getTooltipData(e)}var pr={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},Uo={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const Ww=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:c=10,events:u=["hover"],openOnClick:f=!1,positionStrategy:d="absolute",middlewares:h,wrapper:m,delayShow:y=0,delayHide:v=0,float:p=!1,hidden:x=!1,noArrow:g=!1,clickable:b=!1,closeOnEsc:O=!1,closeOnScroll:_=!1,closeOnResize:T=!1,openEvents:S,closeEvents:N,globalCloseEvents:D,imperativeModeOnly:U,style:G,position:z,afterShow:ne,afterHide:B,disableTooltip:ce,content:se,contentWrapperRef:te,isOpen:ge,defaultIsOpen:we=!1,setIsOpen:A,activeAnchor:k,setActiveAnchor:$,border:L,opacity:j,arrowColor:F,role:Y="tooltip"})=>{var Z;const q=w.useRef(null),ee=w.useRef(null),Q=w.useRef(null),de=w.useRef(null),M=w.useRef(null),[ve,H]=w.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ee,Ke]=w.useState(!1),[Ge,Ve]=w.useState(!1),[Ie,At]=w.useState(null),Qe=w.useRef(!1),mt=w.useRef(null),{anchorRefs:Pt,setActiveAnchor:Dt}=id(t),Xe=w.useRef(!1),[We,$e]=w.useState([]),Ae=w.useRef(!1),Ft=f||u.includes("click"),tt=Ft||(S==null?void 0:S.click)||(S==null?void 0:S.dblclick)||(S==null?void 0:S.mousedown),tn=S?{...S}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!S&&Ft&&Object.assign(tn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const mn=N?{...N}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!N&&Ft&&Object.assign(mn,{mouseleave:!1,blur:!1,mouseout:!1});const gt=D?{...D}:{escape:O||!1,scroll:_||!1,resize:T||!1,clickOutsideAnchor:tt||!1};U&&(Object.assign(tn,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(mn,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(gt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),Uw(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]);const Pe=W=>{Ae.current&&(W&&Ve(!0),setTimeout(()=>{Ae.current&&(A==null||A(W),ge===void 0&&Ke(W))},10))};w.useEffect(()=>{if(ge===void 0)return()=>null;ge&&Ve(!0);const W=setTimeout(()=>{Ke(ge)},10);return()=>{clearTimeout(W)}},[ge]),w.useEffect(()=>{if(Ee!==Qe.current)if(St(M),Qe.current=Ee,Ee)ne==null||ne();else{const W=(ae=>{const le=ae.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,Le,qe]=le;return Number(Le)*(qe==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));M.current=setTimeout(()=>{Ve(!1),At(null),B==null||B()},W+25)}},[Ee]);const nn=W=>{H(ae=>Cs(ae,W)?ae:W)},gn=(W=y)=>{St(Q),Ge?Pe(!0):Q.current=setTimeout(()=>{Pe(!0)},W)},rn=(W=v)=>{St(de),de.current=setTimeout(()=>{Xe.current||Pe(!1)},W)},Vn=W=>{var ae;if(!W)return;const le=(ae=W.currentTarget)!==null&&ae!==void 0?ae:W.target;if(!(le!=null&&le.isConnected))return $(null),void Dt({current:null});y?gn():Pe(!0),$(le),Dt({current:le}),St(de)},lt=()=>{b?rn(v||100):v?rn():Pe(!1),St(Q)},on=({x:W,y:ae})=>{var le;const Le={getBoundingClientRect:()=>({x:W,y:ae,width:0,height:0,top:ae,left:W,right:W,bottom:ae})};_c({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:c,elementReference:Le,tooltipReference:q.current,tooltipArrowReference:ee.current,strategy:d,middlewares:h,border:L}).then(qe=>{nn(qe)})},yn=W=>{if(!W)return;const ae=W,le={x:ae.clientX,y:ae.clientY};on(le),mt.current=le},$n=W=>{var ae;if(!Ee)return;const le=W.target;le.isConnected&&(!((ae=q.current)===null||ae===void 0)&&ae.contains(le)||[document.querySelector(`[id='${i}']`),...We].some(Le=>Le==null?void 0:Le.contains(le))||(Pe(!1),St(Q)))},vn=Oc(Vn,50),Re=Oc(lt,50),nt=W=>{Re.cancel(),vn(W)},ie=()=>{vn.cancel(),Re()},me=w.useCallback(()=>{var W,ae;const le=(W=Ie==null?void 0:Ie.position)!==null&&W!==void 0?W:z;le?on(le):p?mt.current&&on(mt.current):k!=null&&k.isConnected&&_c({place:(ae=Ie==null?void 0:Ie.place)!==null&&ae!==void 0?ae:a,offset:c,elementReference:k,tooltipReference:q.current,tooltipArrowReference:ee.current,strategy:d,middlewares:h,border:L}).then(Le=>{Ae.current&&nn(Le)})},[Ee,k,se,G,a,Ie==null?void 0:Ie.place,c,d,z,Ie==null?void 0:Ie.position,p]);w.useEffect(()=>{var W,ae;const le=new Set(Pt);We.forEach(Se=>{ce!=null&&ce(Se)||le.add({current:Se})});const Le=document.querySelector(`[id='${i}']`);Le&&!(ce!=null&&ce(Le))&&le.add({current:Le});const qe=()=>{Pe(!1)},ut=Ec(k),Je=Ec(q.current);gt.scroll&&(window.addEventListener("scroll",qe),ut==null||ut.addEventListener("scroll",qe),Je==null||Je.addEventListener("scroll",qe));let Ye=null;gt.resize?window.addEventListener("resize",qe):k&&q.current&&(Ye=Fw(k,q.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const dt=Se=>{Se.key==="Escape"&&Pe(!1)};gt.escape&&window.addEventListener("keydown",dt),gt.clickOutsideAnchor&&window.addEventListener("click",$n);const Ne=[],Un=Se=>{Ee&&(Se==null?void 0:Se.target)===k||Vn(Se)},Co=Se=>{Ee&&(Se==null?void 0:Se.target)===k&<()},Ot=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],bi=["click","dblclick","mousedown","mouseup"];Object.entries(tn).forEach(([Se,Mt])=>{Mt&&(Ot.includes(Se)?Ne.push({event:Se,listener:nt}):bi.includes(Se)&&Ne.push({event:Se,listener:Un}))}),Object.entries(mn).forEach(([Se,Mt])=>{Mt&&(Ot.includes(Se)?Ne.push({event:Se,listener:ie}):bi.includes(Se)&&Ne.push({event:Se,listener:Co}))}),p&&Ne.push({event:"pointermove",listener:yn});const _i=()=>{Xe.current=!0},xi=()=>{Xe.current=!1,lt()};return b&&!tt&&((W=q.current)===null||W===void 0||W.addEventListener("mouseenter",_i),(ae=q.current)===null||ae===void 0||ae.addEventListener("mouseleave",xi)),Ne.forEach(({event:Se,listener:Mt})=>{le.forEach(kt=>{var qn;(qn=kt.current)===null||qn===void 0||qn.addEventListener(Se,Mt)})}),()=>{var Se,Mt;gt.scroll&&(window.removeEventListener("scroll",qe),ut==null||ut.removeEventListener("scroll",qe),Je==null||Je.removeEventListener("scroll",qe)),gt.resize?window.removeEventListener("resize",qe):Ye==null||Ye(),gt.clickOutsideAnchor&&window.removeEventListener("click",$n),gt.escape&&window.removeEventListener("keydown",dt),b&&!tt&&((Se=q.current)===null||Se===void 0||Se.removeEventListener("mouseenter",_i),(Mt=q.current)===null||Mt===void 0||Mt.removeEventListener("mouseleave",xi)),Ne.forEach(({event:kt,listener:qn})=>{le.forEach(Eo=>{var Wr;(Wr=Eo.current)===null||Wr===void 0||Wr.removeEventListener(kt,qn)})})}},[k,me,Ge,Pt,We,S,N,D,Ft,y,v]),w.useEffect(()=>{var W,ae;let le=(ae=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s)!==null&&ae!==void 0?ae:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Le=new MutationObserver(qe=>{const ut=[],Je=[];qe.forEach(Ye=>{if(Ye.type==="attributes"&&Ye.attributeName==="data-tooltip-id"&&(Ye.target.getAttribute("data-tooltip-id")===t?ut.push(Ye.target):Ye.oldValue===t&&Je.push(Ye.target)),Ye.type==="childList"){if(k){const dt=[...Ye.removedNodes].filter(Ne=>Ne.nodeType===1);if(le)try{Je.push(...dt.filter(Ne=>Ne.matches(le))),Je.push(...dt.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}dt.some(Ne=>{var Un;return!!(!((Un=Ne==null?void 0:Ne.contains)===null||Un===void 0)&&Un.call(Ne,k))&&(Ve(!1),Pe(!1),$(null),St(Q),St(de),!0)})}if(le)try{const dt=[...Ye.addedNodes].filter(Ne=>Ne.nodeType===1);ut.push(...dt.filter(Ne=>Ne.matches(le))),ut.push(...dt.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}}}),(ut.length||Je.length)&&$e(Ye=>[...Ye.filter(dt=>!Je.includes(dt)),...ut])});return Le.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Le.disconnect()}},[t,s,Ie==null?void 0:Ie.anchorSelect,k]),w.useEffect(()=>{me()},[me]),w.useEffect(()=>{if(!(te!=null&&te.current))return()=>null;const W=new ResizeObserver(()=>{setTimeout(()=>me())});return W.observe(te.current),()=>{W.disconnect()}},[se,te==null?void 0:te.current]),w.useEffect(()=>{var W;const ae=document.querySelector(`[id='${i}']`),le=[...We,ae];k&&le.includes(k)||$((W=We[0])!==null&&W!==void 0?W:ae)},[i,We,k]),w.useEffect(()=>(we&&Pe(!0),()=>{St(Q),St(de)}),[]),w.useEffect(()=>{var W;let ae=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s;if(!ae&&t&&(ae=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ae)try{const le=Array.from(document.querySelectorAll(ae));$e(le)}catch{$e([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),w.useEffect(()=>{Q.current&&(St(Q),gn(y))},[y]);const Ue=(Z=Ie==null?void 0:Ie.content)!==null&&Z!==void 0?Z:se,sn=Ee&&Object.keys(ve.tooltipStyles).length>0;return w.useImperativeHandle(e,()=>({open:W=>{if(W!=null&&W.anchorSelect)try{document.querySelector(W.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${W.anchorSelect}" is not a valid CSS selector`)}At(W??null),W!=null&&W.delay?gn(W.delay):Pe(!0)},close:W=>{W!=null&&W.delay?rn(W.delay):Pe(!1)},activeAnchor:k,place:ve.place,isOpen:!!(Ge&&!x&&Ue&&sn)})),Ge&&!x&&Ue?w.createElement(m,{id:t,role:Y,className:wt("react-tooltip",pr.tooltip,Uo.tooltip,Uo[o],n,`react-tooltip__place-${ve.place}`,pr[sn?"show":"closing"],sn?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&pr.fixed,b&&pr.clickable),onTransitionEnd:W=>{St(M),Ee||W.propertyName!=="opacity"||(Ve(!1),At(null),B==null||B())},style:{...G,...ve.tooltipStyles,opacity:j!==void 0&&sn?j:void 0},ref:q},Ue,w.createElement(m,{className:wt("react-tooltip-arrow",pr.arrow,Uo.arrow,r,g&&pr.noArrow),style:{...ve.tooltipArrowStyles,background:F?`linear-gradient(to right bottom, transparent 50%, ${F} 50%)`:void 0},ref:ee})):null},Jw=({content:e})=>w.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),zw=w.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:u="top",offset:f=10,wrapper:d="div",children:h=null,events:m=["hover"],openOnClick:y=!1,positionStrategy:v="absolute",middlewares:p,delayShow:x=0,delayHide:g=0,float:b=!1,hidden:O=!1,noArrow:_=!1,clickable:T=!1,closeOnEsc:S=!1,closeOnScroll:N=!1,closeOnResize:D=!1,openEvents:U,closeEvents:G,globalCloseEvents:z,imperativeModeOnly:ne=!1,style:B,position:ce,isOpen:se,defaultIsOpen:te=!1,disableStyleInjection:ge=!1,border:we,opacity:A,arrowColor:k,setIsOpen:$,afterShow:L,afterHide:j,disableTooltip:F,role:Y="tooltip"},Z)=>{const[q,ee]=w.useState(r),[Q,de]=w.useState(o),[M,ve]=w.useState(u),[H,Ee]=w.useState(c),[Ke,Ge]=w.useState(f),[Ve,Ie]=w.useState(x),[At,Qe]=w.useState(g),[mt,Pt]=w.useState(b),[Dt,Xe]=w.useState(O),[We,$e]=w.useState(d),[Ae,Ft]=w.useState(m),[tt,tn]=w.useState(v),[mn,gt]=w.useState(null),[Pe,nn]=w.useState(null),gn=w.useRef(ge),{anchorRefs:rn,activeAnchor:Vn}=id(e),lt=Re=>Re==null?void 0:Re.getAttributeNames().reduce((nt,ie)=>{var me;return ie.startsWith("data-tooltip-")&&(nt[ie.replace(/^data-tooltip-/,"")]=(me=Re==null?void 0:Re.getAttribute(ie))!==null&&me!==void 0?me:null),nt},{}),on=Re=>{const nt={place:ie=>{var me;ve((me=ie)!==null&&me!==void 0?me:u)},content:ie=>{ee(ie??r)},html:ie=>{de(ie??o)},variant:ie=>{var me;Ee((me=ie)!==null&&me!==void 0?me:c)},offset:ie=>{Ge(ie===null?f:Number(ie))},wrapper:ie=>{var me;$e((me=ie)!==null&&me!==void 0?me:d)},events:ie=>{const me=ie==null?void 0:ie.split(" ");Ft(me??m)},"position-strategy":ie=>{var me;tn((me=ie)!==null&&me!==void 0?me:v)},"delay-show":ie=>{Ie(ie===null?x:Number(ie))},"delay-hide":ie=>{Qe(ie===null?g:Number(ie))},float:ie=>{Pt(ie===null?b:ie==="true")},hidden:ie=>{Xe(ie===null?O:ie==="true")},"class-name":ie=>{gt(ie)}};Object.values(nt).forEach(ie=>ie(null)),Object.entries(Re).forEach(([ie,me])=>{var Ue;(Ue=nt[ie])===null||Ue===void 0||Ue.call(nt,me)})};w.useEffect(()=>{ee(r)},[r]),w.useEffect(()=>{de(o)},[o]),w.useEffect(()=>{ve(u)},[u]),w.useEffect(()=>{Ee(c)},[c]),w.useEffect(()=>{Ge(f)},[f]),w.useEffect(()=>{Ie(x)},[x]),w.useEffect(()=>{Qe(g)},[g]),w.useEffect(()=>{Pt(b)},[b]),w.useEffect(()=>{Xe(O)},[O]),w.useEffect(()=>{tn(v)},[v]),w.useEffect(()=>{gn.current!==ge&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[ge]),w.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:ge==="core",disableBase:ge}}))},[]),w.useEffect(()=>{var Re;const nt=new Set(rn);let ie=n;if(!ie&&e&&(ie=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ie)try{document.querySelectorAll(ie).forEach(ae=>{nt.add({current:ae})})}catch{console.warn(`[react-tooltip] "${ie}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&nt.add({current:me}),!nt.size)return()=>null;const Ue=(Re=Pe??me)!==null&&Re!==void 0?Re:Vn.current,sn=new MutationObserver(ae=>{ae.forEach(le=>{var Le;if(!Ue||le.type!=="attributes"||!(!((Le=le.attributeName)===null||Le===void 0)&&Le.startsWith("data-tooltip-")))return;const qe=lt(Ue);on(qe)})}),W={attributes:!0,childList:!1,subtree:!1};if(Ue){const ae=lt(Ue);on(ae),sn.observe(Ue,W)}return()=>{sn.disconnect()}},[rn,Vn,Pe,t,n]),w.useEffect(()=>{B!=null&&B.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),we&&!xc("border",`${we}`)&&console.warn(`[react-tooltip] "${we}" is not a valid \`border\`.`),B!=null&&B.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),A&&!xc("opacity",`${A}`)&&console.warn(`[react-tooltip] "${A}" is not a valid \`opacity\`.`)},[]);let yn=h;const $n=w.useRef(null);if(i){const Re=i({content:(Pe==null?void 0:Pe.getAttribute("data-tooltip-content"))||q||null,activeAnchor:Pe});yn=Re?w.createElement("div",{ref:$n,className:"react-tooltip-content-wrapper"},Re):null}else q&&(yn=q);Q&&(yn=w.createElement(Jw,{content:Q}));const vn={forwardRef:Z,id:e,anchorId:t,anchorSelect:n,className:wt(s,mn),classNameArrow:a,content:yn,contentWrapperRef:$n,place:M,variant:H,offset:Ke,wrapper:We,events:Ae,openOnClick:y,positionStrategy:tt,middlewares:p,delayShow:Ve,delayHide:At,float:mt,hidden:Dt,noArrow:_,clickable:T,closeOnEsc:S,closeOnScroll:N,closeOnResize:D,openEvents:U,closeEvents:G,globalCloseEvents:z,imperativeModeOnly:ne,style:B,position:ce,isOpen:se,defaultIsOpen:te,border:we,opacity:A,arrowColor:k,setIsOpen:$,afterShow:L,afterHide:j,disableTooltip:F,activeAnchor:Pe,setActiveAnchor:Re=>nn(Re),role:Y};return w.createElement(Ww,{...vn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||bc({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||bc({css:`
|
|
51
|
-
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function Gw(){return l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[l.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[l.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_2896_16290",children:l.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function Qw({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:Gw()}),l.jsx(zw,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const Xw="Each field must be mapped to a unique value";function ca({field:e,onSelectChange:t,allFields:n}){var g;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Jt(),[s,a]=w.useState(!0),{isError:c,removeError:u,getError:f}=Rt(),d=(g=r==null?void 0:r.read)==null?void 0:g.selectedFieldMappings,h=d==null?void 0:d[e.mapToName];w.useEffect(()=>{e._default&&!h&&o&&r&&oi(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,h,r]);const m=w.useMemo(()=>n.map(b=>({id:b.fieldName,label:b.displayName,value:b.fieldName})),[n]),y=l.jsx(zu,{disabled:s,items:m,selectedValue:h||null,onSelectedItemChange:b=>{t({target:{name:e.mapToName,value:b==null?void 0:b.value}})},placeholder:"Please select one",style:{width:"100%"}}),v=w.useCallback(()=>{o&&(oi(o,i,[{field:e.mapToName,value:null}]),c(ue.MAPPING,o)&&u(ue.MAPPING,o))},[e.mapToName,o,i,c,u]),{hasDuplicationError:p,errorMessage:x}=w.useMemo(()=>{const b=f(ue.MAPPING,o),O=Array.isArray(b)&&b.length>0&&b.includes(e.mapToName);return{hasDuplicationError:O,errorMessage:O?Xw:""}},[o,f,e.mapToName]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[l.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName}),l.jsx("span",{children:(e==null?void 0:e.prompt)&&l.jsx(Qw,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[y,l.jsx(ct,{type:"button",variant:"ghost",onClick:v,children:"Clear"})]})]},e.mapToName),p&&l.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",x," "]},e.mapToName)]})}const Yw="_formControl_9qd8d_1",Zw="_formLabel_9qd8d_5",eI="_formLabelRequired_9qd8d_11",tI="_formInput_9qd8d_16",nI="_formInputInvalid_9qd8d_20",rI="_formError_9qd8d_24",iI="_disabled_9qd8d_30",Wn={formControl:Yw,formLabel:Zw,formLabelRequired:eI,formInput:tI,formInputInvalid:nI,formError:rI,disabled:iI};function Io({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return l.jsxs("div",{className:wt(Wn.formControl,{[Wn.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:wt(Wn.formLabel,{[Wn.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:wt(Wn.formInput,{[Wn.formInputInvalid]:o}),children:s}),o&&i&&l.jsx("div",{className:Wn.formError,role:"alert",children:i})]})}const oI="_divider_1kmoj_1",Sc={divider:oI};function bo({className:e,style:t}){return l.jsx("hr",{className:e?`${Sc.divider} ${e}`:Sc.divider,style:t})}function yi({string:e}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(bo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function od({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:o}){if(!e||!t)return!1;if(Object.values(e).some(s=>s===r&&s!==n)){console.error("Each field must be mapped to a unique value",e);const s=Object.keys(e).filter(c=>e[c]===r),a=[n,...s];return o(ue.MAPPING,t,a),!0}return!1}function sI({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>l.jsx(Io,{id:r.mapToName,children:l.jsx(ca,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function aI(){var y,v;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Jt(),{isError:r,removeError:o,setError:i}=Rt(),s=((y=t==null?void 0:t.read)==null?void 0:y.allFields)||[],{fieldMapping:a}=et(),c=(v=t==null?void 0:t.read)==null?void 0:v.selectedFieldMappings,u=p=>{const{value:x,name:g}=p.target;!x||od({selectedFieldMappings:c,selectedObjectName:e,fieldName:g,fieldValue:x,setError:i})||(e&&oi(e,n,[{field:g,value:x}]),r(ue.MAPPING,g)&&o(ue.MAPPING,g),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},f=w.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(p=>!p.fieldName),[a,e]),d=w.useMemo(()=>{var g;return(((g=t==null?void 0:t.read)==null?void 0:g.optionalMapFields)||[]).filter(b=>!f.some(O=>O.mapToName===b.mapToName))},[t,f]),h=f.length>0;return d.length>0||h?l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:"Map the following optional fields"}),l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d==null?void 0:d.map(p=>l.jsx(Io,{id:p.mapToName,children:l.jsx(ca,{allFields:s,field:p,onSelectChange:u})},p.mapToName)),h&&l.jsx(sI,{dynamicFieldMappings:f,onSelectChange:u,allFields:s})]})]}):null}function cI(){var u;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Jt(),{isError:r,removeError:o,setError:i}=Rt(),s=(u=t==null?void 0:t.read)==null?void 0:u.selectedFieldMappings,a=f=>{const{value:d,name:h}=f.target;!d||od({selectedFieldMappings:s,selectedObjectName:e,fieldName:h,fieldValue:d,setError:i})||(e&&oi(e,n,[{field:h,value:d}]),r(ue.MAPPING,h)&&o(ue.MAPPING,h),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},c=w.useMemo(()=>{var f;return((f=t==null?void 0:t.read)==null?void 0:f.requiredMapFields)||[]},[t]);return c!=null&&c.length?l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(f=>{var d;return l.jsx(Io,{id:f.mapToName,isInvalid:r(ue.MAPPING,f.mapToName),errorMessage:"* required",children:l.jsx(ca,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:f,onSelectChange:a})},f.mapToName)})})]}):null}const lI={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function uI({children:e,style:t}){return l.jsx(jn,{style:{...lI,...t},children:e})}const sd=e=>{const t=xt(),{provider:n}=et(),r=e||n;return hn({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},Ln=e=>{const t=sd(e),{data:n}=t,{provider:r}=et(),o=n&&Rl(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function dI(){var u,f,d;const{project:e}=Fe(),{hydratedRevision:t}=Hr(),{selectedObjectName:n}=Jt(),{providerName:r}=Ln(),o=e==null?void 0:e.appName,i=(d=(f=(u=t==null?void 0:t.content)==null?void 0:u.read)==null?void 0:f.objects)==null?void 0:d.find(h=>h.objectName===n),s=(i==null?void 0:i.displayName)||n&&Ar(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&Ar(a);return c&&o&&r?l.jsx(uI,{style:{marginTop:"1rem"},children:l.jsxs("p",{style:{margin:"1rem 0"},children:[l.jsx("b",{children:c})," in ",o," is mapped to ",l.jsx("b",{children:s})," in ",r,"."]})}):null}function Nc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ad(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Nc(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():Nc(e[o],null)}}}}function ai(...e){return V.useCallback(ad(...e),e)}function _o(e,t=[]){let n=[];function r(i,s){const a=V.createContext(s),c=n.length;n=[...n,s];const u=d=>{var x;const{scope:h,children:m,...y}=d,v=((x=h==null?void 0:h[e])==null?void 0:x[c])||a,p=V.useMemo(()=>y,Object.values(y));return l.jsx(v.Provider,{value:p,children:m})};u.displayName=i+"Provider";function f(d,h){var v;const m=((v=h==null?void 0:h[e])==null?void 0:v[c])||a,y=V.useContext(m);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[u,f]}const o=()=>{const i=n.map(s=>V.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return V.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,fI(o,...t)]}function fI(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:u})=>{const d=c(i)[`__scope${u}`];return{...a,...d}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function qt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function la(e){const t=V.useRef(e);return V.useEffect(()=>{t.current=e}),V.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ua({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=pI({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=la(n),c=V.useCallback(u=>{if(i){const d=typeof u=="function"?u(e):u;d!==e&&a(d)}else o(u)},[i,e,o,a]);return[s,c]}function pI({defaultProp:e,onChange:t}){const n=V.useState(e),[r]=n,o=V.useRef(r),i=la(t);return V.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function hI(e){const t=V.useRef({value:e,previous:e});return V.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ao=globalThis!=null&&globalThis.document?V.useLayoutEffect:()=>{};function mI(e){const[t,n]=V.useState(void 0);return ao(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function gI(e,t){return V.useReducer((n,r)=>t[n][r]??n,e)}var da=e=>{const{present:t,children:n}=e,r=yI(t),o=typeof n=="function"?n({present:r.isPresent}):V.Children.only(n),i=ai(r.ref,vI(o));return typeof n=="function"||r.isPresent?V.cloneElement(o,{ref:i}):null};da.displayName="Presence";function yI(e){const[t,n]=V.useState(),r=V.useRef({}),o=V.useRef(e),i=V.useRef("none"),s=e?"mounted":"unmounted",[a,c]=gI(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return V.useEffect(()=>{const u=Vi(r.current);i.current=a==="mounted"?u:"none"},[a]),ao(()=>{const u=r.current,f=o.current;if(f!==e){const h=i.current,m=Vi(u);e?c("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(f&&h!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),ao(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,d=m=>{const v=Vi(r.current).includes(m.animationName);if(m.target===t&&v&&(c("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},h=m=>{m.target===t&&(i.current=Vi(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:V.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Vi(e){return(e==null?void 0:e.animationName)||"none"}function vI(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 co=V.forwardRef((e,t)=>{const{children:n,...r}=e,o=V.Children.toArray(n),i=o.find(II);if(i){const s=i.props.children,a=o.map(c=>c===i?V.Children.count(s)>1?V.Children.only(null):V.isValidElement(s)?s.props.children:null:c);return l.jsx(Es,{...r,ref:t,children:V.isValidElement(s)?V.cloneElement(s,void 0,a):null})}return l.jsx(Es,{...r,ref:t,children:n})});co.displayName="Slot";var Es=V.forwardRef((e,t)=>{const{children:n,...r}=e;if(V.isValidElement(n)){const o=_I(n),i=bI(r,n.props);return n.type!==V.Fragment&&(i.ref=t?ad(t,o):o),V.cloneElement(n,i)}return V.Children.count(n)>1?V.Children.only(null):null});Es.displayName="SlotClone";var wI=({children:e})=>l.jsx(l.Fragment,{children:e});function II(e){return V.isValidElement(e)&&e.type===wI}function bI(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function _I(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 xI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Kn=xI.reduce((e,t)=>{const n=V.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?co:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),fa="Checkbox",[OI,z_]=_o(fa),[CI,EI]=OI(fa),cd=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c="on",onCheckedChange:u,form:f,...d}=e,[h,m]=V.useState(null),y=ai(t,O=>m(O)),v=V.useRef(!1),p=h?f||!!h.closest("form"):!0,[x=!1,g]=ua({prop:o,defaultProp:i,onChange:u}),b=V.useRef(x);return V.useEffect(()=>{const O=h==null?void 0:h.form;if(O){const _=()=>g(b.current);return O.addEventListener("reset",_),()=>O.removeEventListener("reset",_)}},[h,g]),l.jsxs(CI,{scope:n,state:x,disabled:a,children:[l.jsx(Kn.button,{type:"button",role:"checkbox","aria-checked":Dn(x)?"mixed":x,"aria-required":s,"data-state":dd(x),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:y,onKeyDown:qt(e.onKeyDown,O=>{O.key==="Enter"&&O.preventDefault()}),onClick:qt(e.onClick,O=>{g(_=>Dn(_)?!0:!_),p&&(v.current=O.isPropagationStopped(),v.current||O.stopPropagation())})}),p&&l.jsx(SI,{control:h,bubbles:!v.current,name:r,value:c,checked:x,required:s,disabled:a,form:f,style:{transform:"translateX(-100%)"},defaultChecked:Dn(i)?!1:i})]})});cd.displayName=fa;var ld="CheckboxIndicator",ud=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=EI(ld,n);return l.jsx(da,{present:r||Dn(i.state)||i.state===!0,children:l.jsx(Kn.span,{"data-state":dd(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});ud.displayName=ld;var SI=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=V.useRef(null),a=hI(n),c=mI(t);V.useEffect(()=>{const f=s.current,d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"checked").set;if(a!==n&&m){const y=new Event("click",{bubbles:r});f.indeterminate=Dn(n),m.call(f,Dn(n)?!1:n),f.dispatchEvent(y)}},[a,n,r]);const u=V.useRef(Dn(n)?!1:n);return l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??u.current,...i,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Dn(e){return e==="indeterminate"}function dd(e){return Dn(e)?"indeterminate":e?"checked":"unchecked"}var fd=cd,pd=ud;function hd(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 NI=["color"],md=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=hd(e,NI);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),w.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),TI=["color"],RI=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=hd(e,TI);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),w.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const AI="_checkboxGroupContainer_1ya1t_1",PI="_stack_1ya1t_6",DI="_selectAllContainer_1ya1t_11",FI="_fieldContainer_1ya1t_18",MI="_checkbox_1ya1t_1",Kr={checkboxGroupContainer:AI,stack:PI,selectAllContainer:DI,fieldContainer:FI,checkbox:MI};function gd({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Kr.fieldContainer,children:[l.jsx(fd,{className:Kr.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(pd,{children:l.jsx(md,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function yd({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:Kr.selectAllContainer,children:[l.jsx(fd,{className:Kr.checkbox,id:e,onCheckedChange:r,children:l.jsxs(pd,{children:[o&&l.jsx(RI,{}),t===!0&&l.jsx(md,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function vd({children:e}){return l.jsx("div",{className:Kr.checkboxGroupContainer,children:e})}function wd({children:e}){return l.jsx("div",{className:Kr.stack,children:e})}function kI(e,t,n){var o,i;const r=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(i=e.read)!=null&&i.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,c=!$l(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function Tc(e,t,n,r){t(e,o=>kI(o,n,r))}function jI(){var d,h;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Jt(),o=(d=t==null?void 0:t.read)==null?void 0:d.selectedOptionalFields,i=(m,y)=>{m!=="indeterminate"&&r&&t&&Tc(r,n,y,m)},s=(h=t==null?void 0:t.read)==null?void 0:h.optionalFields,a=m=>{r&&s&&s.forEach(y=>{Fn(y)||Tc(r,n,y.fieldName,m)})},c=!!(s&&s.length>0),u=Object.keys(o||{}).length===(s==null?void 0:s.length),f=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:`${e} reads the following optional fields`}),l.jsxs(vd,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(yd,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:a,isIndeterminate:f}),l.jsx(wd,{children:s.map(m=>Fn(m)?null:l.jsx(gd,{id:m.fieldName,isChecked:!!(o!=null&&o[m==null?void 0:m.fieldName]),label:m.displayName,onCheckedChange:y=>i(y,m.fieldName)},m.fieldName))})]})]})}function LI(){return l.jsx(jI,{})}const KI={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 VI({children:e,style:t,...n}){return l.jsx("span",{style:{...KI,...t},...n,children:e})}function $I(){var r,o,i;const{configureState:e,selectedObjectName:t}=Jt(),{appName:n}=Fe();return l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:`${n} reads the following ${t} fields`}),l.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(o=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&o.length?(i=e.read)==null?void 0:i.requiredFields.map(s=>Fn(s)?null:l.jsx(VI,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function UI(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 Id(e,t,n,r,o){t(e,i=>UI(i,e,n,r,o))}function qI(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function HI({string:e,fieldName:t}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,l.jsx("b",{children:t})]}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(bo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function BI({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var _;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Jt(),[c,u]=w.useState(!0),{getError:f,setError:d,resetBoundary:h,isError:m,removeError:y}=Rt(),v=w.useMemo(()=>{var T,S;return((S=(T=i==null?void 0:i.read)==null?void 0:T.selectedValueMappings)==null?void 0:S[n])||{}},[(_=i==null?void 0:i.read)==null?void 0:_.selectedValueMappings,n]),p=w.useMemo(()=>v==null?void 0:v[e.mappedValue],[v,e.mappedValue]);w.useEffect(()=>{u(!1)},[e,a,s,p,i]);const x=w.useMemo(()=>r.map(T=>({id:T.value,label:T.displayValue,value:T.value})),[r]),g=w.useCallback(T=>{if(T){if(Object.values(v).some(S=>S===T.value&&S!==p)){const S=[...Object.entries(v).filter(([N,D])=>D===T.value&&D!==p).map(([N])=>N),e.mappedValue];d(ue.VALUE_MAPPING,n,S);return}f(ue.VALUE_MAPPING,n)&&h(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:T.value,fieldName:n}})}},[t,v,p,n,e.mappedValue,h,d,f]),b=w.useMemo(()=>l.jsx(zu,{disabled:c,items:x,selectedValue:p||null,onSelectedItemChange:g,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,c,x,g,o]),O=w.useCallback(()=>{s&&(Id(s,a,e.mappedValue,"",n),m(ue.VALUE_MAPPING,n)&&y(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,m,y]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[l.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:l.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[b,l.jsx(ct,{type:"button",variant:"ghost",onClick:O,children:"Clear"})]})]},e.mappedValue)}function WI(){var m,y,v;const{fieldMapping:e}=et(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Jt(),{isError:o,removeError:i,getError:s}=Rt(),a=(m=n==null?void 0:n.read)==null?void 0:m.selectedFieldMappings,c=(y=n==null?void 0:n.read)==null?void 0:y.selectedValueMappings,u=(v=n==null?void 0:n.read)==null?void 0:v.isValueMappingsModified,f=w.useRef(!1),d=w.useMemo(()=>{const p=t&&e?Object.values(e[t]||{}).flat().filter(x=>x.mappedValues).map(x=>({...x})):[];if(a)for(let x=0;x<p.length;x+=1){const{mapToName:g}=p[x];a!=null&&a[g]&&(p[x].fieldName=a[g])}return p},[t,e,a]),h=w.useCallback(p=>{const{value:x,name:g,fieldName:b}=p.target;x&&(t&&Id(t,r,g,x,b),o(ue.VALUE_MAPPING,g)&&i(ue.VALUE_MAPPING,g))},[t,r,o,i]);return w.useEffect(()=>{var p;if(t&&c){const x=((p=e==null?void 0:e[t])==null?void 0:p.filter(b=>b.fieldName&&b.mappedValues.length>0))||[];x.every(b=>{const O=c[b.fieldName]||{};return Object.keys(O).length===Object.keys(b.mappedValues).length})&&x.length>0?!u&&!f.current&&(qI(t,r,!0),f.current=!0):f.current=!1}},[c,d,t,r,e,u]),d!=null&&d.length?l.jsx(l.Fragment,{children:d.map(p=>{var T,S,N;if(!p.fieldName)return null;const x=(S=(T=n==null?void 0:n.read)==null?void 0:T.allFieldsMetadata)==null?void 0:S[p.fieldName],g=x==null?void 0:x.valueType;if(!["singleSelect","multiSelect"].includes(g))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const b=x==null?void 0:x.values;if(!b)return null;const O=Object.keys(b).length,_=Object.keys((p==null?void 0:p.mappedValues)||[]).length;return O!==_?(console.error("field values and the values to be mapped are not of the same length",p,b),null):l.jsxs(l.Fragment,{children:[l.jsx(HI,{string:"Map the values for ",fieldName:p.mapToDisplayName||p.mapToName||p.fieldName}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(Io,{id:p.mapToName||p.fieldName,children:(N=p==null?void 0:p.mappedValues)==null?void 0:N.map(D=>{var ne,B,ce;const U=s(ue.VALUE_MAPPING,p.fieldName),G=Array.isArray(U)&&U.includes(D.mappedValue),z=((ce=(B=(ne=n==null?void 0:n.read)==null?void 0:ne.allFieldsMetadata)==null?void 0:B[p.fieldName])==null?void 0:ce.values)||[];return l.jsxs(l.Fragment,{children:[l.jsx(BI,{allValueOptions:z,mappedValue:D,onSelectChange:h,fieldName:(p==null?void 0:p.fieldName)||"",hasError:G},`${D.mappedValue}-${p.fieldName}`),G&&l.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${p.mapToName||p.fieldName} must be mapped to a unique value`},D.mappedValue)]})})},p.mapToName||p.fieldName)})]})})}):null}function JI(){return Wy(),l.jsxs(l.Fragment,{children:[l.jsx(dI,{}),l.jsx($I,{}),l.jsx(cI,{}),l.jsx(aI,{}),l.jsx(WI,{}),l.jsx(LI,{})]})}function zI(e,t,n){var r,o,i;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const s=e.write.selectedWriteObjects;if(n&&(s[t]={objectName:t}),n||delete s[t],(i=(o=e==null?void 0:e.write)==null?void 0:o.savedConfig)!=null&&i.selectedWriteObjects){const a=e.write.savedConfig.selectedWriteObjects,u=!dy(a,s);e.write.isWriteModified=u}}}function Rc(e,t,n,r){t(e,o=>{zI(o,n,r)})}function GI(){var d,h,m,y;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Jt(),o=(d=n==null?void 0:n.write)==null?void 0:d.selectedWriteObjects,i=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects,s=(v,p)=>{v!=="indeterminate"&&t&&n&&Rc(t,r,p,v)},a=v=>{var p,x;t&&n&&((x=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null||x.forEach(g=>{Rc(t,r,g.objectName,v)}))},c=!!i,u=Object.keys(o||{}).length===((y=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects)==null?void 0:y.length),f=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(yi,{string:`Allow ${e} to write to these objects`}),l.jsxs(vd,{children:[((i==null?void 0:i.length)||0)>=2&&l.jsx(yd,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:f,isChecked:u,label:"Select all"}),l.jsx(wd,{children:i.map(v=>l.jsx(gd,{id:v.objectName,onCheckedChange:p=>s(p,v.objectName),isChecked:!!(o!=null&&o[v.objectName]),label:v.displayName},v.objectName))})]})]})}function QI(){return l.jsx(l.Fragment,{children:l.jsx(GI,{})})}function XI(){return l.jsx("div",{children:"ManageContent"})}const YI=()=>{const e=xt(),t=Wt();return uo({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."),ot(n)}})};function bd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=Fe(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=et(),[c,u]=w.useState(!1),f=!r||!o||!(i!=null&&i.id)||c,d=YI(),h=async()=>{f||(u(!0),console.warn("uninstalling installation",{projectId: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:()=>u(!1)}))},m=c?"Uninstalling...":e,y=l.jsx(ct,{type:"button",onClick:h,disabled:f,variant:t,style:n,children:m});return i!=null&&i.id?y:null}function ZI(){const{installation:e}=et();return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e!=null&&e.id?l.jsx("p",{children:"Once you uninstall this integration, its configuration will be lost."}):l.jsx("p",{children:"You've successfully uninstalled the integration."}),l.jsx(bd,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function _d({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var S,N,D,U;const{installation:i}=et(),{hydratedRevision:s,loading:a}=Hr(),{configureState:c,selectedObjectName:u}=Jt(),f=i==null?void 0:i.config,d=f&&u&&!!jl(f,u)||!1,h=((S=c==null?void 0:c.read)==null?void 0:S.isOptionalFieldsModified)||((N=c==null?void 0:c.read)==null?void 0:N.isRequiredMapFieldsModified)||((D=c==null?void 0:c.read)==null?void 0:D.isValueMappingsModified),m=(U=c==null?void 0:c.write)==null?void 0:U.isWriteModified,x=a||n||!c||!u||!(h||m||r||u!==ar&&!d),g=u===ar,b=u===Qi,O=u===cs,_=l.jsx(ct,{type:"submit",disabled:x,children:r?"Install":"Save"}),T=l.jsx(ct,{type:"button",onClick:t,disabled:x,variant:"ghost",children:"Reset"});return n?l.jsx(ni,{}):l.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px"},children:[_,T]}),l.jsxs(jn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&l.jsx(Ql,{children:typeof o=="string"?o:"Installation Failed."}),a&&l.jsx(ni,{}),s&&!b&&!g&&!O&&l.jsx(JI,{}),s&&!b&&g&&!O&&l.jsx(QI,{}),!a&&b&&l.jsx(ZI,{}),!a&&O&&l.jsx(XI,{})]})]})}const xd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=et(),{hydratedRevision:s,loading:a}=Hr(),{selectedObjectName:c}=tu(),{selectedConnection:u}=qr(),f=rl(),{projectId:d}=Fe(),{resetBoundary:h,setErrors:m,setError:y,getError:v}=Rt(),{resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:g}=Ls(),b=Jl(c||"",x),{onNextIncompleteTab:O}=Ry(),_=w.useCallback(()=>{h(ue.INSTALLATION_MUTATION)},[h]),T=w.useCallback(N=>N?D=>{y(ue.INSTALLATION_MUTATION,N,D)}:D=>{console.error("objectName is required to set installation error: ",D)},[y]),S=w.useCallback(N=>N?v(ue.INSTALLATION_MUTATION,N):"",[v]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:u,apiKey:f,projectId:d,resetBoundary:h,setErrors:m,setMutateInstallationError:T,getMutateInstallationError:S,resetMutateInstallationErrorState:_,resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:g,configureState:b,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:O}},eb=void 0;function tb(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:u,resetBoundary:f,setErrors:d,setMutateInstallationError:h,getMutateInstallationError:m,resetMutateInstallationErrorState:y,resetConfigureState:v,objectConfigurationsState:p,resetPendingConfigurationState:x,configureState:g,onInstallSuccess:b,onNextIncompleteTab:O}=xd(),[_,T]=w.useState(!1),S=s===ar,N=m(s),D=w.useCallback(()=>{f(ue.MAPPING),o!=null&&o.content&&!i&&s&&ql(o,eb,s,v)},[f,o,i,s,v]);w.useEffect(()=>{!g&&(o!=null&&o.content)&&!i&&D()},[g,p,o,i,D]);const U=()=>{y();const{requiredMapFields:ne,selectedFieldMappings:B}=(g==null?void 0:g.read)||{},{errorList:ce}=Vl(ne,B,d);ce.length>0||(s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(T(!0),yy(u,e,t,n,a.id,s,c,o,g,h(s),r,b).finally(()=>{T(!1),x(s),O()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},G=()=>{y(),s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(T(!0),Iy(u,e,t,n,a.id,c,o,g,h(s),r,b).finally(()=>{T(!1),x(s),O()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},z=ne=>{ne.preventDefault(),S?G():U()};return l.jsx(_d,{errorMsg:N,isCreateMode:!0,isLoading:_,onSave:z,onReset:D})}function nb({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:c}){const u={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${Zg(i)}`],installation:{config:e}}};return Ps().installationApi.updateInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(f=>{s(f),a==null||a(f.id,f.config)}).catch(f=>{ot(f,c)})}const rb=(e,t,n,r,o,i)=>{const s=Hl(e),a=Bl(e),c=Wl(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:c||{},backfill:i}}}}};return pi(o)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},ib=(e,t,n,r,o,i,s,a,c,u,f)=>{const d=rb(i,r||"",a,a.schedule,c,a.backfill);return d?nb({updateConfig:d,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:u,setInstallation:s,onUpdateSuccess:f}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},ob=(e,t)=>{const r={content:{write:{objects:Gl(e)}}};return pi(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},sb=(e,t,n,r,o,i,s,a,c)=>{const u=ob(o,i);if(!u)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const f={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:u}}};return Ps().installationApi.updateInstallation(f,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(d=>{a(d),c==null||c(d.id,d.config)}).catch(d=>{ot(d,s)})};function ab({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:c,setErrors:u,setMutateInstallationError:f,getMutateInstallationError:d,resetConfigureState:h,resetPendingConfigurationState:m,configureState:y,onUpdateSuccess:v,onNextIncompleteTab:p}=xd(),[x,g]=w.useState(!1),b=i===ar,O=d(i),{config:_}=e,T=w.useCallback(()=>{c(ue.MAPPING),r!=null&&r.content&&!o&&i&&ql(r,_,i,h)},[c,r,o,i,_,h]);w.useEffect(()=>{y||T()},[y,T]);const S=w.useMemo(()=>{var z,ne,B;return(B=(ne=(z=r==null?void 0:r.content)==null?void 0:z.read)==null?void 0:ne.objects)==null?void 0:B.find(ce=>(ce==null?void 0:ce.objectName)===i)},[r,i]),N=()=>{const{requiredMapFields:G,selectedFieldMappings:z}=(y==null?void 0:y.read)||{},{errorList:ne}=Vl(G,z,u);ne.length>0||(r&&e&&i&&s&&a&&S?(g(!0),ib(a,t.id,e.id,i,s,y,n,S,r,f(i),v).finally(()=>{g(!1),m(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},D=()=>{e&&i&&s&&a&&r?(g(!0),sb(a,t.id,e.id,s,y,r,f(i),n,v).finally(()=>{g(!1),m(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},U=G=>{G.preventDefault(),b?D():N()};return l.jsx(_d,{errorMsg:O,onSave:U,onReset:T,isLoading:x})}function cb(){const{integrationObj:e,installation:t}=et();return e?t&&e?l.jsx(ab,{installation:t,integrationObj:e}):l.jsx(tb,{}):l.jsx(Sl,{message:"We can't load the integration"})}const lb=()=>{const e=xt(),t=Wt(),[n,r]=w.useState(null);return{...uo({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"),ot(i,r)}}),errorMsg:n}};function ub(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),l.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function pa({text:e,children:t}){return l.jsx($r,{children:l.jsxs(jn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(ub,{}),l.jsx("p",{children:e}),t]})})}function db({provider:e}){const{providerName:t}=Ln(e),n=`You have successfully installed your ${t} integration.`;return l.jsx(pa,{text:n,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(bd,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const fb=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function pb({children:e}){var _;const t=w.useRef(!1),{projectId:n}=Fe(),{hydratedRevision:r,loading:o}=Hr(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,onInstallSuccess:u,isIntegrationDeleted:f}=et(),{mutate:d,isIdle:h,isPending:m,error:y,errorMsg:v}=lb(),{selectedConnection:p,isConnectionsLoading:x}=qr(),g=o||m||x,b=(_=r==null?void 0:r.content)==null?void 0:_.provider,O=fb(r);return w.useEffect(()=>{var T;if(!g&&!x&&r&&O&&!s&&p&&(i!=null&&i.id)&&!f&&b){const S={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:p==null?void 0:p.id,config:{content:{provider:b}}}};pi(r)===!0&&(S.installation.config.content.proxy=(T=r==null?void 0:r.content)==null?void 0:T.proxy),h&&!t.current&&(d(S,{onSuccess:N=>{u==null||u(N==null?void 0:N.id,N.config)}}),t.current=!0)}},[r,O,s,p,n,i==null?void 0:i.id,a,c,g,u,f,x,b,d,h]),O&&b&&s?l.jsx(db,{provider:b}):y?l.jsx(Ut,{message:v??"Create installation failed"}):i?g?l.jsx(Ur,{}):l.jsx("div",{children:e}):l.jsx(Ut,{message:"We can't load the integration"})}function xo(){const e=xt(),t=Wt();return uo({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"),ot(n)}})}const hb=()=>{const{project:e}=Fe(),t=e==null?void 0:e.id,n=xt();return hn({queryKey:["project",t,"entitlements"],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await n()).projectApi.getProject({projectIdOrName:t,includeEntitlements:!0})},enabled:!!t})};function Od(){var n,r;const{data:e}=hb();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:l.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[l.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),l.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:l.jsxs("picture",{children:[l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),l.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function vi({children:e}){return l.jsx($r,{children:l.jsxs(jn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(Od,{})]})})}function wi({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function mb({children:e}){return l.jsx("p",{style:{padding:".5em 0"},children:e})}function Ii({error:e}){return e?l.jsx(Ql,{style:{marginTop:"2em"},children:e}):null}function ha({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:o,title:i}){if(!i&&!r)throw new Error("Either title or providerName is required");return l.jsxs(vi,{children:[l.jsx(wi,{children:i||`Set up ${r} integration`}),l.jsx(Ii,{error:t}),o,l.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const gb="_link_oo2kv_1",yb={link:gb};function Cd({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:wt(yb.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function Ed({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(Cd,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const vb="_input_1ymb7_1",wb="_inputError_1ymb7_27",Ib="_error_1ymb7_43",qo={input:vb,inputError:wb,error:Ib};function bb({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?wt(qo.inputError,qo.input):qo.input;return l.jsx("input",{id:e,type:t,className:wt(i,n),...o})}const _b="_textarea_18zl4_1",xb="_textareaError_18zl4_14",Ob="_error_18zl4_29",Ho={textarea:_b,textareaError:xb,error:Ob};function Cb({className:e,isError:t=!1,...n}){const r=t?wt(Ho.textareaError,Ho.textarea):Ho.textarea;return l.jsx("textarea",{className:wt(e,r),...n})}const fn={Input:bb,Textarea:Cb};function Eb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){var v;const[i,s]=w.useState(!1),a=()=>s(p=>!p),[c,u]=w.useState(""),f=p=>u(p.currentTarget.value),{providerName:d}=Ln(e),h=c.length>0,m=o||!h,y=(v=t.apiKeyOpts)==null?void 0:v.docsURL;return l.jsx(ha,{providerName:d,handleSubmit:()=>{n({apiKey:c})},error:r,isButtonDisabled:m,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[y&&l.jsx(Ed,{url:y,providerDisplayName:d||Ar(e),credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(fn.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"API Key",onChange:p=>f(p)}),l.jsx(ct,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:i?"Hide":"Show"})]})]})})}function Sb({...e}){return l.jsx(Eb,{...e})}function Nb({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Fe(),u=xo(),f=w.useCallback(d=>{const{apiKey:h}=d,m={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:h}};u.mutate(m)},[c,i,o,r,n,e,u]);return a===null?l.jsx(Sb,{provider:e,providerInfo:t,handleSubmit:f,error:null}):s}function Tb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){var g;const[i,s]=w.useState(!1),a=()=>s(b=>!b),[c,u]=w.useState({username:"",password:""}),{username:f,password:d}=c,{providerName:h}=Ln(e),m=h||Ar(e),y=(g=t.basicOpts)==null?void 0:g.docsURL,v=f.length>0,p=o||!v,x=b=>{const{name:O,value:_}=b.currentTarget;u(T=>({...T,[O]:_}))};return l.jsx(ha,{providerName:h,handleSubmit:()=>{n({user:f,pass:d})},error:r,isButtonDisabled:p,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[y&&l.jsx(Ed,{url:y,providerDisplayName:m,credentialName:"credentials"}),l.jsx(fn.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:b=>x(b)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(fn.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:b=>x(b)}),l.jsx(ct,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:i?"Hide":"Show"})]})]})})}function Rb({...e}){return l.jsx(Tb,{...e})}function Ab({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Fe(),u=xo(),f=w.useCallback(d=>{const{user:h,pass:m}=d,y={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:h,password:m}}};u.mutate(y)},[c,i,o,r,n,e,u]);return a===null?l.jsx(Rb,{provider:e,providerInfo:t,handleSubmit:f,error:null}):s}function Pb({...e}){return l.jsx(ha,{...e})}function Db({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=Fe(),u=xo(),f=w.useCallback(()=>{const d={projectIdOrName:c,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};u.mutate(d)},[c,o,r,n,t,e,u]);return s===null?l.jsx(Pb,{handleSubmit:f,error:null,providerName:a}):i}const Ac=600,Pc=600,Fb="AUTHORIZATION_SUCCEEDED",Mb="AUTHORIZATION_FAILED";function kb(e,t,n,r){return w.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Ac)/2,i=window.screenY+(window.outerHeight-Pc)/2.5,s=`width=${Ac},height=${Pc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function jb(e,t,n){const r=Wt();return w.useCallback(o=>{var i,s;if(o.origin===Ng){if(o.data.eventType===Fb){const a=(i=o.data.data)==null?void 0:i.connection;a?(e(a),t==null||t.close(),r.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:o})}o.data.eventType===Mb&&(console.error("OAuth failed: ",{event:o}),n==null||n(((s=o==null?void 0:o.data)==null?void 0:s.message)??"Something went wrong. Please try again."))}},[t,n,r,e])}function Sd({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o}){const[i,s]=w.useState(null),[a,c]=w.useState(null),u=jb(s,a,r),f=kb(n,c,u,t);return w.useEffect(()=>{t&&!a&&!i&&!o&&f()},[t,a,f,i,o]),w.useEffect(()=>{if(!a)return;const d=setInterval(()=>{a.closed&&(clearInterval(d),window.removeEventListener("message",u),c(null),!i&&!o?(console.error("OAuth failed. Please try again."),r==null||r("Authentication was cancelled. Please try again.")):i&&(r==null||r(null)))},500);return()=>{clearInterval(d),window.removeEventListener("message",u)}},[a,i,o,u,r]),l.jsx("div",{children:e})}const Lb=()=>{const e=xt(),{projectIdOrName:t}=Fe();return hn({queryKey:["amp","providerApps",t],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await e()).providerAppApi.listProviderApps({projectIdOrName:t})},enabled:!!t})},Kb=e=>{const t=xt(),n={connectOAuthParams:e};return hn({queryKey:["amp","oauthConnect",e.projectId,e.groupRef,e.consumerRef,e.provider],queryFn:async()=>{if(!e.projectId)throw new Error("Project ID is required");if(!(e!=null&&e.providerAppId))throw new Error("Provider App ID is required");if(!(e!=null&&e.provider))throw new Error("Provider is required");if(!(e!=null&&e.consumerRef))throw new Error("Consumer Ref is required");if(!(e!=null&&e.groupRef))throw new Error("Group Ref is required");return(await t()).oAuthApi.oauthConnect(n)},enabled:!1})},Vb=Fs("VITE_AMP_ENABLE_CSRF",!1),$b=Fs("NEXT_AMP_ENABLE_CSRF",!1),Ub=Fs("REACT_APP_AMP_ENABLE_CSRF",!1),qb=!!Vb||!!$b||!!Ub,Nd=(e,t,n,r,o,i)=>{const{projectId:s}=Fe(),{data:a,isLoading:c,error:u}=sd(n),{data:f,isLoading:d,error:h}=Lb(),m=f==null?void 0:f.find(_=>_.provider===n),y=a?Rl(n,a):null,v={providerWorkspaceRef:r,projectId:s,groupRef:t,groupName:i,consumerRef:e,consumerName:o,providerAppId:m==null?void 0:m.id,provider:n,enableCSRFProtection:qb},{data:p,error:x,isLoading:g,refetch:b}=Kb(v);return w.useEffect(()=>{a&&n&&!m&&console.error(`You must first set up a ${y} Provider App using the Ampersand Console.`)},[m,y,a,n]),w.useEffect(()=>{u&&(console.error("Error fetching provider info:",u),ot(u))},[u]),w.useEffect(()=>{h&&(console.error("Error fetching provider apps:",h),ot(h))},[h]),w.useEffect(()=>{x&&(console.error("Error fetching OAuth connect:",x),ot(x))},[x]),{url:p,error:u||h||x,isLoading:c||d||g,refetchOauthConnect:()=>{var _,T;(a==null?void 0:a.authType)==="oauth2"?((_=a==null?void 0:a.oauth2Opts)==null?void 0:_.grantType)==="authorizationCode"||((T=a==null?void 0:a.oauth2Opts)==null?void 0:T.grantType)==="authorizationCodePKCE"?b():console.error("Provider does not support an OAuth2 web flow grant type."):console.error("Provider does not support an OAuth2 web flow.")}}};function Hb({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(vi,{children:[l.jsx(wi,{children:`Set up ${r} integration`}),l.jsx(mb,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),l.jsx(Ii,{error:t}),l.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Bb({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const[s,a]=w.useState(null),{url:c,error:u,isLoading:f,refetchOauthConnect:d}=Nd(t,r,e,void 0,n,o),h=(u==null?void 0:u.message)||s||null,m=async()=>{a(null),d()},y=w.useCallback(v=>{a(v)},[]);return l.jsx(Sd,{windowTitle:`Connect to ${i}`,oauthUrl:c||null,onError:y,children:l.jsx(Hb,{handleSubmit:m,error:h,providerName:i,isButtonDisabled:f})})}const Wb="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Jb({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(vi,{children:[l.jsx(wi,{children:"Enter your Salesforce subdomain"}),l.jsx(Cd,{href:Wb,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(Ii,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(fn.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),l.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),l.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function zb({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:o}){return l.jsxs(vi,{children:[l.jsxs(wi,{children:["Enter your ",o," workspace"]}),l.jsx(Ii,{error:n}),l.jsx("br",{}),l.jsx(fn.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:i=>t(i.currentTarget.value)}),l.jsx("br",{}),l.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Gb="salesforce";function Qb({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const[s,a]=w.useState(""),[c,u]=w.useState(null),{url:f,error:d,isLoading:h,refetchOauthConnect:m}=Nd(t,r,e,s,n,o),y=(d==null?void 0:d.message)||c||null,v=async()=>{if(u(null),!s){u("Workspace is required");return}m()},p=w.useCallback(g=>{u(g)},[]),x=e===Gb?l.jsx(Jb,{handleSubmit:v,setWorkspace:a,error:y,isButtonDisabled:s.length===0}):l.jsx(zb,{handleSubmit:v,setWorkspace:a,error:y,isButtonDisabled:s.length===0||h,providerName:i});return l.jsx(Sd,{windowTitle:`Connect to ${i}`,oauthUrl:f||null,onError:p,error:y,children:x})}function Xb({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:o,explicitWorkspaceRequired:i}){const[s,a]=w.useState(!1),[c,u]=w.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),f=()=>a(_=>!_),d=_=>{const{name:T,value:S}=_.currentTarget;u(N=>({...N,[T]:S}))},{clientSecret:h,clientId:m,workspace:y,scopes:v}=c,p=h.length>0,x=m.length>0,g=i?y.length>0:!0,b=n||!p||!x||!g,O=()=>{const _={clientId:m,clientSecret:h};i&&(_.workspace=y),o&&v.length>0&&(_.scopes=Xg(v)),e(_)};return l.jsxs(vi,{children:[l.jsx(wi,{children:`Set up ${r} integration`}),l.jsx(Ii,{error:t}),l.jsx("br",{}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[i&&l.jsx(fn.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:_=>d(_)}),l.jsx(fn.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:_=>d(_)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(fn.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:_=>d(_)}),l.jsx(ct,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:f,children:s?"Hide":"Show"})]}),o&&l.jsx(fn.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:_=>d(_)})]}),l.jsx("br",{}),l.jsx(ct,{style:{marginTop:"1em",width:"100%"},disabled:b,type:"submit",onClick:O,children:"Next"})]})}function Yb({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c}){const{projectIdOrName:u}=Fe(),f=xo(),[d,h]=w.useState(null),m=w.useCallback(y=>{h(null);const v={projectIdOrName:u,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:y.workspace,oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret,scopes:y.scopes}}};f.mutate(v,{onError:()=>h("Error loading provider info")})},[u,i,o,r,n,e,f]);return c===null?l.jsx(Xb,{providerName:t,handleSubmit:m,error:d,explicitScopesRequired:s,explicitWorkspaceRequired:a}):l.jsx(ni,{})}function Zb({...e}){return l.jsx(Yb,{...e})}const e_="authorizationCode",t_="authorizationCodePKCE",n_="clientCredentials";function r_({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=Ln(e);if(t.oauth2Opts===void 0)return l.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:u,explicitScopesRequired:f,explicitWorkspaceRequired:d}=t.oauth2Opts,h={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return u===e_||u===t_?d?l.jsx(Qb,{...h}):l.jsx(Bb,{...h}):u===n_?l.jsx(Zb,{...h,explicitWorkspaceRequired:d,explicitScopesRequired:f,selectedConnection:s,setSelectedConnection:a}):u==="password"?l.jsx("em",{children:"Password flow not supported yet"}):l.jsxs("em",{children:["Unsupported grant type: ",u]})}function i_(e){const{selectedConnection:t}=qr();w.useEffect(()=>{e&&t&&e(t)},[e,t])}function o_({onSuccess:e}){i_(e)}function Td({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:u,isLoading:f,isError:d,error:h,providerName:m,selectedProvider:y}=Ln(e),{provider:v,isIntegrationDeleted:p}=et(),{selectedConnection:x,setSelectedConnection:g}=qr();o_({onSuccess:s});const b=Wt();w.useEffect(()=>{d&&(console.error("Error loading provider info."),ot(h))},[d,h]);const O=w.useCallback(()=>{b.clear(),c()},[c,b]);if(!e&&!v)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return l.jsx(pa,{text:"Integration successfully uninstalled.",children:l.jsx(ct,{type:"button",onClick:O,style:{width:"100%"},children:"Reinstall Integration"})});if(x)return i;if(f)return l.jsx(Ur,{});if(u==null)return l.jsx(Ut,{message:"Provider info was not found."});const _={provider:y,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:x,setSelectedConnection:g,providerName:m,providerInfo:u,onDisconnectSuccess:a};return u.authType==="none"?l.jsx(Db,{..._,children:i}):u.authType==="basic"?l.jsx(Ab,{..._,children:i}):u.authType==="apiKey"?l.jsx(Nb,{..._,children:i}):l.jsx(r_,{..._})}function s_(e){const t=e+"CollectionProvider",[n,r]=_o(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:y,children:v}=m,p=w.useRef(null),x=w.useRef(new Map).current;return l.jsx(o,{scope:y,itemMap:x,collectionRef:p,children:v})};s.displayName=t;const a=e+"CollectionSlot",c=w.forwardRef((m,y)=>{const{scope:v,children:p}=m,x=i(a,v),g=ai(y,x.collectionRef);return l.jsx(co,{ref:g,children:p})});c.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",d=w.forwardRef((m,y)=>{const{scope:v,children:p,...x}=m,g=w.useRef(null),b=ai(y,g),O=i(u,v);return w.useEffect(()=>(O.itemMap.set(g,{ref:g,...x}),()=>void O.itemMap.delete(g))),l.jsx(co,{[f]:"",ref:b,children:p})});d.displayName=u;function h(m){const y=i(e+"CollectionConsumer",m);return w.useCallback(()=>{const p=y.collectionRef.current;if(!p)return[];const x=Array.from(p.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((O,_)=>x.indexOf(O.ref.current)-x.indexOf(_.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:c,ItemSlot:d},h,r]}var a_=V.useId||(()=>{}),c_=0;function Rd(e){const[t,n]=V.useState(a_());return ao(()=>{e||n(r=>r??String(c_++))},[e]),e||(t?`radix-${t}`:"")}var l_=V.createContext(void 0);function Ad(e){const t=V.useContext(l_);return e||t||"ltr"}var Bo="rovingFocusGroup.onEntryFocus",u_={bubbles:!1,cancelable:!0},Oo="RovingFocusGroup",[Ss,Pd,d_]=s_(Oo),[f_,Dd]=_o(Oo,[d_]),[p_,h_]=f_(Oo),Fd=V.forwardRef((e,t)=>l.jsx(Ss.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Ss.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(m_,{...e,ref:t})})}));Fd.displayName=Oo;var m_=V.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...d}=e,h=V.useRef(null),m=ai(t,h),y=Ad(i),[v=null,p]=ua({prop:s,defaultProp:a,onChange:c}),[x,g]=V.useState(!1),b=la(u),O=Pd(n),_=V.useRef(!1),[T,S]=V.useState(0);return V.useEffect(()=>{const N=h.current;if(N)return N.addEventListener(Bo,b),()=>N.removeEventListener(Bo,b)},[b]),l.jsx(p_,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:v,onItemFocus:V.useCallback(N=>p(N),[p]),onItemShiftTab:V.useCallback(()=>g(!0),[]),onFocusableItemAdd:V.useCallback(()=>S(N=>N+1),[]),onFocusableItemRemove:V.useCallback(()=>S(N=>N-1),[]),children:l.jsx(Kn.div,{tabIndex:x||T===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:qt(e.onMouseDown,()=>{_.current=!0}),onFocus:qt(e.onFocus,N=>{const D=!_.current;if(N.target===N.currentTarget&&D&&!x){const U=new CustomEvent(Bo,u_);if(N.currentTarget.dispatchEvent(U),!U.defaultPrevented){const G=O().filter(se=>se.focusable),z=G.find(se=>se.active),ne=G.find(se=>se.id===v),ce=[z,ne,...G].filter(Boolean).map(se=>se.ref.current);jd(ce,f)}}_.current=!1}),onBlur:qt(e.onBlur,()=>g(!1))})})}),Md="RovingFocusGroupItem",kd=V.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Rd(),c=i||a,u=h_(Md,n),f=u.currentTabStopId===c,d=Pd(n),{onFocusableItemAdd:h,onFocusableItemRemove:m}=u;return V.useEffect(()=>{if(r)return h(),()=>m()},[r,h,m]),l.jsx(Ss.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:l.jsx(Kn.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:qt(e.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:qt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:qt(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=v_(y,u.orientation,u.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let x=d().filter(g=>g.focusable).map(g=>g.ref.current);if(v==="last")x.reverse();else if(v==="prev"||v==="next"){v==="prev"&&x.reverse();const g=x.indexOf(y.currentTarget);x=u.loop?w_(x,g+1):x.slice(g+1)}setTimeout(()=>jd(x))}})})})});kd.displayName=Md;var g_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function y_(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function v_(e,t,n){const r=y_(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return g_[r]}function jd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function w_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var I_=Fd,b_=kd,ma="Tabs",[__,G_]=_o(ma,[Dd]),Ld=Dd(),[x_,ga]=__(ma),Kd=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...u}=e,f=Ad(a),[d,h]=ua({prop:r,onChange:o,defaultProp:i});return l.jsx(x_,{scope:n,baseId:Rd(),value:d,onValueChange:h,orientation:s,dir:f,activationMode:c,children:l.jsx(Kn.div,{dir:f,"data-orientation":s,...u,ref:t})})});Kd.displayName=ma;var Vd="TabsList",$d=V.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=ga(Vd,n),s=Ld(n);return l.jsx(I_,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(Kn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});$d.displayName=Vd;var Ud="TabsTrigger",qd=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=ga(Ud,n),a=Ld(n),c=Bd(s.baseId,r),u=Wd(s.baseId,r),f=r===s.value;return l.jsx(b_,{asChild:!0,...a,focusable:!o,active:f,children:l.jsx(Kn.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:qt(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:qt(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:qt(e.onFocus,()=>{const d=s.activationMode!=="manual";!f&&!o&&d&&s.onValueChange(r)})})})});qd.displayName=Ud;var Hd="TabsContent",O_=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=ga(Hd,n),c=Bd(a.baseId,r),u=Wd(a.baseId,r),f=r===a.value,d=V.useRef(f);return V.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),l.jsx(da,{present:o||f,children:({present:h})=>l.jsx(Kn.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&i})})});O_.displayName=Hd;function Bd(e,t){return`${e}-trigger-${t}`}function Wd(e,t){return`${e}-content-${t}`}var C_=Kd,E_=$d,Jd=qd;const S_=l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[l.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),l.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function N_(e,t){return t?w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},w.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?S_:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:l.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function T_(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const R_="_tabsRoot_ktpr0_1",A_="_tabsList_ktpr0_6",P_="_tabTrigger_ktpr0_12",D_="_danger_ktpr0_29",ci={tabsRoot:R_,tabsList:A_,tabTrigger:P_,danger:D_},Dc=!1;function zd({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(Jd,{value:e,className:ci.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[N_(t,n),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsx("span",{children:r||e}),n&&l.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function F_({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(bo,{style:{margin:"1rem 0"}}),l.jsx(zd,{objectName:ar,completed:e,pending:t,displayName:n},"other-write")]})}function M_(){return l.jsxs(l.Fragment,{children:[l.jsx(bo,{style:{margin:"3rem 0 1rem 0"}}),l.jsx(Jd,{value:Qi,className:wt(ci.tabTrigger,ci.danger),children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[T_(),l.jsx("span",{children:"Uninstall"})]})})]})}function k_({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o,showUninstallButton:i}){var s,a;return l.jsx(C_,{value:e,className:ci.tabsRoot,onValueChange:n,children:l.jsxs(E_,{className:ci.tabsList,children:[t.map(c=>{var u,f,d,h,m,y;return l.jsx(zd,{objectName:c.name,displayName:c.displayName,completed:c.completed,pending:((f=(u=r==null?void 0:r[c.name])==null?void 0:u.read)==null?void 0:f.isOptionalFieldsModified)||((h=(d=r==null?void 0:r[c.name])==null?void 0:d.read)==null?void 0:h.isRequiredMapFieldsModified)||((y=(m=r==null?void 0:r[c.name])==null?void 0:m.read)==null?void 0:y.isValueMappingsModified)||!1},c.name)}),o&&l.jsx(F_,{completed:o.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),i&&!Dc&&l.jsx(M_,{}),Dc]})})}function j_(e,t){return t===Qi?{name:Qi,completed:!1}:t===cs?{name:cs,completed:!1}:e.find(n=>n.name===t)}function L_({children:e}){var x;const{project:t}=Fe(),{installation:n}=et(),{providerName:r}=Ln(),{hydratedRevision:o}=Hr(),{objectConfigurationsState:i}=Ls(),[s,a]=w.useState(""),c=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,f=o&&Ll(u,o),d=f!==null,h=!!((x=o==null?void 0:o.content)!=null&&x.write),m=h?Kl(u):void 0,y=w.useMemo(()=>{const g=[...f||[]];return m&&h&&g.push(m),g},[f,m,h]),v=j_(y,s),p=w.useCallback(()=>{const g=y.find(b=>v!==b&&!b.completed);g&&a(g.name)},[y,v]);return w.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,p]),l.jsx(nu.Provider,{value:p,children:l.jsx(eu.Provider,{value:v==null?void 0:v.name,children:l.jsxs($r,{style:{maxWidth:"55rem"},children:[l.jsxs(jn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[l.jsxs("div",{style:{width:"20rem"},children:[l.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),l.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),d&&l.jsx(k_,{value:s,readNavObjects:f,onValueChange:g=>a(g),objectConfigurationsState:i,writeNavObject:m,showUninstallButton:!!n})]}),e]}),l.jsx(Od,{})]})})})}function K_({...e}){return l.jsx(L_,{...e})}function V_({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var p;const{projectIdOrName:u,isLoading:f}=Fe(),{isLoading:d}=Ds(),{isError:h,errorState:m}=Rt(),{seed:y,reset:v}=Fl();return f||d?l.jsx(Ur,{}):h(ue.PROJECT,u)?l.jsx(Ut,{message:`Error loading project ${u}`}):h(ue.INTEGRATION_LIST,u)?l.jsx(Ut,{message:"Error retrieving integrations for the project, double check the API key"}):(p=m[ue.INTEGRATION_LIST])!=null&&p.apiError?l.jsx(Ut,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:Ml.resetContainer,children:l.jsx(ty,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(Dl,{children:l.jsx(Td,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:v,children:l.jsx(Ty,{resetComponent:v,children:l.jsx(pb,{children:l.jsx(qy,{children:l.jsx(K_,{children:l.jsx(cb,{})})})})})})})},y)})}function $_(){return l.jsxs($r,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(ni,{}),l.jsx("p",{children:"Redirecting"})]})}function U_({redirectURL:e,children:t}){return w.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx($_,{}):t}function q_({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Fe(),{providerName:o}=Ln(e),i=`You have successfully connected your ${o} account to ${r}.`;return l.jsx(pa,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Yl,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function H_({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:u,reset:f}=Fl(),d=w.useCallback(h=>{s?s(h.id):c&&c(h)},[s,c]);return l.jsx("div",{className:Ml.resetContainer,children:l.jsx(Dl,{groupRef:r,provider:e,children:l.jsx(Td,{resetComponent:f,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:d,onDisconnectSuccess:a,children:l.jsx(U_,{redirectURL:i,children:l.jsx(q_,{resetComponent:f,provider:e,onDisconnectSuccess:a})})})})},u)}const B_=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=Tl(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r;return w.useEffect(()=>{o&&ot(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r}};exports.AmpersandContext=Cl;exports.AmpersandProvider=Mg;exports.ConnectProvider=H_;exports.InstallIntegration=V_;exports.useAmpersandProvider=kg;exports.useIsIntegrationInstalled=B_;
|
|
50
|
+
*/const Qw="react-tooltip-core-styles",Xw="react-tooltip-base-styles",Tc={core:!1,base:!1};function Rc({css:e,id:t=Xw,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||Tc[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=Qw),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.id=t,l.type="text/css",s==="top"&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e)),Tc[n]=!0}const Ac=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[Ww(Number(o)),zw({fallbackAxisSideDirection:"start"}),Jw({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const l=s;return n?(l.push(Gw({element:n,padding:5})),Nc(e,t,{placement:r,strategy:i,middleware:l}).then(({x:u,y:f,placement:d,middlewareData:m})=>{var h,y;const w={left:`${u}px`,top:`${f}px`,border:a},{x:p,y:b}=(h=m.arrow)!==null&&h!==void 0?h:{x:0,y:0},g=(y={top:"bottom",right:"left",bottom:"top",left:"right"}[d.split("-")[0]])!==null&&y!==void 0?y:"bottom",_=a&&{borderBottom:a,borderRight:a};let x=0;if(a){const C=`${a}`.match(/(\d+)px/);x=C!=null&&C[1]?Number(C[1]):1}return{tooltipStyles:w,tooltipArrowStyles:{left:p!=null?`${p}px`:"",top:b!=null?`${b}px`:"",right:"",bottom:"",..._,[g]:`-${4+x}px`},place:d}})):Nc(e,t,{placement:"bottom",strategy:i,middleware:l}).then(({x:u,y:f,placement:d})=>({tooltipStyles:{left:`${u}px`,top:`${f}px`},tooltipArrowStyles:{},place:d}))},Pc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Dc=(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},Fc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Rs=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>Rs(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Fc(e)||!Fc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Rs(e[o],t[o]))},Yw=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"})},Mc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Yw(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Zw=typeof window<"u"?v.useLayoutEffect:v.useEffect,Tt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},eI="DEFAULT_TOOLTIP_ID",tI={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},nI=v.createContext({getTooltipData:()=>tI});function hd(e=eI){return v.useContext(nI).getTooltipData(e)}var wr={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"},Jo={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 rI=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:l=10,events:u=["hover"],openOnClick:f=!1,positionStrategy:d="absolute",middlewares:m,wrapper:h,delayShow:y=0,delayHide:w=0,float:p=!1,hidden:b=!1,noArrow:g=!1,clickable:_=!1,closeOnEsc:x=!1,closeOnScroll:C=!1,closeOnResize:T=!1,openEvents:S,closeEvents:N,globalCloseEvents:D,imperativeModeOnly:$,style:G,position:z,afterShow:ne,afterHide:B,disableTooltip:ce,content:se,contentWrapperRef:te,isOpen:ge,defaultIsOpen:we=!1,setIsOpen:A,activeAnchor:k,setActiveAnchor:U,border:L,opacity:j,arrowColor:F,role:Y="tooltip"})=>{var Z;const q=v.useRef(null),ee=v.useRef(null),Q=v.useRef(null),de=v.useRef(null),M=v.useRef(null),[ve,H]=v.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ee,Ve]=v.useState(!1),[Ye,Ue]=v.useState(!1),[Ie,Dt]=v.useState(null),Ze=v.useRef(!1),yt=v.useRef(null),{anchorRefs:Ft,setActiveAnchor:Mt}=hd(t),et=v.useRef(!1),[Je,$e]=v.useState([]),Pe=v.useRef(!1),kt=f||u.includes("click"),rt=kt||(S==null?void 0:S.click)||(S==null?void 0:S.dblclick)||(S==null?void 0:S.mousedown),on=S?{...S}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!S&&kt&&Object.assign(on,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const wn=N?{...N}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!N&&kt&&Object.assign(wn,{mouseleave:!1,blur:!1,mouseout:!1});const vt=D?{...D}:{escape:x||!1,scroll:C||!1,resize:T||!1,clickOutsideAnchor:rt||!1};$&&(Object.assign(on,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(wn,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(vt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),Zw(()=>(Pe.current=!0,()=>{Pe.current=!1}),[]);const De=W=>{Pe.current&&(W&&Ue(!0),setTimeout(()=>{Pe.current&&(A==null||A(W),ge===void 0&&Ve(W))},10))};v.useEffect(()=>{if(ge===void 0)return()=>null;ge&&Ue(!0);const W=setTimeout(()=>{Ve(ge)},10);return()=>{clearTimeout(W)}},[ge]),v.useEffect(()=>{if(Ee!==Ze.current)if(Tt(M),Ze.current=Ee,Ee)ne==null||ne();else{const W=(ae=>{const le=ae.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,Ke,He]=le;return Number(Ke)*(He==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));M.current=setTimeout(()=>{Ue(!1),Dt(null),B==null||B()},W+25)}},[Ee]);const sn=W=>{H(ae=>Rs(ae,W)?ae:W)},In=(W=y)=>{Tt(Q),Ye?De(!0):Q.current=setTimeout(()=>{De(!0)},W)},an=(W=w)=>{Tt(de),de.current=setTimeout(()=>{et.current||De(!1)},W)},qn=W=>{var ae;if(!W)return;const le=(ae=W.currentTarget)!==null&&ae!==void 0?ae:W.target;if(!(le!=null&&le.isConnected))return U(null),void Mt({current:null});y?In():De(!0),U(le),Mt({current:le}),Tt(de)},ut=()=>{_?an(w||100):w?an():De(!1),Tt(Q)},cn=({x:W,y:ae})=>{var le;const Ke={getBoundingClientRect:()=>({x:W,y:ae,width:0,height:0,top:ae,left:W,right:W,bottom:ae})};Ac({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:l,elementReference:Ke,tooltipReference:q.current,tooltipArrowReference:ee.current,strategy:d,middlewares:m,border:L}).then(He=>{sn(He)})},bn=W=>{if(!W)return;const ae=W,le={x:ae.clientX,y:ae.clientY};cn(le),yt.current=le},Hn=W=>{var ae;if(!Ee)return;const le=W.target;le.isConnected&&(!((ae=q.current)===null||ae===void 0)&&ae.contains(le)||[document.querySelector(`[id='${i}']`),...Je].some(Ke=>Ke==null?void 0:Ke.contains(le))||(De(!1),Tt(Q)))},_n=Dc(qn,50),Ae=Dc(ut,50),it=W=>{Ae.cancel(),_n(W)},ie=()=>{_n.cancel(),Ae()},me=v.useCallback(()=>{var W,ae;const le=(W=Ie==null?void 0:Ie.position)!==null&&W!==void 0?W:z;le?cn(le):p?yt.current&&cn(yt.current):k!=null&&k.isConnected&&Ac({place:(ae=Ie==null?void 0:Ie.place)!==null&&ae!==void 0?ae:a,offset:l,elementReference:k,tooltipReference:q.current,tooltipArrowReference:ee.current,strategy:d,middlewares:m,border:L}).then(Ke=>{Pe.current&&sn(Ke)})},[Ee,k,se,G,a,Ie==null?void 0:Ie.place,l,d,z,Ie==null?void 0:Ie.position,p]);v.useEffect(()=>{var W,ae;const le=new Set(Ft);Je.forEach(Se=>{ce!=null&&ce(Se)||le.add({current:Se})});const Ke=document.querySelector(`[id='${i}']`);Ke&&!(ce!=null&&ce(Ke))&&le.add({current:Ke});const He=()=>{De(!1)},dt=Mc(k),ze=Mc(q.current);vt.scroll&&(window.addEventListener("scroll",He),dt==null||dt.addEventListener("scroll",He),ze==null||ze.addEventListener("scroll",He));let tt=null;vt.resize?window.addEventListener("resize",He):k&&q.current&&(tt=Bw(k,q.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const ft=Se=>{Se.key==="Escape"&&De(!1)};vt.escape&&window.addEventListener("keydown",ft),vt.clickOutsideAnchor&&window.addEventListener("click",Hn);const Te=[],Bn=Se=>{Ee&&(Se==null?void 0:Se.target)===k||qn(Se)},To=Se=>{Ee&&(Se==null?void 0:Se.target)===k&&ut()},Et=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Oi=["click","dblclick","mousedown","mouseup"];Object.entries(on).forEach(([Se,jt])=>{jt&&(Et.includes(Se)?Te.push({event:Se,listener:it}):Oi.includes(Se)&&Te.push({event:Se,listener:Bn}))}),Object.entries(wn).forEach(([Se,jt])=>{jt&&(Et.includes(Se)?Te.push({event:Se,listener:ie}):Oi.includes(Se)&&Te.push({event:Se,listener:To}))}),p&&Te.push({event:"pointermove",listener:bn});const Ei=()=>{et.current=!0},Si=()=>{et.current=!1,ut()};return _&&!rt&&((W=q.current)===null||W===void 0||W.addEventListener("mouseenter",Ei),(ae=q.current)===null||ae===void 0||ae.addEventListener("mouseleave",Si)),Te.forEach(({event:Se,listener:jt})=>{le.forEach(Lt=>{var Wn;(Wn=Lt.current)===null||Wn===void 0||Wn.addEventListener(Se,jt)})}),()=>{var Se,jt;vt.scroll&&(window.removeEventListener("scroll",He),dt==null||dt.removeEventListener("scroll",He),ze==null||ze.removeEventListener("scroll",He)),vt.resize?window.removeEventListener("resize",He):tt==null||tt(),vt.clickOutsideAnchor&&window.removeEventListener("click",Hn),vt.escape&&window.removeEventListener("keydown",ft),_&&!rt&&((Se=q.current)===null||Se===void 0||Se.removeEventListener("mouseenter",Ei),(jt=q.current)===null||jt===void 0||jt.removeEventListener("mouseleave",Si)),Te.forEach(({event:Lt,listener:Wn})=>{le.forEach(Ro=>{var Zr;(Zr=Ro.current)===null||Zr===void 0||Zr.removeEventListener(Lt,Wn)})})}},[k,me,Ye,Ft,Je,S,N,D,kt,y,w]),v.useEffect(()=>{var W,ae;let le=(ae=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s)!==null&&ae!==void 0?ae:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ke=new MutationObserver(He=>{const dt=[],ze=[];He.forEach(tt=>{if(tt.type==="attributes"&&tt.attributeName==="data-tooltip-id"&&(tt.target.getAttribute("data-tooltip-id")===t?dt.push(tt.target):tt.oldValue===t&&ze.push(tt.target)),tt.type==="childList"){if(k){const ft=[...tt.removedNodes].filter(Te=>Te.nodeType===1);if(le)try{ze.push(...ft.filter(Te=>Te.matches(le))),ze.push(...ft.flatMap(Te=>[...Te.querySelectorAll(le)]))}catch{}ft.some(Te=>{var Bn;return!!(!((Bn=Te==null?void 0:Te.contains)===null||Bn===void 0)&&Bn.call(Te,k))&&(Ue(!1),De(!1),U(null),Tt(Q),Tt(de),!0)})}if(le)try{const ft=[...tt.addedNodes].filter(Te=>Te.nodeType===1);dt.push(...ft.filter(Te=>Te.matches(le))),dt.push(...ft.flatMap(Te=>[...Te.querySelectorAll(le)]))}catch{}}}),(dt.length||ze.length)&&$e(tt=>[...tt.filter(ft=>!ze.includes(ft)),...dt])});return Ke.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Ke.disconnect()}},[t,s,Ie==null?void 0:Ie.anchorSelect,k]),v.useEffect(()=>{me()},[me]),v.useEffect(()=>{if(!(te!=null&&te.current))return()=>null;const W=new ResizeObserver(()=>{setTimeout(()=>me())});return W.observe(te.current),()=>{W.disconnect()}},[se,te==null?void 0:te.current]),v.useEffect(()=>{var W;const ae=document.querySelector(`[id='${i}']`),le=[...Je,ae];k&&le.includes(k)||U((W=Je[0])!==null&&W!==void 0?W:ae)},[i,Je,k]),v.useEffect(()=>(we&&De(!0),()=>{Tt(Q),Tt(de)}),[]),v.useEffect(()=>{var W;let ae=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s;if(!ae&&t&&(ae=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ae)try{const le=Array.from(document.querySelectorAll(ae));$e(le)}catch{$e([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),v.useEffect(()=>{Q.current&&(Tt(Q),In(y))},[y]);const qe=(Z=Ie==null?void 0:Ie.content)!==null&&Z!==void 0?Z:se,ln=Ee&&Object.keys(ve.tooltipStyles).length>0;return v.useImperativeHandle(e,()=>({open:W=>{if(W!=null&&W.anchorSelect)try{document.querySelector(W.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${W.anchorSelect}" is not a valid CSS selector`)}Dt(W??null),W!=null&&W.delay?In(W.delay):De(!0)},close:W=>{W!=null&&W.delay?an(W.delay):De(!1)},activeAnchor:k,place:ve.place,isOpen:!!(Ye&&!b&&qe&&ln)})),Ye&&!b&&qe?v.createElement(h,{id:t,role:Y,className:bt("react-tooltip",wr.tooltip,Jo.tooltip,Jo[o],n,`react-tooltip__place-${ve.place}`,wr[ln?"show":"closing"],ln?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&wr.fixed,_&&wr.clickable),onTransitionEnd:W=>{Tt(M),Ee||W.propertyName!=="opacity"||(Ue(!1),Dt(null),B==null||B())},style:{...G,...ve.tooltipStyles,opacity:j!==void 0&&ln?j:void 0},ref:q},qe,v.createElement(h,{className:bt("react-tooltip-arrow",wr.arrow,Jo.arrow,r,g&&wr.noArrow),style:{...ve.tooltipArrowStyles,background:F?`linear-gradient(to right bottom, transparent 50%, ${F} 50%)`:void 0},ref:ee})):null},iI=({content:e})=>v.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),oI=v.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:l="dark",place:u="top",offset:f=10,wrapper:d="div",children:m=null,events:h=["hover"],openOnClick:y=!1,positionStrategy:w="absolute",middlewares:p,delayShow:b=0,delayHide:g=0,float:_=!1,hidden:x=!1,noArrow:C=!1,clickable:T=!1,closeOnEsc:S=!1,closeOnScroll:N=!1,closeOnResize:D=!1,openEvents:$,closeEvents:G,globalCloseEvents:z,imperativeModeOnly:ne=!1,style:B,position:ce,isOpen:se,defaultIsOpen:te=!1,disableStyleInjection:ge=!1,border:we,opacity:A,arrowColor:k,setIsOpen:U,afterShow:L,afterHide:j,disableTooltip:F,role:Y="tooltip"},Z)=>{const[q,ee]=v.useState(r),[Q,de]=v.useState(o),[M,ve]=v.useState(u),[H,Ee]=v.useState(l),[Ve,Ye]=v.useState(f),[Ue,Ie]=v.useState(b),[Dt,Ze]=v.useState(g),[yt,Ft]=v.useState(_),[Mt,et]=v.useState(x),[Je,$e]=v.useState(d),[Pe,kt]=v.useState(h),[rt,on]=v.useState(w),[wn,vt]=v.useState(null),[De,sn]=v.useState(null),In=v.useRef(ge),{anchorRefs:an,activeAnchor:qn}=hd(e),ut=Ae=>Ae==null?void 0:Ae.getAttributeNames().reduce((it,ie)=>{var me;return ie.startsWith("data-tooltip-")&&(it[ie.replace(/^data-tooltip-/,"")]=(me=Ae==null?void 0:Ae.getAttribute(ie))!==null&&me!==void 0?me:null),it},{}),cn=Ae=>{const it={place:ie=>{var me;ve((me=ie)!==null&&me!==void 0?me:u)},content:ie=>{ee(ie??r)},html:ie=>{de(ie??o)},variant:ie=>{var me;Ee((me=ie)!==null&&me!==void 0?me:l)},offset:ie=>{Ye(ie===null?f:Number(ie))},wrapper:ie=>{var me;$e((me=ie)!==null&&me!==void 0?me:d)},events:ie=>{const me=ie==null?void 0:ie.split(" ");kt(me??h)},"position-strategy":ie=>{var me;on((me=ie)!==null&&me!==void 0?me:w)},"delay-show":ie=>{Ie(ie===null?b:Number(ie))},"delay-hide":ie=>{Ze(ie===null?g:Number(ie))},float:ie=>{Ft(ie===null?_:ie==="true")},hidden:ie=>{et(ie===null?x:ie==="true")},"class-name":ie=>{vt(ie)}};Object.values(it).forEach(ie=>ie(null)),Object.entries(Ae).forEach(([ie,me])=>{var qe;(qe=it[ie])===null||qe===void 0||qe.call(it,me)})};v.useEffect(()=>{ee(r)},[r]),v.useEffect(()=>{de(o)},[o]),v.useEffect(()=>{ve(u)},[u]),v.useEffect(()=>{Ee(l)},[l]),v.useEffect(()=>{Ye(f)},[f]),v.useEffect(()=>{Ie(b)},[b]),v.useEffect(()=>{Ze(g)},[g]),v.useEffect(()=>{Ft(_)},[_]),v.useEffect(()=>{et(x)},[x]),v.useEffect(()=>{on(w)},[w]),v.useEffect(()=>{In.current!==ge&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[ge]),v.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:ge==="core",disableBase:ge}}))},[]),v.useEffect(()=>{var Ae;const it=new Set(an);let ie=n;if(!ie&&e&&(ie=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ie)try{document.querySelectorAll(ie).forEach(ae=>{it.add({current:ae})})}catch{console.warn(`[react-tooltip] "${ie}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&it.add({current:me}),!it.size)return()=>null;const qe=(Ae=De??me)!==null&&Ae!==void 0?Ae:qn.current,ln=new MutationObserver(ae=>{ae.forEach(le=>{var Ke;if(!qe||le.type!=="attributes"||!(!((Ke=le.attributeName)===null||Ke===void 0)&&Ke.startsWith("data-tooltip-")))return;const He=ut(qe);cn(He)})}),W={attributes:!0,childList:!1,subtree:!1};if(qe){const ae=ut(qe);cn(ae),ln.observe(qe,W)}return()=>{ln.disconnect()}},[an,qn,De,t,n]),v.useEffect(()=>{B!=null&&B.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),we&&!Pc("border",`${we}`)&&console.warn(`[react-tooltip] "${we}" is not a valid \`border\`.`),B!=null&&B.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),A&&!Pc("opacity",`${A}`)&&console.warn(`[react-tooltip] "${A}" is not a valid \`opacity\`.`)},[]);let bn=m;const Hn=v.useRef(null);if(i){const Ae=i({content:(De==null?void 0:De.getAttribute("data-tooltip-content"))||q||null,activeAnchor:De});bn=Ae?v.createElement("div",{ref:Hn,className:"react-tooltip-content-wrapper"},Ae):null}else q&&(bn=q);Q&&(bn=v.createElement(iI,{content:Q}));const _n={forwardRef:Z,id:e,anchorId:t,anchorSelect:n,className:bt(s,wn),classNameArrow:a,content:bn,contentWrapperRef:Hn,place:M,variant:H,offset:Ve,wrapper:Je,events:Pe,openOnClick:y,positionStrategy:rt,middlewares:p,delayShow:Ue,delayHide:Dt,float:yt,hidden:Mt,noArrow:C,clickable:T,closeOnEsc:S,closeOnScroll:N,closeOnResize:D,openEvents:$,closeEvents:G,globalCloseEvents:z,imperativeModeOnly:ne,style:B,position:ce,isOpen:se,defaultIsOpen:te,border:we,opacity:A,arrowColor:k,setIsOpen:U,afterShow:L,afterHide:j,disableTooltip:F,activeAnchor:De,setActiveAnchor:Ae=>sn(Ae),role:Y};return v.createElement(rI,{..._n})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||Rc({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||Rc({css:`
|
|
51
|
+
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function sI(){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 aI({id:e,tooltipText:t}){return c.jsxs(c.Fragment,{children:[c.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:sI()}),c.jsx(oI,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const cI="Each field must be mapped to a unique value";function fa({field:e,onSelectChange:t,allFields:n}){var g;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Gt(),[s,a]=v.useState(!0),{isError:l,removeError:u,getError:f}=Pt(),d=(g=r==null?void 0:r.read)==null?void 0:g.selectedFieldMappings,m=d==null?void 0:d[e.mapToName];v.useEffect(()=>{e._default&&!m&&o&&r&&fi(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,m,r]);const h=v.useMemo(()=>n.map(_=>({id:_.fieldName,label:_.displayName,value:_.fieldName})),[n]),y=c.jsx(id,{disabled:s,items:h,selectedValue:m||null,onSelectedItemChange:_=>{t({target:{name:e.mapToName,value:_==null?void 0:_.value}})},placeholder:"Please select one",style:{width:"100%"}}),w=v.useCallback(()=>{o&&(fi(o,i,[{field:e.mapToName,value:null}]),l(ue.MAPPING,o)&&u(ue.MAPPING,o))},[e.mapToName,o,i,l,u]),{hasDuplicationError:p,errorMessage:b}=v.useMemo(()=>{const _=f(ue.MAPPING,o),x=Array.isArray(_)&&_.length>0&&_.includes(e.mapToName);return{hasDuplicationError:x,errorMessage:x?cI:""}},[o,f,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}),c.jsx("span",{children:(e==null?void 0:e.prompt)&&c.jsx(aI,{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(Qe,{type:"button",variant:"ghost",onClick:w,children:"Clear"})]})]},e.mapToName),p&&c.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",b," "]},e.mapToName)]})}const lI="_formControl_9qd8d_1",uI="_formLabel_9qd8d_5",dI="_formLabelRequired_9qd8d_11",fI="_formInput_9qd8d_16",pI="_formInputInvalid_9qd8d_20",hI="_formError_9qd8d_24",mI="_disabled_9qd8d_30",Gn={formControl:lI,formLabel:uI,formLabelRequired:dI,formInput:fI,formInputInvalid:pI,formError:hI,disabled:mI};function Co({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return c.jsxs("div",{className:bt(Gn.formControl,{[Gn.disabled]:r}),children:[t&&c.jsx("label",{htmlFor:e,className:bt(Gn.formLabel,{[Gn.formLabelRequired]:n}),children:t}),c.jsx("div",{id:e,className:bt(Gn.formInput,{[Gn.formInputInvalid]:o}),children:s}),o&&i&&c.jsx("div",{className:Gn.formError,role:"alert",children:i})]})}const gI="_divider_1kmoj_1",kc={divider:gI};function Ci({className:e,style:t}){return c.jsx("hr",{className:e?`${kc.divider} ${e}`:kc.divider,style:t})}function Qt({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(Ci,{style:{width:"100%",marginLeft:"1rem"}})})]})}function md({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(l=>e[l]===r),a=[n,...s];return o(ue.MAPPING,t,a),!0}return!1}function yI({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(Co,{id:r.mapToName,children:c.jsx(fa,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function vI(){var y,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Gt(),{isError:r,removeError:o,setError:i}=Pt(),s=((y=t==null?void 0:t.read)==null?void 0:y.allFields)||[],{fieldMapping:a}=Xe(),l=(w=t==null?void 0:t.read)==null?void 0:w.selectedFieldMappings,u=p=>{const{value:b,name:g}=p.target;!b||md({selectedFieldMappings:l,selectedObjectName:e,fieldName:g,fieldValue:b,setError:i})||(e&&fi(e,n,[{field:g,value:b}]),r(ue.MAPPING,g)&&o(ue.MAPPING,g),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},f=v.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(p=>!p.fieldName),[a,e]),d=v.useMemo(()=>{var g;return(((g=t==null?void 0:t.read)==null?void 0:g.optionalMapFields)||[]).filter(_=>!f.some(x=>x.mapToName===_.mapToName))},[t,f]),m=f.length>0;return d.length>0||m?c.jsxs(c.Fragment,{children:[c.jsx(Qt,{string:"Map the following optional fields"}),c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d==null?void 0:d.map(p=>c.jsx(Co,{id:p.mapToName,children:c.jsx(fa,{allFields:s,field:p,onSelectChange:u})},p.mapToName)),m&&c.jsx(yI,{dynamicFieldMappings:f,onSelectChange:u,allFields:s})]})]}):null}function wI(){var u;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Gt(),{isError:r,removeError:o,setError:i}=Pt(),s=(u=t==null?void 0:t.read)==null?void 0:u.selectedFieldMappings,a=f=>{const{value:d,name:m}=f.target;!d||md({selectedFieldMappings:s,selectedObjectName:e,fieldName:m,fieldValue:d,setError:i})||(e&&fi(e,n,[{field:m,value:d}]),r(ue.MAPPING,m)&&o(ue.MAPPING,m),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},l=v.useMemo(()=>{var f;return((f=t==null?void 0:t.read)==null?void 0:f.requiredMapFields)||[]},[t]);return l!=null&&l.length?c.jsxs(c.Fragment,{children:[c.jsx(Qt,{string:"Map the following fields"}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.map(f=>{var d;return c.jsx(Co,{id:f.mapToName,isInvalid:r(ue.MAPPING,f.mapToName),errorMessage:"* required",children:c.jsx(fa,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:f,onSelectChange:a})},f.mapToName)})})]}):null}const II={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function bI({children:e,style:t}){return c.jsx(vn,{style:{...II,...t},children:e})}const pa=e=>{const t=lt(),{provider:n}=Xe(),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})},gt=e=>{const t=pa(e),{data:n}=t,{provider:r}=Xe(),o=n&&Ul(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function _I(){var u,f,d;const{project:e}=Ne(),{hydratedRevision:t}=Xr(),{selectedObjectName:n}=Gt(),{providerName:r}=gt(),o=e==null?void 0:e.appName,i=(d=(f=(u=t==null?void 0:t.content)==null?void 0:u.read)==null?void 0:f.objects)==null?void 0:d.find(m=>m.objectName===n),s=(i==null?void 0:i.displayName)||n&&kr(n),a=i==null?void 0:i.mapToName,l=(i==null?void 0:i.mapToDisplayName)||a&&kr(a);return l&&o&&r?c.jsx(bI,{style:{marginTop:"1rem"},children:c.jsxs("p",{style:{margin:"1rem 0"},children:[c.jsx("b",{children:l})," in ",o," is mapped to ",c.jsx("b",{children:s})," in ",r,"."]})}):null}function jc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gd(...e){return t=>{let n=!1;const r=e.map(o=>{const i=jc(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():jc(e[o],null)}}}}function hi(...e){return V.useCallback(gd(...e),e)}function Oo(e,t=[]){let n=[];function r(i,s){const a=V.createContext(s),l=n.length;n=[...n,s];const u=d=>{var b;const{scope:m,children:h,...y}=d,w=((b=m==null?void 0:m[e])==null?void 0:b[l])||a,p=V.useMemo(()=>y,Object.values(y));return c.jsx(w.Provider,{value:p,children:h})};u.displayName=i+"Provider";function f(d,m){var w;const h=((w=m==null?void 0:m[e])==null?void 0:w[l])||a,y=V.useContext(h);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[u,f]}const o=()=>{const i=n.map(s=>V.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return V.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,xI(o,...t)]}function xI(...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:l,scopeName:u})=>{const d=l(i)[`__scope${u}`];return{...a,...d}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Bt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function ha(e){const t=V.useRef(e);return V.useEffect(()=>{t.current=e}),V.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ma({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=CI({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=ha(n),l=V.useCallback(u=>{if(i){const d=typeof u=="function"?u(e):u;d!==e&&a(d)}else o(u)},[i,e,o,a]);return[s,l]}function CI({defaultProp:e,onChange:t}){const n=V.useState(e),[r]=n,o=V.useRef(r),i=ha(t);return V.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function OI(e){const t=V.useRef({value:e,previous:e});return V.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var po=globalThis!=null&&globalThis.document?V.useLayoutEffect:()=>{};function EI(e){const[t,n]=V.useState(void 0);return po(()=>{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 l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function SI(e,t){return V.useReducer((n,r)=>t[n][r]??n,e)}var ga=e=>{const{present:t,children:n}=e,r=NI(t),o=typeof n=="function"?n({present:r.isPresent}):V.Children.only(n),i=hi(r.ref,TI(o));return typeof n=="function"||r.isPresent?V.cloneElement(o,{ref:i}):null};ga.displayName="Presence";function NI(e){const[t,n]=V.useState(),r=V.useRef({}),o=V.useRef(e),i=V.useRef("none"),s=e?"mounted":"unmounted",[a,l]=SI(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return V.useEffect(()=>{const u=Hi(r.current);i.current=a==="mounted"?u:"none"},[a]),po(()=>{const u=r.current,f=o.current;if(f!==e){const m=i.current,h=Hi(u);e?l("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(f&&m!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),po(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,d=h=>{const w=Hi(r.current).includes(h.animationName);if(h.target===t&&w&&(l("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},m=h=>{h.target===t&&(i.current=Hi(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:V.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Hi(e){return(e==null?void 0:e.animationName)||"none"}function TI(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 ho=V.forwardRef((e,t)=>{const{children:n,...r}=e,o=V.Children.toArray(n),i=o.find(AI);if(i){const s=i.props.children,a=o.map(l=>l===i?V.Children.count(s)>1?V.Children.only(null):V.isValidElement(s)?s.props.children:null:l);return c.jsx(As,{...r,ref:t,children:V.isValidElement(s)?V.cloneElement(s,void 0,a):null})}return c.jsx(As,{...r,ref:t,children:n})});ho.displayName="Slot";var As=V.forwardRef((e,t)=>{const{children:n,...r}=e;if(V.isValidElement(n)){const o=DI(n),i=PI(r,n.props);return n.type!==V.Fragment&&(i.ref=t?gd(t,o):o),V.cloneElement(n,i)}return V.Children.count(n)>1?V.Children.only(null):null});As.displayName="SlotClone";var RI=({children:e})=>c.jsx(c.Fragment,{children:e});function AI(e){return V.isValidElement(e)&&e.type===RI}function PI(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function DI(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var FI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Un=FI.reduce((e,t)=>{const n=V.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?ho:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),ya="Checkbox",[MI,Cx]=Oo(ya),[kI,jI]=MI(ya),yd=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:u,form:f,...d}=e,[m,h]=V.useState(null),y=hi(t,x=>h(x)),w=V.useRef(!1),p=m?f||!!m.closest("form"):!0,[b=!1,g]=ma({prop:o,defaultProp:i,onChange:u}),_=V.useRef(b);return V.useEffect(()=>{const x=m==null?void 0:m.form;if(x){const C=()=>g(_.current);return x.addEventListener("reset",C),()=>x.removeEventListener("reset",C)}},[m,g]),c.jsxs(kI,{scope:n,state:b,disabled:a,children:[c.jsx(Un.button,{type:"button",role:"checkbox","aria-checked":jn(b)?"mixed":b,"aria-required":s,"data-state":Id(b),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:y,onKeyDown:Bt(e.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:Bt(e.onClick,x=>{g(C=>jn(C)?!0:!C),p&&(w.current=x.isPropagationStopped(),w.current||x.stopPropagation())})}),p&&c.jsx(LI,{control:m,bubbles:!w.current,name:r,value:l,checked:b,required:s,disabled:a,form:f,style:{transform:"translateX(-100%)"},defaultChecked:jn(i)?!1:i})]})});yd.displayName=ya;var vd="CheckboxIndicator",wd=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=jI(vd,n);return c.jsx(ga,{present:r||jn(i.state)||i.state===!0,children:c.jsx(Un.span,{"data-state":Id(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});wd.displayName=vd;var LI=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=V.useRef(null),a=OI(n),l=EI(t);V.useEffect(()=>{const f=s.current,d=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(d,"checked").set;if(a!==n&&h){const y=new Event("click",{bubbles:r});f.indeterminate=jn(n),h.call(f,jn(n)?!1:n),f.dispatchEvent(y)}},[a,n,r]);const u=V.useRef(jn(n)?!1:n);return c.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??u.current,...i,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function jn(e){return e==="indeterminate"}function Id(e){return jn(e)?"indeterminate":e?"checked":"unchecked"}var bd=yd,_d=wd;function xd(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 KI=["color"],Cd=v.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=xd(e,KI);return v.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),VI=["color"],UI=v.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=xd(e,VI);return v.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const $I="_checkboxGroupContainer_1ya1t_1",qI="_stack_1ya1t_6",HI="_selectAllContainer_1ya1t_11",BI="_fieldContainer_1ya1t_18",WI="_checkbox_1ya1t_1",Hr={checkboxGroupContainer:$I,stack:qI,selectAllContainer:HI,fieldContainer:BI,checkbox:WI};function Od({id:e,isChecked:t,label:n,onCheckedChange:r}){return c.jsxs("div",{className:Hr.fieldContainer,children:[c.jsx(bd,{className:Hr.checkbox,id:e,onCheckedChange:r,checked:t,children:c.jsx(_d,{children:c.jsx(Cd,{})})}),c.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Ed({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return c.jsxs("div",{className:Hr.selectAllContainer,children:[c.jsx(bd,{className:Hr.checkbox,id:e,onCheckedChange:r,children:c.jsxs(_d,{children:[o&&c.jsx(UI,{}),t===!0&&c.jsx(Cd,{})]})}),c.jsx("label",{htmlFor:e,children:n})]})}function Sd({children:e}){return c.jsx("div",{className:Hr.checkboxGroupContainer,children:e})}function Nd({children:e}){return c.jsx("div",{className:Hr.stack,children:e})}function JI(e,t,n){var o,i;const r=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(i=e.read)!=null&&i.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,l=!Yl(s,r);e.read.isOptionalFieldsModified=l}else console.warn("read.savedConfig.optionalFields is undefined")}function Lc(e,t,n,r){t(e,o=>JI(o,n,r))}function zI(){var d,m;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Gt(),o=(d=t==null?void 0:t.read)==null?void 0:d.selectedOptionalFields,i=(h,y)=>{h!=="indeterminate"&&r&&t&&Lc(r,n,y,h)},s=(m=t==null?void 0:t.read)==null?void 0:m.optionalFields,a=h=>{r&&s&&s.forEach(y=>{Ln(y)||Lc(r,n,y.fieldName,h)})},l=!!(s&&s.length>0),u=Object.keys(o||{}).length===(s==null?void 0:s.length),f=!u&&Object.keys(o||{}).length>0;return l&&c.jsxs(c.Fragment,{children:[c.jsx(Qt,{string:`${e} reads the following optional fields`}),c.jsxs(Sd,{children:[((s==null?void 0:s.length)||0)>=2&&c.jsx(Ed,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:a,isIndeterminate:f}),c.jsx(Nd,{children:s.map(h=>Ln(h)?null:c.jsx(Od,{id:h.fieldName,isChecked:!!(o!=null&&o[h==null?void 0:h.fieldName]),label:h.displayName,onCheckedChange:y=>i(y,h.fieldName)},h.fieldName))})]})]})}function GI(){return c.jsx(zI,{})}const QI={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 XI({children:e,style:t,...n}){return c.jsx("span",{style:{...QI,...t},...n,children:e})}function YI(){var r,o,i;const{configureState:e,selectedObjectName:t}=Gt(),{appName:n}=Ne();return c.jsxs(c.Fragment,{children:[c.jsx(Qt,{string:`${n} reads the following ${t} fields`}),c.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(o=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&o.length?(i=e.read)==null?void 0:i.requiredFields.map(s=>Ln(s)?null:c.jsx(XI,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function ZI(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 Td(e,t,n,r,o){t(e,i=>ZI(i,e,n,r,o))}function eb(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function tb({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(Ci,{style:{width:"100%",marginLeft:"1rem"}})})]})}function nb({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var C;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Gt(),[l,u]=v.useState(!0),{getError:f,setError:d,resetBoundary:m,isError:h,removeError:y}=Pt(),w=v.useMemo(()=>{var T,S;return((S=(T=i==null?void 0:i.read)==null?void 0:T.selectedValueMappings)==null?void 0:S[n])||{}},[(C=i==null?void 0:i.read)==null?void 0:C.selectedValueMappings,n]),p=v.useMemo(()=>w==null?void 0:w[e.mappedValue],[w,e.mappedValue]);v.useEffect(()=>{u(!1)},[e,a,s,p,i]);const b=v.useMemo(()=>r.map(T=>({id:T.value,label:T.displayValue,value:T.value})),[r]),g=v.useCallback(T=>{if(T){if(Object.values(w).some(S=>S===T.value&&S!==p)){const S=[...Object.entries(w).filter(([N,D])=>D===T.value&&D!==p).map(([N])=>N),e.mappedValue];d(ue.VALUE_MAPPING,n,S);return}f(ue.VALUE_MAPPING,n)&&m(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:T.value,fieldName:n}})}},[t,w,p,n,e.mappedValue,m,d,f]),_=v.useMemo(()=>c.jsx(id,{disabled:l,items:b,selectedValue:p||null,onSelectedItemChange:g,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,l,b,g,o]),x=v.useCallback(()=>{s&&(Td(s,a,e.mappedValue,"",n),h(ue.VALUE_MAPPING,n)&&y(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,h,y]);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:[_,c.jsx(Qe,{type:"button",variant:"ghost",onClick:x,children:"Clear"})]})]},e.mappedValue)}function rb(){var h,y,w;const{fieldMapping:e}=Xe(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Gt(),{isError:o,removeError:i,getError:s}=Pt(),a=(h=n==null?void 0:n.read)==null?void 0:h.selectedFieldMappings,l=(y=n==null?void 0:n.read)==null?void 0:y.selectedValueMappings,u=(w=n==null?void 0:n.read)==null?void 0:w.isValueMappingsModified,f=v.useRef(!1),d=v.useMemo(()=>{const p=t&&e?Object.values(e[t]||{}).flat().filter(b=>b.mappedValues).map(b=>({...b})):[];if(a)for(let b=0;b<p.length;b+=1){const{mapToName:g}=p[b];a!=null&&a[g]&&(p[b].fieldName=a[g])}return p},[t,e,a]),m=v.useCallback(p=>{const{value:b,name:g,fieldName:_}=p.target;b&&(t&&Td(t,r,g,b,_),o(ue.VALUE_MAPPING,g)&&i(ue.VALUE_MAPPING,g))},[t,r,o,i]);return v.useEffect(()=>{var p;if(t&&l){const b=((p=e==null?void 0:e[t])==null?void 0:p.filter(_=>_.fieldName&&_.mappedValues.length>0))||[];b.every(_=>{const x=l[_.fieldName]||{};return Object.keys(x).length===Object.keys(_.mappedValues).length})&&b.length>0?!u&&!f.current&&(eb(t,r,!0),f.current=!0):f.current=!1}},[l,d,t,r,e,u]),d!=null&&d.length?c.jsx(c.Fragment,{children:d.map(p=>{var T,S,N;if(!p.fieldName)return null;const b=(S=(T=n==null?void 0:n.read)==null?void 0:T.allFieldsMetadata)==null?void 0:S[p.fieldName],g=b==null?void 0:b.valueType;if(!["singleSelect","multiSelect"].includes(g))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const _=b==null?void 0:b.values;if(!_)return null;const x=Object.keys(_).length,C=Object.keys((p==null?void 0:p.mappedValues)||[]).length;return x!==C?(console.error("field values and the values to be mapped are not of the same length",p,_),null):c.jsxs(c.Fragment,{children:[c.jsx(tb,{string:"Map the values for ",fieldName:p.mapToDisplayName||p.mapToName||p.fieldName}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.jsx(Co,{id:p.mapToName||p.fieldName,children:(N=p==null?void 0:p.mappedValues)==null?void 0:N.map(D=>{var ne,B,ce;const $=s(ue.VALUE_MAPPING,p.fieldName),G=Array.isArray($)&&$.includes(D.mappedValue),z=((ce=(B=(ne=n==null?void 0:n.read)==null?void 0:ne.allFieldsMetadata)==null?void 0:B[p.fieldName])==null?void 0:ce.values)||[];return c.jsxs(c.Fragment,{children:[c.jsx(nb,{allValueOptions:z,mappedValue:D,onSelectChange:m,fieldName:(p==null?void 0:p.fieldName)||"",hasError:G},`${D.mappedValue}-${p.fieldName}`),G&&c.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${p.mapToName||p.fieldName} must be mapped to a unique value`},D.mappedValue)]})})},p.mapToName||p.fieldName)})]})})}):null}function ib(){return rv(),c.jsxs(c.Fragment,{children:[c.jsx(_I,{}),c.jsx(YI,{}),c.jsx(wI,{}),c.jsx(vI,{}),c.jsx(rb,{}),c.jsx(GI,{})]})}function ob(e,t,n){var r,o,i;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const s=e.write.selectedWriteObjects;if(n&&(s[t]={objectName:t}),n||delete s[t],(i=(o=e==null?void 0:e.write)==null?void 0:o.savedConfig)!=null&&i.selectedWriteObjects){const a=e.write.savedConfig.selectedWriteObjects,u=!_y(a,s);e.write.isWriteModified=u}}}function Kc(e,t,n,r){t(e,o=>{ob(o,n,r)})}function sb(){var d,m,h,y;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Gt(),o=(d=n==null?void 0:n.write)==null?void 0:d.selectedWriteObjects,i=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects,s=(w,p)=>{w!=="indeterminate"&&t&&n&&Kc(t,r,p,w)},a=w=>{var p,b;t&&n&&((b=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null||b.forEach(g=>{Kc(t,r,g.objectName,w)}))},l=!!i,u=Object.keys(o||{}).length===((y=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects)==null?void 0:y.length),f=!u&&Object.keys(o||{}).length>0;return l&&c.jsxs(c.Fragment,{children:[c.jsx(Qt,{string:`Allow ${e} to write to these objects`}),c.jsxs(Sd,{children:[((i==null?void 0:i.length)||0)>=2&&c.jsx(Ed,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:f,isChecked:u,label:"Select all"}),c.jsx(Nd,{children:i.map(w=>c.jsx(Od,{id:w.objectName,onCheckedChange:p=>s(p,w.objectName),isChecked:!!(o!=null&&o[w.objectName]),label:w.displayName},w.objectName))})]})]})}function ab(){return c.jsx(c.Fragment,{children:c.jsx(sb,{})})}const cb="_link_oo2kv_1",lb={link:cb};function Rd({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return c.jsx("a",{className:bt(lb.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function Ad({url:e,providerDisplayName:t,credentialName:n}){return c.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[c.jsx(Rd,{href:e,newTab:!0,children:c.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}function $n({error:e}){return e?c.jsx(Ii,{style:{marginTop:"2em"},children:e}):null}const ub="_input_1ymb7_1",db="_inputError_1ymb7_27",fb="_error_1ymb7_43",zo={input:ub,inputError:db,error:fb};function pb({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?bt(zo.inputError,zo.input):zo.input;return c.jsx("input",{id:e,type:t,className:bt(i,n),...o})}const hb="_textarea_18zl4_1",mb="_textareaError_18zl4_14",gb="_error_18zl4_29",Go={textarea:hb,textareaError:mb,error:gb};function yb({className:e,isError:t=!1,...n}){const r=t?bt(Go.textareaError,Go.textarea):Go.textarea;return c.jsx("textarea",{className:bt(e,r),...n})}const mn={Input:pb,Textarea:yb},vb=()=>{const{project:e}=Ne(),t=e==null?void 0:e.id,n=lt();return yn({queryKey:["project",t,"entitlements"],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await n()).projectApi.getProject({projectIdOrName:t,includeEntitlements:!0})},enabled:!!t})};function Pd(){var n,r;const{data:e}=vb();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.jsxs("picture",{children:[c.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),c.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),c.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function gr({children:e}){return c.jsx(zr,{children:c.jsxs(vn,{children:[c.jsx("div",{style:{padding:"3rem 2rem"},children:e}),c.jsx(Pd,{})]})})}function yr({children:e}){return c.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function wb({children:e}){return c.jsx("p",{style:{padding:".5em 0"},children:e})}function Dd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var p;const[s,a]=v.useState(!1),l=()=>a(b=>!b),[u,f]=v.useState(""),d=b=>f(b.currentTarget.value),{providerName:m}=gt(e),h=u.length>0,y=r||!h,w=(p=t.apiKeyOpts)==null?void 0:p.docsURL;return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&c.jsx(Ad,{url:w,providerDisplayName:m||kr(e),credentialName:"API key"}),c.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[c.jsx(mn.Input,{id:"password",name:"password",type:s?"text":"password",placeholder:"API Key",onChange:b=>d(b)}),c.jsx(Qe,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:l,variant:o,children:s?"Hide":"Show"})]}),c.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:y,type:i||"submit",onClick:()=>n({apiKey:u}),variant:o,children:"Next"})]})}function Ib({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=gt(e);return c.jsxs(gr,{children:[c.jsx(yr,{children:`Set up ${i} integration`}),c.jsx($n,{error:r}),c.jsx(Dd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function bb({...e}){return c.jsx(Ib,{...e})}const _b={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 Eo({children:e,style:t}){return c.jsx(vn,{style:{..._b,...t},children:e})}const va=()=>{const e=lt(),t=Ot(),[n,r]=v.useState(null);return{...Jr({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}};function xb(){const{projectIdOrName:e}=Ne(),{providerName:t,data:n}=gt(),{selectedConnection:r,isConnectionsLoading:o}=zt(),{mutateAsync:i,isPending:s,error:a}=va(),[l,u]=v.useState(null),[f,d]=v.useState(!1),m=()=>d(!1),h=()=>{d(!0),u(null)},y=(a==null?void 0:a.message)||l||null,w=async p=>{m(),u(null);try{await i({projectIdOrName:e||"",connectionId:(r==null?void 0:r.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:p.apiKey}}},{onError:b=>{console.error("Update connection error:",b),Le(b,u)},onSuccess:()=>{h()}})}catch(b){console.error("Update connection caught error:",b),Le(b,u)}};return n?c.jsxs(c.Fragment,{children:[c.jsx(Qt,{string:"Update Connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${t} API Key`}),f&&c.jsx(Eo,{children:"Connection updated successfully"}),y&&c.jsx(Ii,{children:`Error updating connection ${y}`}),c.jsx(Dd,{provider:n==null?void 0:n.name,providerInfo:n,handleSubmit:w,isButtonDisabled:s||o,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function Fd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var p;const[i,s]=v.useState(!1),a=()=>s(b=>!b),[l,u]=v.useState({username:"",password:""}),{username:f,password:d}=l,{providerName:m}=gt(e),h=b=>{const{name:g,value:_}=b.currentTarget;u(x=>({...x,[g]:_}))},y=r,w=(p=t.basicOpts)==null?void 0:p.docsURL;return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&c.jsx(Ad,{url:w,providerDisplayName:m||kr(e),credentialName:"credentials"}),c.jsx(mn.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:b=>h(b)}),c.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[c.jsx(mn.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:b=>h(b)}),c.jsx(Qe,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,variant:o,children:i?"Hide":"Show"})]}),c.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:y,type:"button",onClick:()=>n({user:f,pass:d}),variant:o,children:"Next"})]})}function Cb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=gt(e);return c.jsxs(gr,{children:[c.jsx(yr,{children:`Set up ${i} integration`}),c.jsx($n,{error:r}),c.jsx(Fd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function Ob({...e}){return c.jsx(Cb,{...e})}function Eb(){const{projectIdOrName:e}=Ne(),{providerName:t,data:n}=gt(),{selectedConnection:r,isConnectionsLoading:o}=zt(),{mutateAsync:i,isPending:s,error:a}=va(),[l,u]=v.useState(null),[f,d]=v.useState(!1),m=()=>d(!1),h=()=>{d(!0),u(null)},y=(a==null?void 0:a.message)||l||null,w=async p=>{m(),u(null);try{await i({projectIdOrName:e||"",connectionId:(r==null?void 0:r.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:p.user,password:p.pass}}}},{onError:b=>{console.error(b),Le(b,u)},onSuccess:()=>{h()}})}catch(b){console.error(b),Le(b,u)}};return n?c.jsxs(c.Fragment,{children:[c.jsx(Qt,{string:"Update Connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${t} credentials`}),f&&c.jsx(Eo,{children:"Connection updated successfully"}),y&&c.jsx(Ii,{children:`Error updating connection: ${y}`}),c.jsx(Fd,{provider:n==null?void 0:n.name,providerInfo:n,handleSubmit:w,isButtonDisabled:s||o,buttonVariant:"ghost"})]})]}):null}function Md({handleSubmit:e,isButtonDisabled:t,explicitScopesRequired:n,explicitWorkspaceRequired:r,buttonVariant:o}){const[i,s]=v.useState(!1),[a,l]=v.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),u=()=>s(x=>!x),f=x=>{const{name:C,value:T}=x.currentTarget;l(S=>({...S,[C]:T}))},{clientSecret:d,clientId:m,workspace:h,scopes:y}=a,w=d.length>0,p=m.length>0,b=r?h.length>0:!0,g=t||!w||!p||!b,_=()=>{const x={clientId:m,clientSecret:d};r&&(x.workspace=h),n&&y.length>0&&(x.scopes=cy(y)),e(x)};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[r&&c.jsx(mn.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:x=>f(x)}),c.jsx(mn.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:x=>f(x)}),c.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[c.jsx(mn.Input,{id:"clientSecret",name:"clientSecret",type:i?"text":"password",placeholder:"Client Secret",onChange:x=>f(x)}),c.jsx(Qe,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:u,variant:o,children:i?"Hide":"Show"})]}),n&&c.jsx(mn.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:x=>f(x)})]}),c.jsx("br",{}),c.jsx(Qe,{style:{width:"100%"},disabled:g,type:"button",onClick:_,variant:o,children:"Next"})]})}function Sb({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:o,explicitWorkspaceRequired:i}){return c.jsxs(gr,{children:[c.jsx(yr,{children:`Set up ${r} integration`}),c.jsx($n,{error:t}),c.jsx("br",{}),c.jsx(Md,{handleSubmit:e,isButtonDisabled:n,explicitScopesRequired:o,explicitWorkspaceRequired:i})]})}function Nb(){var b;const{projectIdOrName:e}=Ne(),{selectedConnection:t,isConnectionsLoading:n}=zt(),{providerName:r,data:o}=gt(),{mutateAsync:i,isPending:s,error:a}=va(),[l,u]=v.useState(null),[f,d]=v.useState(!1),m=()=>{d(!1)},h=()=>{d(!0),u(null)},y=(b=o==null?void 0:o.oauth2Opts)==null?void 0:b.explicitScopesRequired,w=(a==null?void 0:a.message)||l||null,p=async g=>{m(),u(null);try{await i({projectIdOrName:e||"",connectionId:(t==null?void 0:t.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:g.clientId,clientSecret:g.clientSecret,scopes:g.scopes}}}}),h()}catch(_){Le(_,u)}};return c.jsxs(c.Fragment,{children:[c.jsx(Qt,{string:"Update Connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Re-authenticate to ${r}`}),f&&c.jsx(Eo,{children:"Connection updated successfully"}),w&&c.jsx(Ii,{children:`Error updating connection ${w}`}),c.jsx(Md,{handleSubmit:p,isButtonDisabled:s||n,explicitScopesRequired:y,explicitWorkspaceRequired:!1,buttonVariant:"ghost"})]})]})}const Vc=600,Uc=600,Tb="AUTHORIZATION_SUCCEEDED",Rb="AUTHORIZATION_FAILED";function Ab(e,t,n,r){return v.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Vc)/2,i=window.screenY+(window.outerHeight-Uc)/2.5,s=`width=${Vc},height=${Uc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Pb(e,t,n,r){const o=Ot();return v.useCallback(i=>{var s,a;if(i.origin===Kg){if(i.data.eventType===Tb){const l=(s=i.data.data)==null?void 0:s.connection;l?(e(l),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 wa({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s}){const[a,l]=v.useState(null),[u,f]=v.useState(null),d=Pb(l,u,r,i),m=Ab(n,f,d,t);return v.useEffect(()=>{t&&!u&&!a&&!o&&!s&&m()},[t,u,m,a,o,s]),v.useEffect(()=>{if(!u)return;const h=setInterval(()=>{u.closed&&(clearInterval(h),window.removeEventListener("message",d),f(null),!a&&!o?(console.error("OAuth failed. Please try again."),r==null||r("Authentication was cancelled. Please try again.")):a&&(r==null||r(null)))},500);return()=>{clearInterval(h),window.removeEventListener("message",d)}},[u,a,o,d,r]),c.jsx("div",{children:e})}const Db=()=>{const e=lt(),t=Ot();return Jr({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 Fb({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($n,{error:t}),c.jsx(Qe,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Mb(){const{selectedConnection:e,isConnectionsLoading:t}=zt(),n=e==null?void 0:e.id,r=e==null?void 0:e.projectId,{providerName:o}=gt(),{mutateAsync:i,isPending:s,error:a}=Db(),[l,u]=v.useState(null),[f,d]=v.useState(!1),[m,h]=v.useState(null),y=()=>{d(!1)},w=()=>{d(!0),u(null),h(null)},p=(a==null?void 0:a.message)||l||null,b=async()=>{y(),u(null);try{const _=await i({projectIdOrName:r||"",connectionId:n||""});h(_)}catch(_){Le(_,u)}},g=v.useCallback(_=>{u(_)},[]);return c.jsxs(c.Fragment,{children:[c.jsx(Qt,{string:"Update Connection"}),f&&c.jsx(Eo,{children:"Connection updated successfully"}),c.jsx(wa,{windowTitle:`Connect to ${o}`,oauthUrl:m||null,onError:g,error:p,isSuccessConnect:f,onSuccessConnect:w,children:c.jsx(Fb,{handleSubmit:b,error:p,providerName:o,isButtonDisabled:s||t||f})})]})}function kb(){var n;const{data:e}=pa();if((e==null?void 0:e.authType)===Wa.Basic)return c.jsx(Eb,{});if((e==null?void 0:e.authType)===Wa.ApiKey)return c.jsx(xb,{});const t=(n=e==null?void 0:e.oauth2Opts)==null?void 0:n.grantType;if(t){if(t===Mo.AuthorizationCode||t===Mo.AuthorizationCodePkce)return c.jsx(Mb,{});if(t===Mo.ClientCredentials)return c.jsx(Nb,{})}return null}const jb="_authenticationRow_cjz1t_1",Lb="_field_cjz1t_8",Kb="_value_cjz1t_12",Qo={authenticationRow:jb,field:Lb,value:Kb};function $c({label:e,value:t}){return c.jsxs("div",{className:Qo.authenticationRow,children:[c.jsx("div",{className:Qo.field,children:e}),c.jsx("div",{className:Qo.value,children:t})]})}function Vb(){const{selectedConnection:e}=zt(),n=(e==null?void 0:e.provider)==="salesforce"?"Subdomain":"Workspace";return c.jsxs(c.Fragment,{children:[c.jsx(Qt,{string:"Authentication"}),c.jsxs("div",{style:{paddingBottom:"1rem"},children:[c.jsx($c,{label:n,value:e==null?void 0:e.providerWorkspaceRef}),c.jsx($c,{label:"Connection Status",value:e==null?void 0:e.status})]})]})}const Ub=()=>{const e=lt(),t=Ot();return Jr({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."),Le(n)}})};function Ia({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=Ne(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=Xe(),[l,u]=v.useState(!1),f=!r||!o||!(i!=null&&i.id)||l,d=Ub(),m=async()=>{f||(u(!0),console.warn("uninstalling installation",{projectId: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:()=>u(!1)}))},h=l?"Uninstalling...":e,y=c.jsx(Qe,{type:"button",onClick:m,disabled:f,variant:t,style:n,children:h});return i!=null&&i.id?y:null}function $b(){const{provider:e,installation:t}=Xe(),{project:n}=Ne(),r=(n==null?void 0:n.appName)||"";return t?c.jsxs(c.Fragment,{children:[c.jsx(Qt,{string:"Uninstall entire integration"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[t!=null&&t.id?c.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall your entire ",e," integration and may lose functionality in ",r,"."]}):c.jsx("p",{children:"You've successfully uninstalled the integration."}),c.jsx(Ia,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function qb(){return c.jsxs(c.Fragment,{children:[c.jsx(Vb,{}),c.jsx(kb,{}),c.jsx($b,{})]})}function Hb(){const{installation:e}=Xe();return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e!=null&&e.id?c.jsx("p",{children:"Once you uninstall this integration, its configuration will be lost."}):c.jsx("p",{children:"You've successfully uninstalled the integration."}),c.jsx(Ia,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function kd({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var S,N,D,$;const{installation:i}=Xe(),{hydratedRevision:s,loading:a}=Xr(),{configureState:l,selectedObjectName:u}=Gt(),f=i==null?void 0:i.config,d=f&&u&&!!zl(f,u)||!1,m=((S=l==null?void 0:l.read)==null?void 0:S.isOptionalFieldsModified)||((N=l==null?void 0:l.read)==null?void 0:N.isRequiredMapFieldsModified)||((D=l==null?void 0:l.read)==null?void 0:D.isValueMappingsModified),h=($=l==null?void 0:l.write)==null?void 0:$.isWriteModified,b=a||n||!l||!u||!(m||h||r||u!==dr&&!d),g=u===dr,_=u===eo,x=u===to,C=c.jsx(Qe,{type:"submit",disabled:b,children:r?"Install":"Save"}),T=c.jsx(Qe,{type:"button",onClick:t,disabled:b,variant:"ghost",children:"Reset"});return n?c.jsx(li,{}):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:!x&&c.jsxs(c.Fragment,{children:[C,T]})}),c.jsxs(vn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&c.jsx(Ii,{children:typeof o=="string"?o:"Installation Failed."}),a&&c.jsx(li,{}),s&&!_&&!g&&!x&&c.jsx(ib,{}),s&&!_&&g&&!x&&c.jsx(ab,{}),!a&&_&&c.jsx(Hb,{}),!a&&x&&c.jsx(qb,{})]})]})}const jd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=Xe(),{hydratedRevision:s,loading:a}=Xr(),{selectedObjectName:l}=du(),{selectedConnection:u}=zt(),f=pl(),{projectId:d}=Ne(),{resetBoundary:m,setErrors:h,setError:y,getError:w}=Pt(),{resetConfigureState:p,objectConfigurationsState:b,resetPendingConfigurationState:g}=$s(),_=iu(l||"",b),{onNextIncompleteTab:x}=Uy(),C=v.useCallback(()=>{m(ue.INSTALLATION_MUTATION)},[m]),T=v.useCallback(N=>N?D=>{y(ue.INSTALLATION_MUTATION,N,D)}:D=>{console.error("objectName is required to set installation error: ",D)},[y]),S=v.useCallback(N=>N?w(ue.INSTALLATION_MUTATION,N):"",[w]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:l,selectedConnection:u,apiKey:f,projectId:d,resetBoundary:m,setErrors:h,setMutateInstallationError:T,getMutateInstallationError:S,resetMutateInstallationErrorState:C,resetConfigureState:p,objectConfigurationsState:b,resetPendingConfigurationState:g,configureState:_,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:x}},Bb=void 0;function Wb(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:l,projectId:u,resetBoundary:f,setErrors:d,setMutateInstallationError:m,getMutateInstallationError:h,resetMutateInstallationErrorState:y,resetConfigureState:w,objectConfigurationsState:p,resetPendingConfigurationState:b,configureState:g,onInstallSuccess:_,onNextIncompleteTab:x}=jd(),[C,T]=v.useState(!1),S=s===dr,N=h(s),D=v.useCallback(()=>{f(ue.MAPPING),o!=null&&o.content&&!i&&s&&eu(o,Bb,s,w)},[f,o,i,s,w]);v.useEffect(()=>{!g&&(o!=null&&o.content)&&!i&&D()},[g,p,o,i,D]);const $=()=>{y();const{requiredMapFields:ne,selectedFieldMappings:B}=(g==null?void 0:g.read)||{},{errorList:ce}=Xl(ne,B,d);ce.length>0||(s&&(a!=null&&a.id)&&l&&u&&e&&t&&n&&o?(T(!0),Ny(u,e,t,n,a.id,s,l,o,g,m(s),r,_).finally(()=>{T(!1),b(s),x()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},G=()=>{y(),s&&(a!=null&&a.id)&&l&&u&&e&&t&&n&&o?(T(!0),Ay(u,e,t,n,a.id,l,o,g,m(s),r,_).finally(()=>{T(!1),b(s),x()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},z=ne=>{ne.preventDefault(),S?G():$()};return c.jsx(kd,{errorMsg:N,isCreateMode:!0,isLoading:C,onSave:z,onReset:D})}function Jb({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:l}){const u={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${uy(i)}`],installation:{config:e}}};return js().installationApi.updateInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(f=>{s(f),a==null||a(f.id,f.config)}).catch(f=>{Le(f,l)})}const zb=(e,t,n,r,o,i)=>{const s=tu(e),a=nu(e),l=ru(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:l||{},backfill:i}}}}};return wi(o)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},Gb=(e,t,n,r,o,i,s,a,l,u,f)=>{const d=zb(i,r||"",a,a.schedule,l,a.backfill);return d?Jb({updateConfig:d,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:u,setInstallation:s,onUpdateSuccess:f}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},Qb=(e,t)=>{const r={content:{write:{objects:su(e)}}};return wi(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},Xb=(e,t,n,r,o,i,s,a,l)=>{const u=Qb(o,i);if(!u)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const f={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:u}}};return js().installationApi.updateInstallation(f,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(d=>{a(d),l==null||l(d.id,d.config)}).catch(d=>{Le(d,s)})};function Yb({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:l,setErrors:u,setMutateInstallationError:f,getMutateInstallationError:d,resetConfigureState:m,resetPendingConfigurationState:h,configureState:y,onUpdateSuccess:w,onNextIncompleteTab:p}=jd(),[b,g]=v.useState(!1),_=i===dr,x=d(i),{config:C}=e,T=v.useCallback(()=>{l(ue.MAPPING),r!=null&&r.content&&!o&&i&&eu(r,C,i,m)},[l,r,o,i,C,m]);v.useEffect(()=>{y||T()},[y,T]);const S=v.useMemo(()=>{var z,ne,B;return(B=(ne=(z=r==null?void 0:r.content)==null?void 0:z.read)==null?void 0:ne.objects)==null?void 0:B.find(ce=>(ce==null?void 0:ce.objectName)===i)},[r,i]),N=()=>{const{requiredMapFields:G,selectedFieldMappings:z}=(y==null?void 0:y.read)||{},{errorList:ne}=Xl(G,z,u);ne.length>0||(r&&e&&i&&s&&a&&S?(g(!0),Gb(a,t.id,e.id,i,s,y,n,S,r,f(i),w).finally(()=>{g(!1),h(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},D=()=>{e&&i&&s&&a&&r?(g(!0),Xb(a,t.id,e.id,s,y,r,f(i),n,w).finally(()=>{g(!1),h(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},$=G=>{G.preventDefault(),_?D():N()};return c.jsx(kd,{errorMsg:x,onSave:$,onReset:T,isLoading:b})}function Zb(){const{integrationObj:e,installation:t}=Xe();return e?t&&e?c.jsx(Yb,{installation:t,integrationObj:e}):c.jsx(Wb,{}):c.jsx(Ll,{message:"We can't load the integration"})}const e_=()=>{const e=lt(),t=Ot(),[n,r]=v.useState(null);return{...Jr({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"),Le(i,r)}}),errorMsg:n}};function t_(){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 ba({text:e,children:t}){return c.jsx(zr,{children:c.jsxs(vn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[c.jsx(t_,{}),c.jsx("p",{children:e}),t]})})}function n_({provider:e}){const{providerName:t}=gt(e),n=`You have successfully installed your ${t} integration.`;return c.jsx(ba,{text:n,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:c.jsx(Ia,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const r_=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function i_({children:e}){var C;const t=v.useRef(!1),{projectId:n}=Ne(),{hydratedRevision:r,loading:o}=Xr(),{integrationObj:i,installation:s,groupRef:a,consumerRef:l,onInstallSuccess:u,isIntegrationDeleted:f}=Xe(),{mutate:d,isIdle:m,isPending:h,error:y,errorMsg:w}=e_(),{selectedConnection:p,isConnectionsLoading:b}=zt(),g=o||h||b,_=(C=r==null?void 0:r.content)==null?void 0:C.provider,x=r_(r);return v.useEffect(()=>{var T;if(!g&&!b&&r&&x&&!s&&p&&(i!=null&&i.id)&&!f&&_){const S={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:p==null?void 0:p.id,config:{content:{provider:_}}}};wi(r)===!0&&(S.installation.config.content.proxy=(T=r==null?void 0:r.content)==null?void 0:T.proxy),m&&!t.current&&(d(S,{onSuccess:N=>{u==null||u(N==null?void 0:N.id,N.config)}}),t.current=!0)}},[r,x,s,p,n,i==null?void 0:i.id,a,l,g,u,f,b,_,d,m]),x&&_&&s?c.jsx(n_,{provider:_}):y?c.jsx(Ht,{message:w??"Create installation failed"}):i?g?c.jsx(Gr,{}):c.jsx("div",{children:e}):c.jsx(Ht,{message:"We can't load the integration"})}function So(){const e=lt(),t=Ot();return Jr({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"),Le(n)}})}function o_({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:l}=Ne(),u=So(),f=v.useCallback(d=>{const{apiKey:m}=d,h={projectIdOrName:l,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:m}};u.mutate(h)},[l,i,o,r,n,e,u]);return a===null?c.jsx(bb,{provider:e,providerInfo:t,handleSubmit:f,error:null}):s}function s_({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:l}=Ne(),u=So(),f=v.useCallback(d=>{const{user:m,pass:h}=d,y={projectIdOrName:l,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m,password:h}}};u.mutate(y)},[l,i,o,r,n,e,u]);return a===null?c.jsx(Ob,{provider:e,providerInfo:t,handleSubmit:f,error:null}):s}function a_({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(gr,{children:[c.jsx(yr,{children:i||`Set up ${r} integration`}),c.jsx($n,{error:t}),o,c.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function c_({...e}){return c.jsx(a_,{...e})}function l_({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:l}=Ne(),u=So(),f=v.useCallback(()=>{const d={projectIdOrName:l,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};u.mutate(d)},[l,o,r,n,t,e,u]);return s===null?c.jsx(c_,{handleSubmit:f,error:null,providerName:a}):i}const u_=()=>{const e=lt(),{projectIdOrName:t}=Ne();return yn({queryKey:["amp","providerApps",t],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await e()).providerAppApi.listProviderApps({projectIdOrName:t})},enabled:!!t})},d_=e=>{const t=lt(),n={connectOAuthParams:e};return yn({queryKey:["amp","oauthConnect",e.projectId,e.groupRef,e.consumerRef,e.provider],queryFn:async()=>{if(!e.projectId)throw new Error("Project ID is required");if(!(e!=null&&e.providerAppId))throw new Error("Provider App ID is required");if(!(e!=null&&e.provider))throw new Error("Provider is required");if(!(e!=null&&e.consumerRef))throw new Error("Consumer Ref is required");if(!(e!=null&&e.groupRef))throw new Error("Group Ref is required");return(await t()).oAuthApi.oauthConnect(n)},enabled:!1})},f_=Qr("VITE_AMP_ENABLE_CSRF",!1),p_=Qr("NEXT_AMP_ENABLE_CSRF",!1),h_=Qr("REACT_APP_AMP_ENABLE_CSRF",!1),m_=!!f_||!!p_||!!h_,Ld=(e,t,n,r,o,i)=>{const{projectId:s}=Ne(),{data:a,isLoading:l,error:u}=pa(n),{data:f,isLoading:d,error:m}=u_(),h=f==null?void 0:f.find(C=>C.provider===n),y=a?Ul(n,a):null,w={providerWorkspaceRef:r,projectId:s,groupRef:t,groupName:i,consumerRef:e,consumerName:o,providerAppId:h==null?void 0:h.id,provider:n,enableCSRFProtection:m_},{data:p,error:b,isLoading:g,refetch:_}=d_(w);return v.useEffect(()=>{a&&n&&!h&&console.error(`You must first set up a ${y} Provider App using the Ampersand Console.`)},[h,y,a,n]),v.useEffect(()=>{u&&(console.error("Error fetching provider info:",u),Le(u))},[u]),v.useEffect(()=>{m&&(console.error("Error fetching provider apps:",m),Le(m))},[m]),v.useEffect(()=>{b&&(console.error("Error fetching OAuth connect:",b),Le(b))},[b]),{url:p,error:u||m||b,isLoading:l||d||g,refetchOauthConnect:()=>{var C,T;(a==null?void 0:a.authType)==="oauth2"?((C=a==null?void 0:a.oauth2Opts)==null?void 0:C.grantType)==="authorizationCode"||((T=a==null?void 0:a.oauth2Opts)==null?void 0:T.grantType)==="authorizationCodePKCE"?_():console.error("Provider does not support an OAuth2 web flow grant type."):console.error("Provider does not support an OAuth2 web flow.")}}};function g_({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs(gr,{children:[c.jsx(yr,{children:`Set up ${r} integration`}),c.jsx(wb,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),c.jsx($n,{error:t}),c.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function y_({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const[s,a]=v.useState(null),{url:l,error:u,isLoading:f,refetchOauthConnect:d}=Ld(t,r,e,void 0,n,o),m=(u==null?void 0:u.message)||s||null,h=async()=>{a(null),d()},y=v.useCallback(w=>{a(w)},[]);return c.jsx(wa,{windowTitle:`Connect to ${i}`,oauthUrl:l||null,onError:y,children:c.jsx(g_,{handleSubmit:h,error:m,providerName:i,isButtonDisabled:f})})}const v_="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function w_({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return c.jsxs(gr,{children:[c.jsx(yr,{children:"Enter your Salesforce subdomain"}),c.jsx(Rd,{href:v_,newTab:!0,children:"What is my Salesforce subdomain?"}),c.jsx($n,{error:n}),c.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[c.jsx(mn.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(Qe,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function I_({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:o}){return c.jsxs(gr,{children:[c.jsxs(yr,{children:["Enter your ",o," workspace"]}),c.jsx($n,{error:n}),c.jsx("br",{}),c.jsx(mn.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:i=>t(i.currentTarget.value)}),c.jsx("br",{}),c.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const b_="salesforce";function __({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const[s,a]=v.useState(""),[l,u]=v.useState(null),{url:f,error:d,isLoading:m,refetchOauthConnect:h}=Ld(t,r,e,s,n,o),y=(d==null?void 0:d.message)||l||null,w=async()=>{if(u(null),!s){u("Workspace is required");return}h()},p=v.useCallback(g=>{u(g)},[]),b=e===b_?c.jsx(w_,{handleSubmit:w,setWorkspace:a,error:y,isButtonDisabled:s.length===0}):c.jsx(I_,{handleSubmit:w,setWorkspace:a,error:y,isButtonDisabled:s.length===0||m,providerName:i});return c.jsx(wa,{windowTitle:`Connect to ${i}`,oauthUrl:f||null,onError:p,error:y,children:b})}function x_({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:l}){const{projectIdOrName:u}=Ne(),f=So(),[d,m]=v.useState(null),h=v.useCallback(y=>{m(null);const w={projectIdOrName:u,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:y.workspace,oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret,scopes:y.scopes}}};f.mutate(w,{onError:()=>m("Error loading provider info")})},[u,i,o,r,n,e,f]);return l===null?c.jsx(Sb,{providerName:t,handleSubmit:h,error:d,explicitScopesRequired:s,explicitWorkspaceRequired:a}):c.jsx(li,{})}function C_({...e}){return c.jsx(x_,{...e})}const O_="authorizationCode",E_="authorizationCodePKCE",S_="clientCredentials";function N_({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:l}=gt(e);if(t.oauth2Opts===void 0)return c.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:u,explicitScopesRequired:f,explicitWorkspaceRequired:d}=t.oauth2Opts,m={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:l};return u===O_||u===E_?d?c.jsx(__,{...m}):c.jsx(y_,{...m}):u===S_?c.jsx(C_,{...m,explicitWorkspaceRequired:d,explicitScopesRequired:f,selectedConnection:s,setSelectedConnection:a}):u==="password"?c.jsx("em",{children:"Password flow not supported yet"}):c.jsxs("em",{children:["Unsupported grant type: ",u]})}function T_(e){const{selectedConnection:t}=zt();v.useEffect(()=>{e&&t&&e(t)},[e,t])}function R_({onSuccess:e}){T_(e)}function Kd({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:l}){const{data:u,isLoading:f,isError:d,error:m,providerName:h,selectedProvider:y}=gt(e),{provider:w,isIntegrationDeleted:p}=Xe(),{selectedConnection:b,setSelectedConnection:g}=zt();R_({onSuccess:s});const _=Ot();v.useEffect(()=>{d&&(console.error("Error loading provider info."),Le(m))},[d,m]);const x=v.useCallback(()=>{_.clear(),l()},[l,_]);if(!e&&!w)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return c.jsx(ba,{text:"Integration successfully uninstalled.",children:c.jsx(Qe,{type:"button",onClick:x,style:{width:"100%"},children:"Reinstall Integration"})});if(b)return i;if(f)return c.jsx(Gr,{});if(u==null)return c.jsx(Ht,{message:"Provider info was not found."});const C={provider:y,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:b,setSelectedConnection:g,providerName:h,providerInfo:u,onDisconnectSuccess:a};return u.authType==="none"?c.jsx(l_,{...C,children:i}):u.authType==="basic"?c.jsx(s_,{...C,children:i}):u.authType==="apiKey"?c.jsx(o_,{...C,children:i}):c.jsx(N_,{...C})}function A_(e){const t=e+"CollectionProvider",[n,r]=Oo(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=h=>{const{scope:y,children:w}=h,p=v.useRef(null),b=v.useRef(new Map).current;return c.jsx(o,{scope:y,itemMap:b,collectionRef:p,children:w})};s.displayName=t;const a=e+"CollectionSlot",l=v.forwardRef((h,y)=>{const{scope:w,children:p}=h,b=i(a,w),g=hi(y,b.collectionRef);return c.jsx(ho,{ref:g,children:p})});l.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",d=v.forwardRef((h,y)=>{const{scope:w,children:p,...b}=h,g=v.useRef(null),_=hi(y,g),x=i(u,w);return v.useEffect(()=>(x.itemMap.set(g,{ref:g,...b}),()=>void x.itemMap.delete(g))),c.jsx(ho,{[f]:"",ref:_,children:p})});d.displayName=u;function m(h){const y=i(e+"CollectionConsumer",h);return v.useCallback(()=>{const p=y.collectionRef.current;if(!p)return[];const b=Array.from(p.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((x,C)=>b.indexOf(x.ref.current)-b.indexOf(C.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:l,ItemSlot:d},m,r]}var P_=V.useId||(()=>{}),D_=0;function Vd(e){const[t,n]=V.useState(P_());return po(()=>{e||n(r=>r??String(D_++))},[e]),e||(t?`radix-${t}`:"")}var F_=V.createContext(void 0);function Ud(e){const t=V.useContext(F_);return e||t||"ltr"}var Xo="rovingFocusGroup.onEntryFocus",M_={bubbles:!1,cancelable:!0},No="RovingFocusGroup",[Ps,$d,k_]=A_(No),[j_,qd]=Oo(No,[k_]),[L_,K_]=j_(No),Hd=V.forwardRef((e,t)=>c.jsx(Ps.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(Ps.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(V_,{...e,ref:t})})}));Hd.displayName=No;var V_=V.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...d}=e,m=V.useRef(null),h=hi(t,m),y=Ud(i),[w=null,p]=ma({prop:s,defaultProp:a,onChange:l}),[b,g]=V.useState(!1),_=ha(u),x=$d(n),C=V.useRef(!1),[T,S]=V.useState(0);return V.useEffect(()=>{const N=m.current;if(N)return N.addEventListener(Xo,_),()=>N.removeEventListener(Xo,_)},[_]),c.jsx(L_,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:w,onItemFocus:V.useCallback(N=>p(N),[p]),onItemShiftTab:V.useCallback(()=>g(!0),[]),onFocusableItemAdd:V.useCallback(()=>S(N=>N+1),[]),onFocusableItemRemove:V.useCallback(()=>S(N=>N-1),[]),children:c.jsx(Un.div,{tabIndex:b||T===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:Bt(e.onMouseDown,()=>{C.current=!0}),onFocus:Bt(e.onFocus,N=>{const D=!C.current;if(N.target===N.currentTarget&&D&&!b){const $=new CustomEvent(Xo,M_);if(N.currentTarget.dispatchEvent($),!$.defaultPrevented){const G=x().filter(se=>se.focusable),z=G.find(se=>se.active),ne=G.find(se=>se.id===w),ce=[z,ne,...G].filter(Boolean).map(se=>se.ref.current);Jd(ce,f)}}C.current=!1}),onBlur:Bt(e.onBlur,()=>g(!1))})})}),Bd="RovingFocusGroupItem",Wd=V.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Vd(),l=i||a,u=K_(Bd,n),f=u.currentTabStopId===l,d=$d(n),{onFocusableItemAdd:m,onFocusableItemRemove:h}=u;return V.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),c.jsx(Ps.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:c.jsx(Un.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Bt(e.onMouseDown,y=>{r?u.onItemFocus(l):y.preventDefault()}),onFocus:Bt(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Bt(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const w=q_(y,u.orientation,u.dir);if(w!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let b=d().filter(g=>g.focusable).map(g=>g.ref.current);if(w==="last")b.reverse();else if(w==="prev"||w==="next"){w==="prev"&&b.reverse();const g=b.indexOf(y.currentTarget);b=u.loop?H_(b,g+1):b.slice(g+1)}setTimeout(()=>Jd(b))}})})})});Wd.displayName=Bd;var U_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $_(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function q_(e,t,n){const r=$_(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return U_[r]}function Jd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function H_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var B_=Hd,W_=Wd,_a="Tabs",[J_,Ox]=Oo(_a,[qd]),zd=qd(),[z_,xa]=J_(_a),Gd=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...u}=e,f=Ud(a),[d,m]=ma({prop:r,onChange:o,defaultProp:i});return c.jsx(z_,{scope:n,baseId:Vd(),value:d,onValueChange:m,orientation:s,dir:f,activationMode:l,children:c.jsx(Un.div,{dir:f,"data-orientation":s,...u,ref:t})})});Gd.displayName=_a;var Qd="TabsList",Xd=V.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=xa(Qd,n),s=zd(n);return c.jsx(B_,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:c.jsx(Un.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Xd.displayName=Qd;var Yd="TabsTrigger",Zd=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=xa(Yd,n),a=zd(n),l=tf(s.baseId,r),u=nf(s.baseId,r),f=r===s.value;return c.jsx(W_,{asChild:!0,...a,focusable:!o,active:f,children:c.jsx(Un.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:Bt(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Bt(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Bt(e.onFocus,()=>{const d=s.activationMode!=="manual";!f&&!o&&d&&s.onValueChange(r)})})})});Zd.displayName=Yd;var ef="TabsContent",G_=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=xa(ef,n),l=tf(a.baseId,r),u=nf(a.baseId,r),f=r===a.value,d=V.useRef(f);return V.useEffect(()=>{const m=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(m)},[]),c.jsx(ga,{present:o||f,children:({present:m})=>c.jsx(Un.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!m,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:m&&i})})});G_.displayName=ef;function tf(e,t){return`${e}-trigger-${t}`}function nf(e,t){return`${e}-content-${t}`}var Q_=Gd,X_=Xd,Ca=Zd;const Y_=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 Z_(e,t){return t?v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},v.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?Y_: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 ex(){return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function tx(){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 nx="_tabsRoot_ktpr0_1",rx="_tabsList_ktpr0_6",ix="_tabTrigger_ktpr0_12",ox="_danger_ktpr0_29",Br={tabsRoot:nx,tabsList:rx,tabTrigger:ix,danger:ox};function sx(){return c.jsxs(c.Fragment,{children:[c.jsx(Ci,{style:{margin:"1rem 0"}}),c.jsx(Ca,{value:to,className:Br.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[c.jsx(tx,{}),c.jsx("span",{children:"Manage"})]})})]})}const ax=Qr("VITE_AMP_SHOW_MANAGE_TABS",!1),cx=Qr("NEXT_AMP_SHOW_MANAGE_TABS",!1),lx=Qr("REACT_APP_AMP_SHOW_MANAGE_TABS",!1),qc=!!ax||!!cx||!!lx;function rf({objectName:e,completed:t,pending:n,displayName:r}){return c.jsx(Ca,{value:e,className:Br.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Z_(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 ux({completed:e,pending:t,displayName:n}){return c.jsxs(c.Fragment,{children:[c.jsx(Ci,{style:{margin:"1rem 0"}}),c.jsx(rf,{objectName:dr,completed:e,pending:t,displayName:n},"other-write")]})}function dx(){return c.jsxs(c.Fragment,{children:[c.jsx(Ci,{style:{margin:"3rem 0 1rem 0"}}),c.jsx(Ca,{value:eo,className:bt(Br.tabTrigger,Br.danger),children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[ex(),c.jsx("span",{children:"Uninstall"})]})})]})}function fx({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o,showUninstallButton:i}){var s,a;return c.jsx(Q_,{value:e,className:Br.tabsRoot,onValueChange:n,children:c.jsxs(X_,{className:Br.tabsList,children:[t.map(l=>{var u,f,d,m,h,y;return c.jsx(rf,{objectName:l.name,displayName:l.displayName,completed:l.completed,pending:((f=(u=r==null?void 0:r[l.name])==null?void 0:u.read)==null?void 0:f.isOptionalFieldsModified)||((m=(d=r==null?void 0:r[l.name])==null?void 0:d.read)==null?void 0:m.isRequiredMapFieldsModified)||((y=(h=r==null?void 0:r[l.name])==null?void 0:h.read)==null?void 0:y.isValueMappingsModified)||!1},l.name)}),o&&c.jsx(ux,{completed:o.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),i&&!qc&&c.jsx(dx,{}),qc&&c.jsx(sx,{})]})})}function px(e,t){return t===eo?{name:eo,completed:!1}:t===to?{name:to,completed:!1}:e.find(n=>n.name===t)}function hx({children:e}){var b;const{project:t}=Ne(),{installation:n}=Xe(),{providerName:r}=gt(),{hydratedRevision:o}=Xr(),{objectConfigurationsState:i}=$s(),[s,a]=v.useState(""),l=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,f=o&&Gl(u,o),d=f!==null,m=!!((b=o==null?void 0:o.content)!=null&&b.write),h=m?Ql(u):void 0,y=v.useMemo(()=>{const g=[...f||[]];return h&&m&&g.push(h),g},[f,h,m]),w=px(y,s),p=v.useCallback(()=>{const g=y.find(_=>w!==_&&!_.completed);g&&a(g.name)},[y,w]);return v.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,p]),c.jsx(fu.Provider,{value:p,children:c.jsx(uu.Provider,{value:w==null?void 0:w.name,children:c.jsxs(zr,{style:{maxWidth:"55rem"},children:[c.jsxs(vn,{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:l}),d&&c.jsx(fx,{value:s,readNavObjects:f,onValueChange:g=>a(g),objectConfigurationsState:i,writeNavObject:h,showUninstallButton:!!n})]}),e]}),c.jsx(Pd,{})]})})})}function mx({...e}){return c.jsx(hx,{...e})}function gx({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l}){var p;const{projectIdOrName:u,isLoading:f}=Ne(),{isLoading:d}=Ls(),{isError:m,errorState:h}=Pt(),{seed:y,reset:w}=Bl();return f||d?c.jsx(Gr,{}):m(ue.PROJECT,u)?c.jsx(Ht,{message:`Error loading project ${u}`}):m(ue.INTEGRATION_LIST,u)?c.jsx(Ht,{message:"Error retrieving integrations for the project, double check the API key"}):(p=h[ue.INTEGRATION_LIST])!=null&&p.apiError?c.jsx(Ht,{message:"Something went wrong, couldn't find integration information"}):c.jsx("div",{className:Wl.resetContainer,children:c.jsx(fy,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,children:c.jsx(Hl,{children:c.jsx(Kd,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:w,children:c.jsx(Vy,{resetComponent:w,children:c.jsx(i_,{children:c.jsx(ev,{children:c.jsx(mx,{children:c.jsx(Zb,{})})})})})})})},y)})}function yx(){return c.jsxs(zr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[c.jsx(li,{}),c.jsx("p",{children:"Redirecting"})]})}function vx({redirectURL:e,children:t}){return v.useEffect(()=>{e&&window.location.replace(e)},[e]),e?c.jsx(yx,{}):t}function wx({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Ne(),{providerName:o}=gt(e),i=`You have successfully connected your ${o} account to ${r}.`;return c.jsx(ba,{text:i,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:c.jsx(cu,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function Ix({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:l}){const{seed:u,reset:f}=Bl(),d=v.useCallback(m=>{s?s(m.id):l&&l(m)},[s,l]);return c.jsx("div",{className:Wl.resetContainer,children:c.jsx(Hl,{groupRef:r,provider:e,children:c.jsx(Kd,{resetComponent:f,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:d,onDisconnectSuccess:a,children:c.jsx(vx,{redirectURL:i,children:c.jsx(wx,{resetComponent:f,provider:e,onDisconnectSuccess:a})})})})},u)}const bx=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=Vl(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r;return v.useEffect(()=>{o&&Le(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r}};exports.AmpersandContext=kl;exports.AmpersandProvider=Wg;exports.ConnectProvider=Ix;exports.InstallIntegration=gx;exports.useAmpersandProvider=Jg;exports.useIsIntegrationInstalled=bx;
|