@amp-labs/react 2.9.4 → 2.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +1,32 @@
1
- "use strict";var $p=Object.defineProperty;var bc=e=>{throw TypeError(e)};var Up=(e,t,n)=>t in e?$p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var je=(e,t,n)=>Up(e,typeof t!="symbol"?t+"":t,n),is=(e,t,n)=>t.has(e)||bc("Cannot "+n);var O=(e,t,n)=>(is(e,t,"read from private field"),n?n.call(e):t.get(e)),se=(e,t,n)=>t.has(e)?bc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Q=(e,t,n,r)=>(is(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ge=(e,t,n)=>(is(e,t,"access private method"),n);var eo=(e,t,n,r)=>({set _(o){Q(e,t,o,n)},get _(){return O(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),b=require("react");require("react-dom");function Vp(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=Vp(b);var ci=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(){}},Sr=typeof window>"u"||"Deno"in globalThis;function vt(){}function qp(e,t){return typeof e=="function"?e(t):e}function Es(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ju(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Gn(e,t){return typeof e=="function"?e(t):e}function Kt(e,t){return typeof e=="function"?e(t):e}function Ic(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==la(s,t.options))return!1}else if(!Oi(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 Cc(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(xr(t.options.mutationKey)!==xr(i))return!1}else if(!Oi(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function la(e,t){return((t==null?void 0:t.queryKeyHashFn)||xr)(e)}function xr(e){return JSON.stringify(e,(t,n)=>Ns(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Oi(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Oi(e[n],t[n])):!1}function _s(e,t){if(e===t)return e;const n=Sc(e)&&Sc(t);if(n||Ns(e)&&Ns(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{},c=new Set(r);let f=0;for(let d=0;d<s;d++){const l=n?d:i[d];(!n&&c.has(l)||n)&&e[l]===void 0&&t[l]===void 0?(a[l]=void 0,f++):(a[l]=_s(e[l],t[l]),a[l]===e[l]&&e[l]!==void 0&&f++)}return o===s&&f===o?e:a}return t}function vo(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Sc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ns(e){if(!xc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!xc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function xc(e){return Object.prototype.toString.call(e)==="[object Object]"}function Bp(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 _s(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return _s(e,t)}return t}function Hp(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Jp(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var wo=Symbol();function Wu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===wo&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===wo?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function zu(e,t){return typeof e=="function"?e(...t):!!e}var hr,Kn,Lr,ku,Wp=(ku=class extends ci{constructor(){super();se(this,hr);se(this,Kn);se(this,Lr);Q(this,Lr,t=>{if(!Sr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,Kn)||this.setEventListener(O(this,Lr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Kn))==null||t.call(this),Q(this,Kn,void 0))}setEventListener(t){var n;Q(this,Lr,t),(n=O(this,Kn))==null||n.call(this),Q(this,Kn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,hr)!==t&&(Q(this,hr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof O(this,hr)=="boolean"?O(this,hr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},hr=new WeakMap,Kn=new WeakMap,Lr=new WeakMap,ku),da=new Wp,Kr,$n,$r,ju,zp=(ju=class extends ci{constructor(){super();se(this,Kr,!0);se(this,$n);se(this,$r);Q(this,$r,t=>{if(!Sr&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){O(this,$n)||this.setEventListener(O(this,$r))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,$n))==null||t.call(this),Q(this,$n,void 0))}setEventListener(t){var n;Q(this,$r,t),(n=O(this,$n))==null||n.call(this),Q(this,$n,t(this.setOnline.bind(this)))}setOnline(t){O(this,Kr)!==t&&(Q(this,Kr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,Kr)}},Kr=new WeakMap,$n=new WeakMap,$r=new WeakMap,ju),bo=new zp;function As(){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 Gp(e){return Math.min(1e3*2**e,3e4)}function Gu(e){return(e??"online")==="online"?bo.isOnline():!0}var Qu=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Xu(e){let t=!1,n=0,r;const o=As(),i=()=>o.status!=="pending",s=w=>{var v;i()||(p(new Qu(w)),(v=e.abort)==null||v.call(e))},a=()=>{t=!0},c=()=>{t=!1},f=()=>da.isFocused()&&(e.networkMode==="always"||bo.isOnline())&&e.canRun(),d=()=>Gu(e.networkMode)&&e.canRun(),l=w=>{i()||(r==null||r(),o.resolve(w))},p=w=>{i()||(r==null||r(),o.reject(w))},m=()=>new Promise(w=>{var v;r=x=>{(i()||f())&&w(x)},(v=e.onPause)==null||v.call(e)}).then(()=>{var w;r=void 0,i()||(w=e.onContinue)==null||w.call(e)}),g=()=>{if(i())return;let w;const v=n===0?e.initialPromise:void 0;try{w=v??e.fn()}catch(x){w=Promise.reject(x)}Promise.resolve(w).then(l).catch(x=>{var E;if(i())return;const h=e.retry??(Sr?0:3),y=e.retryDelay??Gp,I=typeof y=="function"?y(n,x):y,S=h===!0||typeof h=="number"&&n<h||typeof h=="function"&&h(n,x);if(t||!S){p(x);return}n++,(E=e.onFail)==null||E.call(e,n,x),Bp(I).then(()=>f()?void 0:m()).then(()=>{t?p(x):g()})})};return{promise:o,status:()=>o.status,cancel:s,continue:()=>(r==null||r(),o),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?g():m().then(g),o)}}var Qp=e=>setTimeout(e,0);function Xp(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=Qp;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 Xe=Xp(),mr,Lu,Yu=(Lu=class{constructor(){se(this,mr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Es(this.gcTime)&&Q(this,mr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Sr?1/0:5*60*1e3))}clearGcTimeout(){O(this,mr)&&(clearTimeout(O(this,mr)),Q(this,mr,void 0))}},mr=new WeakMap,Lu),Ur,Vr,Lt,gr,it,Fi,yr,Jt,bn,Ku,Yp=(Ku=class extends Yu{constructor(t){super();se(this,Jt);se(this,Ur);se(this,Vr);se(this,Lt);se(this,gr);se(this,it);se(this,Fi);se(this,yr);Q(this,yr,!1),Q(this,Fi,t.defaultOptions),this.setOptions(t.options),this.observers=[],Q(this,gr,t.client),Q(this,Lt,O(this,gr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Q(this,Ur,Zp(this.options)),this.state=t.state??O(this,Ur),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,it))==null?void 0:t.promise}setOptions(t){this.options={...O(this,Fi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Lt).remove(this)}setData(t,n){const r=Ts(this.state.data,t,this.options);return ge(this,Jt,bn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ge(this,Jt,bn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=O(this,it))==null?void 0:r.promise;return(o=O(this,it))==null||o.cancel(t),n?n.then(vt).catch(vt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Ur))}isActive(){return this.observers.some(t=>Kt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wo||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Gn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Ju(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,it))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,it))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Lt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(O(this,it)&&(O(this,yr)?O(this,it).cancel({revert:!0}):O(this,it).cancelRetry()),this.scheduleGc()),O(this,Lt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ge(this,Jt,bn).call(this,{type:"invalidate"})}async fetch(t,n){var c,f,d,l,p,m,g,w,v,x,h,y;if(this.state.fetchStatus!=="idle"&&((c=O(this,it))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,it))return O(this,it).continueRetry(),O(this,it).promise}if(t&&this.setOptions(t),!this.options.queryFn){const I=this.observers.find(S=>S.options.queryFn);I&&this.setOptions(I.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=I=>{Object.defineProperty(I,"signal",{enumerable:!0,get:()=>(Q(this,yr,!0),r.signal)})},i=()=>{const I=Wu(this.options,n),E=(()=>{const P={client:O(this,gr),queryKey:this.queryKey,meta:this.meta};return o(P),P})();return Q(this,yr,!1),this.options.persister?this.options.persister(I,E,this):I(E)},a=(()=>{const I={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,gr),state:this.state,fetchFn:i};return o(I),I})();(f=this.options.behavior)==null||f.onFetch(a,this),Q(this,Vr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&ge(this,Jt,bn).call(this,{type:"fetch",meta:(l=a.fetchOptions)==null?void 0:l.meta}),Q(this,it,Xu({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onFail:(I,S)=>{ge(this,Jt,bn).call(this,{type:"failed",failureCount:I,error:S})},onPause:()=>{ge(this,Jt,bn).call(this,{type:"pause"})},onContinue:()=>{ge(this,Jt,bn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const I=await O(this,it).start();if(I===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(I),(m=(p=O(this,Lt).config).onSuccess)==null||m.call(p,I,this),(w=(g=O(this,Lt).config).onSettled)==null||w.call(g,I,this.state.error,this),I}catch(I){if(I instanceof Qu){if(I.silent)return O(this,it).promise;if(I.revert){if(this.setState({...O(this,Vr),fetchStatus:"idle"}),this.state.data===void 0)throw I;return this.state.data}}throw ge(this,Jt,bn).call(this,{type:"error",error:I}),(x=(v=O(this,Lt).config).onError)==null||x.call(v,I,this),(y=(h=O(this,Lt).config).onSettled)==null||y.call(h,this.state.data,I,this),I}finally{this.scheduleGc()}}},Ur=new WeakMap,Vr=new WeakMap,Lt=new WeakMap,gr=new WeakMap,it=new WeakMap,Fi=new WeakMap,yr=new WeakMap,Jt=new WeakSet,bn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Zu(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Q(this,Vr,t.manual?o:void 0),o;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Xe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,Lt).notify({query:this,type:"updated",action:t})})},Ku);function Zu(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Gu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Zp(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 nn,$u,eh=($u=class extends ci{constructor(t={}){super();se(this,nn);this.config=t,Q(this,nn,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??la(o,n);let s=this.get(i);return s||(s=new Yp({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){O(this,nn).has(t.queryHash)||(O(this,nn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,nn).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,nn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Xe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,nn).get(t)}getAll(){return[...O(this,nn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ic(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ic(t,r)):n}notify(t){Xe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Xe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Xe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},nn=new WeakMap,$u),rn,gt,vr,on,Ln,Uu,th=(Uu=class extends Yu{constructor(t){super();se(this,on);se(this,rn);se(this,gt);se(this,vr);this.mutationId=t.mutationId,Q(this,gt,t.mutationCache),Q(this,rn,[]),this.state=t.state||el(),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,rn).includes(t)||(O(this,rn).push(t),this.clearGcTimeout(),O(this,gt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Q(this,rn,O(this,rn).filter(n=>n!==t)),this.scheduleGc(),O(this,gt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,rn).length||(this.state.status==="pending"?this.scheduleGc():O(this,gt).remove(this))}continue(){var t;return((t=O(this,vr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,a,c,f,d,l,p,m,g,w,v,x,h,y,I,S,E,P,_;const n=()=>{ge(this,on,Ln).call(this,{type:"continue"})};Q(this,vr,Xu({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,R)=>{ge(this,on,Ln).call(this,{type:"failed",failureCount:A,error:R})},onPause:()=>{ge(this,on,Ln).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,gt).canRun(this)}));const r=this.state.status==="pending",o=!O(this,vr).canStart();try{if(r)n();else{ge(this,on,Ln).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(i=O(this,gt).config).onMutate)==null?void 0:s.call(i,t,this));const R=await((c=(a=this.options).onMutate)==null?void 0:c.call(a,t));R!==this.state.context&&ge(this,on,Ln).call(this,{type:"pending",context:R,variables:t,isPaused:o})}const A=await O(this,vr).start();return await((d=(f=O(this,gt).config).onSuccess)==null?void 0:d.call(f,A,t,this.state.context,this)),await((p=(l=this.options).onSuccess)==null?void 0:p.call(l,A,t,this.state.context)),await((g=(m=O(this,gt).config).onSettled)==null?void 0:g.call(m,A,null,this.state.variables,this.state.context,this)),await((v=(w=this.options).onSettled)==null?void 0:v.call(w,A,null,t,this.state.context)),ge(this,on,Ln).call(this,{type:"success",data:A}),A}catch(A){try{throw await((h=(x=O(this,gt).config).onError)==null?void 0:h.call(x,A,t,this.state.context,this)),await((I=(y=this.options).onError)==null?void 0:I.call(y,A,t,this.state.context)),await((E=(S=O(this,gt).config).onSettled)==null?void 0:E.call(S,void 0,A,this.state.variables,this.state.context,this)),await((_=(P=this.options).onSettled)==null?void 0:_.call(P,void 0,A,t,this.state.context)),A}finally{ge(this,on,Ln).call(this,{type:"error",error:A})}}finally{O(this,gt).runNext(this)}}},rn=new WeakMap,gt=new WeakMap,vr=new WeakMap,on=new WeakSet,Ln=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Xe.batch(()=>{O(this,rn).forEach(r=>{r.onMutationUpdate(t)}),O(this,gt).notify({mutation:this,type:"updated",action:t})})},Uu);function el(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var In,Wt,Di,Vu,nh=(Vu=class extends ci{constructor(t={}){super();se(this,In);se(this,Wt);se(this,Di);this.config=t,Q(this,In,new Set),Q(this,Wt,new Map),Q(this,Di,0)}build(t,n,r){const o=new th({mutationCache:this,mutationId:++eo(this,Di)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,In).add(t);const n=to(t);if(typeof n=="string"){const r=O(this,Wt).get(n);r?r.push(t):O(this,Wt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,In).delete(t)){const n=to(t);if(typeof n=="string"){const r=O(this,Wt).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,Wt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=to(t);if(typeof n=="string"){const r=O(this,Wt).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=to(t);if(typeof n=="string"){const o=(r=O(this,Wt).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(){Xe.batch(()=>{O(this,In).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,In).clear(),O(this,Wt).clear()})}getAll(){return Array.from(O(this,In))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Cc(n,r))}findAll(t={}){return this.getAll().filter(n=>Cc(t,n))}notify(t){Xe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Xe.batch(()=>Promise.all(t.map(n=>n.continue().catch(vt))))}},In=new WeakMap,Wt=new WeakMap,Di=new WeakMap,Vu);function to(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Oc(e){return{onFetch:(t,n)=>{var d,l,p,m,g;const r=t.options,o=(p=(l=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:l.fetchMore)==null?void 0:p.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],s=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const f=async()=>{let w=!1;const v=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},x=Wu(t.options,t.fetchOptions),h=async(y,I,S)=>{if(w)return Promise.reject();if(I==null&&y.pages.length)return Promise.resolve(y);const P=(()=>{const M={client:t.client,queryKey:t.queryKey,pageParam:I,direction:S?"backward":"forward",meta:t.options.meta};return v(M),M})(),_=await x(P),{maxPages:A}=t.options,R=S?Jp:Hp;return{pages:R(y.pages,_,A),pageParams:R(y.pageParams,I,A)}};if(o&&i.length){const y=o==="backward",I=y?rh:Ec,S={pages:i,pageParams:s},E=I(r,S);a=await h(S,E,y)}else{const y=e??i.length;do{const I=c===0?s[0]??r.initialPageParam:Ec(r,a);if(c>0&&I==null)break;a=await h(a,I),c++}while(c<y)}return a};t.options.persister?t.fetchFn=()=>{var w,v;return(v=(w=t.options).persister)==null?void 0:v.call(w,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function Ec(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 rh(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 Ve,Un,Vn,qr,Br,qn,Hr,Jr,qu,ih=(qu=class{constructor(e={}){se(this,Ve);se(this,Un);se(this,Vn);se(this,qr);se(this,Br);se(this,qn);se(this,Hr);se(this,Jr);Q(this,Ve,e.queryCache||new eh),Q(this,Un,e.mutationCache||new nh),Q(this,Vn,e.defaultOptions||{}),Q(this,qr,new Map),Q(this,Br,new Map),Q(this,qn,0)}mount(){eo(this,qn)._++,O(this,qn)===1&&(Q(this,Hr,da.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ve).onFocus())})),Q(this,Jr,bo.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ve).onOnline())})))}unmount(){var e,t;eo(this,qn)._--,O(this,qn)===0&&((e=O(this,Hr))==null||e.call(this),Q(this,Hr,void 0),(t=O(this,Jr))==null||t.call(this),Q(this,Jr,void 0))}isFetching(e){return O(this,Ve).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Un).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Ve).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,Ve).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Gn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(this,Ve).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,Ve).get(r.queryHash),i=o==null?void 0:o.state.data,s=qp(t,i);if(s!==void 0)return O(this,Ve).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Xe.batch(()=>O(this,Ve).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,Ve).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,Ve);Xe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,Ve);return Xe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Xe.batch(()=>O(this,Ve).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(vt).catch(vt)}invalidateQueries(e,t={}){return Xe.batch(()=>(O(this,Ve).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Xe.batch(()=>O(this,Ve).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(vt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(vt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=O(this,Ve).build(this,t);return n.isStaleByTime(Gn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(vt).catch(vt)}fetchInfiniteQuery(e){return e.behavior=Oc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(vt).catch(vt)}ensureInfiniteQueryData(e){return e.behavior=Oc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return bo.isOnline()?O(this,Un).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Ve)}getMutationCache(){return O(this,Un)}getDefaultOptions(){return O(this,Vn)}setDefaultOptions(e){Q(this,Vn,e)}setQueryDefaults(e,t){O(this,qr).set(xr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,qr).values()],n={};return t.forEach(r=>{Oi(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,Br).set(xr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Br).values()],n={};return t.forEach(r=>{Oi(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,Vn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=la(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===wo&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Vn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Ve).clear(),O(this,Un).clear()}},Ve=new WeakMap,Un=new WeakMap,Vn=new WeakMap,qr=new WeakMap,Br=new WeakMap,qn=new WeakMap,Hr=new WeakMap,Jr=new WeakMap,qu),St,Ie,Mi,yt,wr,Wr,Cn,Bn,ki,zr,Gr,br,Ir,Hn,Qr,Ae,bi,Rs,Ps,Fs,Ds,Ms,ks,js,tl,Bu,oh=(Bu=class extends ci{constructor(t,n){super();se(this,Ae);se(this,St);se(this,Ie);se(this,Mi);se(this,yt);se(this,wr);se(this,Wr);se(this,Cn);se(this,Bn);se(this,ki);se(this,zr);se(this,Gr);se(this,br);se(this,Ir);se(this,Hn);se(this,Qr,new Set);this.options=n,Q(this,St,t),Q(this,Bn,null),Q(this,Cn,As()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,Ie).addObserver(this),_c(O(this,Ie),this.options)?ge(this,Ae,bi).call(this):this.updateResult(),ge(this,Ae,Ds).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ls(O(this,Ie),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ls(O(this,Ie),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ge(this,Ae,Ms).call(this),ge(this,Ae,ks).call(this),O(this,Ie).removeObserver(this)}setOptions(t){const n=this.options,r=O(this,Ie);if(this.options=O(this,St).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Kt(this.options.enabled,O(this,Ie))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ge(this,Ae,js).call(this),O(this,Ie).setOptions(this.options),n._defaulted&&!vo(this.options,n)&&O(this,St).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,Ie),observer:this});const o=this.hasListeners();o&&Nc(O(this,Ie),r,this.options,n)&&ge(this,Ae,bi).call(this),this.updateResult(),o&&(O(this,Ie)!==r||Kt(this.options.enabled,O(this,Ie))!==Kt(n.enabled,O(this,Ie))||Gn(this.options.staleTime,O(this,Ie))!==Gn(n.staleTime,O(this,Ie)))&&ge(this,Ae,Rs).call(this);const i=ge(this,Ae,Ps).call(this);o&&(O(this,Ie)!==r||Kt(this.options.enabled,O(this,Ie))!==Kt(n.enabled,O(this,Ie))||i!==O(this,Hn))&&ge(this,Ae,Fs).call(this,i)}getOptimisticResult(t){const n=O(this,St).getQueryCache().build(O(this,St),t),r=this.createResult(n,t);return ah(this,r)&&(Q(this,yt,r),Q(this,Wr,this.options),Q(this,wr,O(this,Ie).state)),r}getCurrentResult(){return O(this,yt)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),o==="promise"&&!this.options.experimental_prefetchInRender&&O(this,Cn).status==="pending"&&O(this,Cn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(r,o))})}trackProp(t){O(this,Qr).add(t)}getCurrentQuery(){return O(this,Ie)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=O(this,St).defaultQueryOptions(t),r=O(this,St).getQueryCache().build(O(this,St),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ge(this,Ae,bi).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,yt)))}createResult(t,n){var A;const r=O(this,Ie),o=this.options,i=O(this,yt),s=O(this,wr),a=O(this,Wr),f=t!==r?t.state:O(this,Mi),{state:d}=t;let l={...d},p=!1,m;if(n._optimisticResults){const R=this.hasListeners(),M=!R&&_c(t,n),j=R&&Nc(t,r,n,o);(M||j)&&(l={...l,...Zu(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(l.fetchStatus="idle")}let{error:g,errorUpdatedAt:w,status:v}=l;m=l.data;let x=!1;if(n.placeholderData!==void 0&&m===void 0&&v==="pending"){let R;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(R=i.data,x=!0):R=typeof n.placeholderData=="function"?n.placeholderData((A=O(this,Gr))==null?void 0:A.state.data,O(this,Gr)):n.placeholderData,R!==void 0&&(v="success",m=Ts(i==null?void 0:i.data,R,n),p=!0)}if(n.select&&m!==void 0&&!x)if(i&&m===(s==null?void 0:s.data)&&n.select===O(this,ki))m=O(this,zr);else try{Q(this,ki,n.select),m=n.select(m),m=Ts(i==null?void 0:i.data,m,n),Q(this,zr,m),Q(this,Bn,null)}catch(R){Q(this,Bn,R)}O(this,Bn)&&(g=O(this,Bn),m=O(this,zr),w=Date.now(),v="error");const h=l.fetchStatus==="fetching",y=v==="pending",I=v==="error",S=y&&h,E=m!==void 0,_={status:v,fetchStatus:l.fetchStatus,isPending:y,isSuccess:v==="success",isError:I,isInitialLoading:S,isLoading:S,data:m,dataUpdatedAt:l.dataUpdatedAt,error:g,errorUpdatedAt:w,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>f.dataUpdateCount||l.errorUpdateCount>f.errorUpdateCount,isFetching:h,isRefetching:h&&!y,isLoadingError:I&&!E,isPaused:l.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:I&&E,isStale:fa(t,n),refetch:this.refetch,promise:O(this,Cn),isEnabled:Kt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=K=>{_.status==="error"?K.reject(_.error):_.data!==void 0&&K.resolve(_.data)},M=()=>{const K=Q(this,Cn,_.promise=As());R(K)},j=O(this,Cn);switch(j.status){case"pending":t.queryHash===r.queryHash&&R(j);break;case"fulfilled":(_.status==="error"||_.data!==j.value)&&M();break;case"rejected":(_.status!=="error"||_.error!==j.reason)&&M();break}}return _}updateResult(){const t=O(this,yt),n=this.createResult(O(this,Ie),this.options);if(Q(this,wr,O(this,Ie).state),Q(this,Wr,this.options),O(this,wr).data!==void 0&&Q(this,Gr,O(this,Ie)),vo(n,t))return;Q(this,yt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!O(this,Qr).size)return!0;const s=new Set(i??O(this,Qr));return this.options.throwOnError&&s.add("error"),Object.keys(O(this,yt)).some(a=>{const c=a;return O(this,yt)[c]!==t[c]&&s.has(c)})};ge(this,Ae,tl).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ge(this,Ae,Ds).call(this)}},St=new WeakMap,Ie=new WeakMap,Mi=new WeakMap,yt=new WeakMap,wr=new WeakMap,Wr=new WeakMap,Cn=new WeakMap,Bn=new WeakMap,ki=new WeakMap,zr=new WeakMap,Gr=new WeakMap,br=new WeakMap,Ir=new WeakMap,Hn=new WeakMap,Qr=new WeakMap,Ae=new WeakSet,bi=function(t){ge(this,Ae,js).call(this);let n=O(this,Ie).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(vt)),n},Rs=function(){ge(this,Ae,Ms).call(this);const t=Gn(this.options.staleTime,O(this,Ie));if(Sr||O(this,yt).isStale||!Es(t))return;const r=Ju(O(this,yt).dataUpdatedAt,t)+1;Q(this,br,setTimeout(()=>{O(this,yt).isStale||this.updateResult()},r))},Ps=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,Ie)):this.options.refetchInterval)??!1},Fs=function(t){ge(this,Ae,ks).call(this),Q(this,Hn,t),!(Sr||Kt(this.options.enabled,O(this,Ie))===!1||!Es(O(this,Hn))||O(this,Hn)===0)&&Q(this,Ir,setInterval(()=>{(this.options.refetchIntervalInBackground||da.isFocused())&&ge(this,Ae,bi).call(this)},O(this,Hn)))},Ds=function(){ge(this,Ae,Rs).call(this),ge(this,Ae,Fs).call(this,ge(this,Ae,Ps).call(this))},Ms=function(){O(this,br)&&(clearTimeout(O(this,br)),Q(this,br,void 0))},ks=function(){O(this,Ir)&&(clearInterval(O(this,Ir)),Q(this,Ir,void 0))},js=function(){const t=O(this,St).getQueryCache().build(O(this,St),this.options);if(t===O(this,Ie))return;const n=O(this,Ie);Q(this,Ie,t),Q(this,Mi,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},tl=function(t){Xe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,yt))}),O(this,St).getQueryCache().notify({query:O(this,Ie),type:"observerResultsUpdated"})})},Bu);function sh(e,t){return Kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function _c(e,t){return sh(e,t)||e.state.data!==void 0&&Ls(e,t,t.refetchOnMount)}function Ls(e,t,n){if(Kt(t.enabled,e)!==!1&&Gn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&fa(e,t)}return!1}function Nc(e,t,n,r){return(e!==t||Kt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&fa(e,n)}function fa(e,t){return Kt(t.enabled,e)!==!1&&e.isStaleByTime(Gn(t.staleTime,e))}function ah(e,t){return!vo(e.getCurrentResult(),t)}var Jn,Wn,xt,Sn,On,fo,Ks,Hu,ch=(Hu=class extends ci{constructor(n,r){super();se(this,On);se(this,Jn);se(this,Wn);se(this,xt);se(this,Sn);Q(this,Jn,n),this.setOptions(r),this.bindMethods(),ge(this,On,fo).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=O(this,Jn).defaultMutationOptions(n),vo(this.options,r)||O(this,Jn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,xt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&xr(r.mutationKey)!==xr(this.options.mutationKey)?this.reset():((o=O(this,xt))==null?void 0:o.state.status)==="pending"&&O(this,xt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=O(this,xt))==null||n.removeObserver(this)}onMutationUpdate(n){ge(this,On,fo).call(this),ge(this,On,Ks).call(this,n)}getCurrentResult(){return O(this,Wn)}reset(){var n;(n=O(this,xt))==null||n.removeObserver(this),Q(this,xt,void 0),ge(this,On,fo).call(this),ge(this,On,Ks).call(this)}mutate(n,r){var o;return Q(this,Sn,r),(o=O(this,xt))==null||o.removeObserver(this),Q(this,xt,O(this,Jn).getMutationCache().build(O(this,Jn),this.options)),O(this,xt).addObserver(this),O(this,xt).execute(n)}},Jn=new WeakMap,Wn=new WeakMap,xt=new WeakMap,Sn=new WeakMap,On=new WeakSet,fo=function(){var r;const n=((r=O(this,xt))==null?void 0:r.state)??el();Q(this,Wn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Ks=function(n){Xe.batch(()=>{var r,o,i,s,a,c,f,d;if(O(this,Sn)&&this.hasListeners()){const l=O(this,Wn).variables,p=O(this,Wn).context;(n==null?void 0:n.type)==="success"?((o=(r=O(this,Sn)).onSuccess)==null||o.call(r,n.data,l,p),(s=(i=O(this,Sn)).onSettled)==null||s.call(i,n.data,null,l,p)):(n==null?void 0:n.type)==="error"&&((c=(a=O(this,Sn)).onError)==null||c.call(a,n.error,l,p),(d=(f=O(this,Sn)).onSettled)==null||d.call(f,void 0,n.error,l,p))}this.listeners.forEach(l=>{l(O(this,Wn))})})},Hu),nl=V.createContext(void 0),qe=e=>{const t=V.useContext(nl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},uh=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(nl.Provider,{value:e,children:t})),rl=V.createContext(!1),lh=()=>V.useContext(rl);rl.Provider;function dh(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fh=V.createContext(dh()),ph=()=>V.useContext(fh),hh=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},mh=e=>{V.useEffect(()=>{e.clearReset()},[e])},gh=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||zu(n,[e.error,r])),yh=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...r)=>t(n(...r)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},vh=(e,t)=>e.isLoading&&e.isFetching&&!t,wh=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Tc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function bh(e,t,n){var l,p,m,g,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=lh(),o=ph(),i=qe(),s=i.defaultQueryOptions(e);(p=(l=i.getDefaultOptions().queries)==null?void 0:l._experimental_beforeQuery)==null||p.call(l,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=r?"isRestoring":"optimistic",yh(s),hh(s,o),mh(o);const a=!i.getQueryCache().get(s.queryHash),[c]=V.useState(()=>new t(i,s)),f=c.getOptimisticResult(s),d=!r&&e.subscribed!==!1;if(V.useSyncExternalStore(V.useCallback(v=>{const x=d?c.subscribe(Xe.batchCalls(v)):vt;return c.updateResult(),x},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),V.useEffect(()=>{c.setOptions(s)},[s,c]),wh(s,f))throw Tc(s,c,o);if(gh({result:f,errorResetBoundary:o,throwOnError:s.throwOnError,query:i.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((g=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||g.call(m,s,f),s.experimental_prefetchInRender&&!Sr&&vh(f,r)){const v=a?Tc(s,c,o):(w=i.getQueryCache().get(s.queryHash))==null?void 0:w.promise;v==null||v.catch(vt).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?f:c.trackResult(f)}function er(e,t){return bh(e,oh)}function En(e,t){const n=qe(),[r]=V.useState(()=>new ch(n,e));V.useEffect(()=>{r.setOptions(e)},[r,e]);const o=V.useSyncExternalStore(V.useCallback(s=>r.subscribe(Xe.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=V.useCallback((s,a)=>{r.mutate(s,a).catch(vt)},[r]);if(o.error&&zu(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const il=b.createContext(null),Ih=il.Provider,ol=()=>b.useContext(il);var we=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e.VALUE_MAPPING="valueMappingError",e))(we||{});const sl=b.createContext(void 0);function un(){const e=b.useContext(sl);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Ch=(()=>{const e={};return Object.values(we).forEach(t=>{e[t]={}}),e})();function Sh({children:e}){const[t,n]=b.useState(Ch),r=b.useCallback((d,l,p=!0)=>{n(m=>{const g={...m};return g[d]=g[d]||{},g[d][l]=p,g})},[n]),o=b.useCallback((d,l)=>{var p;return!!((p=t[d])!=null&&p[l])},[t]),i=b.useCallback((d,l)=>{var p;return(p=t[d])==null?void 0:p[l]},[t]),s=b.useCallback((d,l)=>{n(p=>{var g;const m={...p};return(g=m[d])==null||delete g[l],m})},[n]),a=b.useCallback(d=>{n(l=>{const p={...l};return p[d]={},p})},[n]),c=b.useCallback((d,l)=>{n(p=>{const m={...p};return m[d]=m[d]||{},l.forEach(g=>{m[d][g]=!0}),m})},[n]),f=b.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:c,getError:i}),[t,n,r,o,s,a,c,i]);return u.jsx(sl.Provider,{value:f,children:e})}const no=new TextEncoder,Ei=new TextDecoder;function xh(...e){const t=e.reduce((o,{length:i})=>o+i,0),n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function Oh(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function po(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:Ei.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=Ei.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return Oh(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class tr extends Error{constructor(n,r){var o;super(n,r);je(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(o=Error.captureStackTrace)==null||o.call(Error,this,this.constructor)}}je(tr,"code","ERR_JOSE_GENERIC");class Ht extends tr{constructor(n,r,o="unspecified",i="unspecified"){super(n,{cause:{claim:o,reason:i,payload:r}});je(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");je(this,"claim");je(this,"reason");je(this,"payload");this.claim=o,this.reason=i,this.payload=r}}je(Ht,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class $s extends tr{constructor(n,r,o="unspecified",i="unspecified"){super(n,{cause:{claim:o,reason:i,payload:r}});je(this,"code","ERR_JWT_EXPIRED");je(this,"claim");je(this,"reason");je(this,"payload");this.claim=o,this.reason=i,this.payload=r}}je($s,"code","ERR_JWT_EXPIRED");class al extends tr{constructor(){super(...arguments);je(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}je(al,"code","ERR_JOSE_ALG_NOT_ALLOWED");class fr extends tr{constructor(){super(...arguments);je(this,"code","ERR_JOSE_NOT_SUPPORTED")}}je(fr,"code","ERR_JOSE_NOT_SUPPORTED");class rt extends tr{constructor(){super(...arguments);je(this,"code","ERR_JWS_INVALID")}}je(rt,"code","ERR_JWS_INVALID");class pa extends tr{constructor(){super(...arguments);je(this,"code","ERR_JWT_INVALID")}}je(pa,"code","ERR_JWT_INVALID");class cl extends tr{constructor(n="signature verification failed",r){super(n,r);je(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}je(cl,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function wn(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function yi(e,t){return e.name===t}function os(e){return parseInt(e.name.slice(4),10)}function Eh(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function _h(e,t){if(!e.usages.includes(t))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function Nh(e,t,n){switch(t){case"HS256":case"HS384":case"HS512":{if(!yi(e.algorithm,"HMAC"))throw wn("HMAC");const r=parseInt(t.slice(2),10);if(os(e.algorithm.hash)!==r)throw wn(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!yi(e.algorithm,"RSASSA-PKCS1-v1_5"))throw wn("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(os(e.algorithm.hash)!==r)throw wn(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!yi(e.algorithm,"RSA-PSS"))throw wn("RSA-PSS");const r=parseInt(t.slice(2),10);if(os(e.algorithm.hash)!==r)throw wn(`SHA-${r}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":{if(!yi(e.algorithm,"Ed25519"))throw wn("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!yi(e.algorithm,"ECDSA"))throw wn("ECDSA");const r=Eh(t);if(e.algorithm.namedCurve!==r)throw wn(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}_h(e,n)}function ul(e,t,...n){var r;if(n=n.filter(Boolean),n.length>2){const o=n.pop();e+=`one of type ${n.join(", ")}, or ${o}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t=="function"&&t.name?e+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&(r=t.constructor)!=null&&r.name&&(e+=` Received an instance of ${t.constructor.name}`),e}const Th=(e,...t)=>ul("Key must be ",e,...t);function ll(e,t,...n){return ul(`Key for the ${e} algorithm must be `,t,...n)}function dl(e){return(e==null?void 0:e[Symbol.toStringTag])==="CryptoKey"}function fl(e){return(e==null?void 0:e[Symbol.toStringTag])==="KeyObject"}const pl=e=>dl(e)||fl(e),Ah=(...e)=>{const t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(const r of t){const o=Object.keys(r);if(!n||n.size===0){n=new Set(o);continue}for(const i of o){if(n.has(i))return!1;n.add(i)}}return!0};function Rh(e){return typeof e=="object"&&e!==null}const Io=e=>{if(!Rh(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},Ph=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if(typeof n!="number"||n<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}};function Fh(e){let t,n;switch(e.kty){case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new fr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new fr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new fr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new fr('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}const Dh=async e=>{if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:t,keyUsages:n}=Fh(e),r={...e};return delete r.alg,delete r.use,crypto.subtle.importKey("jwk",r,t,e.ext??!e.d,e.key_ops??n)},Mh=(e,t,n,r,o)=>{if(o.crit!==void 0&&(r==null?void 0:r.crit)===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(s=>typeof s!="string"||s.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;n!==void 0?i=new Map([...Object.entries(n),...t.entries()]):i=t;for(const s of r.crit){if(!i.has(s))throw new fr(`Extension Header Parameter "${s}" is not recognized`);if(o[s]===void 0)throw new e(`Extension Header Parameter "${s}" is missing`);if(i.get(s)&&r[s]===void 0)throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(r.crit)},kh=(e,t)=>{if(t!==void 0&&(!Array.isArray(t)||t.some(n=>typeof n!="string")))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)};function ha(e){return Io(e)&&typeof e.kty=="string"}function jh(e){return e.kty!=="oct"&&typeof e.d=="string"}function Lh(e){return e.kty!=="oct"&&typeof e.d>"u"}function Kh(e){return e.kty==="oct"&&typeof e.k=="string"}let kr;const Ac=async(e,t,n,r=!1)=>{kr||(kr=new WeakMap);let o=kr.get(e);if(o!=null&&o[n])return o[n];const i=await Dh({...t,alg:n});return r&&Object.freeze(e),o?o[n]=i:kr.set(e,{[n]:i}),i},$h=(e,t)=>{var s;kr||(kr=new WeakMap);let n=kr.get(e);if(n!=null&&n[t])return n[t];const r=e.type==="public",o=!!r;let i;if(e.asymmetricKeyType==="x25519"){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if(e.asymmetricKeyType==="ed25519"){if(t!=="EdDSA"&&t!=="Ed25519")throw new TypeError("given KeyObject instance cannot be used for this algorithm");i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if(e.asymmetricKeyType==="rsa"){let a;switch(t){case"RSA-OAEP":a="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":a="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":a="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":a="SHA-512";break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:a},o,r?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:a},o,[r?"verify":"sign"])}if(e.asymmetricKeyType==="ec"){const c=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get((s=e.asymmetricKeyDetails)==null?void 0:s.namedCurve);if(!c)throw new TypeError("given KeyObject instance cannot be used for this algorithm");t==="ES256"&&c==="P-256"&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:c},o,[r?"verify":"sign"])),t==="ES384"&&c==="P-384"&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:c},o,[r?"verify":"sign"])),t==="ES512"&&c==="P-521"&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:c},o,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:c},o,r?[]:["deriveBits"]))}if(!i)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return n?n[t]=i:kr.set(e,{[t]:i}),i},Uh=async(e,t)=>{if(e instanceof Uint8Array||dl(e))return e;if(fl(e)){if(e.type==="secret")return e.export();if("toCryptoKey"in e&&typeof e.toCryptoKey=="function")try{return $h(e,t)}catch(r){if(r instanceof TypeError)throw r}let n=e.export({format:"jwk"});return Ac(e,n,t)}if(ha(e))return e.k?po(e.k):Ac(e,e,t,!0);throw new Error("unreachable")},Dr=e=>e==null?void 0:e[Symbol.toStringTag],Us=(e,t,n)=>{var r,o;if(t.use!==void 0){let i;switch(n){case"sign":case"verify":i="sig";break;case"encrypt":case"decrypt":i="enc";break}if(t.use!==i)throw new TypeError(`Invalid key for this operation, its "use" must be "${i}" when present`)}if(t.alg!==void 0&&t.alg!==e)throw new TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);if(Array.isArray(t.key_ops)){let i;switch(!0){case n==="verify":case e==="dir":case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):!e.includes("GCM")&&e.endsWith("KW")?i="unwrapKey":i=n;break;case n==="encrypt":i="wrapKey";break;case n==="decrypt":i=e.startsWith("RSA")?"unwrapKey":"deriveBits";break}if(i&&((o=(r=t.key_ops)==null?void 0:r.includes)==null?void 0:o.call(r,i))===!1)throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${i}" when present`)}return!0},Vh=(e,t,n)=>{if(!(t instanceof Uint8Array)){if(ha(t)){if(Kh(t)&&Us(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!pl(t))throw new TypeError(ll(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(t.type!=="secret")throw new TypeError(`${Dr(t)} instances for symmetric algorithms must be of type "secret"`)}},qh=(e,t,n)=>{if(ha(t))switch(n){case"decrypt":case"sign":if(jh(t)&&Us(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(Lh(t)&&Us(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!pl(t))throw new TypeError(ll(e,t,"CryptoKey","KeyObject","JSON Web Key"));if(t.type==="secret")throw new TypeError(`${Dr(t)} instances for asymmetric algorithms must not be of type "secret"`);if(t.type==="public")switch(n){case"sign":throw new TypeError(`${Dr(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${Dr(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if(t.type==="private")switch(n){case"verify":throw new TypeError(`${Dr(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${Dr(t)} instances for asymmetric algorithm encryption must be of type "public"`)}},Bh=(e,t,n)=>{e.startsWith("HS")||e==="dir"||e.startsWith("PBES2")||/^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(e)||/^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(e)?Vh(e,t,n):qh(e,t,n)},Hh=(e,t)=>{const n=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};default:throw new fr(`alg ${e} is not supported either by JOSE or your javascript runtime`)}},Jh=async(e,t,n)=>{if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(Th(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[n])}return Nh(t,e,n),t},Wh=async(e,t,n,r)=>{const o=await Jh(e,t,"verify");Ph(e,o);const i=Hh(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch{return!1}};async function zh(e,t,n){if(!Io(e))throw new rt("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new rt('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new rt("JWS Protected Header incorrect type");if(e.payload===void 0)throw new rt("JWS Payload missing");if(typeof e.signature!="string")throw new rt("JWS Signature missing or incorrect type");if(e.header!==void 0&&!Io(e.header))throw new rt("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const v=po(e.protected);r=JSON.parse(Ei.decode(v))}catch{throw new rt("JWS Protected Header is invalid")}if(!Ah(r,e.header))throw new rt("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const o={...r,...e.header},i=Mh(rt,new Map([["b64",!0]]),n==null?void 0:n.crit,r,o);let s=!0;if(i.has("b64")&&(s=r.b64,typeof s!="boolean"))throw new rt('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:a}=o;if(typeof a!="string"||!a)throw new rt('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&kh("algorithms",n.algorithms);if(c&&!c.has(a))throw new al('"alg" (Algorithm) Header Parameter value not allowed');if(s){if(typeof e.payload!="string")throw new rt("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new rt("JWS Payload must be a string or an Uint8Array instance");let f=!1;typeof t=="function"&&(t=await t(r,e),f=!0),Bh(a,t,"verify");const d=xh(no.encode(e.protected??""),no.encode("."),typeof e.payload=="string"?no.encode(e.payload):e.payload);let l;try{l=po(e.signature)}catch{throw new rt("Failed to base64url decode the signature")}const p=await Uh(t,a);if(!await Wh(a,p,l,d))throw new cl;let g;if(s)try{g=po(e.payload)}catch{throw new rt("Failed to base64url decode the payload")}else typeof e.payload=="string"?g=no.encode(e.payload):g=e.payload;const w={payload:g};return e.protected!==void 0&&(w.protectedHeader=r),e.header!==void 0&&(w.unprotectedHeader=e.header),f?{...w,key:p}:w}async function Gh(e,t,n){if(e instanceof Uint8Array&&(e=Ei.decode(e)),typeof e!="string")throw new rt("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:s}=e.split(".");if(s!==3)throw new rt("Invalid Compact JWS");const a=await zh({payload:o,protected:r,signature:i},t,n),c={payload:a.payload,protectedHeader:a.protectedHeader};return typeof t=="function"?{...c,key:a.key}:c}const Qh=e=>Math.floor(e.getTime()/1e3),hl=60,ml=hl*60,ma=ml*24,Xh=ma*7,Yh=ma*365.25,Zh=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Rc=e=>{const t=Zh.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]),r=t[3].toLowerCase();let o;switch(r){case"sec":case"secs":case"second":case"seconds":case"s":o=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":o=Math.round(n*hl);break;case"hour":case"hours":case"hr":case"hrs":case"h":o=Math.round(n*ml);break;case"day":case"days":case"d":o=Math.round(n*ma);break;case"week":case"weeks":case"w":o=Math.round(n*Xh);break;default:o=Math.round(n*Yh);break}return t[1]==="-"||t[4]==="ago"?-o:o},Pc=e=>e.includes("/")?e.toLowerCase():`application/${e.toLowerCase()}`,em=(e,t)=>typeof e=="string"?t.includes(e):Array.isArray(e)?t.some(Set.prototype.has.bind(new Set(e))):!1;function tm(e,t,n={}){let r;try{r=JSON.parse(Ei.decode(t))}catch{}if(!Io(r))throw new pa("JWT Claims Set must be a top-level JSON object");const{typ:o}=n;if(o&&(typeof e.typ!="string"||Pc(e.typ)!==Pc(o)))throw new Ht('unexpected "typ" JWT header value',r,"typ","check_failed");const{requiredClaims:i=[],issuer:s,subject:a,audience:c,maxTokenAge:f}=n,d=[...i];f!==void 0&&d.push("iat"),c!==void 0&&d.push("aud"),a!==void 0&&d.push("sub"),s!==void 0&&d.push("iss");for(const g of new Set(d.reverse()))if(!(g in r))throw new Ht(`missing required "${g}" claim`,r,g,"missing");if(s&&!(Array.isArray(s)?s:[s]).includes(r.iss))throw new Ht('unexpected "iss" claim value',r,"iss","check_failed");if(a&&r.sub!==a)throw new Ht('unexpected "sub" claim value',r,"sub","check_failed");if(c&&!em(r.aud,typeof c=="string"?[c]:c))throw new Ht('unexpected "aud" claim value',r,"aud","check_failed");let l;switch(typeof n.clockTolerance){case"string":l=Rc(n.clockTolerance);break;case"number":l=n.clockTolerance;break;case"undefined":l=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:p}=n,m=Qh(p||new Date);if((r.iat!==void 0||f)&&typeof r.iat!="number")throw new Ht('"iat" claim must be a number',r,"iat","invalid");if(r.nbf!==void 0){if(typeof r.nbf!="number")throw new Ht('"nbf" claim must be a number',r,"nbf","invalid");if(r.nbf>m+l)throw new Ht('"nbf" claim timestamp check failed',r,"nbf","check_failed")}if(r.exp!==void 0){if(typeof r.exp!="number")throw new Ht('"exp" claim must be a number',r,"exp","invalid");if(r.exp<=m-l)throw new $s('"exp" claim timestamp check failed',r,"exp","check_failed")}if(f){const g=m-r.iat,w=typeof f=="number"?f:Rc(f);if(g-l>w)throw new $s('"iat" claim timestamp check failed (too far in the past)',r,"iat","check_failed");if(g<0-l)throw new Ht('"iat" claim timestamp check failed (it should be in the past)',r,"iat","check_failed")}return r}async function nm(e,t,n){var s;const r=await Gh(e,t,n);if((s=r.protectedHeader.crit)!=null&&s.includes("b64")&&r.protectedHeader.b64===!1)throw new pa("JWTs MUST NOT use unencoded payload");const i={payload:tm(r.protectedHeader,r.payload,n),protectedHeader:r.protectedHeader};return typeof t=="function"?{...i,key:r.key}:i}const Vs="amp-labs_jwt_",rm=10*60*1e3,Fc=(e,t)=>`${e}:${t}`,Dc=e=>`${Vs}${e}`,gl=b.createContext(null),im=async e=>{try{const n=(await nm(e,new Uint8Array(0),{algorithms:[]})).payload;return n.exp&&typeof n.exp=="number"?n.exp*1e3:null}catch(t){return console.warn("Failed to decode JWT token:",t),null}};function om({getTokenCallback:e,children:t}){const[n,r]=b.useState(new Map);b.useEffect(()=>{try{const c=new Map,f=Date.now();Object.keys(sessionStorage).forEach(d=>{if(d.startsWith(Vs)){const l=d.replace(Vs,""),p=sessionStorage.getItem(d);if(p)try{const m=JSON.parse(p);m.expiresAt>f?c.set(l,m):sessionStorage.removeItem(d)}catch{sessionStorage.removeItem(d)}}}),c.size>0&&r(c)}catch{console.warn("Failed to load JWT tokens from sessionStorage")}},[]);const o=b.useCallback((c,f)=>{const d=Fc(c,f),l=Date.now(),p=n.get(d);if(p&&p.expiresAt>l)return p.token;n.delete(d);const m=Dc(d),g=sessionStorage.getItem(m);if(g)try{const w=JSON.parse(g);if(w.expiresAt>l)return r(v=>new Map(v).set(d,w)),w.token;sessionStorage.removeItem(m)}catch{sessionStorage.removeItem(m)}return null},[n]),i=b.useCallback(async(c,f,d)=>{const l=Fc(c,f),m=await im(d)||Date.now()+rm,g={token:d,expiresAt:m};r(w=>new Map(w).set(l,g));try{sessionStorage.setItem(Dc(l),JSON.stringify(g))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=b.useCallback(async({consumerRef:c,groupRef:f})=>{const d=o(c,f);if(d)return d;if(!e)throw new Error("JWT token callback not provided");try{const l=await e({consumerRef:c,groupRef:f});return await i(c,f,l),l}catch(l){throw console.error("Failed to get JWT token:",l),new Error("Failed to get JWT token")}},[e,o,i]),a={getToken:e?s:void 0};return u.jsx(gl.Provider,{value:a,children:t})}const sm=()=>{const e=b.useContext(gl);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},ga=b.createContext(null);function Le(){const e=b.useContext(ga);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
2
- component is wrapped with AmpersandProvider`);return e}const am=new ih;function cm(e){const{options:{apiKey:t,projectId:n,project:r,getToken:o},children:i}=e,s=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!s)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t&&!o)throw new Error("Cannot use AmpersandProvider without an apiKey or getToken.");if(t&&o)throw new Error("Cannot use AmpersandProvider with both apiKey and getToken.");const a={options:e.options,projectIdOrName:s};return u.jsx(uh,{client:am,children:u.jsx(ga.Provider,{value:a,children:u.jsx(Sh,{children:u.jsx(om,{getTokenCallback:o||null,children:u.jsx(Ih,{value:t||null,children:i})})})})})}const um="https://api.withampersand.com/v1".replace(/\/+$/,"");class ya{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:um}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||vl}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 lm=new ya,jo=class jo{constructor(t=lm){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 pm(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?jo.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 yl(i,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const o=Object.assign({},this.configuration.headers,t.headers);Object.keys(o).forEach(f=>o[f]===void 0?delete o[f]:{});const i=typeof n=="function"?n:async()=>n,s={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},a={...s,...await i({init:s,context:t})},c={...a,body:fm(a.body)||a.body instanceof URLSearchParams||dm(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}};jo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let sn=jo;function dm(e){return typeof Blob<"u"&&e instanceof Blob}function fm(e){return typeof FormData<"u"&&e instanceof FormData}class yl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class pm extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function N(e,t){const n=e[t];return n!=null}function vl(e,t=""){return Object.keys(e).map(n=>wl(n,e[n],t)).filter(n=>n.length>0).join("&")}function wl(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 wl(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?vl(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function He(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Me{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Xr{constructor(t){this.raw=t}async value(){}}class Mc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function hm(e){return mm(e)}function mm(e,t){return e==null?e:{fieldUsed:N(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:N(e,"keyFormat")?e.keyFormat:void 0}}function gm(e){return ym(e)}function ym(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function vm(e){return wm(e)}function wm(e,t){return e==null?e:{name:e.name}}function bm(e){return Im(e)}function Im(e,t){return e==null?e:{attachmentType:e.attachmentType,query:N(e,"query")?vm(e.query):void 0,header:N(e,"header")?gm(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Cm(e){return Sm(e)}function Sm(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,includeFullRecords:N(e,"includeFullRecords")?e.includeFullRecords:void 0}}function xm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function Om(e){return Em(e)}function Em(e,t){return e==null?e:{url:e.url,method:N(e,"method")?e.method:void 0,successStatusCodes:N(e,"successStatusCodes")?e.successStatusCodes:void 0}}const kc={ApiKey:"apiKey",Basic:"basic"};function _m(e){return Nm(e)}function Nm(e,t){return e}function Tm(e){return Am(e)}function Am(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function Rm(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function bl(e){return Pm(e)}function Pm(e,t){return e==null?e:{defaultPeriod:Tm(e.defaultPeriod)}}function Fm(e){if(e!==void 0)return e===null?null:{defaultPeriod:Rm(e.defaultPeriod)}}function Dm(e){return Mm(e)}function Mm(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function km(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function jm(e){return Lm(e)}function Lm(e,t){return e==null?e:{defaultPeriod:Dm(e.defaultPeriod)}}function Il(e){if(e!==void 0)return e===null?null:{defaultPeriod:km(e.defaultPeriod)}}function Km(e){return $m(e)}function $m(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,useModule:N(e,"useModule")?e.useModule:void 0}}function Cl(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function Um(e){return Vm(e)}function Vm(e,t){return e}function qm(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:Il(e.backfill)}}function Bm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:He(e.objects,qm)}}function Hm(e){return Jm(e)}function Jm(e,t){return e==null?e:{stringValue:N(e,"stringValue")?e.stringValue:void 0,integerValue:N(e,"integerValue")?e.integerValue:void 0,booleanValue:N(e,"booleanValue")?e.booleanValue:void 0}}function Wm(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const zm={Always:"always",Never:"never"},Gm={Always:"always",Never:"never"};function Qm(e){return Xm(e)}function Xm(e,t){return e==null?e:{default:N(e,"default")?Hm(e.default):void 0,writeOnCreate:N(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:N(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function Sl(e){if(e!==void 0)return e===null?null:{default:Wm(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function Ym(e){let t=!0;return t=t&&"value"in e,t}function Zm(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function eg(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function tg(e){let t=!0;return t=t&&"value"in e,t}function ng(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function rg(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function ig(e){let t=!0;return t=t&&"value"in e,t}function og(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function sg(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function ag(e){return cg(e)}function cg(e,t){return e==null?e:{...Zm(e),...ng(e),...og(e)}}function xl(e){if(e!==void 0)return e===null?null:Ym(e)?eg(e):tg(e)?rg(e):ig(e)?sg(e):{}}function ug(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:He(e.selectedValueDefaults,xl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:He(e.selectedFieldSettings,Sl)}}function lg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:He(e.objects,ug)}}function dg(e){return fg(e)}function fg(e,t){return e==null?e:{enabled:e.enabled}}function pg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function hg(e){return mg(e)}function mg(e,t){return e==null?e:{enabled:e.enabled}}function gg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function yg(e){return vg(e)}function vg(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:N(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:N(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function wg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function bg(e){return Ig(e)}function Ig(e,t){return e==null?e:{apiKeyAsBasic:N(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:N(e,"apiKeyAsBasicOpts")?hm(e.apiKeyAsBasicOpts):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Cg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Sg(e){return xg(e)}function xg(e,t){return e==null?e:{value:e.value}}function Og(e){return Eg(e)}function Eg(e,t){return e==null?e:{brandingRemoval:N(e,"brandingRemoval")?Sg(e.brandingRemoval):void 0}}function ro(e){return _g(e)}function _g(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:N(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:N(e,"entitlements")?Og(e.entitlements):void 0}}function Ng(e){return Tg(e)}function Tg(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Ag(e){return Rg(e)}function Rg(e,t){return e==null?e:{objectName:e.objectName,schedule:N(e,"schedule")?e.schedule:void 0,destination:N(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:N(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:N(e,"selectedFieldsAuto")?Um(e.selectedFieldsAuto):void 0,backfill:N(e,"backfill")?jm(e.backfill):void 0}}function Pg(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:Il(e.backfill)}}function Fg(e){return Dg(e)}function Dg(e,t){return e==null?e:{objects:He(e.objects,Ag)}}function Mg(e){if(e!==void 0)return e===null?null:{objects:He(e.objects,Pg)}}function kg(e){return jg(e)}function jg(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:N(e,"createEvent")?dg(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?yg(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?hg(e.deleteEvent):void 0}}function Lg(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:pg(e.createEvent),updateEvent:wg(e.updateEvent),deleteEvent:gg(e.deleteEvent)}}function Kg(e){return $g(e)}function $g(e,t){return e==null?e:{objects:He(e.objects,kg)}}function Ug(e){if(e!==void 0)return e===null?null:{objects:He(e.objects,Lg)}}function Vg(e){return qg(e)}function qg(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:N(e,"selectedValueDefaults")?He(e.selectedValueDefaults,ag):void 0,selectedFieldSettings:N(e,"selectedFieldSettings")?He(e.selectedFieldSettings,Qm):void 0}}function Bg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:He(e.selectedValueDefaults,xl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:He(e.selectedFieldSettings,Sl)}}function Hg(e){return Jg(e)}function Jg(e,t){return e==null?e:{objects:N(e,"objects")?He(e.objects,Vg):void 0}}function Wg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:He(e.objects,Bg)}}function zg(e){return Gg(e)}function Gg(e,t){return e==null?e:{provider:e.provider,module:N(e,"module")?e.module:void 0,read:N(e,"read")?Fg(e.read):void 0,write:N(e,"write")?Hg(e.write):void 0,proxy:N(e,"proxy")?Km(e.proxy):void 0,subscribe:N(e,"subscribe")?Kg(e.subscribe):void 0}}function Qg(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:Mg(e.read),write:Wg(e.write),proxy:Cl(e.proxy),subscribe:Ug(e.subscribe)}}function Xg(e){return Yg(e)}function Yg(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:zg(e.content)}}function Zg(e){return ey(e)}function ey(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function Ol(e){return ty(e)}function ty(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function ny(e){return ry(e)}function ry(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function iy(e){return oy(e)}function oy(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function sy(e){return ay(e)}function ay(e,t){return e==null?e:{accessToken:N(e,"accessToken")?ny(e.accessToken):void 0,refreshToken:N(e,"refreshToken")?iy(e.refreshToken):void 0,scopes:N(e,"scopes")?e.scopes:void 0}}function ho(e){return cy(e)}function cy(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:N(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:N(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function uy(e){return ly(e)}function ly(e,t){return e==null?e:{value:e.value,source:e.source,displayName:N(e,"displayName")?e.displayName:void 0}}function va(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function Ii(e){return dy(e)}function dy(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:N(e,"providerApp")?ho(e.providerApp):void 0,group:Ol(e.group),consumer:Zg(e.consumer),providerWorkspaceRef:N(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:N(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:N(e,"oauth2AuthorizationCode")?sy(e.oauth2AuthorizationCode):void 0,apiKey:N(e,"apiKey")?e.apiKey:void 0,providerMetadata:N(e,"providerMetadata")?He(e.providerMetadata,uy):void 0}}function El(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 Nl(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 fy(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 py(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 Tl(e){if(e!==void 0)return e===null?null:{accessToken:fy(e.accessToken),refreshToken:py(e.refreshToken),scopes:e.scopes}}function hy(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:He(e.providerMetadata,va),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:El(e.basicAuth),oauth2ClientCredentials:_l(e.oauth2ClientCredentials),oauth2PasswordCredentials:Nl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Tl(e.oauth2AuthorizationCode)}}function my(e){return gy(e)}function gy(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function yy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function vy(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Qg(e.content)}}function wy(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:vy(e.config)}}function by(e){return Iy(e)}function Iy(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,useModule:N(e,"useModule")?e.useModule:void 0}}function Cy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function Sy(e){return xy(e)}function xy(e,t){return e==null?e:{mode:N(e,"mode")?e.mode:void 0,pageSize:N(e,"pageSize")?e.pageSize:void 0}}function Oy(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Ey(e){let t=!0;return t=t&&"fieldName"in e,t}function _y(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Ny(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Ty(e){let t=!0;return t=t&&"mapToName"in e,t}function Al(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:N(e,"default")?e.default:void 0,prompt:N(e,"prompt")?e.prompt:void 0}}function Ay(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function jc(e){return Ry(e)}function Ry(e,t){return e==null?e:{..._y(e),...Al(e)}}function Lc(e){if(e!==void 0)return e===null?null:Ey(e)?Ny(e):Ty(e)?Ay(e):{}}function Rl(e){return Py(e)}function Py(e,t){return e}function Fy(e){return Dy(e)}function Dy(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:N(e,"requiredFields")?e.requiredFields.map(jc):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(jc):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Rl(e.optionalFieldsAuto):void 0,backfill:N(e,"backfill")?bl(e.backfill):void 0,delivery:N(e,"delivery")?Sy(e.delivery):void 0,enabled:N(e,"enabled")?e.enabled:void 0}}function My(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(Lc),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Lc),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Fm(e.backfill),delivery:Oy(e.delivery),enabled:e.enabled}}function ky(e){return jy(e)}function jy(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Fy):void 0}}function Ly(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(My)}}function Ky(e){return $y(e)}function $y(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Uy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Vy(e){return qy(e)}function qy(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,watchFieldsAuto:N(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:N(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function By(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Hy(e){return Jy(e)}function Jy(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:N(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:N(e,"createEvent")?my(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?Vy(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?Ky(e.deleteEvent):void 0,associationChangeEvent:N(e,"associationChangeEvent")?Cm(e.associationChangeEvent):void 0,otherEvents:N(e,"otherEvents")?e.otherEvents:void 0}}function Wy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:yy(e.createEvent),updateEvent:By(e.updateEvent),deleteEvent:Uy(e.deleteEvent),associationChangeEvent:xm(e.associationChangeEvent),otherEvents:e.otherEvents}}function zy(e){return Gy(e)}function Gy(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Hy):void 0}}function Qy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Wy)}}function Pl(e){return Xy(e)}function Xy(e,t){return e==null?e:{allowAnyFields:N(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Yy(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Zy(e){return ev(e)}function ev(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:N(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:N(e,"valueDefaults")?Pl(e.valueDefaults):void 0}}function tv(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Yy(e.valueDefaults)}}function nv(e){return rv(e)}function rv(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Zy):void 0}}function iv(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(tv)}}function ov(e){return sv(e)}function sv(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:N(e,"displayName")?e.displayName:void 0,module:N(e,"module")?e.module:void 0,read:N(e,"read")?ky(e.read):void 0,write:N(e,"write")?nv(e.write):void 0,proxy:N(e,"proxy")?by(e.proxy):void 0,subscribe:N(e,"subscribe")?zy(e.subscribe):void 0}}function av(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:Ly(e.read),write:iv(e.write),proxy:Cy(e.proxy),subscribe:Qy(e.subscribe)}}function cv(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:av(e.content)}}function uv(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:cv(e.latestRevision)}}function lv(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function dv(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 fv(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function pv(e){return hv(e)}function hv(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function mv(e){return gv(e)}function gv(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:N(e,"prompt")?e.prompt:void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function yv(e){return vv(e)}function vv(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function wv(e){return bv(e)}function bv(e,t){return e==null?e:{headers:N(e,"headers")?e.headers.map(pv):void 0,queryParams:N(e,"queryParams")?e.queryParams.map(yv):void 0,inputs:N(e,"inputs")?e.inputs.map(mv):void 0}}function Iv(e){return Cv(e)}function Cv(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Sv(e){return xv(e)}function xv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:N(e,"valueType")?e.valueType:void 0,providerType:N(e,"providerType")?e.providerType:void 0,readOnly:N(e,"readOnly")?e.readOnly:void 0,values:N(e,"values")?e.values.map(Iv):void 0}}function Ov(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:He(e.providerMetadata,va),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:El(e.basicAuth),oauth2ClientCredentials:_l(e.oauth2ClientCredentials),oauth2PasswordCredentials:Nl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Tl(e.oauth2AuthorizationCode)}}function Ev(e){return _v(e)}function _v(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,useModule:N(e,"useModule")?e.useModule:void 0}}function Nv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function ss(e){return Tv(e)}function Tv(e,t){return e==null?e:{...Nv(e),...Al(e)}}function Av(e){return Rv(e)}function Rv(e,t){return e==null?e:{error:N(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:N(e,"requiredFields")?e.requiredFields.map(ss):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(ss):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Rl(e.optionalFieldsAuto):void 0,allFieldsMetadata:N(e,"allFieldsMetadata")?He(e.allFieldsMetadata,Sv):void 0,allFields:N(e,"allFields")?e.allFields.map(ss):void 0,backfill:N(e,"backfill")?bl(e.backfill):void 0}}function Pv(e){return Fv(e)}function Fv(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Av):void 0}}function Dv(e){return Mv(e)}function Mv(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:N(e,"valueDefaults")?Pl(e.valueDefaults):void 0}}function kv(e){return jv(e)}function jv(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Dv):void 0}}function Lv(e){return Kv(e)}function Kv(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,module:N(e,"module")?e.module:void 0,provider:e.provider,read:N(e,"read")?Pv(e.read):void 0,write:N(e,"write")?kv(e.write):void 0,proxy:N(e,"proxy")?Ev(e.proxy):void 0}}function $v(e){return Uv(e)}function Uv(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Lv(e.content)}}function vi(e){return Vv(e)}function Vv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:N(e,"group")?Ol(e.group):void 0,healthStatus:e.healthStatus,connection:Ii(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,config:Xg(e.config)}}function qv(e){return Bv(e)}function Bv(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:ov(e.content)}}function as(e){return Hv(e)}function Hv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:qv(e.latestRevision)}}function Jv(e){return Wv(e)}function Wv(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function zv(e){return Gv(e)}function Gv(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function Qv(e){return Xv(e)}function Xv(e,t){return e==null?e:{regular:N(e,"regular")?zv(e.regular):void 0,darkMode:N(e,"darkMode")?Jv(e.darkMode):void 0}}function Yv(e){return Zv(e)}function Zv(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,defaultValue:N(e,"defaultValue")?e.defaultValue:void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function ew(e){return tw(e)}function tw(e,t){return e==null?e:{name:e.name,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function nw(e){return rw(e)}function rw(e,t){return e==null?e:{create:N(e,"create")?e.create:void 0,update:N(e,"update")?e.update:void 0,_delete:N(e,"delete")?e.delete:void 0,passThrough:N(e,"passThrough")?e.passThrough:void 0}}function Fl(e){return iw(e)}function iw(e,t){return e==null?e:{bulkWrite:Ng(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:N(e,"subscribeSupport")?nw(e.subscribeSupport):void 0}}function ow(e){return sw(e)}function sw(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Fl(e.support)}}function aw(e){return cw(e)}function cw(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:N(e,"capture")?e.capture:void 0}}function uw(e){return lw(e)}function lw(e,t){return e==null?e:{workspaceRefField:N(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:N(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:N(e,"scopesField")?e.scopesField:void 0,otherFields:N(e,"otherFields")?e.otherFields.map(aw):void 0}}const cs={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function dw(e){return fw(e)}function fw(e,t){return e==null?e:{grantType:e.grantType,authURL:N(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:N(e,"audience")?e.audience:void 0,tokenMetadataFields:uw(e.tokenMetadataFields),docsURL:N(e,"docsURL")?e.docsURL:void 0,authURLParams:N(e,"authURLParams")?e.authURLParams:void 0}}function pw(e){if(e!==void 0)return e===null?null:{projectId:e.projectId,provider:e.provider,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:He(e.providerMetadata,va),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function hw(e){return mw(e)}function mw(e,t){return e==null?e:{input:N(e,"input")?e.input.map(Yv):void 0,postAuthentication:N(e,"postAuthentication")?e.postAuthentication.map(ew):void 0}}function gw(e){return yw(e)}function yw(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Kc(e){return vw(e)}function vw(e,t){return e==null?e:{name:e.name,authType:_m(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:N(e,"oauth2Opts")?dw(e.oauth2Opts):void 0,apiKeyOpts:N(e,"apiKeyOpts")?bm(e.apiKeyOpts):void 0,basicOpts:N(e,"basicOpts")?bg(e.basicOpts):void 0,customOpts:N(e,"customOpts")?wv(e.customOpts):void 0,support:Fl(e.support),providerOpts:e.providerOpts,authHealthCheck:N(e,"authHealthCheck")?Om(e.authHealthCheck):void 0,displayName:N(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:N(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:N(e,"media")?Qv(e.media):void 0,labels:N(e,"labels")?e.labels:void 0,subscribeOpts:N(e,"subscribeOpts")?gw(e.subscribeOpts):void 0,modules:N(e,"modules")?He(e.modules,ow):void 0,metadata:N(e,"metadata")?hw(e.metadata):void 0}}function ww(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:hy(e.connection)}}function bw(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:Bm(e.read),write:lg(e.write),proxy:Cl(e.proxy)}}function Iw(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:bw(e.content)}}function Cw(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Iw(e.config)}}function Sw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Cw(e.installation)}}function xw(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function Ow(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:xw(e.project)}}function Ew(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 _w(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Ew(e.providerApp)}}class Nw extends sn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new Xr(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Ov(t.generateConnectionParams)},n);return new Me(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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new Me(i,s=>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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Me(i,s=>s.map(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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ie("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:ww(t.updateConnectionRequest)},n);return new Me(i,s=>Ii(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Tw extends sn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:wy(t.installation)},n);return new Me(i,s=>vi(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:o,query:r},n);return new Xr(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:r},n);return new Me(i,s=>vi(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new Me(i,s=>s.map(vi))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async listInstallationsForProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallationsForProject.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Me(i,s=>s.map(vi))}async listInstallationsForProject(t,n){return await(await this.listInstallationsForProjectRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ie("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:o,query:r,body:Sw(t.installationUpdate)},n);return new Me(i,s=>vi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Aw extends sn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ie("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:Cg(t.batchUpsertIntegrationsRequest)},n);return new Me(i,s=>s.map(as))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ie("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:uv(t.integration)},n);return new Xr(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new Xr(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new ie("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getIntegration.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationIdOrName}".replace("{integrationIdOrName}",encodeURIComponent(String(t.integrationIdOrName))).replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Me(i,s=>as(s))}async getIntegration(t,n){return await(await this.getIntegrationRaw(t,n)).value()}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Me(i,s=>s.map(as))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Rw extends sn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:pw(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Me(i):new Mc(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new Me(i):new Mc(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Pw extends sn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:lv(t.project)},n);return new Me(i,s=>ro(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Me(i,s=>ro(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const i=this.configuration.accessToken,s=await i("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Me(o,i=>i.map(ro))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ie("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:Ow(t.projectUpdate)},n);return new Me(i,s=>ro(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Fw extends sn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new Me(i,s=>Kc(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const i=this.configuration.accessToken,s=await i("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Me(o,i=>He(i,Kc))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Dw extends sn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:dv(t.providerApp)},n);return new Me(i,s=>ho(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new Xr(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Me(i,s=>s.map(ho))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ie("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:_w(t.providerAppUpdate)},n);return new Me(i,s=>ho(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Mw extends sn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ie("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:fv(t.revision)},n);return new Xr(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ie("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:o,query:r},n);return new Me(i,s=>$v(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var Dl=Symbol.for("immer-nothing"),$c=Symbol.for("immer-draftable"),Pt=Symbol.for("immer-state"),kw=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 Ot(e,...t){if(process.env.NODE_ENV!=="production"){const n=kw[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 Yr=Object.getPrototypeOf;function Zr(e){return!!e&&!!e[Pt]}function Or(e){var t;return e?Ml(e)||Array.isArray(e)||!!e[$c]||!!((t=e.constructor)!=null&&t[$c])||ji(e)||Ko(e):!1}var jw=Object.prototype.constructor.toString();function Ml(e){if(!e||typeof e!="object")return!1;const t=Yr(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)===jw}function Co(e,t){Lo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Lo(e){const t=e[Pt];return t?t.type_:Array.isArray(e)?1:ji(e)?2:Ko(e)?3:0}function qs(e,t){return Lo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function kl(e,t,n){const r=Lo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Lw(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ji(e){return e instanceof Map}function Ko(e){return e instanceof Set}function dr(e){return e.copy_||e.base_}function Bs(e,t){if(ji(e))return new Map(e);if(Ko(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ml(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Pt];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(Yr(e),r)}else{const r=Yr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function wa(e,t=!1){return $o(e)||Zr(e)||!Or(e)||(Lo(e)>1&&Object.defineProperties(e,{set:{value:io},add:{value:io},clear:{value:io},delete:{value:io}}),Object.freeze(e),t&&Object.values(e).forEach(n=>wa(n,!0))),e}function io(){Ot(2)}function $o(e){return Object.isFrozen(e)}var Kw={};function Er(e){const t=Kw[e];return t||Ot(0,e),t}var _i;function jl(){return _i}function $w(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Uc(e,t){t&&(Er("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Hs(e){Js(e),e.drafts_.forEach(Uw),e.drafts_=null}function Js(e){e===_i&&(_i=e.parent_)}function Vc(e){return _i=$w(_i,e)}function Uw(e){const t=e[Pt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function qc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Pt].modified_&&(Hs(t),Ot(4)),Or(e)&&(e=So(t,e),t.parent_||xo(t,e)),t.patches_&&Er("Patches").generateReplacementPatches_(n[Pt].base_,e,t.patches_,t.inversePatches_)):e=So(t,n,[]),Hs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Dl?e:void 0}function So(e,t,n){if($o(t))return t;const r=t[Pt];if(!r)return Co(t,(o,i)=>Bc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return xo(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let i=o,s=!1;r.type_===3&&(i=new Set(o),o.clear(),s=!0),Co(i,(a,c)=>Bc(e,r,o,a,c,n,s)),xo(e,o,!1),n&&e.patches_&&Er("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Bc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&Ot(5),Zr(o)){const a=i&&t&&t.type_!==3&&!qs(t.assigned_,r)?i.concat(r):void 0,c=So(e,o,a);if(kl(n,r,c),Zr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(Or(o)&&!$o(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;So(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(ji(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&xo(e,o)}}function xo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&wa(t,n)}function Vw(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:jl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=ba;n&&(o=[r],i=Ni);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var ba={get(e,t){if(t===Pt)return e;const n=dr(e);if(!qs(n,t))return qw(e,n,t);const r=n[t];return e.finalized_||!Or(r)?r:r===us(e.base_,t)?(ls(e),e.copy_[t]=zs(r,e)):r},has(e,t){return t in dr(e)},ownKeys(e){return Reflect.ownKeys(dr(e))},set(e,t,n){const r=Ll(dr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=us(dr(e),t),i=o==null?void 0:o[Pt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Lw(n,o)&&(n!==void 0||qs(e.base_,t)))return!0;ls(e),Ws(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 us(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ls(e),Ws(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=dr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Ot(11)},getPrototypeOf(e){return Yr(e.base_)},setPrototypeOf(){Ot(12)}},Ni={};Co(ba,(e,t)=>{Ni[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Ni.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ot(13),Ni.set.call(this,e,t,void 0)};Ni.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ot(14),ba.set.call(this,e[0],t,n,e[0])};function us(e,t){const n=e[Pt];return(n?dr(n):e)[t]}function qw(e,t,n){var o;const r=Ll(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Ll(e,t){if(!(t in e))return;let n=Yr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Yr(n)}}function Ws(e){e.modified_||(e.modified_=!0,e.parent_&&Ws(e.parent_))}function ls(e){e.copy_||(e.copy_=Bs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Bw=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(c=i,...f){return s.produce(c,d=>n.call(this,d,...f))}}typeof n!="function"&&Ot(6),r!==void 0&&typeof r!="function"&&Ot(7);let o;if(Or(t)){const i=Vc(this),s=zs(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Hs(i):Js(i)}return Uc(i,r),qc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===Dl&&(o=void 0),this.autoFreeze_&&wa(o,!0),r){const i=[],s=[];Er("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else Ot(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){Or(e)||Ot(8),Zr(e)&&(e=Hw(e));const t=Vc(this),n=zs(e,void 0);return n[Pt].isManual_=!0,Js(t),n}finishDraft(e,t){const n=e&&e[Pt];(!n||!n.isManual_)&&Ot(9);const{scope_:r}=n;return Uc(r,t),qc(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=Er("Patches").applyPatches_;return Zr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function zs(e,t){const n=ji(e)?Er("MapSet").proxyMap_(e,t):Ko(e)?Er("MapSet").proxySet_(e,t):Vw(e,t);return(t?t.scope_:jl()).drafts_.push(n),n}function Hw(e){return Zr(e)||Ot(10,e),Kl(e)}function Kl(e){if(!Or(e)||$o(e))return e;const t=e[Pt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Bs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Bs(e,!0);return Co(n,(r,o)=>{kl(n,r,Kl(o))}),t&&(t.finalized_=!1),n}var Jw=new Bw,Tt=Jw.produce,zn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Uo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Oo={exports:{}};Oo.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",d="[object Boolean]",l="[object Date]",p="[object Error]",m="[object Function]",g="[object GeneratorFunction]",w="[object Map]",v="[object Number]",x="[object Null]",h="[object Object]",y="[object Promise]",I="[object Proxy]",S="[object RegExp]",E="[object Set]",P="[object String]",_="[object Symbol]",A="[object Undefined]",R="[object WeakMap]",M="[object ArrayBuffer]",j="[object DataView]",K="[object Float32Array]",$="[object Float64Array]",ce="[object Int8Array]",re="[object Int16Array]",pe="[object Int32Array]",de="[object Uint8Array]",be="[object Uint8ClampedArray]",F="[object Uint16Array]",L="[object Uint32Array]",B=/[\\^$.*+?()[\]{}|]/g,H=/^\[object .+?Constructor\]$/,J=/^(?:0|[1-9]\d*)$/,U={};U[K]=U[$]=U[ce]=U[re]=U[pe]=U[de]=U[be]=U[F]=U[L]=!0,U[a]=U[c]=U[M]=U[d]=U[j]=U[l]=U[p]=U[m]=U[w]=U[v]=U[h]=U[S]=U[E]=U[P]=U[R]=!1;var X=typeof zn=="object"&&zn&&zn.Object===Object&&zn,ee=typeof self=="object"&&self&&self.Object===Object&&self,Y=X||ee||Function("return this")(),te=t&&!t.nodeType&&t,ne=te&&!0&&e&&!e.nodeType&&e,ue=ne&&ne.exports===te,k=ue&&X.process,ve=function(){try{return k&&k.binding&&k.binding("util")}catch{}}(),z=ve&&ve.isTypedArray;function Ye(C,T){for(var D=-1,Z=C==null?0:C.length,Fe=0,fe=[];++D<Z;){var Ue=C[D];T(Ue,D,C)&&(fe[Fe++]=Ue)}return fe}function Ce(C,T){for(var D=-1,Z=T.length,Fe=C.length;++D<Z;)C[Fe+D]=T[D];return C}function lt(C,T){for(var D=-1,Z=C==null?0:C.length;++D<Z;)if(T(C[D],D,C))return!0;return!1}function Be(C,T){for(var D=-1,Z=Array(C);++D<C;)Z[D]=T(D);return Z}function ot(C){return function(T){return C(T)}}function Se(C,T){return C.has(T)}function Ge(C,T){return C==null?void 0:C[T]}function ht(C){var T=-1,D=Array(C.size);return C.forEach(function(Z,Fe){D[++T]=[Fe,Z]}),D}function wt(C,T){return function(D){return C(T(D))}}function bt(C){var T=-1,D=Array(C.size);return C.forEach(function(Z){D[++T]=Z}),D}var Ze=Array.prototype,et=Function.prototype,De=Object.prototype,q=Y["__core-js_shared__"],he=et.toString,Oe=De.hasOwnProperty,fn=function(){var C=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),pn=De.toString,hn=RegExp("^"+he.call(Oe).replace(B,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),It=ue?Y.Buffer:void 0,Pe=Y.Symbol,sr=Y.Uint8Array,Tn=De.propertyIsEnumerable,An=Ze.splice,_t=Pe?Pe.toStringTag:void 0,mn=Object.getOwnPropertySymbols,Rn=It?It.isBuffer:void 0,Pn=wt(Object.keys,Object),gn=Pr(Y,"DataView"),en=Pr(Y,"Map"),Ke=Pr(Y,"Promise"),dt=Pr(Y,"Set"),oe=Pr(Y,"WeakMap"),me=Pr(Object,"create"),mt=cr(gn),yn=cr(en),G=cr(Ke),ae=cr(dt),le=cr(oe),$e=Pe?Pe.prototype:void 0,Je=$e?$e.valueOf:void 0;function tt(C){var T=-1,D=C==null?0:C.length;for(this.clear();++T<D;){var Z=C[T];this.set(Z[0],Z[1])}}function Dt(){this.__data__=me?me(null):{},this.size=0}function st(C){var T=this.has(C)&&delete this.__data__[C];return this.size-=T?1:0,T}function Ct(C){var T=this.__data__;if(me){var D=T[C];return D===r?void 0:D}return Oe.call(T,C)?T[C]:void 0}function Re(C){var T=this.__data__;return me?T[C]!==void 0:Oe.call(T,C)}function Fn(C,T){var D=this.__data__;return this.size+=this.has(C)?0:1,D[C]=me&&T===void 0?r:T,this}tt.prototype.clear=Dt,tt.prototype.delete=st,tt.prototype.get=Ct,tt.prototype.has=Re,tt.prototype.set=Fn;function Ut(C){var T=-1,D=C==null?0:C.length;for(this.clear();++T<D;){var Z=C[T];this.set(Z[0],Z[1])}}function ts(){this.__data__=[],this.size=0}function Hi(C){var T=this.__data__,D=Gi(T,C);if(D<0)return!1;var Z=T.length-1;return D==Z?T.pop():An.call(T,D,1),--this.size,!0}function Ji(C){var T=this.__data__,D=Gi(T,C);return D<0?void 0:T[D][1]}function Wi(C){return Gi(this.__data__,C)>-1}function zi(C,T){var D=this.__data__,Z=Gi(D,C);return Z<0?(++this.size,D.push([C,T])):D[Z][1]=T,this}Ut.prototype.clear=ts,Ut.prototype.delete=Hi,Ut.prototype.get=Ji,Ut.prototype.has=Wi,Ut.prototype.set=zi;function tn(C){var T=-1,D=C==null?0:C.length;for(this.clear();++T<D;){var Z=C[T];this.set(Z[0],Z[1])}}function xe(){this.size=0,this.__data__={hash:new tt,map:new(en||Ut),string:new tt}}function Vt(C){var T=Qi(this,C).delete(C);return this.size-=T?1:0,T}function hi(C){return Qi(this,C).get(C)}function ar(C){return Qi(this,C).has(C)}function ns(C,T){var D=Qi(this,C),Z=D.size;return D.set(C,T),this.size+=D.size==Z?0:1,this}tn.prototype.clear=xe,tn.prototype.delete=Vt,tn.prototype.get=hi,tn.prototype.has=ar,tn.prototype.set=ns;function Dn(C){var T=-1,D=C==null?0:C.length;for(this.__data__=new tn;++T<D;)this.add(C[T])}function fp(C){return this.__data__.set(C,r),this}function pp(C){return this.__data__.has(C)}Dn.prototype.add=Dn.prototype.push=fp,Dn.prototype.has=pp;function Mn(C){var T=this.__data__=new Ut(C);this.size=T.size}function hp(){this.__data__=new Ut,this.size=0}function mp(C){var T=this.__data__,D=T.delete(C);return this.size=T.size,D}function gp(C){return this.__data__.get(C)}function yp(C){return this.__data__.has(C)}function vp(C,T){var D=this.__data__;if(D instanceof Ut){var Z=D.__data__;if(!en||Z.length<n-1)return Z.push([C,T]),this.size=++D.size,this;D=this.__data__=new tn(Z)}return D.set(C,T),this.size=D.size,this}Mn.prototype.clear=hp,Mn.prototype.delete=mp,Mn.prototype.get=gp,Mn.prototype.has=yp,Mn.prototype.set=vp;function wp(C,T){var D=Xi(C),Z=!D&&Dp(C),Fe=!D&&!Z&&rs(C),fe=!D&&!Z&&!Fe&&vc(C),Ue=D||Z||Fe||fe,nt=Ue?Be(C.length,String):[],at=nt.length;for(var ke in C)Oe.call(C,ke)&&!(Ue&&(ke=="length"||Fe&&(ke=="offset"||ke=="parent")||fe&&(ke=="buffer"||ke=="byteLength"||ke=="byteOffset")||Tp(ke,at)))&&nt.push(ke);return nt}function Gi(C,T){for(var D=C.length;D--;)if(hc(C[D][0],T))return D;return-1}function bp(C,T,D){var Z=T(C);return Xi(C)?Z:Ce(Z,D(C))}function mi(C){return C==null?C===void 0?A:x:_t&&_t in Object(C)?_p(C):Fp(C)}function lc(C){return gi(C)&&mi(C)==a}function dc(C,T,D,Z,Fe){return C===T?!0:C==null||T==null||!gi(C)&&!gi(T)?C!==C&&T!==T:Ip(C,T,D,Z,dc,Fe)}function Ip(C,T,D,Z,Fe,fe){var Ue=Xi(C),nt=Xi(T),at=Ue?c:kn(C),ke=nt?c:kn(T);at=at==a?h:at,ke=ke==a?h:ke;var Nt=at==h,qt=ke==h,ft=at==ke;if(ft&&rs(C)){if(!rs(T))return!1;Ue=!0,Nt=!1}if(ft&&!Nt)return fe||(fe=new Mn),Ue||vc(C)?fc(C,T,D,Z,Fe,fe):Op(C,T,at,D,Z,Fe,fe);if(!(D&o)){var Mt=Nt&&Oe.call(C,"__wrapped__"),kt=qt&&Oe.call(T,"__wrapped__");if(Mt||kt){var jn=Mt?C.value():C,vn=kt?T.value():T;return fe||(fe=new Mn),Fe(jn,vn,D,Z,fe)}}return ft?(fe||(fe=new Mn),Ep(C,T,D,Z,Fe,fe)):!1}function Cp(C){if(!yc(C)||Rp(C))return!1;var T=mc(C)?hn:H;return T.test(cr(C))}function Sp(C){return gi(C)&&gc(C.length)&&!!U[mi(C)]}function xp(C){if(!Pp(C))return Pn(C);var T=[];for(var D in Object(C))Oe.call(C,D)&&D!="constructor"&&T.push(D);return T}function fc(C,T,D,Z,Fe,fe){var Ue=D&o,nt=C.length,at=T.length;if(nt!=at&&!(Ue&&at>nt))return!1;var ke=fe.get(C);if(ke&&fe.get(T))return ke==T;var Nt=-1,qt=!0,ft=D&i?new Dn:void 0;for(fe.set(C,T),fe.set(T,C);++Nt<nt;){var Mt=C[Nt],kt=T[Nt];if(Z)var jn=Ue?Z(kt,Mt,Nt,T,C,fe):Z(Mt,kt,Nt,C,T,fe);if(jn!==void 0){if(jn)continue;qt=!1;break}if(ft){if(!lt(T,function(vn,ur){if(!Se(ft,ur)&&(Mt===vn||Fe(Mt,vn,D,Z,fe)))return ft.push(ur)})){qt=!1;break}}else if(!(Mt===kt||Fe(Mt,kt,D,Z,fe))){qt=!1;break}}return fe.delete(C),fe.delete(T),qt}function Op(C,T,D,Z,Fe,fe,Ue){switch(D){case j:if(C.byteLength!=T.byteLength||C.byteOffset!=T.byteOffset)return!1;C=C.buffer,T=T.buffer;case M:return!(C.byteLength!=T.byteLength||!fe(new sr(C),new sr(T)));case d:case l:case v:return hc(+C,+T);case p:return C.name==T.name&&C.message==T.message;case S:case P:return C==T+"";case w:var nt=ht;case E:var at=Z&o;if(nt||(nt=bt),C.size!=T.size&&!at)return!1;var ke=Ue.get(C);if(ke)return ke==T;Z|=i,Ue.set(C,T);var Nt=fc(nt(C),nt(T),Z,Fe,fe,Ue);return Ue.delete(C),Nt;case _:if(Je)return Je.call(C)==Je.call(T)}return!1}function Ep(C,T,D,Z,Fe,fe){var Ue=D&o,nt=pc(C),at=nt.length,ke=pc(T),Nt=ke.length;if(at!=Nt&&!Ue)return!1;for(var qt=at;qt--;){var ft=nt[qt];if(!(Ue?ft in T:Oe.call(T,ft)))return!1}var Mt=fe.get(C);if(Mt&&fe.get(T))return Mt==T;var kt=!0;fe.set(C,T),fe.set(T,C);for(var jn=Ue;++qt<at;){ft=nt[qt];var vn=C[ft],ur=T[ft];if(Z)var wc=Ue?Z(ur,vn,ft,T,C,fe):Z(vn,ur,ft,C,T,fe);if(!(wc===void 0?vn===ur||Fe(vn,ur,D,Z,fe):wc)){kt=!1;break}jn||(jn=ft=="constructor")}if(kt&&!jn){var Yi=C.constructor,Zi=T.constructor;Yi!=Zi&&"constructor"in C&&"constructor"in T&&!(typeof Yi=="function"&&Yi instanceof Yi&&typeof Zi=="function"&&Zi instanceof Zi)&&(kt=!1)}return fe.delete(C),fe.delete(T),kt}function pc(C){return bp(C,jp,Np)}function Qi(C,T){var D=C.__data__;return Ap(T)?D[typeof T=="string"?"string":"hash"]:D.map}function Pr(C,T){var D=Ge(C,T);return Cp(D)?D:void 0}function _p(C){var T=Oe.call(C,_t),D=C[_t];try{C[_t]=void 0;var Z=!0}catch{}var Fe=pn.call(C);return Z&&(T?C[_t]=D:delete C[_t]),Fe}var Np=mn?function(C){return C==null?[]:(C=Object(C),Ye(mn(C),function(T){return Tn.call(C,T)}))}:Lp,kn=mi;(gn&&kn(new gn(new ArrayBuffer(1)))!=j||en&&kn(new en)!=w||Ke&&kn(Ke.resolve())!=y||dt&&kn(new dt)!=E||oe&&kn(new oe)!=R)&&(kn=function(C){var T=mi(C),D=T==h?C.constructor:void 0,Z=D?cr(D):"";if(Z)switch(Z){case mt:return j;case yn:return w;case G:return y;case ae:return E;case le:return R}return T});function Tp(C,T){return T=T??s,!!T&&(typeof C=="number"||J.test(C))&&C>-1&&C%1==0&&C<T}function Ap(C){var T=typeof C;return T=="string"||T=="number"||T=="symbol"||T=="boolean"?C!=="__proto__":C===null}function Rp(C){return!!fn&&fn in C}function Pp(C){var T=C&&C.constructor,D=typeof T=="function"&&T.prototype||De;return C===D}function Fp(C){return pn.call(C)}function cr(C){if(C!=null){try{return he.call(C)}catch{}try{return C+""}catch{}}return""}function hc(C,T){return C===T||C!==C&&T!==T}var Dp=lc(function(){return arguments}())?lc:function(C){return gi(C)&&Oe.call(C,"callee")&&!Tn.call(C,"callee")},Xi=Array.isArray;function Mp(C){return C!=null&&gc(C.length)&&!mc(C)}var rs=Rn||Kp;function kp(C,T){return dc(C,T)}function mc(C){if(!yc(C))return!1;var T=mi(C);return T==m||T==g||T==f||T==I}function gc(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=s}function yc(C){var T=typeof C;return C!=null&&(T=="object"||T=="function")}function gi(C){return C!=null&&typeof C=="object"}var vc=z?ot(z):Sp;function jp(C){return Mp(C)?wp(C):xp(C)}function Lp(){return[]}function Kp(){return!1}e.exports=kp})(Oo,Oo.exports);var Ww=Oo.exports;const Ia=Uo(Ww),We=async(e,t)=>{var n;if(e instanceof yl){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
3
- `))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const c=`${a} ${s!=null&&s.remedy?`
1
+ "use strict";var xp=Object.defineProperty;var dc=e=>{throw TypeError(e)};var Op=(e,t,n)=>t in e?xp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pi=(e,t,n)=>Op(e,typeof t!="symbol"?t+"":t,n),Yo=(e,t,n)=>t.has(e)||dc("Cannot "+n);var S=(e,t,n)=>(Yo(e,t,"read from private field"),n?n.call(e):t.get(e)),oe=(e,t,n)=>t.has(e)?dc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Q=(e,t,n,r)=>(Yo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),me=(e,t,n)=>(Yo(e,t,"access private method"),n);var Xi=(e,t,n,r)=>({set _(o){Q(e,t,o,n)},get _(){return S(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),b=require("react");require("react-dom");function Sp(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const B=Sp(b);var ii=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_p={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Zt,dr,Su,Ep=(Su=class{constructor(){oe(this,Zt,_p);oe(this,dr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&S(this,dr)&&e!==S(this,Zt)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:S(this,Zt),provider:e}),Q(this,Zt,e),process.env.NODE_ENV!=="production"&&Q(this,dr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Q(this,dr,!0),S(this,Zt).setTimeout(e,t)}clearTimeout(e){S(this,Zt).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Q(this,dr,!0),S(this,Zt).setInterval(e,t)}clearInterval(e){S(this,Zt).clearInterval(e)}},Zt=new WeakMap,dr=new WeakMap,Su),ur=new Ep;function Np(e){setTimeout(e,0)}var Cr=typeof window>"u"||"Deno"in globalThis;function gt(){}function Tp(e,t){return typeof e=="function"?e(t):e}function ws(e){return typeof e=="number"&&e>=0&&e!==1/0}function ku(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Wn(e,t){return typeof e=="function"?e(t):e}function jt(e,t){return typeof e=="function"?e(t):e}function fc(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==ra(s,t.options))return!1}else if(!Ci(t.queryKey,s))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function pc(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(xr(t.options.mutationKey)!==xr(i))return!1}else if(!Ci(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function ra(e,t){return((t==null?void 0:t.queryKeyHashFn)||xr)(e)}function xr(e){return JSON.stringify(e,(t,n)=>Is(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Ci(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ci(e[n],t[n])):!1}var Rp=Object.prototype.hasOwnProperty;function bs(e,t){if(e===t)return e;const n=hc(e)&&hc(t);if(!n&&!(Is(e)&&Is(t)))return t;const o=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),s=i.length,a=n?new Array(s):{};let u=0;for(let f=0;f<s;f++){const l=n?f:i[f],d=e[l],h=t[l];if(d===h){a[l]=d,(n?f<o:Rp.call(e,l))&&u++;continue}if(d===null||h===null||typeof d!="object"||typeof h!="object"){a[l]=h;continue}const m=bs(d,h);a[l]=m,m===d&&u++}return o===s&&u===o?e:a}function po(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function hc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Is(e){if(!mc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!mc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function mc(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ap(e){return new Promise(t=>{ur.setTimeout(t,e)})}function Cs(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return bs(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return bs(e,t)}return t}function Fp(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Pp(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ho=Symbol();function ju(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===ho&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ho?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Lu(e,t){return typeof e=="function"?e(...t):!!e}var fr,Ln,Dr,_u,Dp=(_u=class extends ii{constructor(){super();oe(this,fr);oe(this,Ln);oe(this,Dr);Q(this,Dr,t=>{if(!Cr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){S(this,Ln)||this.setEventListener(S(this,Dr))}onUnsubscribe(){var t;this.hasListeners()||((t=S(this,Ln))==null||t.call(this),Q(this,Ln,void 0))}setEventListener(t){var n;Q(this,Dr,t),(n=S(this,Ln))==null||n.call(this),Q(this,Ln,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){S(this,fr)!==t&&(Q(this,fr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof S(this,fr)=="boolean"?S(this,fr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},fr=new WeakMap,Ln=new WeakMap,Dr=new WeakMap,_u),ia=new Dp;function xs(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}var Mp=Np;function kp(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=Mp;const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(u=>{n(u)})})})};return{batch:a=>{let u;t++;try{u=a()}finally{t--,t||s()}return u},batchCalls:a=>(...u)=>{i(()=>{a(...u)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Ge=kp(),Mr,Vn,kr,Eu,jp=(Eu=class extends ii{constructor(){super();oe(this,Mr,!0);oe(this,Vn);oe(this,kr);Q(this,kr,t=>{if(!Cr&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){S(this,Vn)||this.setEventListener(S(this,kr))}onUnsubscribe(){var t;this.hasListeners()||((t=S(this,Vn))==null||t.call(this),Q(this,Vn,void 0))}setEventListener(t){var n;Q(this,kr,t),(n=S(this,Vn))==null||n.call(this),Q(this,Vn,t(this.setOnline.bind(this)))}setOnline(t){S(this,Mr)!==t&&(Q(this,Mr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return S(this,Mr)}},Mr=new WeakMap,Vn=new WeakMap,kr=new WeakMap,Eu),mo=new jp;function Lp(e){return Math.min(1e3*2**e,3e4)}function Vu(e){return(e??"online")==="online"?mo.isOnline():!0}var Os=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function $u(e){let t=!1,n=0,r;const o=xs(),i=()=>o.status!=="pending",s=w=>{var g;if(!i()){const O=new Os(w);h(O),(g=e.onCancel)==null||g.call(e,O)}},a=()=>{t=!0},u=()=>{t=!1},f=()=>ia.isFocused()&&(e.networkMode==="always"||mo.isOnline())&&e.canRun(),l=()=>Vu(e.networkMode)&&e.canRun(),d=w=>{i()||(r==null||r(),o.resolve(w))},h=w=>{i()||(r==null||r(),o.reject(w))},m=()=>new Promise(w=>{var g;r=O=>{(i()||f())&&w(O)},(g=e.onPause)==null||g.call(e)}).then(()=>{var w;r=void 0,i()||(w=e.onContinue)==null||w.call(e)}),v=()=>{if(i())return;let w;const g=n===0?e.initialPromise:void 0;try{w=g??e.fn()}catch(O){w=Promise.reject(O)}Promise.resolve(w).then(d).catch(O=>{var N;if(i())return;const p=e.retry??(Cr?0:3),y=e.retryDelay??Lp,I=typeof y=="function"?y(n,O):y,x=p===!0||typeof p=="number"&&n<p||typeof p=="function"&&p(n,O);if(t||!x){h(O);return}n++,(N=e.onFail)==null||N.call(e,n,O),Ap(I).then(()=>f()?void 0:m()).then(()=>{t?h(O):v()})})};return{promise:o,status:()=>o.status,cancel:s,continue:()=>(r==null||r(),o),cancelRetry:a,continueRetry:u,canStart:l,start:()=>(l()?v():m().then(v),o)}}var pr,Nu,Ku=(Nu=class{constructor(){oe(this,pr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ws(this.gcTime)&&Q(this,pr,ur.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Cr?1/0:5*60*1e3))}clearGcTimeout(){S(this,pr)&&(ur.clearTimeout(S(this,pr)),Q(this,pr,void 0))}},pr=new WeakMap,Nu),hr,jr,kt,mr,nt,Ti,gr,Ut,yn,Tu,Vp=(Tu=class extends Ku{constructor(t){super();oe(this,Ut);oe(this,hr);oe(this,jr);oe(this,kt);oe(this,mr);oe(this,nt);oe(this,Ti);oe(this,gr);Q(this,gr,!1),Q(this,Ti,t.defaultOptions),this.setOptions(t.options),this.observers=[],Q(this,mr,t.client),Q(this,kt,S(this,mr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Q(this,hr,gc(this.options)),this.state=t.state??S(this,hr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=S(this,nt))==null?void 0:t.promise}setOptions(t){if(this.options={...S(this,Ti),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=gc(this.options);n.data!==void 0&&(this.setData(n.data,{updatedAt:n.dataUpdatedAt,manual:!0}),Q(this,hr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&S(this,kt).remove(this)}setData(t,n){const r=Cs(this.state.data,t,this.options);return me(this,Ut,yn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){me(this,Ut,yn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=S(this,nt))==null?void 0:r.promise;return(o=S(this,nt))==null||o.cancel(t),n?n.then(gt).catch(gt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(S(this,hr))}isActive(){return this.observers.some(t=>jt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ho||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Wn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!ku(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=S(this,nt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=S(this,nt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),S(this,kt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(S(this,nt)&&(S(this,gr)?S(this,nt).cancel({revert:!0}):S(this,nt).cancelRetry()),this.scheduleGc()),S(this,kt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||me(this,Ut,yn).call(this,{type:"invalidate"})}async fetch(t,n){var u,f,l,d,h,m,v,w,g,O,p,y;if(this.state.fetchStatus!=="idle"&&((u=S(this,nt))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(S(this,nt))return S(this,nt).continueRetry(),S(this,nt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const I=this.observers.find(x=>x.options.queryFn);I&&this.setOptions(I.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=I=>{Object.defineProperty(I,"signal",{enumerable:!0,get:()=>(Q(this,gr,!0),r.signal)})},i=()=>{const I=ju(this.options,n),N=(()=>{const A={client:S(this,mr),queryKey:this.queryKey,meta:this.meta};return o(A),A})();return Q(this,gr,!1),this.options.persister?this.options.persister(I,N,this):I(N)},a=(()=>{const I={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:S(this,mr),state:this.state,fetchFn:i};return o(I),I})();(f=this.options.behavior)==null||f.onFetch(a,this),Q(this,jr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((l=a.fetchOptions)==null?void 0:l.meta))&&me(this,Ut,yn).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),Q(this,nt,$u({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:I=>{I instanceof Os&&I.revert&&this.setState({...S(this,jr),fetchStatus:"idle"}),r.abort()},onFail:(I,x)=>{me(this,Ut,yn).call(this,{type:"failed",failureCount:I,error:x})},onPause:()=>{me(this,Ut,yn).call(this,{type:"pause"})},onContinue:()=>{me(this,Ut,yn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const I=await S(this,nt).start();if(I===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(I),(m=(h=S(this,kt).config).onSuccess)==null||m.call(h,I,this),(w=(v=S(this,kt).config).onSettled)==null||w.call(v,I,this.state.error,this),I}catch(I){if(I instanceof Os){if(I.silent)return S(this,nt).promise;if(I.revert){if(this.state.data===void 0)throw I;return this.state.data}}throw me(this,Ut,yn).call(this,{type:"error",error:I}),(O=(g=S(this,kt).config).onError)==null||O.call(g,I,this),(y=(p=S(this,kt).config).onSettled)==null||y.call(p,this.state.data,I,this),I}finally{this.scheduleGc()}}},hr=new WeakMap,jr=new WeakMap,kt=new WeakMap,mr=new WeakMap,nt=new WeakMap,Ti=new WeakMap,gr=new WeakMap,Ut=new WeakSet,yn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...qu(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Q(this,jr,t.manual?o:void 0),o;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Ge.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),S(this,kt).notify({query:this,type:"updated",action:t})})},Tu);function qu(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function gc(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var It,Ie,Ri,ht,yr,Lr,vn,$n,Ai,Vr,$r,vr,wr,Kn,Kr,Re,yi,Ss,_s,Es,Ns,Ts,Rs,As,Uu,Ru,$p=(Ru=class extends ii{constructor(t,n){super();oe(this,Re);oe(this,It);oe(this,Ie);oe(this,Ri);oe(this,ht);oe(this,yr);oe(this,Lr);oe(this,vn);oe(this,$n);oe(this,Ai);oe(this,Vr);oe(this,$r);oe(this,vr);oe(this,wr);oe(this,Kn);oe(this,Kr,new Set);this.options=n,Q(this,It,t),Q(this,$n,null),Q(this,vn,xs()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(S(this,Ie).addObserver(this),yc(S(this,Ie),this.options)?me(this,Re,yi).call(this):this.updateResult(),me(this,Re,Ns).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Fs(S(this,Ie),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Fs(S(this,Ie),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,me(this,Re,Ts).call(this),me(this,Re,Rs).call(this),S(this,Ie).removeObserver(this)}setOptions(t){const n=this.options,r=S(this,Ie);if(this.options=S(this,It).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof jt(this.options.enabled,S(this,Ie))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");me(this,Re,As).call(this),S(this,Ie).setOptions(this.options),n._defaulted&&!po(this.options,n)&&S(this,It).getQueryCache().notify({type:"observerOptionsUpdated",query:S(this,Ie),observer:this});const o=this.hasListeners();o&&vc(S(this,Ie),r,this.options,n)&&me(this,Re,yi).call(this),this.updateResult(),o&&(S(this,Ie)!==r||jt(this.options.enabled,S(this,Ie))!==jt(n.enabled,S(this,Ie))||Wn(this.options.staleTime,S(this,Ie))!==Wn(n.staleTime,S(this,Ie)))&&me(this,Re,Ss).call(this);const i=me(this,Re,_s).call(this);o&&(S(this,Ie)!==r||jt(this.options.enabled,S(this,Ie))!==jt(n.enabled,S(this,Ie))||i!==S(this,Kn))&&me(this,Re,Es).call(this,i)}getOptimisticResult(t){const n=S(this,It).getQueryCache().build(S(this,It),t),r=this.createResult(n,t);return qp(this,r)&&(Q(this,ht,r),Q(this,Lr,this.options),Q(this,yr,S(this,Ie).state)),r}getCurrentResult(){return S(this,ht)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),o==="promise"&&!this.options.experimental_prefetchInRender&&S(this,vn).status==="pending"&&S(this,vn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(r,o))})}trackProp(t){S(this,Kr).add(t)}getCurrentQuery(){return S(this,Ie)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=S(this,It).defaultQueryOptions(t),r=S(this,It).getQueryCache().build(S(this,It),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return me(this,Re,yi).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),S(this,ht)))}createResult(t,n){var F;const r=S(this,Ie),o=this.options,i=S(this,ht),s=S(this,yr),a=S(this,Lr),f=t!==r?t.state:S(this,Ri),{state:l}=t;let d={...l},h=!1,m;if(n._optimisticResults){const R=this.hasListeners(),D=!R&&yc(t,n),K=R&&vc(t,r,n,o);(D||K)&&(d={...d,...qu(l.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:v,errorUpdatedAt:w,status:g}=d;m=d.data;let O=!1;if(n.placeholderData!==void 0&&m===void 0&&g==="pending"){let R;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(R=i.data,O=!0):R=typeof n.placeholderData=="function"?n.placeholderData((F=S(this,$r))==null?void 0:F.state.data,S(this,$r)):n.placeholderData,R!==void 0&&(g="success",m=Cs(i==null?void 0:i.data,R,n),h=!0)}if(n.select&&m!==void 0&&!O)if(i&&m===(s==null?void 0:s.data)&&n.select===S(this,Ai))m=S(this,Vr);else try{Q(this,Ai,n.select),m=n.select(m),m=Cs(i==null?void 0:i.data,m,n),Q(this,Vr,m),Q(this,$n,null)}catch(R){Q(this,$n,R)}S(this,$n)&&(v=S(this,$n),m=S(this,Vr),w=Date.now(),g="error");const p=d.fetchStatus==="fetching",y=g==="pending",I=g==="error",x=y&&p,N=m!==void 0,_={status:g,fetchStatus:d.fetchStatus,isPending:y,isSuccess:g==="success",isError:I,isInitialLoading:x,isLoading:x,data:m,dataUpdatedAt:d.dataUpdatedAt,error:v,errorUpdatedAt:w,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>f.dataUpdateCount||d.errorUpdateCount>f.errorUpdateCount,isFetching:p,isRefetching:p&&!y,isLoadingError:I&&!N,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:I&&N,isStale:oa(t,n),refetch:this.refetch,promise:S(this,vn),isEnabled:jt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=j=>{_.status==="error"?j.reject(_.error):_.data!==void 0&&j.resolve(_.data)},D=()=>{const j=Q(this,vn,_.promise=xs());R(j)},K=S(this,vn);switch(K.status){case"pending":t.queryHash===r.queryHash&&R(K);break;case"fulfilled":(_.status==="error"||_.data!==K.value)&&D();break;case"rejected":(_.status!=="error"||_.error!==K.reason)&&D();break}}return _}updateResult(){const t=S(this,ht),n=this.createResult(S(this,Ie),this.options);if(Q(this,yr,S(this,Ie).state),Q(this,Lr,this.options),S(this,yr).data!==void 0&&Q(this,$r,S(this,Ie)),po(n,t))return;Q(this,ht,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!S(this,Kr).size)return!0;const s=new Set(i??S(this,Kr));return this.options.throwOnError&&s.add("error"),Object.keys(S(this,ht)).some(a=>{const u=a;return S(this,ht)[u]!==t[u]&&s.has(u)})};me(this,Re,Uu).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&me(this,Re,Ns).call(this)}},It=new WeakMap,Ie=new WeakMap,Ri=new WeakMap,ht=new WeakMap,yr=new WeakMap,Lr=new WeakMap,vn=new WeakMap,$n=new WeakMap,Ai=new WeakMap,Vr=new WeakMap,$r=new WeakMap,vr=new WeakMap,wr=new WeakMap,Kn=new WeakMap,Kr=new WeakMap,Re=new WeakSet,yi=function(t){me(this,Re,As).call(this);let n=S(this,Ie).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(gt)),n},Ss=function(){me(this,Re,Ts).call(this);const t=Wn(this.options.staleTime,S(this,Ie));if(Cr||S(this,ht).isStale||!ws(t))return;const r=ku(S(this,ht).dataUpdatedAt,t)+1;Q(this,vr,ur.setTimeout(()=>{S(this,ht).isStale||this.updateResult()},r))},_s=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(S(this,Ie)):this.options.refetchInterval)??!1},Es=function(t){me(this,Re,Rs).call(this),Q(this,Kn,t),!(Cr||jt(this.options.enabled,S(this,Ie))===!1||!ws(S(this,Kn))||S(this,Kn)===0)&&Q(this,wr,ur.setInterval(()=>{(this.options.refetchIntervalInBackground||ia.isFocused())&&me(this,Re,yi).call(this)},S(this,Kn)))},Ns=function(){me(this,Re,Ss).call(this),me(this,Re,Es).call(this,me(this,Re,_s).call(this))},Ts=function(){S(this,vr)&&(ur.clearTimeout(S(this,vr)),Q(this,vr,void 0))},Rs=function(){S(this,wr)&&(ur.clearInterval(S(this,wr)),Q(this,wr,void 0))},As=function(){const t=S(this,It).getQueryCache().build(S(this,It),this.options);if(t===S(this,Ie))return;const n=S(this,Ie);Q(this,Ie,t),Q(this,Ri,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Uu=function(t){Ge.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(S(this,ht))}),S(this,It).getQueryCache().notify({query:S(this,Ie),type:"observerResultsUpdated"})})},Ru);function Kp(e,t){return jt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function yc(e,t){return Kp(e,t)||e.state.data!==void 0&&Fs(e,t,t.refetchOnMount)}function Fs(e,t,n){if(jt(t.enabled,e)!==!1&&Wn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&oa(e,t)}return!1}function vc(e,t,n,r){return(e!==t||jt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&oa(e,n)}function oa(e,t){return jt(t.enabled,e)!==!1&&e.isStaleByTime(Wn(t.staleTime,e))}function qp(e,t){return!po(e.getCurrentResult(),t)}function wc(e){return{onFetch:(t,n)=>{var l,d,h,m,v;const r=t.options,o=(h=(d=(l=t.fetchOptions)==null?void 0:l.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],s=((v=t.state.data)==null?void 0:v.pageParams)||[];let a={pages:[],pageParams:[]},u=0;const f=async()=>{let w=!1;const g=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},O=ju(t.options,t.fetchOptions),p=async(y,I,x)=>{if(w)return Promise.reject();if(I==null&&y.pages.length)return Promise.resolve(y);const A=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:I,direction:x?"backward":"forward",meta:t.options.meta};return g(D),D})(),_=await O(A),{maxPages:F}=t.options,R=x?Pp:Fp;return{pages:R(y.pages,_,F),pageParams:R(y.pageParams,I,F)}};if(o&&i.length){const y=o==="backward",I=y?Up:bc,x={pages:i,pageParams:s},N=I(r,x);a=await p(x,N,y)}else{const y=e??i.length;do{const I=u===0?s[0]??r.initialPageParam:bc(r,a);if(u>0&&I==null)break;a=await p(a,I),u++}while(u<y)}return a};t.options.persister?t.fetchFn=()=>{var w,g;return(g=(w=t.options).persister)==null?void 0:g.call(w,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function bc(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Up(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Fi,en,mt,br,tn,kn,Au,Bp=(Au=class extends Ku{constructor(t){super();oe(this,tn);oe(this,Fi);oe(this,en);oe(this,mt);oe(this,br);Q(this,Fi,t.client),this.mutationId=t.mutationId,Q(this,mt,t.mutationCache),Q(this,en,[]),this.state=t.state||Bu(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){S(this,en).includes(t)||(S(this,en).push(t),this.clearGcTimeout(),S(this,mt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Q(this,en,S(this,en).filter(n=>n!==t)),this.scheduleGc(),S(this,mt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){S(this,en).length||(this.state.status==="pending"?this.scheduleGc():S(this,mt).remove(this))}continue(){var t;return((t=S(this,br))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,a,u,f,l,d,h,m,v,w,g,O,p,y,I,x,N,A,_,F;const n=()=>{me(this,tn,kn).call(this,{type:"continue"})},r={client:S(this,Fi),meta:this.options.meta,mutationKey:this.options.mutationKey};Q(this,br,$u({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,D)=>{me(this,tn,kn).call(this,{type:"failed",failureCount:R,error:D})},onPause:()=>{me(this,tn,kn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>S(this,mt).canRun(this)}));const o=this.state.status==="pending",i=!S(this,br).canStart();try{if(o)n();else{me(this,tn,kn).call(this,{type:"pending",variables:t,isPaused:i}),await((a=(s=S(this,mt).config).onMutate)==null?void 0:a.call(s,t,this,r));const D=await((f=(u=this.options).onMutate)==null?void 0:f.call(u,t,r));D!==this.state.context&&me(this,tn,kn).call(this,{type:"pending",context:D,variables:t,isPaused:i})}const R=await S(this,br).start();return await((d=(l=S(this,mt).config).onSuccess)==null?void 0:d.call(l,R,t,this.state.context,this,r)),await((m=(h=this.options).onSuccess)==null?void 0:m.call(h,R,t,this.state.context,r)),await((w=(v=S(this,mt).config).onSettled)==null?void 0:w.call(v,R,null,this.state.variables,this.state.context,this,r)),await((O=(g=this.options).onSettled)==null?void 0:O.call(g,R,null,t,this.state.context,r)),me(this,tn,kn).call(this,{type:"success",data:R}),R}catch(R){try{throw await((y=(p=S(this,mt).config).onError)==null?void 0:y.call(p,R,t,this.state.context,this,r)),await((x=(I=this.options).onError)==null?void 0:x.call(I,R,t,this.state.context,r)),await((A=(N=S(this,mt).config).onSettled)==null?void 0:A.call(N,void 0,R,this.state.variables,this.state.context,this,r)),await((F=(_=this.options).onSettled)==null?void 0:F.call(_,void 0,R,t,this.state.context,r)),R}finally{me(this,tn,kn).call(this,{type:"error",error:R})}}finally{S(this,mt).runNext(this)}}},Fi=new WeakMap,en=new WeakMap,mt=new WeakMap,br=new WeakMap,tn=new WeakSet,kn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Ge.batch(()=>{S(this,en).forEach(r=>{r.onMutationUpdate(t)}),S(this,mt).notify({mutation:this,type:"updated",action:t})})},Au);function Bu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wn,Bt,Pi,Fu,Jp=(Fu=class extends ii{constructor(t={}){super();oe(this,wn);oe(this,Bt);oe(this,Pi);this.config=t,Q(this,wn,new Set),Q(this,Bt,new Map),Q(this,Pi,0)}build(t,n,r){const o=new Bp({client:t,mutationCache:this,mutationId:++Xi(this,Pi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){S(this,wn).add(t);const n=Yi(t);if(typeof n=="string"){const r=S(this,Bt).get(n);r?r.push(t):S(this,Bt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(S(this,wn).delete(t)){const n=Yi(t);if(typeof n=="string"){const r=S(this,Bt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&S(this,Bt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Yi(t);if(typeof n=="string"){const r=S(this,Bt).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=Yi(t);if(typeof n=="string"){const o=(r=S(this,Bt).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ge.batch(()=>{S(this,wn).forEach(t=>{this.notify({type:"removed",mutation:t})}),S(this,wn).clear(),S(this,Bt).clear()})}getAll(){return Array.from(S(this,wn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>pc(n,r))}findAll(t={}){return this.getAll().filter(n=>pc(t,n))}notify(t){Ge.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ge.batch(()=>Promise.all(t.map(n=>n.continue().catch(gt))))}},wn=new WeakMap,Bt=new WeakMap,Pi=new WeakMap,Fu);function Yi(e){var t;return(t=e.options.scope)==null?void 0:t.id}var bn,qn,Ct,In,xn,ao,Ps,Pu,Hp=(Pu=class extends ii{constructor(n,r){super();oe(this,xn);oe(this,bn);oe(this,qn);oe(this,Ct);oe(this,In);Q(this,bn,n),this.setOptions(r),this.bindMethods(),me(this,xn,ao).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=S(this,bn).defaultMutationOptions(n),po(this.options,r)||S(this,bn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:S(this,Ct),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&xr(r.mutationKey)!==xr(this.options.mutationKey)?this.reset():((o=S(this,Ct))==null?void 0:o.state.status)==="pending"&&S(this,Ct).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=S(this,Ct))==null||n.removeObserver(this)}onMutationUpdate(n){me(this,xn,ao).call(this),me(this,xn,Ps).call(this,n)}getCurrentResult(){return S(this,qn)}reset(){var n;(n=S(this,Ct))==null||n.removeObserver(this),Q(this,Ct,void 0),me(this,xn,ao).call(this),me(this,xn,Ps).call(this)}mutate(n,r){var o;return Q(this,In,r),(o=S(this,Ct))==null||o.removeObserver(this),Q(this,Ct,S(this,bn).getMutationCache().build(S(this,bn),this.options)),S(this,Ct).addObserver(this),S(this,Ct).execute(n)}},bn=new WeakMap,qn=new WeakMap,Ct=new WeakMap,In=new WeakMap,xn=new WeakSet,ao=function(){var r;const n=((r=S(this,Ct))==null?void 0:r.state)??Bu();Q(this,qn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Ps=function(n){Ge.batch(()=>{var r,o,i,s,a,u,f,l;if(S(this,In)&&this.hasListeners()){const d=S(this,qn).variables,h=S(this,qn).context,m={client:S(this,bn),meta:this.options.meta,mutationKey:this.options.mutationKey};(n==null?void 0:n.type)==="success"?((o=(r=S(this,In)).onSuccess)==null||o.call(r,n.data,d,h,m),(s=(i=S(this,In)).onSettled)==null||s.call(i,n.data,null,d,h,m)):(n==null?void 0:n.type)==="error"&&((u=(a=S(this,In)).onError)==null||u.call(a,n.error,d,h,m),(l=(f=S(this,In)).onSettled)==null||l.call(f,void 0,n.error,d,h,m))}this.listeners.forEach(d=>{d(S(this,qn))})})},Pu),nn,Du,Wp=(Du=class extends ii{constructor(t={}){super();oe(this,nn);this.config=t,Q(this,nn,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??ra(o,n);let s=this.get(i);return s||(s=new Vp({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){S(this,nn).has(t.queryHash)||(S(this,nn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=S(this,nn).get(t.queryHash);n&&(t.destroy(),n===t&&S(this,nn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ge.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return S(this,nn).get(t)}getAll(){return[...S(this,nn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>fc(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>fc(t,r)):n}notify(t){Ge.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ge.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ge.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},nn=new WeakMap,Du),Ke,Un,Bn,qr,Ur,Jn,Br,Jr,Mu,zp=(Mu=class{constructor(e={}){oe(this,Ke);oe(this,Un);oe(this,Bn);oe(this,qr);oe(this,Ur);oe(this,Jn);oe(this,Br);oe(this,Jr);Q(this,Ke,e.queryCache||new Wp),Q(this,Un,e.mutationCache||new Jp),Q(this,Bn,e.defaultOptions||{}),Q(this,qr,new Map),Q(this,Ur,new Map),Q(this,Jn,0)}mount(){Xi(this,Jn)._++,S(this,Jn)===1&&(Q(this,Br,ia.subscribe(async e=>{e&&(await this.resumePausedMutations(),S(this,Ke).onFocus())})),Q(this,Jr,mo.subscribe(async e=>{e&&(await this.resumePausedMutations(),S(this,Ke).onOnline())})))}unmount(){var e,t;Xi(this,Jn)._--,S(this,Jn)===0&&((e=S(this,Br))==null||e.call(this),Q(this,Br,void 0),(t=S(this,Jr))==null||t.call(this),Q(this,Jr,void 0))}isFetching(e){return S(this,Ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return S(this,Un).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=S(this,Ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=S(this,Ke).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Wn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return S(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=S(this,Ke).get(r.queryHash),i=o==null?void 0:o.state.data,s=Tp(t,i);if(s!==void 0)return S(this,Ke).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Ge.batch(()=>S(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=S(this,Ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=S(this,Ke);Ge.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=S(this,Ke);return Ge.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ge.batch(()=>S(this,Ke).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(gt).catch(gt)}invalidateQueries(e,t={}){return Ge.batch(()=>(S(this,Ke).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ge.batch(()=>S(this,Ke).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(gt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(gt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=S(this,Ke).build(this,t);return n.isStaleByTime(Wn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(gt).catch(gt)}fetchInfiniteQuery(e){return e.behavior=wc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(gt).catch(gt)}ensureInfiniteQueryData(e){return e.behavior=wc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return mo.isOnline()?S(this,Un).resumePausedMutations():Promise.resolve()}getQueryCache(){return S(this,Ke)}getMutationCache(){return S(this,Un)}getDefaultOptions(){return S(this,Bn)}setDefaultOptions(e){Q(this,Bn,e)}setQueryDefaults(e,t){S(this,qr).set(xr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...S(this,qr).values()],n={};return t.forEach(r=>{Ci(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){S(this,Ur).set(xr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...S(this,Ur).values()],n={};return t.forEach(r=>{Ci(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...S(this,Bn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ra(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ho&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...S(this,Bn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){S(this,Ke).clear(),S(this,Un).clear()}},Ke=new WeakMap,Un=new WeakMap,Bn=new WeakMap,qr=new WeakMap,Ur=new WeakMap,Jn=new WeakMap,Br=new WeakMap,Jr=new WeakMap,Mu),Ju=B.createContext(void 0),qe=e=>{const t=B.useContext(Ju);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Qp=({client:e,children:t})=>(B.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(Ju.Provider,{value:e,children:t})),Hu=B.createContext(!1),Gp=()=>B.useContext(Hu);Hu.Provider;function Xp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Yp=B.createContext(Xp()),Zp=()=>B.useContext(Yp),eh=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},th=e=>{B.useEffect(()=>{e.clearReset()},[e])},nh=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||Lu(n,[e.error,r])),rh=e=>{if(e.suspense){const n=o=>o==="static"?o:Math.max(o??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...o)=>n(r(...o)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},ih=(e,t)=>e.isLoading&&e.isFetching&&!t,oh=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ic=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function sh(e,t,n){var d,h,m,v,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=Gp(),o=Zp(),i=qe(),s=i.defaultQueryOptions(e);(h=(d=i.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||h.call(d,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=r?"isRestoring":"optimistic",rh(s),eh(s,o),th(o);const a=!i.getQueryCache().get(s.queryHash),[u]=B.useState(()=>new t(i,s)),f=u.getOptimisticResult(s),l=!r&&e.subscribed!==!1;if(B.useSyncExternalStore(B.useCallback(g=>{const O=l?u.subscribe(Ge.batchCalls(g)):gt;return u.updateResult(),O},[u,l]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),B.useEffect(()=>{u.setOptions(s)},[s,u]),oh(s,f))throw Ic(s,u,o);if(nh({result:f,errorResetBoundary:o,throwOnError:s.throwOnError,query:i.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((v=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||v.call(m,s,f),s.experimental_prefetchInRender&&!Cr&&ih(f,r)){const g=a?Ic(s,u,o):(w=i.getQueryCache().get(s.queryHash))==null?void 0:w.promise;g==null||g.catch(gt).finally(()=>{u.updateResult()})}return s.notifyOnChangeProps?f:u.trackResult(f)}function Yn(e,t){return sh(e,$p)}function On(e,t){const n=qe(),[r]=B.useState(()=>new Hp(n,e));B.useEffect(()=>{r.setOptions(e)},[r,e]);const o=B.useSyncExternalStore(B.useCallback(s=>r.subscribe(Ge.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=B.useCallback((s,a)=>{r.mutate(s,a).catch(gt)},[r]);if(o.error&&Lu(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const Wu=b.createContext(null),ah=Wu.Provider,zu=()=>b.useContext(Wu);var we=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e.VALUE_MAPPING="valueMappingError",e))(we||{});const Qu=b.createContext(void 0);function an(){const e=b.useContext(Qu);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const ch=(()=>{const e={};return Object.values(we).forEach(t=>{e[t]={}}),e})();function uh({children:e}){const[t,n]=b.useState(ch),r=b.useCallback((l,d,h=!0)=>{n(m=>{const v={...m};return v[l]=v[l]||{},v[l][d]=h,v})},[n]),o=b.useCallback((l,d)=>{var h;return!!((h=t[l])!=null&&h[d])},[t]),i=b.useCallback((l,d)=>{var h;return(h=t[l])==null?void 0:h[d]},[t]),s=b.useCallback((l,d)=>{n(h=>{var v;const m={...h};return(v=m[l])==null||delete v[d],m})},[n]),a=b.useCallback(l=>{n(d=>{const h={...d};return h[l]={},h})},[n]),u=b.useCallback((l,d)=>{n(h=>{const m={...h};return m[l]=m[l]||{},d.forEach(v=>{m[l][v]=!0}),m})},[n]),f=b.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:u,getError:i}),[t,n,r,o,s,a,u,i]);return c.jsx(Qu.Provider,{value:f,children:e})}new TextEncoder;const Ds=new TextDecoder;function lh(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function dh(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:Ds.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=Ds.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return lh(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class Gu extends Error{constructor(n,r){var o;super(n,r);pi(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(o=Error.captureStackTrace)==null||o.call(Error,this,this.constructor)}}pi(Gu,"code","ERR_JOSE_GENERIC");class jn extends Gu{constructor(){super(...arguments);pi(this,"code","ERR_JWT_INVALID")}}pi(jn,"code","ERR_JWT_INVALID");function fh(e){return typeof e=="object"&&e!==null}const ph=e=>{if(!fh(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t};function hh(e){if(typeof e!="string")throw new jn("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new jn("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new jn("Invalid JWT");if(!t)throw new jn("JWTs must contain a payload");let r;try{r=dh(t)}catch{throw new jn("Failed to base64url decode the payload")}let o;try{o=JSON.parse(Ds.decode(r))}catch{throw new jn("Failed to parse the decoded payload as JSON")}if(!ph(o))throw new jn("Invalid JWT Claims Set");return o}const Ms="amp-labs_jwt_",mh=10*60*1e3,Cc=(e,t)=>`${e}:${t}`,xc=e=>`${Ms}${e}`,Xu=b.createContext(null),gh=e=>{try{const t=hh(e);return t.exp&&typeof t.exp=="number"?t.exp*1e3:null}catch(t){return console.warn("Failed to decode JWT token:",t),null}};function yh({getTokenCallback:e,children:t}){const[n,r]=b.useState(new Map);b.useEffect(()=>{try{const u=new Map,f=Date.now();Object.keys(sessionStorage).forEach(l=>{if(l.startsWith(Ms)){const d=l.replace(Ms,""),h=sessionStorage.getItem(l);if(h)try{const m=JSON.parse(h);m.expiresAt>f?u.set(d,m):sessionStorage.removeItem(l)}catch{sessionStorage.removeItem(l)}}}),u.size>0&&r(u)}catch{console.warn("Failed to load JWT tokens from sessionStorage")}},[]);const o=b.useCallback((u,f)=>{const l=Cc(u,f),d=Date.now(),h=n.get(l);if(h&&h.expiresAt>d)return h.token;n.delete(l);const m=xc(l),v=sessionStorage.getItem(m);if(v)try{const w=JSON.parse(v);if(w.expiresAt>d)return r(g=>new Map(g).set(l,w)),w.token;sessionStorage.removeItem(m)}catch{sessionStorage.removeItem(m)}return null},[n]),i=b.useCallback(async(u,f,l)=>{const d=Cc(u,f),m=await gh(l)||Date.now()+mh,v={token:l,expiresAt:m};r(w=>new Map(w).set(d,v));try{sessionStorage.setItem(xc(d),JSON.stringify(v))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=b.useCallback(async({consumerRef:u,groupRef:f})=>{const l=o(u,f);if(l)return l;if(!e)throw new Error("JWT token callback not provided");try{const d=await e({consumerRef:u,groupRef:f});return await i(u,f,d),d}catch(d){throw console.error("Failed to get JWT token:",d),new Error("Failed to get JWT token")}},[e,o,i]),a={getToken:e?s:void 0};return c.jsx(Xu.Provider,{value:a,children:t})}const vh=()=>{const e=b.useContext(Xu);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},sa=b.createContext(null);function je(){const e=b.useContext(sa);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
2
+ component is wrapped with AmpersandProvider`);return e}const wh=new zp;function bh(e){const{options:{apiKey:t,projectId:n,project:r,getToken:o},children:i}=e,s=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!s)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t&&!o)throw new Error("Cannot use AmpersandProvider without an apiKey or getToken.");if(t&&o)throw new Error("Cannot use AmpersandProvider with both apiKey and getToken.");const a={options:e.options,projectIdOrName:s};return c.jsx(Qp,{client:wh,children:c.jsx(sa.Provider,{value:a,children:c.jsx(uh,{children:c.jsx(yh,{getTokenCallback:o||null,children:c.jsx(ah,{value:t||null,children:i})})})})})}const Ih="https://api.withampersand.com/v1".replace(/\/+$/,"");class aa{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ih}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Zu}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Ch=new aa,Ao=class Ao{constructor(t=Ch){this.configuration=t,this.fetchApi=async(n,r)=>{let o={url:n,init:r};for(const s of this.middleware)s.pre&&(o=await s.pre({fetch:this.fetchApi,...o})||o);let i;try{i=await(this.configuration.fetchApi||fetch)(o.url,o.init)}catch(s){for(const a of this.middleware)a.onError&&(i=await a.onError({fetch:this.fetchApi,url:o.url,init:o.init,error:s,response:i?i.clone():void 0})||i);if(i===void 0)throw s instanceof Error?new Sh(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(i=await s.post({fetch:this.fetchApi,url:o.url,init:o.init,response:i.clone()})||i);return i},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?Ao.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:o}=await this.createFetchParams(t,n),i=await this.fetchApi(r,o);if(i&&i.status>=200&&i.status<300)return i;throw new Yu(i,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const o=Object.assign({},this.configuration.headers,t.headers);Object.keys(o).forEach(f=>o[f]===void 0?delete o[f]:{});const i=typeof n=="function"?n:async()=>n,s={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},a={...s,...await i({init:s,context:t})},u={...a,body:Oh(a.body)||a.body instanceof URLSearchParams||xh(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:u}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Ao.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let rn=Ao;function xh(e){return typeof Blob<"u"&&e instanceof Blob}function Oh(e){return typeof FormData<"u"&&e instanceof FormData}class Yu extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Sh extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function E(e,t){const n=e[t];return n!=null}function Zu(e,t=""){return Object.keys(e).map(n=>el(n,e[n],t)).filter(n=>n.length>0).join("&")}function el(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const o=t.map(i=>encodeURIComponent(String(i))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${o}`}if(t instanceof Set){const o=Array.from(t);return el(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Zu(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Be(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Me{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Hr{constructor(t){this.raw=t}async value(){}}class Oc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function _h(e){return Eh(e)}function Eh(e,t){return e==null?e:{fieldUsed:E(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:E(e,"keyFormat")?e.keyFormat:void 0}}function Nh(e){return Th(e)}function Th(e,t){return e==null?e:{name:e.name,valuePrefix:E(e,"valuePrefix")?e.valuePrefix:void 0}}function Rh(e){return Ah(e)}function Ah(e,t){return e==null?e:{name:e.name}}function Fh(e){return Ph(e)}function Ph(e,t){return e==null?e:{attachmentType:e.attachmentType,query:E(e,"query")?Rh(e.query):void 0,header:E(e,"header")?Nh(e.header):void 0,docsURL:E(e,"docsURL")?e.docsURL:void 0}}function Dh(e){return Mh(e)}function Mh(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,includeFullRecords:E(e,"includeFullRecords")?e.includeFullRecords:void 0}}function kh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function jh(e){return Lh(e)}function Lh(e,t){return e==null?e:{url:e.url,method:E(e,"method")?e.method:void 0,successStatusCodes:E(e,"successStatusCodes")?e.successStatusCodes:void 0}}const Sc={ApiKey:"apiKey",Basic:"basic"};function Vh(e){return $h(e)}function $h(e,t){return e}function Kh(e){return qh(e)}function qh(e,t){return e==null?e:{days:E(e,"days")?e.days:void 0,fullHistory:E(e,"fullHistory")?e.fullHistory:void 0}}function Uh(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function tl(e){return Bh(e)}function Bh(e,t){return e==null?e:{defaultPeriod:Kh(e.defaultPeriod)}}function Jh(e){if(e!==void 0)return e===null?null:{defaultPeriod:Uh(e.defaultPeriod)}}function Hh(e){return Wh(e)}function Wh(e,t){return e==null?e:{days:E(e,"days")?e.days:void 0,fullHistory:E(e,"fullHistory")?e.fullHistory:void 0}}function zh(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Qh(e){return Gh(e)}function Gh(e,t){return e==null?e:{defaultPeriod:Hh(e.defaultPeriod)}}function nl(e){if(e!==void 0)return e===null?null:{defaultPeriod:zh(e.defaultPeriod)}}function Xh(e){return Yh(e)}function Yh(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,useModule:E(e,"useModule")?e.useModule:void 0}}function rl(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function Zh(e){return em(e)}function em(e,t){return e==null?e:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function tm(e){if(e!==void 0)return e===null?null:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function nm(e){return rm(e)}function rm(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0,prompt:E(e,"prompt")?e.prompt:void 0,mappedValues:E(e,"mappedValues")?e.mappedValues.map(Zh):void 0,fieldName:E(e,"fieldName")?e.fieldName:void 0}}function il(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,prompt:e.prompt,mappedValues:e.mappedValues===void 0?void 0:e.mappedValues.map(tm),fieldName:e.fieldName}}function im(e){return om(e)}function om(e,t){return e}function sm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(il),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:nl(e.backfill)}}function am(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Be(e.objects,sm)}}function cm(e){return um(e)}function um(e,t){return e==null?e:{stringValue:E(e,"stringValue")?e.stringValue:void 0,integerValue:E(e,"integerValue")?e.integerValue:void 0,booleanValue:E(e,"booleanValue")?e.booleanValue:void 0}}function lm(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const dm={Always:"always",Never:"never"},fm={Always:"always",Never:"never"};function pm(e){return hm(e)}function hm(e,t){return e==null?e:{default:E(e,"default")?cm(e.default):void 0,writeOnCreate:E(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:E(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function ol(e){if(e!==void 0)return e===null?null:{default:lm(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function mm(e){let t=!0;return t=t&&"value"in e,t}function gm(e,t){return e==null?e:{value:e.value,applyOnUpdate:E(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function ym(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function vm(e){let t=!0;return t=t&&"value"in e,t}function wm(e,t){return e==null?e:{value:e.value,applyOnUpdate:E(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function bm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Im(e){let t=!0;return t=t&&"value"in e,t}function Cm(e,t){return e==null?e:{value:e.value,applyOnUpdate:E(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function xm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Om(e){return Sm(e)}function Sm(e,t){return e==null?e:{...gm(e),...wm(e),...Cm(e)}}function sl(e){if(e!==void 0)return e===null?null:mm(e)?ym(e):vm(e)?bm(e):Im(e)?xm(e):{}}function _m(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Be(e.selectedValueDefaults,sl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Be(e.selectedFieldSettings,ol)}}function Em(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Be(e.objects,_m)}}function Nm(e){return Tm(e)}function Tm(e,t){return e==null?e:{enabled:e.enabled}}function Rm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Am(e){return Fm(e)}function Fm(e,t){return e==null?e:{enabled:e.enabled}}function Pm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Dm(e){return Mm(e)}function Mm(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:E(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:E(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function km(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function jm(e){return Lm(e)}function Lm(e,t){return e==null?e:{apiKeyAsBasic:E(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:E(e,"apiKeyAsBasicOpts")?_h(e.apiKeyAsBasicOpts):void 0,docsURL:E(e,"docsURL")?e.docsURL:void 0}}function Vm(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function $m(e){return Km(e)}function Km(e,t){return e==null?e:{value:e.value}}function qm(e){return Um(e)}function Um(e,t){return e==null?e:{brandingRemoval:E(e,"brandingRemoval")?$m(e.brandingRemoval):void 0}}function Zi(e){return Bm(e)}function Bm(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:E(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:E(e,"entitlements")?qm(e.entitlements):void 0}}function Jm(e){return Hm(e)}function Hm(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Wm(e){return zm(e)}function zm(e,t){return e==null?e:{objectName:e.objectName,schedule:E(e,"schedule")?e.schedule:void 0,destination:E(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:E(e,"selectedValueMappings")?e.selectedValueMappings:void 0,dynamicMappingsInput:E(e,"dynamicMappingsInput")?e.dynamicMappingsInput.map(nm):void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:E(e,"selectedFieldsAuto")?im(e.selectedFieldsAuto):void 0,backfill:E(e,"backfill")?Qh(e.backfill):void 0}}function Qm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,dynamicMappingsInput:e.dynamicMappingsInput===void 0?void 0:e.dynamicMappingsInput.map(il),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:nl(e.backfill)}}function Gm(e){return Xm(e)}function Xm(e,t){return e==null?e:{objects:Be(e.objects,Wm)}}function Ym(e){if(e!==void 0)return e===null?null:{objects:Be(e.objects,Qm)}}function Zm(e){return eg(e)}function eg(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:E(e,"createEvent")?Nm(e.createEvent):void 0,updateEvent:E(e,"updateEvent")?Dm(e.updateEvent):void 0,deleteEvent:E(e,"deleteEvent")?Am(e.deleteEvent):void 0}}function tg(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:Rm(e.createEvent),updateEvent:km(e.updateEvent),deleteEvent:Pm(e.deleteEvent)}}function ng(e){return rg(e)}function rg(e,t){return e==null?e:{objects:Be(e.objects,Zm)}}function ig(e){if(e!==void 0)return e===null?null:{objects:Be(e.objects,tg)}}function og(e){return sg(e)}function sg(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:E(e,"selectedValueDefaults")?Be(e.selectedValueDefaults,Om):void 0,selectedFieldSettings:E(e,"selectedFieldSettings")?Be(e.selectedFieldSettings,pm):void 0}}function ag(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Be(e.selectedValueDefaults,sl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Be(e.selectedFieldSettings,ol)}}function cg(e){return ug(e)}function ug(e,t){return e==null?e:{objects:E(e,"objects")?Be(e.objects,og):void 0}}function lg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Be(e.objects,ag)}}function dg(e){return fg(e)}function fg(e,t){return e==null?e:{provider:e.provider,module:E(e,"module")?e.module:void 0,read:E(e,"read")?Gm(e.read):void 0,write:E(e,"write")?cg(e.write):void 0,proxy:E(e,"proxy")?Xh(e.proxy):void 0,subscribe:E(e,"subscribe")?ng(e.subscribe):void 0}}function pg(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:Ym(e.read),write:lg(e.write),proxy:rl(e.proxy),subscribe:ig(e.subscribe)}}function hg(e){return mg(e)}function mg(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:dg(e.content)}}function gg(e){return yg(e)}function yg(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0}}function al(e){return vg(e)}function vg(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0}}function wg(e){return bg(e)}function bg(e,t){return e==null?e:{token:e.token,issuedAt:E(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:E(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Ig(e){return Cg(e)}function Cg(e,t){return e==null?e:{token:e.token,issuedAt:E(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:E(e,"expiresAt")?new Date(e.expiresAt):void 0}}function xg(e){return Og(e)}function Og(e,t){return e==null?e:{accessToken:E(e,"accessToken")?wg(e.accessToken):void 0,refreshToken:E(e,"refreshToken")?Ig(e.refreshToken):void 0,scopes:E(e,"scopes")?e.scopes:void 0}}function co(e){return Sg(e)}function Sg(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:E(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:E(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0}}function _g(e){return Eg(e)}function Eg(e,t){return e==null?e:{value:e.value,source:e.source,displayName:E(e,"displayName")?e.displayName:void 0}}function ca(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function vi(e){return Ng(e)}function Ng(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:E(e,"providerApp")?co(e.providerApp):void 0,group:al(e.group),consumer:gg(e.consumer),providerWorkspaceRef:E(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:E(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:E(e,"oauth2AuthorizationCode")?xg(e.oauth2AuthorizationCode):void 0,apiKey:E(e,"apiKey")?e.apiKey:void 0,providerMetadata:E(e,"providerMetadata")?Be(e.providerMetadata,_g):void 0}}function cl(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function ul(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function ll(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Tg(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 Rg(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function dl(e){if(e!==void 0)return e===null?null:{accessToken:Tg(e.accessToken),refreshToken:Rg(e.refreshToken),scopes:e.scopes}}function Ag(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Be(e.providerMetadata,ca),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:cl(e.basicAuth),oauth2ClientCredentials:ul(e.oauth2ClientCredentials),oauth2PasswordCredentials:ll(e.oauth2PasswordCredentials),oauth2AuthorizationCode:dl(e.oauth2AuthorizationCode)}}function Fg(e){return Pg(e)}function Pg(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0}}function Dg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Mg(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:pg(e.content)}}function kg(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Mg(e.config)}}function jg(e){return Lg(e)}function Lg(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,useModule:E(e,"useModule")?e.useModule:void 0}}function Vg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function $g(e){return Kg(e)}function Kg(e,t){return e==null?e:{mode:E(e,"mode")?e.mode:void 0,pageSize:E(e,"pageSize")?e.pageSize:void 0}}function qg(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Ug(e){let t=!0;return t=t&&"fieldName"in e,t}function Bg(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:E(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Jg(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Hg(e){let t=!0;return t=t&&"mapToName"in e,t}function fl(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:E(e,"default")?e.default:void 0,prompt:E(e,"prompt")?e.prompt:void 0}}function Wg(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function _c(e){return zg(e)}function zg(e,t){return e==null?e:{...Bg(e),...fl(e)}}function Ec(e){if(e!==void 0)return e===null?null:Ug(e)?Jg(e):Hg(e)?Wg(e):{}}function pl(e){return Qg(e)}function Qg(e,t){return e}function Gg(e){return Xg(e)}function Xg(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:E(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:E(e,"requiredFields")?e.requiredFields.map(_c):void 0,optionalFields:E(e,"optionalFields")?e.optionalFields.map(_c):void 0,optionalFieldsAuto:E(e,"optionalFieldsAuto")?pl(e.optionalFieldsAuto):void 0,backfill:E(e,"backfill")?tl(e.backfill):void 0,delivery:E(e,"delivery")?$g(e.delivery):void 0,enabled:E(e,"enabled")?e.enabled:void 0}}function Yg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(Ec),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Ec),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Jh(e.backfill),delivery:qg(e.delivery),enabled:e.enabled}}function Zg(e){return ey(e)}function ey(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(Gg):void 0}}function ty(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Yg)}}function ny(e){return ry(e)}function ry(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0}}function iy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function oy(e){return sy(e)}function sy(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,watchFieldsAuto:E(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:E(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function ay(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function cy(e){return uy(e)}function uy(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:E(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:E(e,"createEvent")?Fg(e.createEvent):void 0,updateEvent:E(e,"updateEvent")?oy(e.updateEvent):void 0,deleteEvent:E(e,"deleteEvent")?ny(e.deleteEvent):void 0,associationChangeEvent:E(e,"associationChangeEvent")?Dh(e.associationChangeEvent):void 0,otherEvents:E(e,"otherEvents")?e.otherEvents:void 0}}function ly(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:Dg(e.createEvent),updateEvent:ay(e.updateEvent),deleteEvent:iy(e.deleteEvent),associationChangeEvent:kh(e.associationChangeEvent),otherEvents:e.otherEvents}}function dy(e){return fy(e)}function fy(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(cy):void 0}}function py(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ly)}}function hl(e){return hy(e)}function hy(e,t){return e==null?e:{allowAnyFields:E(e,"allowAnyFields")?e.allowAnyFields:void 0}}function my(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function gy(e){return yy(e)}function yy(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:E(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:E(e,"valueDefaults")?hl(e.valueDefaults):void 0}}function vy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:my(e.valueDefaults)}}function wy(e){return by(e)}function by(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(gy):void 0}}function Iy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(vy)}}function Cy(e){return xy(e)}function xy(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:E(e,"displayName")?e.displayName:void 0,module:E(e,"module")?e.module:void 0,read:E(e,"read")?Zg(e.read):void 0,write:E(e,"write")?wy(e.write):void 0,proxy:E(e,"proxy")?jg(e.proxy):void 0,subscribe:E(e,"subscribe")?dy(e.subscribe):void 0}}function Oy(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:ty(e.read),write:Iy(e.write),proxy:Vg(e.proxy),subscribe:py(e.subscribe)}}function Sy(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Oy(e.content)}}function _y(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Sy(e.latestRevision)}}function Ey(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Ny(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 Ty(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Ry(e){return Ay(e)}function Ay(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Fy(e){return Py(e)}function Py(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:E(e,"prompt")?e.prompt:void 0,docsURL:E(e,"docsURL")?e.docsURL:void 0}}function Dy(e){return My(e)}function My(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function ky(e){return jy(e)}function jy(e,t){return e==null?e:{headers:E(e,"headers")?e.headers.map(Ry):void 0,queryParams:E(e,"queryParams")?e.queryParams.map(Dy):void 0,inputs:E(e,"inputs")?e.inputs.map(Fy):void 0}}function Ly(e){return Vy(e)}function Vy(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function $y(e){return Ky(e)}function Ky(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:E(e,"valueType")?e.valueType:void 0,providerType:E(e,"providerType")?e.providerType:void 0,readOnly:E(e,"readOnly")?e.readOnly:void 0,values:E(e,"values")?e.values.map(Ly):void 0}}function qy(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Be(e.providerMetadata,ca),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:cl(e.basicAuth),oauth2ClientCredentials:ul(e.oauth2ClientCredentials),oauth2PasswordCredentials:ll(e.oauth2PasswordCredentials),oauth2AuthorizationCode:dl(e.oauth2AuthorizationCode)}}function Uy(e){return By(e)}function By(e,t){return e==null?e:{enabled:E(e,"enabled")?e.enabled:void 0,useModule:E(e,"useModule")?e.useModule:void 0}}function Jy(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:E(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Zo(e){return Hy(e)}function Hy(e,t){return e==null?e:{...Jy(e),...fl(e)}}function Wy(e){return zy(e)}function zy(e,t){return e==null?e:{error:E(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:E(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:E(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:E(e,"requiredFields")?e.requiredFields.map(Zo):void 0,optionalFields:E(e,"optionalFields")?e.optionalFields.map(Zo):void 0,optionalFieldsAuto:E(e,"optionalFieldsAuto")?pl(e.optionalFieldsAuto):void 0,allFieldsMetadata:E(e,"allFieldsMetadata")?Be(e.allFieldsMetadata,$y):void 0,allFields:E(e,"allFields")?e.allFields.map(Zo):void 0,backfill:E(e,"backfill")?tl(e.backfill):void 0}}function Qy(e){return Gy(e)}function Gy(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(Wy):void 0}}function Xy(e){return Yy(e)}function Yy(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:E(e,"valueDefaults")?hl(e.valueDefaults):void 0}}function Zy(e){return ev(e)}function ev(e,t){return e==null?e:{objects:E(e,"objects")?e.objects.map(Xy):void 0}}function tv(e){return nv(e)}function nv(e,t){return e==null?e:{name:e.name,displayName:E(e,"displayName")?e.displayName:void 0,module:E(e,"module")?e.module:void 0,provider:e.provider,read:E(e,"read")?Qy(e.read):void 0,write:E(e,"write")?Zy(e.write):void 0,proxy:E(e,"proxy")?Uy(e.proxy):void 0}}function rv(e){return iv(e)}function iv(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:tv(e.content)}}function hi(e){return ov(e)}function ov(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:E(e,"group")?al(e.group):void 0,healthStatus:e.healthStatus,connection:vi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0,config:hg(e.config)}}function sv(e){return av(e)}function av(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Cy(e.content)}}function es(e){return cv(e)}function cv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:E(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:sv(e.latestRevision)}}function uv(e){return lv(e)}function lv(e,t){return e==null?e:{iconURL:E(e,"iconURL")?e.iconURL:void 0,logoURL:E(e,"logoURL")?e.logoURL:void 0}}function dv(e){return fv(e)}function fv(e,t){return e==null?e:{iconURL:E(e,"iconURL")?e.iconURL:void 0,logoURL:E(e,"logoURL")?e.logoURL:void 0}}function pv(e){return hv(e)}function hv(e,t){return e==null?e:{regular:E(e,"regular")?dv(e.regular):void 0,darkMode:E(e,"darkMode")?uv(e.darkMode):void 0}}function mv(e){return gv(e)}function gv(e,t){return e==null?e:{name:e.name,displayName:E(e,"displayName")?e.displayName:void 0,defaultValue:E(e,"defaultValue")?e.defaultValue:void 0,docsURL:E(e,"docsURL")?e.docsURL:void 0,moduleDependencies:E(e,"moduleDependencies")?e.moduleDependencies:void 0}}function yv(e){return vv(e)}function vv(e,t){return e==null?e:{name:e.name,moduleDependencies:E(e,"moduleDependencies")?e.moduleDependencies:void 0}}function wv(e){return bv(e)}function bv(e,t){return e==null?e:{create:E(e,"create")?e.create:void 0,update:E(e,"update")?e.update:void 0,_delete:E(e,"delete")?e.delete:void 0,passThrough:E(e,"passThrough")?e.passThrough:void 0}}function ml(e){return Iv(e)}function Iv(e,t){return e==null?e:{bulkWrite:Jm(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:E(e,"subscribeSupport")?wv(e.subscribeSupport):void 0}}function Cv(e){return xv(e)}function xv(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:ml(e.support)}}function Ov(e){return Sv(e)}function Sv(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:E(e,"capture")?e.capture:void 0}}function _v(e){return Ev(e)}function Ev(e,t){return e==null?e:{workspaceRefField:E(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:E(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:E(e,"scopesField")?e.scopesField:void 0,otherFields:E(e,"otherFields")?e.otherFields.map(Ov):void 0}}const ts={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function Nv(e){return Tv(e)}function Tv(e,t){return e==null?e:{grantType:e.grantType,authURL:E(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:E(e,"audience")?e.audience:void 0,tokenMetadataFields:_v(e.tokenMetadataFields),docsURL:E(e,"docsURL")?e.docsURL:void 0,authURLParams:E(e,"authURLParams")?e.authURLParams:void 0}}function Rv(e){if(e!==void 0)return e===null?null:{projectId:e.projectId,provider:e.provider,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Be(e.providerMetadata,ca),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function Av(e){return Fv(e)}function Fv(e,t){return e==null?e:{input:E(e,"input")?e.input.map(mv):void 0,postAuthentication:E(e,"postAuthentication")?e.postAuthentication.map(yv):void 0}}function Pv(e){return Dv(e)}function Dv(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Nc(e){return Mv(e)}function Mv(e,t){return e==null?e:{name:e.name,authType:Vh(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:E(e,"oauth2Opts")?Nv(e.oauth2Opts):void 0,apiKeyOpts:E(e,"apiKeyOpts")?Fh(e.apiKeyOpts):void 0,basicOpts:E(e,"basicOpts")?jm(e.basicOpts):void 0,customOpts:E(e,"customOpts")?ky(e.customOpts):void 0,support:ml(e.support),providerOpts:e.providerOpts,authHealthCheck:E(e,"authHealthCheck")?jh(e.authHealthCheck):void 0,displayName:E(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:E(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:E(e,"media")?pv(e.media):void 0,labels:E(e,"labels")?e.labels:void 0,subscribeOpts:E(e,"subscribeOpts")?Pv(e.subscribeOpts):void 0,modules:E(e,"modules")?Be(e.modules,Cv):void 0,metadata:E(e,"metadata")?Av(e.metadata):void 0}}function kv(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:Ag(e.connection)}}function jv(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:am(e.read),write:Em(e.write),proxy:rl(e.proxy)}}function Lv(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:jv(e.content)}}function Vv(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Lv(e.config)}}function $v(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Vv(e.installation)}}function Kv(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function qv(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Kv(e.project)}}function Uv(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 Bv(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Uv(e.providerApp)}}class Jv extends rn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new Hr(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:qy(t.generateConnectionParams)},n);return new Me(i,s=>vi(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new Me(i,s=>vi(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Me(i,s=>s.map(vi))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}async updateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ie("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:kv(t.updateConnectionRequest)},n);return new Me(i,s=>vi(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Hv extends rn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:kg(t.installation)},n);return new Me(i,s=>hi(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:o,query:r},n);return new Hr(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:r},n);return new Me(i,s=>hi(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new Me(i,s=>s.map(hi))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async listInstallationsForProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallationsForProject.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Me(i,s=>s.map(hi))}async listInstallationsForProject(t,n){return await(await this.listInstallationsForProjectRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ie("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:o,query:r,body:$v(t.installationUpdate)},n);return new Me(i,s=>hi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Wv extends rn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ie("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:Vm(t.batchUpsertIntegrationsRequest)},n);return new Me(i,s=>s.map(es))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ie("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:_y(t.integration)},n);return new Hr(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new Hr(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new ie("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getIntegration.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationIdOrName}".replace("{integrationIdOrName}",encodeURIComponent(String(t.integrationIdOrName))).replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Me(i,s=>es(s))}async getIntegration(t,n){return await(await this.getIntegrationRaw(t,n)).value()}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Me(i,s=>s.map(es))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class zv extends rn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:Rv(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Me(i):new Oc(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new Me(i):new Oc(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Qv extends rn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:Ey(t.project)},n);return new Me(i,s=>Zi(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Me(i,s=>Zi(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const i=this.configuration.accessToken,s=await i("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Me(o,i=>i.map(Zi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ie("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:qv(t.projectUpdate)},n);return new Me(i,s=>Zi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Gv extends rn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new Me(i,s=>Nc(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const i=this.configuration.accessToken,s=await i("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Me(o,i=>Be(i,Nc))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Xv extends rn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Ny(t.providerApp)},n);return new Me(i,s=>co(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new Hr(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Me(i,s=>s.map(co))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ie("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:Bv(t.providerAppUpdate)},n);return new Me(i,s=>co(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Yv extends rn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ie("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:Ty(t.revision)},n);return new Hr(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ie("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:o,query:r},n);return new Me(i,s=>rv(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var gl=Symbol.for("immer-nothing"),Tc=Symbol.for("immer-draftable"),Tt=Symbol.for("immer-state"),Zv=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function xt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Zv[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Wr=Object.getPrototypeOf;function zr(e){return!!e&&!!e[Tt]}function Or(e){var t;return e?yl(e)||Array.isArray(e)||!!e[Tc]||!!((t=e.constructor)!=null&&t[Tc])||Di(e)||Po(e):!1}var ew=Object.prototype.constructor.toString();function yl(e){if(!e||typeof e!="object")return!1;const t=Wr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===ew}function go(e,t){Fo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Fo(e){const t=e[Tt];return t?t.type_:Array.isArray(e)?1:Di(e)?2:Po(e)?3:0}function ks(e,t){return Fo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function vl(e,t,n){const r=Fo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function tw(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Di(e){return e instanceof Map}function Po(e){return e instanceof Set}function cr(e){return e.copy_||e.base_}function js(e,t){if(Di(e))return new Map(e);if(Po(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=yl(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Tt];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){const s=o[i],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Wr(e),r)}else{const r=Wr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function ua(e,t=!1){return Do(e)||zr(e)||!Or(e)||(Fo(e)>1&&Object.defineProperties(e,{set:{value:eo},add:{value:eo},clear:{value:eo},delete:{value:eo}}),Object.freeze(e),t&&Object.values(e).forEach(n=>ua(n,!0))),e}function eo(){xt(2)}function Do(e){return Object.isFrozen(e)}var nw={};function Sr(e){const t=nw[e];return t||xt(0,e),t}var xi;function wl(){return xi}function rw(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Rc(e,t){t&&(Sr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ls(e){Vs(e),e.drafts_.forEach(iw),e.drafts_=null}function Vs(e){e===xi&&(xi=e.parent_)}function Ac(e){return xi=rw(xi,e)}function iw(e){const t=e[Tt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Fc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Tt].modified_&&(Ls(t),xt(4)),Or(e)&&(e=yo(t,e),t.parent_||vo(t,e)),t.patches_&&Sr("Patches").generateReplacementPatches_(n[Tt].base_,e,t.patches_,t.inversePatches_)):e=yo(t,n,[]),Ls(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==gl?e:void 0}function yo(e,t,n){if(Do(t))return t;const r=t[Tt];if(!r)return go(t,(o,i)=>Pc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return vo(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let i=o,s=!1;r.type_===3&&(i=new Set(o),o.clear(),s=!0),go(i,(a,u)=>Pc(e,r,o,a,u,n,s)),vo(e,o,!1),n&&e.patches_&&Sr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Pc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&xt(5),zr(o)){const a=i&&t&&t.type_!==3&&!ks(t.assigned_,r)?i.concat(r):void 0,u=yo(e,o,a);if(vl(n,r,u),zr(u))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(Or(o)&&!Do(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;yo(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Di(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&vo(e,o)}}function vo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ua(t,n)}function ow(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:wl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=la;n&&(o=[r],i=Oi);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var la={get(e,t){if(t===Tt)return e;const n=cr(e);if(!ks(n,t))return sw(e,n,t);const r=n[t];return e.finalized_||!Or(r)?r:r===ns(e.base_,t)?(rs(e),e.copy_[t]=Ks(r,e)):r},has(e,t){return t in cr(e)},ownKeys(e){return Reflect.ownKeys(cr(e))},set(e,t,n){const r=bl(cr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=ns(cr(e),t),i=o==null?void 0:o[Tt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(tw(n,o)&&(n!==void 0||ks(e.base_,t)))return!0;rs(e),$s(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return ns(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,rs(e),$s(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=cr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){xt(11)},getPrototypeOf(e){return Wr(e.base_)},setPrototypeOf(){xt(12)}},Oi={};go(la,(e,t)=>{Oi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Oi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&xt(13),Oi.set.call(this,e,t,void 0)};Oi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&xt(14),la.set.call(this,e[0],t,n,e[0])};function ns(e,t){const n=e[Tt];return(n?cr(n):e)[t]}function sw(e,t,n){var o;const r=bl(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function bl(e,t){if(!(t in e))return;let n=Wr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Wr(n)}}function $s(e){e.modified_||(e.modified_=!0,e.parent_&&$s(e.parent_))}function rs(e){e.copy_||(e.copy_=js(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var aw=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(u=i,...f){return s.produce(u,l=>n.call(this,l,...f))}}typeof n!="function"&&xt(6),r!==void 0&&typeof r!="function"&&xt(7);let o;if(Or(t)){const i=Ac(this),s=Ks(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Ls(i):Vs(i)}return Rc(i,r),Fc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===gl&&(o=void 0),this.autoFreeze_&&ua(o,!0),r){const i=[],s=[];Sr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else xt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,u=>t(u,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Or(e)||xt(8),zr(e)&&(e=cw(e));const t=Ac(this),n=Ks(e,void 0);return n[Tt].isManual_=!0,Vs(t),n}finishDraft(e,t){const n=e&&e[Tt];(!n||!n.isManual_)&&xt(9);const{scope_:r}=n;return Rc(r,t),Fc(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=Sr("Patches").applyPatches_;return zr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Ks(e,t){const n=Di(e)?Sr("MapSet").proxyMap_(e,t):Po(e)?Sr("MapSet").proxySet_(e,t):ow(e,t);return(t?t.scope_:wl()).drafts_.push(n),n}function cw(e){return zr(e)||xt(10,e),Il(e)}function Il(e){if(!Or(e)||Do(e))return e;const t=e[Tt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=js(e,t.scope_.immer_.useStrictShallowCopy_)}else n=js(e,!0);return go(n,(r,o)=>{vl(n,r,Il(o))}),t&&(t.finalized_=!1),n}var uw=new aw,Mt=uw.produce,Hn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wo={exports:{}};wo.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",u="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",d="[object Date]",h="[object Error]",m="[object Function]",v="[object GeneratorFunction]",w="[object Map]",g="[object Number]",O="[object Null]",p="[object Object]",y="[object Promise]",I="[object Proxy]",x="[object RegExp]",N="[object Set]",A="[object String]",_="[object Symbol]",F="[object Undefined]",R="[object WeakMap]",D="[object ArrayBuffer]",K="[object DataView]",j="[object Float32Array]",L="[object Float64Array]",se="[object Int8Array]",re="[object Int16Array]",ge="[object Int32Array]",de="[object Uint8Array]",be="[object Uint8ClampedArray]",P="[object Uint16Array]",$="[object Uint32Array]",H=/[\\^$.*+?()[\]{}|]/g,q=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,V={};V[j]=V[L]=V[se]=V[re]=V[ge]=V[de]=V[be]=V[P]=V[$]=!0,V[a]=V[u]=V[D]=V[l]=V[K]=V[d]=V[h]=V[m]=V[w]=V[g]=V[p]=V[x]=V[N]=V[A]=V[R]=!1;var G=typeof Hn=="object"&&Hn&&Hn.Object===Object&&Hn,Z=typeof self=="object"&&self&&self.Object===Object&&self,Y=G||Z||Function("return this")(),ee=t&&!t.nodeType&&t,ne=ee&&!0&&e&&!e.nodeType&&e,ce=ne&&ne.exports===ee,k=ce&&G.process,ve=function(){try{return k&&k.binding&&k.binding("util")}catch{}}(),z=ve&&ve.isTypedArray;function Xe(C,T){for(var M=-1,te=C==null?0:C.length,Pe=0,fe=[];++M<te;){var $e=C[M];T($e,M,C)&&(fe[Pe++]=$e)}return fe}function Ce(C,T){for(var M=-1,te=T.length,Pe=C.length;++M<te;)C[Pe+M]=T[M];return C}function ct(C,T){for(var M=-1,te=C==null?0:C.length;++M<te;)if(T(C[M],M,C))return!0;return!1}function Ue(C,T){for(var M=-1,te=Array(C);++M<C;)te[M]=T(M);return te}function rt(C){return function(T){return C(T)}}function xe(C,T){return C.has(T)}function ze(C,T){return C==null?void 0:C[T]}function ft(C){var T=-1,M=Array(C.size);return C.forEach(function(te,Pe){M[++T]=[Pe,te]}),M}function yt(C,T){return function(M){return C(T(M))}}function vt(C){var T=-1,M=Array(C.size);return C.forEach(function(te){M[++T]=te}),M}var Ye=Array.prototype,Ze=Function.prototype,De=Object.prototype,J=Y["__core-js_shared__"],pe=Ze.toString,Se=De.hasOwnProperty,ln=function(){var C=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),dn=De.toString,fn=RegExp("^"+pe.call(Se).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),wt=ce?Y.Buffer:void 0,Fe=Y.Symbol,rr=Y.Uint8Array,En=De.propertyIsEnumerable,Nn=Ye.splice,St=Fe?Fe.toStringTag:void 0,pn=Object.getOwnPropertySymbols,Tn=wt?wt.isBuffer:void 0,Rn=yt(Object.keys,Object),hn=Rr(Y,"DataView"),Xt=Rr(Y,"Map"),Le=Rr(Y,"Promise"),ut=Rr(Y,"Set"),ae=Rr(Y,"WeakMap"),he=Rr(Object,"create"),pt=or(hn),mn=or(Xt),X=or(Le),ue=or(ut),le=or(ae),Ve=Fe?Fe.prototype:void 0,Je=Ve?Ve.valueOf:void 0;function et(C){var T=-1,M=C==null?0:C.length;for(this.clear();++T<M;){var te=C[T];this.set(te[0],te[1])}}function At(){this.__data__=he?he(null):{},this.size=0}function it(C){var T=this.has(C)&&delete this.__data__[C];return this.size-=T?1:0,T}function bt(C){var T=this.__data__;if(he){var M=T[C];return M===r?void 0:M}return Se.call(T,C)?T[C]:void 0}function Ae(C){var T=this.__data__;return he?T[C]!==void 0:Se.call(T,C)}function An(C,T){var M=this.__data__;return this.size+=this.has(C)?0:1,M[C]=he&&T===void 0?r:T,this}et.prototype.clear=At,et.prototype.delete=it,et.prototype.get=bt,et.prototype.has=Ae,et.prototype.set=An;function Vt(C){var T=-1,M=C==null?0:C.length;for(this.clear();++T<M;){var te=C[T];this.set(te[0],te[1])}}function Qo(){this.__data__=[],this.size=0}function qi(C){var T=this.__data__,M=Hi(T,C);if(M<0)return!1;var te=T.length-1;return M==te?T.pop():Nn.call(T,M,1),--this.size,!0}function Ui(C){var T=this.__data__,M=Hi(T,C);return M<0?void 0:T[M][1]}function Bi(C){return Hi(this.__data__,C)>-1}function Ji(C,T){var M=this.__data__,te=Hi(M,C);return te<0?(++this.size,M.push([C,T])):M[te][1]=T,this}Vt.prototype.clear=Qo,Vt.prototype.delete=qi,Vt.prototype.get=Ui,Vt.prototype.has=Bi,Vt.prototype.set=Ji;function Yt(C){var T=-1,M=C==null?0:C.length;for(this.clear();++T<M;){var te=C[T];this.set(te[0],te[1])}}function Oe(){this.size=0,this.__data__={hash:new et,map:new(Xt||Vt),string:new et}}function $t(C){var T=Wi(this,C).delete(C);return this.size-=T?1:0,T}function li(C){return Wi(this,C).get(C)}function ir(C){return Wi(this,C).has(C)}function Go(C,T){var M=Wi(this,C),te=M.size;return M.set(C,T),this.size+=M.size==te?0:1,this}Yt.prototype.clear=Oe,Yt.prototype.delete=$t,Yt.prototype.get=li,Yt.prototype.has=ir,Yt.prototype.set=Go;function Fn(C){var T=-1,M=C==null?0:C.length;for(this.__data__=new Yt;++T<M;)this.add(C[T])}function Qf(C){return this.__data__.set(C,r),this}function Gf(C){return this.__data__.has(C)}Fn.prototype.add=Fn.prototype.push=Qf,Fn.prototype.has=Gf;function Pn(C){var T=this.__data__=new Vt(C);this.size=T.size}function Xf(){this.__data__=new Vt,this.size=0}function Yf(C){var T=this.__data__,M=T.delete(C);return this.size=T.size,M}function Zf(C){return this.__data__.get(C)}function ep(C){return this.__data__.has(C)}function tp(C,T){var M=this.__data__;if(M instanceof Vt){var te=M.__data__;if(!Xt||te.length<n-1)return te.push([C,T]),this.size=++M.size,this;M=this.__data__=new Yt(te)}return M.set(C,T),this.size=M.size,this}Pn.prototype.clear=Xf,Pn.prototype.delete=Yf,Pn.prototype.get=Zf,Pn.prototype.has=ep,Pn.prototype.set=tp;function np(C,T){var M=zi(C),te=!M&&yp(C),Pe=!M&&!te&&Xo(C),fe=!M&&!te&&!Pe&&uc(C),$e=M||te||Pe||fe,tt=$e?Ue(C.length,String):[],ot=tt.length;for(var ke in C)Se.call(C,ke)&&!($e&&(ke=="length"||Pe&&(ke=="offset"||ke=="parent")||fe&&(ke=="buffer"||ke=="byteLength"||ke=="byteOffset")||fp(ke,ot)))&&tt.push(ke);return tt}function Hi(C,T){for(var M=C.length;M--;)if(oc(C[M][0],T))return M;return-1}function rp(C,T,M){var te=T(C);return zi(C)?te:Ce(te,M(C))}function di(C){return C==null?C===void 0?F:O:St&&St in Object(C)?lp(C):gp(C)}function tc(C){return fi(C)&&di(C)==a}function nc(C,T,M,te,Pe){return C===T?!0:C==null||T==null||!fi(C)&&!fi(T)?C!==C&&T!==T:ip(C,T,M,te,nc,Pe)}function ip(C,T,M,te,Pe,fe){var $e=zi(C),tt=zi(T),ot=$e?u:Dn(C),ke=tt?u:Dn(T);ot=ot==a?p:ot,ke=ke==a?p:ke;var _t=ot==p,Kt=ke==p,lt=ot==ke;if(lt&&Xo(C)){if(!Xo(T))return!1;$e=!0,_t=!1}if(lt&&!_t)return fe||(fe=new Pn),$e||uc(C)?rc(C,T,M,te,Pe,fe):cp(C,T,ot,M,te,Pe,fe);if(!(M&o)){var Ft=_t&&Se.call(C,"__wrapped__"),Pt=Kt&&Se.call(T,"__wrapped__");if(Ft||Pt){var Mn=Ft?C.value():C,gn=Pt?T.value():T;return fe||(fe=new Pn),Pe(Mn,gn,M,te,fe)}}return lt?(fe||(fe=new Pn),up(C,T,M,te,Pe,fe)):!1}function op(C){if(!cc(C)||hp(C))return!1;var T=sc(C)?fn:q;return T.test(or(C))}function sp(C){return fi(C)&&ac(C.length)&&!!V[di(C)]}function ap(C){if(!mp(C))return Rn(C);var T=[];for(var M in Object(C))Se.call(C,M)&&M!="constructor"&&T.push(M);return T}function rc(C,T,M,te,Pe,fe){var $e=M&o,tt=C.length,ot=T.length;if(tt!=ot&&!($e&&ot>tt))return!1;var ke=fe.get(C);if(ke&&fe.get(T))return ke==T;var _t=-1,Kt=!0,lt=M&i?new Fn:void 0;for(fe.set(C,T),fe.set(T,C);++_t<tt;){var Ft=C[_t],Pt=T[_t];if(te)var Mn=$e?te(Pt,Ft,_t,T,C,fe):te(Ft,Pt,_t,C,T,fe);if(Mn!==void 0){if(Mn)continue;Kt=!1;break}if(lt){if(!ct(T,function(gn,sr){if(!xe(lt,sr)&&(Ft===gn||Pe(Ft,gn,M,te,fe)))return lt.push(sr)})){Kt=!1;break}}else if(!(Ft===Pt||Pe(Ft,Pt,M,te,fe))){Kt=!1;break}}return fe.delete(C),fe.delete(T),Kt}function cp(C,T,M,te,Pe,fe,$e){switch(M){case K:if(C.byteLength!=T.byteLength||C.byteOffset!=T.byteOffset)return!1;C=C.buffer,T=T.buffer;case D:return!(C.byteLength!=T.byteLength||!fe(new rr(C),new rr(T)));case l:case d:case g:return oc(+C,+T);case h:return C.name==T.name&&C.message==T.message;case x:case A:return C==T+"";case w:var tt=ft;case N:var ot=te&o;if(tt||(tt=vt),C.size!=T.size&&!ot)return!1;var ke=$e.get(C);if(ke)return ke==T;te|=i,$e.set(C,T);var _t=rc(tt(C),tt(T),te,Pe,fe,$e);return $e.delete(C),_t;case _:if(Je)return Je.call(C)==Je.call(T)}return!1}function up(C,T,M,te,Pe,fe){var $e=M&o,tt=ic(C),ot=tt.length,ke=ic(T),_t=ke.length;if(ot!=_t&&!$e)return!1;for(var Kt=ot;Kt--;){var lt=tt[Kt];if(!($e?lt in T:Se.call(T,lt)))return!1}var Ft=fe.get(C);if(Ft&&fe.get(T))return Ft==T;var Pt=!0;fe.set(C,T),fe.set(T,C);for(var Mn=$e;++Kt<ot;){lt=tt[Kt];var gn=C[lt],sr=T[lt];if(te)var lc=$e?te(sr,gn,lt,T,C,fe):te(gn,sr,lt,C,T,fe);if(!(lc===void 0?gn===sr||Pe(gn,sr,M,te,fe):lc)){Pt=!1;break}Mn||(Mn=lt=="constructor")}if(Pt&&!Mn){var Qi=C.constructor,Gi=T.constructor;Qi!=Gi&&"constructor"in C&&"constructor"in T&&!(typeof Qi=="function"&&Qi instanceof Qi&&typeof Gi=="function"&&Gi instanceof Gi)&&(Pt=!1)}return fe.delete(C),fe.delete(T),Pt}function ic(C){return rp(C,bp,dp)}function Wi(C,T){var M=C.__data__;return pp(T)?M[typeof T=="string"?"string":"hash"]:M.map}function Rr(C,T){var M=ze(C,T);return op(M)?M:void 0}function lp(C){var T=Se.call(C,St),M=C[St];try{C[St]=void 0;var te=!0}catch{}var Pe=dn.call(C);return te&&(T?C[St]=M:delete C[St]),Pe}var dp=pn?function(C){return C==null?[]:(C=Object(C),Xe(pn(C),function(T){return En.call(C,T)}))}:Ip,Dn=di;(hn&&Dn(new hn(new ArrayBuffer(1)))!=K||Xt&&Dn(new Xt)!=w||Le&&Dn(Le.resolve())!=y||ut&&Dn(new ut)!=N||ae&&Dn(new ae)!=R)&&(Dn=function(C){var T=di(C),M=T==p?C.constructor:void 0,te=M?or(M):"";if(te)switch(te){case pt:return K;case mn:return w;case X:return y;case ue:return N;case le:return R}return T});function fp(C,T){return T=T??s,!!T&&(typeof C=="number"||U.test(C))&&C>-1&&C%1==0&&C<T}function pp(C){var T=typeof C;return T=="string"||T=="number"||T=="symbol"||T=="boolean"?C!=="__proto__":C===null}function hp(C){return!!ln&&ln in C}function mp(C){var T=C&&C.constructor,M=typeof T=="function"&&T.prototype||De;return C===M}function gp(C){return dn.call(C)}function or(C){if(C!=null){try{return pe.call(C)}catch{}try{return C+""}catch{}}return""}function oc(C,T){return C===T||C!==C&&T!==T}var yp=tc(function(){return arguments}())?tc:function(C){return fi(C)&&Se.call(C,"callee")&&!En.call(C,"callee")},zi=Array.isArray;function vp(C){return C!=null&&ac(C.length)&&!sc(C)}var Xo=Tn||Cp;function wp(C,T){return nc(C,T)}function sc(C){if(!cc(C))return!1;var T=di(C);return T==m||T==v||T==f||T==I}function ac(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=s}function cc(C){var T=typeof C;return C!=null&&(T=="object"||T=="function")}function fi(C){return C!=null&&typeof C=="object"}var uc=z?rt(z):sp;function bp(C){return vp(C)?np(C):ap(C)}function Ip(){return[]}function Cp(){return!1}e.exports=wp})(wo,wo.exports);var lw=wo.exports;const Cl=Mo(lw),He=async(e,t)=>{var n;if(e instanceof Yu){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
3
+ `))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const u=`${a} ${s!=null&&s.remedy?`
4
4
 
5
- [Remedy] ${s.remedy}`:""}`;t&&t(c)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)};function Vo(){const e=ct(),{projectIdOrName:t}=Le(),{setError:n,removeError:r}=un(),o=er({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t});return b.useEffect(()=>{o.isError?(We(o.error),n(we.INTEGRATION_LIST,t)):r(we.INTEGRATION_LIST,t)},[o.isError,o.error,t,n,r]),o}const Ca=(e,t)=>{var s;const n=ct(),{projectIdOrName:r}=Le(),{data:o}=Vo(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return er({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})},nr=()=>{var o,i;const{setError:e}=un(),t=ct(),{projectIdOrName:n}=Le(),r=er({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return b.useEffect(()=>{r.isError&&e(we.PROJECT,n)},[r.isError,n,e]),{...r,projectIdOrName:n,appName:(o=r.data)==null?void 0:o.name,projectId:(i=r.data)==null?void 0:i.id}};function Ar(){const{integrationNameOrId:e,groupRef:t}=Rr(),n=Ca(e,t),{isPending:r,isFetching:o,isError:i,isSuccess:s,error:a,data:c}=n;return{installation:c==null?void 0:c[0],isPending:r,isFetching:o,isError:i,isSuccess:s,error:a}}const ui=e=>{const t=Vo(),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}},Sa=()=>{const{groupRef:e,integrationNameOrId:t}=Rr(),{provider:n}=ui(t),r=Ea({groupRef:e,provider:n}),{isPending:o,isFetching:i,isError:s,isSuccess:a,error:c,data:f}=r;return{connection:f==null?void 0:f[0],error:c,isPending:o,isFetching:i,isError:s,isSuccess:a}},$l=()=>{var p;const e=qe(),t=ct(),{connection:n,isPending:r,isFetching:o}=Sa(),{projectIdOrName:i}=Le(),{integrationNameOrId:s}=Rr(),{data:a}=ui(s),c=n==null?void 0:n.id,f=a==null?void 0:a.id,d=(p=a==null?void 0:a.latestRevision)==null?void 0:p.id,l=r||o;return b.useEffect(()=>{c||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[c,e]),er({queryKey:["amp","hydratedRevision",i,f,d,c],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!f)throw new Error("integrationId is required");if(!d)throw new Error("revisionId is required");if(!c)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:f,revisionId:d,connectionId:c})},retry:3,enabled:!!i&&!!f&&!!d&&!!c&&!l})};function Ul(){var f,d;const e=$l(),{isPending:t,isFetching:n,isError:r,isSuccess:o,error:i,data:s}=e,a=s==null?void 0:s.content,c=b.useMemo(()=>({getReadObject:l=>{var m,g;const p=(g=(m=a==null?void 0:a.read)==null?void 0:m.objects)==null?void 0:g.find(w=>w.objectName===l);return p?{object:p,getRequiredFields:()=>p.requiredFields??[],getOptionalFields:()=>p.optionalFields??[]}:(console.error(`Object ${l} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:l=>{var m,g;const p=(g=(m=a==null?void 0:a.write)==null?void 0:m.objects)==null?void 0:g.find(w=>w.objectName===l);return p?{object:p}:(console.error(`Object ${l} not found`),{object:null})},getCustomerFieldsForObject:l=>{var m,g;const p=(g=(m=a==null?void 0:a.read)==null?void 0:m.objects)==null?void 0:g.find(w=>w.objectName===l);return p?{allFields:p.allFieldsMetadata??{},getField:w=>{var x;const v=(x=p.allFieldsMetadata)==null?void 0:x[w];return v||(console.error(`Field ${w} not found`),null)}}:(console.error(`Object ${l} not found`),{allFields:null,getField:()=>null})}}),[(f=a==null?void 0:a.read)==null?void 0:f.objects,(d=a==null?void 0:a.write)==null?void 0:d.objects]);return{data:s,...c,isPending:t,isFetching:n,isError:r,isSuccess:o,error:i}}function zw(e){var m,g,w,v;const[t,n]=b.useState(e),r=b.useRef(void 0),{getReadObject:o,data:i}=Ul(),{installation:s}=Ar(),a=b.useCallback(()=>t,[t]),c=b.useCallback((x,h)=>{var _,A;h.provider=h.provider||((_=i==null?void 0:i.content)==null?void 0:_.provider)||"";const y=h.read||{objects:{}},I=y.objects||{},S=I[x]||{},E=o(x),P={};return(A=E==null?void 0:E.getRequiredFields())==null||A.forEach(R=>{"fieldName"in R&&(P[R.fieldName]=!0)}),S.objectName=S.objectName||x,S.selectedFields=S.selectedFields||P,I[x]=S,y.objects=I,h.read=y,{read:y,objects:I,obj:S}},[o,(m=i==null?void 0:i.content)==null?void 0:m.provider]),f=b.useCallback(x=>{var h,y;return{object:(y=(h=t.read)==null?void 0:h.objects)==null?void 0:y[x],getSelectedField:I=>{var S,E,P,_;return!!((_=(P=(E=(S=t.read)==null?void 0:S.objects)==null?void 0:E[x])==null?void 0:P.selectedFields)!=null&&_[I])},setSelectedField:({fieldName:I,selected:S})=>{n(E=>Tt(E,P=>{const{obj:_}=c(x,P);_.selectedFields=_.selectedFields||{},_.selectedFields[I]=S,_.selectedFields[I]===!1&&delete _.selectedFields[I]}))},getFieldMapping:I=>{var S,E,P,_;return(_=(P=(E=(S=t.read)==null?void 0:S.objects)==null?void 0:E[x])==null?void 0:P.selectedFieldMappings)==null?void 0:_[I]},setFieldMapping:({fieldName:I,mapToName:S})=>{n(E=>Tt(E,P=>{const{obj:_}=c(x,P);_.selectedFieldMappings=_.selectedFieldMappings||{},_.selectedFieldMappings[S]=I}))}}},[(g=t.read)==null?void 0:g.objects,c]),d=b.useCallback(x=>{var E,P;const h=(P=(E=t.write)==null?void 0:E.objects)==null?void 0:P[x],y=_=>{const A=_.write||{},R=A.objects||{},M=R[x]||{objectName:x};return R[x]=M,A.objects=R,_.write=A,{write:A,objects:R,obj:M}},I=(_,A)=>{var R,M;return(M=(R=h==null?void 0:h.selectedFieldSettings)==null?void 0:R[_])==null?void 0:M[A]},S=(_,A,R)=>{n(M=>Tt(M,j=>{var $;const{obj:K}=y(j);K.selectedFieldSettings={...K.selectedFieldSettings,[_]:{...($=K.selectedFieldSettings)==null?void 0:$[_],[A]:R}}}))};return{object:h,setEnableWrite:()=>{n(_=>Tt(_,A=>{const{obj:R}=y(A);R.objectName=x}))},setDisableWrite:()=>{n(_=>Tt(_,A=>{const{objects:R}=y(A);delete R[x]}))},getWriteObject:()=>{var _,A;return(A=(_=t.write)==null?void 0:_.objects)==null?void 0:A[x]},getSelectedFieldSettings:_=>{var A;return(A=h==null?void 0:h.selectedFieldSettings)==null?void 0:A[_]},setSelectedFieldSettings:({fieldName:_,settings:A})=>{n(R=>Tt(R,M=>{const{obj:j}=y(M),K=j.selectedFieldSettings||{};j.selectedFieldSettings={...K,[_]:A},A===void 0&&delete j.selectedFieldSettings[_]}))},getDefaultValues:_=>I(_,"default"),setDefaultValues:({fieldName:_,value:A})=>S(_,"default",A),getWriteOnCreateSetting:_=>I(_,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:_,value:A})=>S(_,"writeOnCreate",A),getWriteOnUpdateSetting:_=>I(_,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:_,value:A})=>S(_,"writeOnUpdate",A)}},[(w=t.write)==null?void 0:w.objects]),l=b.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(x=>Tt(x,h=>{h.proxy={enabled:!0}}))},setDisableProxy:()=>{n(x=>Tt(x,h=>{h.proxy={enabled:!1}}))},getProxyEnabled:()=>{var x;return((x=t.proxy)==null?void 0:x.enabled)||!1}}),[t.proxy]),p=b.useCallback(()=>{n(x=>Tt(x,h=>{var y;Object.assign(h,(y=s==null?void 0:s.config)==null?void 0:y.content)}))},[(v=s==null?void 0:s.config)==null?void 0:v.content]);return b.useEffect(()=>{s&&(console.debug("Installation found",{installation:s}),r.current?Ia(r.current,s)||(console.debug("Installation changed, resetting config",{previous:r.current,current:s}),p(),r.current=s):(r.current=s,p()))},[s,p]),{draft:t,get:a,reset:p,setDraft:n,readObject:f,writeObject:d,proxy:l}}const xa=b.createContext(null);function Gw({children:e,initialConfig:t}){const n=zw(t);return u.jsx(xa.Provider,{value:n,children:e})}function Qw(){const e=b.useContext(xa);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function Xw(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=b.useContext(xa);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const Vl=b.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Rr(){const e=b.useContext(Vl);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function Oa({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}){const s=b.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}),[t,n,r,o,i]);return u.jsx(Vl.Provider,{value:s,children:u.jsx(Gw,{initialConfig:{},children:e})})}class Gs{constructor(t){this.connectionApi=new Nw(t),this.installationApi=new Tw(t),this.integrationApi=new Aw(t),this.oAuthApi=new Rw(t),this.projectApi=new Pw(t),this.providerApi=new Fw(t),this.providerAppApi=new Dw(t),this.revisionApi=new Mw(t)}}const ql="2.9.4",Yw="v1",oo="https://api.withampersand.com";function Bl(){try{const e=process.env.REACT_APP_AMP_SERVER;switch(e){case"local":return"http://localhost:8080";case"dev":return"https://dev-api.withampersand.com";case"staging":return"https://staging-api.withampersand.com";case"prod":return oo;case"mock":return"http://127.0.0.1:4010";case"":return oo;default:return e??oo}}catch{return oo}}const Zw=(e,t)=>`${e}/${t}`;function eb(){return Zw(Bl(),Yw)}const Hl=Bl(),Jl=eb(),tb=new ya({basePath:Jl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":ql}});new Gs(tb);const nb=e=>({header:"X-Api-Key",value:e}),rb=e=>{try{return{header:"Authorization",value:`Bearer ${e}`}}catch(t){throw console.error("Failed to get JWT token for API authentication:",t),new Error("Failed to authenticate with JWT token")}},Hc=(e,t)=>new ya({basePath:Jl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":ql,[e]:t}});function ct(){const e=ol(),{getToken:t}=sm(),{consumerRef:n,groupRef:r}=Rr();return b.useCallback(async()=>{if(e){const i=nb(e),s=Hc(i.header,i.value);return new Gs(s)}if(t){if(!n||!r)throw console.error("Unable to create JWT API service without consumerRef or groupRef.",{consumerRef:n,groupRef:r}),new Error("Unable to create JWT API service without consumerRef or groupRef.");const i=await t({consumerRef:n,groupRef:r}),s=rb(i),a=Hc(s.header,s.value);return new Gs(a)}throw console.error("Unable to create API service without API key or JWT token."),new Error("Unable to create API service without API key or JWT token.")},[e,t,n,r])}const Ea=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Le(),r=ct();return er({queryKey:["amp","connections",n,e,t],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!e)throw new Error("Group reference not found.");if(!t)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:n,groupRef:e,provider:t})},retry:3,enabled:!!n&&!!e&&!!t})};function ib(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const ob="_box_1p7c5_1",Jc={box:ob};function _n({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Jc.box} ${t}`:Jc.box,style:n,children:e})}const sb="_container_1wvzr_1",Wc={container:sb};function li({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Wc.container} ${t}`:Wc.container,style:n,children:e})}const ab="_errorBoxContainer_4sdb2_1",cb="_errorBox_4sdb2_1",ub="_errorText_4sdb2_20",Qs={errorBoxContainer:ab,errorBox:cb,errorText:ub};function Wl({message:e}){return u.jsx(_n,{className:Qs.errorBox,children:u.jsx("p",{className:Qs.errorText,children:e})})}function zl({message:e,children:t}){return u.jsxs(li,{className:Qs.errorBoxContainer,children:[u.jsx(ib,{}),u.jsx(Wl,{message:e}),t]})}const lb="_loader_6ubm6_1",db={loader:lb};function fb(){return u.jsx("span",{className:db.loader})}function Ti(){return u.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:u.jsx(fb,{})})}function Gl({children:e}){return u.jsx(li,{style:{maxWidth:"55rem"},children:u.jsx(_n,{children:e})})}function di(){return u.jsx(Gl,{children:u.jsx(Ti,{})})}function zt({message:e,children:t}){return u.jsx(Gl,{children:u.jsx(zl,{message:e,children:t})})}function an(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pb(e,t){return(t==null?void 0:t.displayName)??an(e)}const hb=e=>e.split(`
6
- `).filter(n=>n.trim()!==""),mb=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null;function gb(e){return!e||typeof e!="string"?"id_"+Math.random().toString(36).substr(2,9):e.toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").replace(/^[^a-z]/,"id-").substring(0,50)}const yb=()=>{const[e,t]=b.useState(!1),n=b.useCallback(()=>{t(!0)},[t]),r=b.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},Ql=b.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{},resetComponent:()=>{}});function ut(){const e=b.useContext(Ql);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function vb({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:f,resetComponent:d}){const{data:l}=Vo(),{setError:p,isError:m,removeError:g}=un(),{isIntegrationDeleted:w,setIntegrationDeleted:v,resetIntegrationDeleted:x}=yb(),h=b.useMemo(()=>mb(t,l||[]),[t,l]),{data:y,isLoading:I,isError:S,error:E}=Ca(t,o),P=(y==null?void 0:y[0])||null;b.useEffect(()=>{x()},[t,n,r,o,i,f]),b.useEffect(()=>{h===null&&(l!=null&&l.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,h,l]),b.useEffect(()=>{S?(p(we.INSTALLATION_LIST,(h==null?void 0:h.id)||""),We(E)):g(we.INSTALLATION_LIST,(h==null?void 0:h.id)||"")},[S,h,p,g,E]);const _=qe(),A=b.useCallback(()=>{_.invalidateQueries({queryKey:["amp","installations"]})},[_]),R=b.useCallback(K=>{_.setQueryData(["amp","installations"],[K]),_.invalidateQueries({queryKey:["amp","installations"]})},[_]),M=(h==null?void 0:h.id)||"",j=b.useMemo(()=>({integrationId:(h==null?void 0:h.id)||"",provider:(h==null?void 0:h.provider)||"",integrationObj:h,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:P||void 0,setInstallation:R,resetInstallations:A,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:w,setIntegrationDeleted:v,fieldMapping:f,resetComponent:d}),[h,n,r,o,i,P,R,A,s,a,c,w,v,f,d]);if(I)return u.jsx(di,{});if(h===null)return u.jsx(zt,{message:`Integration "${t}" not found`});if(m(we.INSTALLATION_LIST,M)){const K=`Error retrieving installation information for integration "${(h==null?void 0:h.name)||"unknown"}"`;return u.jsx(zt,{message:K})}return u.jsx(Ql.Provider,{value:j,children:e})}const Xl=b.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Yt=()=>{const e=b.useContext(Xl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Yl({groupRef:e,provider:t,children:n}){const r=qe(),{setError:o,isError:i}=un(),{projectIdOrName:s,isLoading:a}=nr(),{integrationId:c,groupRef:f}=ut(),{provider:d}=ui(c),{data:l,isLoading:p,isError:m,error:g}=Ea({groupRef:e||f,provider:d||t}),w=l==null?void 0:l[0],v=b.useCallback(y=>{r.setQueryData(["amp","connections"],()=>y),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),x=b.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);b.useEffect(()=>{m?(o(we.CONNECTION_LIST,s,!0),We(g)):o(we.CONNECTION_LIST,s,!1)},[m,o,s,g]);const h=b.useMemo(()=>({connections:l||null,isConnectionsLoading:p,selectedConnection:w||null,setConnections:v,setSelectedConnection:x}),[l,p,w,v,x]);if(p||a)return u.jsx(di,{});if(s&&i(we.PROJECT,s))return u.jsx(zt,{message:`Error loading project ${s}`});if(s&&i(we.CONNECTION_LIST,s))return u.jsx(zt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID or Project Name not found. ConnectionsProvider must be used within AmpersandProvider");return u.jsx(Xl.Provider,{value:h,children:n})}const Zl=()=>{const e=ct(),t=qe(),[n,r]=b.useState(null);return{...En({mutationKey:["createInstallation"],mutationFn:async i=>(await e()).installationApi.createInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error creating installation"),We(i,r)}}),errorMsg:n}};function wb(e){return typeof e.provider=="string"}function bb(e){if(!wb(e))throw new Error("Config must have a provider field for creation");return e}function ed(){const{projectIdOrName:e}=Le(),{groupRef:t,integrationNameOrId:n}=Rr(),{data:r}=ui(n),{connection:o}=Sa(),{installation:i}=Ar(),s=qe(),{mutate:a,isIdle:c,isPending:f,error:d,errorMsg:l}=Zl();return{createInstallation:({config:m,onSuccess:g,onError:w,onSettled:v})=>{if(i)throw Error("Installation already created. Try updating instead.");if(!r)throw Error("No integration found");const x={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:o==null?void 0:o.id,config:{content:bb(m)}}};return a(x,{onSuccess:h=>{g==null||g(h)},onError:h=>{w==null||w(h)},onSettled:()=>{v==null||v(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:c,isPending:f,error:d,errorMsg:l}}const Ib=()=>{const e=ct(),t=qe(),[n,r]=b.useState(null);return{...En({mutationKey:["updateInstallation"],mutationFn:async i=>(await e()).installationApi.updateInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error updating installation"),We(i,r)}}),errorMsg:n}};function td(){const{projectIdOrName:e}=Le(),{integrationNameOrId:t}=Rr(),{data:n}=ui(t),{installation:r}=Ar(),o=qe(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=Ib();return{updateInstallation:({config:l,onSuccess:p,onError:m,onSettled:g})=>{var x,h;if(!r)throw Error("Installation not created yet. Try creating the installation first.");if(!n)throw Error("No integration found");const w=[];if((x=l==null?void 0:l.write)!=null&&x.objects&&Object.keys(l.write.objects).length>0&&w.push("config.content.write.objects"),(h=l==null?void 0:l.read)!=null&&h.objects){const y=Object.keys(l.read.objects);w.push(...y.map(I=>`config.content.read.objects.${I}`))}const v={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:w,installation:{config:{content:l}}}};return i(v,{onSuccess:y=>{p==null||p(y)},onError:y=>{m==null||m(y)},onSettled:()=>{g==null||g(),o.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}const Cb=()=>{const e=ct(),t=qe(),[n,r]=b.useState(null);return{...En({mutationKey:["deleteInstallation"],mutationFn:async i=>(await e()).installationApi.deleteInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error deleting installation"),We(i,r)}}),errorMsg:n}};function Sb(){const{projectIdOrName:e}=Le(),{integrationNameOrId:t}=Rr(),{data:n}=ui(t),{installation:r}=Ar(),o=qe(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=Cb();return{deleteInstallation:({onSuccess:l,onError:p,onSettled:m})=>{if(!r)throw Error("Installation not found. Not able to delete installation.");if(!n)throw Error("No integration found");return i({projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id},{onSuccess:()=>{l==null||l()},onError:g=>{p==null||p(g)},onSettled:()=>{m==null||m(),o.invalidateQueries({queryKey:["amp","installations"]}),o.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}function nd(){const[e,t]=b.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Eo={exports:{}};Eo.exports;(function(e,t){var n=9007199254740991,r="[object Arguments]",o="[object Function]",i="[object GeneratorFunction]",s="[object Map]",a="[object Object]",c="[object Promise]",f="[object Set]",d="[object WeakMap]",l="[object DataView]",p=/[\\^$.*+?()[\]{}|]/g,m=/^\[object .+?Constructor\]$/,g=typeof zn=="object"&&zn&&zn.Object===Object&&zn,w=typeof self=="object"&&self&&self.Object===Object&&self,v=g||w||Function("return this")(),x=t&&!t.nodeType&&t,h=x&&!0&&e&&!e.nodeType&&e,y=h&&h.exports===x;function I(q,he){return q==null?void 0:q[he]}function S(q){var he=!1;if(q!=null&&typeof q.toString!="function")try{he=!!(q+"")}catch{}return he}function E(q,he){return function(Oe){return q(he(Oe))}}var P=Function.prototype,_=Object.prototype,A=v["__core-js_shared__"],R=function(){var q=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||"");return q?"Symbol(src)_1."+q:""}(),M=P.toString,j=_.hasOwnProperty,K=_.toString,$=RegExp("^"+M.call(j).replace(p,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ce=y?v.Buffer:void 0,re=_.propertyIsEnumerable,pe=ce?ce.isBuffer:void 0,de=E(Object.keys,Object),be=k(v,"DataView"),F=k(v,"Map"),L=k(v,"Promise"),B=k(v,"Set"),H=k(v,"WeakMap"),J=!re.call({valueOf:1},"valueOf"),U=Ce(be),X=Ce(F),ee=Ce(L),Y=Ce(B),te=Ce(H);function ne(q){return K.call(q)}function ue(q){if(!Ze(q)||z(q))return!1;var he=wt(q)||S(q)?$:m;return he.test(Ce(q))}function k(q,he){var Oe=I(q,he);return ue(Oe)?Oe:void 0}var ve=ne;(be&&ve(new be(new ArrayBuffer(1)))!=l||F&&ve(new F)!=s||L&&ve(L.resolve())!=c||B&&ve(new B)!=f||H&&ve(new H)!=d)&&(ve=function(q){var he=K.call(q),Oe=he==a?q.constructor:void 0,fn=Oe?Ce(Oe):void 0;if(fn)switch(fn){case U:return l;case X:return s;case ee:return c;case Y:return f;case te:return d}return he});function z(q){return!!R&&R in q}function Ye(q){var he=q&&q.constructor,Oe=typeof he=="function"&&he.prototype||_;return q===Oe}function Ce(q){if(q!=null){try{return M.call(q)}catch{}try{return q+""}catch{}}return""}function lt(q){return Se(q)&&j.call(q,"callee")&&(!re.call(q,"callee")||K.call(q)==r)}var Be=Array.isArray;function ot(q){return q!=null&&bt(q.length)&&!wt(q)}function Se(q){return et(q)&&ot(q)}var Ge=pe||De;function ht(q){if(ot(q)&&(Be(q)||typeof q=="string"||typeof q.splice=="function"||Ge(q)||lt(q)))return!q.length;var he=ve(q);if(he==s||he==f)return!q.size;if(J||Ye(q))return!de(q).length;for(var Oe in q)if(j.call(q,Oe))return!1;return!0}function wt(q){var he=Ze(q)?K.call(q):"";return he==o||he==i}function bt(q){return typeof q=="number"&&q>-1&&q%1==0&&q<=n}function Ze(q){var he=typeof q;return!!q&&(he=="object"||he=="function")}function et(q){return!!q&&typeof q=="object"}function De(){return!1}e.exports=ht})(Eo,Eo.exports);var xb=Eo.exports;const Ob=Uo(xb),_r="other",_o="manage-tab";function rr(e){return!e.fieldName}function rd(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Eb(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!rr(n)&&!!n.fieldName))||null}function _b(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>rr(r)&&!!r.mapToName))||[]}function Nb(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>rr(r)&&!!r.mapToName))||[]}function id(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!rr(n)&&!!n.fieldName))||null}const od=(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 Tb(e){return rr(e)?e.mapToName:e.fieldName}const sd=(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)&&an(s==null?void 0:s.objectName),completed:e?!!od(e,s.objectName):!1})}),n},ad=e=>{var n;return{name:_r,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Ab(e,t){var i;const n=sd(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?ad(e):void 0;return o&&n.push(o),n}function cd(e,t,n){const r=(e==null?void 0:e.filter(i=>!(t!=null&&t[i==null?void 0:i.mapToName])))||[],o=r.map(i=>i.mapToName);return n(we.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function zc(e,t){return Ob(e)?!0:Object.values(e).every(t)}function _a(e,t,n){const r=zc(e,n),o=zc(t,n);return r&&o?!0:r!==o?!1:Ia(e,t)}function ud(e,t){return _a(e,t,n=>n===!1||n===void 0)}function ld(e,t){return _a(e,t,n=>!n||n==="")}function dd(e,t){return _a(e,t,n=>!n||typeof n!="object"?!0:Object.keys(n).length===0)}function Rb(e,t){return Ia(e,t)}const Pb=(e,t,n)=>{var g,w,v,x,h,y;if(!e)return null;const r=rd(e,t),o=r&&Eb(r),i=r&&id(r),s=r&&_b(r),a=r&&Nb(r),c=(r==null?void 0:r.allFields)||[],f=(r==null?void 0:r.allFieldsMetadata)||{},d=n==null?void 0:n.content,l=((v=(w=(g=d==null?void 0:d.read)==null?void 0:g.objects)==null?void 0:w[t])==null?void 0:v.selectedValueMappings)||{},p=((y=(h=(x=d==null?void 0:d.read)==null?void 0:x.objects)==null?void 0:h[t])==null?void 0:y.selectedFieldMappings)||{},m=Na(n,{content:{read:e}},t);return{allFields:c,allFieldsMetadata:f,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:m,selectedFieldMappings:p,selectedValueMappings:l}},Fb=(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 fd(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:Pb(r,t,n),write:Fb(o,n)}}const pd=(e,t,n,r)=>{const o=fd(e,n,t);r(n,o)},Db=(e,t,n)=>{const r=Ab(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=fd(e,i,t))}),n(o)},hd=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(Tb(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},md=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},gd=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t},Na=(e,t,n)=>{var f,d,l,p,m;if(!e||!t)return{};const r=(f=t==null?void 0:t.content)==null?void 0:f.read;if(!r)return{};const o=rd(r,n),i=o&&id(o),s=new Set((i==null?void 0:i.filter(g=>!rr(g)&&!!g.fieldName).map(g=>g.fieldName))||[]),a=((m=(p=(l=(d=e==null?void 0:e.content)==null?void 0:d.read)==null?void 0:l.objects)==null?void 0:p[n])==null?void 0:m.selectedFields)||{};return Object.entries(a).reduce((g,[w,v])=>(s.has(w)&&(g[w]=v),g),{})},yd=(e,t)=>{var r,o,i,s;return!e||!t?{}:((s=(i=(o=(r=e==null?void 0:e.content)==null?void 0:r.read)==null?void 0:o.objects)==null?void 0:i[t])==null?void 0:s.selectedFieldMappings)||{}};function vd(e,t){return t[e]||void 0}function Li(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Mb=(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)},kb=(e,t,n,r)=>{const o=hd(e),i=md(e),s=gd(e),a=Mb(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return Li(n)&&(c.content.proxy={enabled:!0}),c},wd=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},jb=e=>{const t=e.content.write;return t==null?void 0:t.objects},Lb=(e,t,n)=>{if(!jb(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=wd(e),i={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return Li(t)&&(i.content.proxy={enabled:!0}),i};var bd={exports:{}};/*!
5
+ [Remedy] ${s.remedy}`:""}`;t&&t(u)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)};function ko(){const e=st(),{projectIdOrName:t}=je(),{setError:n,removeError:r}=an(),o=Yn({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t});return b.useEffect(()=>{o.isError?(He(o.error),n(we.INTEGRATION_LIST,t)):r(we.INTEGRATION_LIST,t)},[o.isError,o.error,t,n,r]),o}const da=(e,t)=>{var s;const n=st(),{projectIdOrName:r}=je(),{data:o}=ko(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return Yn({queryKey:["amp","installations",r,i,t],queryFn:async()=>{if(!r)throw new Error("Project ID is required");if(!i)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await n()).installationApi.listInstallations({projectIdOrName:r,integrationId:i,groupRef:t})},enabled:!!r&&!!i&&!!t&&!!o&&o.length>0})},Zn=()=>{var o,i;const{setError:e}=an(),t=st(),{projectIdOrName:n}=je(),r=Yn({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return b.useEffect(()=>{r.isError&&e(we.PROJECT,n)},[r.isError,n,e]),{...r,projectIdOrName:n,appName:(o=r.data)==null?void 0:o.name,projectId:(i=r.data)==null?void 0:i.id}};function Nr(){const{integrationNameOrId:e,groupRef:t}=Tr(),n=da(e,t),{isPending:r,isFetching:o,isError:i,isSuccess:s,error:a,data:u}=n;return{installation:u==null?void 0:u[0],isPending:r,isFetching:o,isError:i,isSuccess:s,error:a}}const oi=e=>{const t=ko(),n=t.data,r=n==null?void 0:n.find(o=>o.name===e||o.id===e);return{...t,data:r,provider:r==null?void 0:r.provider}},fa=()=>{const{groupRef:e,integrationNameOrId:t}=Tr(),{provider:n}=oi(t),r=ga({groupRef:e,provider:n}),{isPending:o,isFetching:i,isError:s,isSuccess:a,error:u,data:f}=r;return{connection:f==null?void 0:f[0],error:u,isPending:o,isFetching:i,isError:s,isSuccess:a}},xl=()=>{var h;const e=qe(),t=st(),{connection:n,isPending:r,isFetching:o}=fa(),{projectIdOrName:i}=je(),{integrationNameOrId:s}=Tr(),{data:a}=oi(s),u=n==null?void 0:n.id,f=a==null?void 0:a.id,l=(h=a==null?void 0:a.latestRevision)==null?void 0:h.id,d=r||o;return b.useEffect(()=>{u||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[u,e]),Yn({queryKey:["amp","hydratedRevision",i,f,l,u],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!f)throw new Error("integrationId is required");if(!l)throw new Error("revisionId is required");if(!u)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:f,revisionId:l,connectionId:u})},retry:3,enabled:!!i&&!!f&&!!l&&!!u&&!d})};function pa(){var f,l;const e=xl(),{isPending:t,isFetching:n,isError:r,isSuccess:o,error:i,data:s}=e,a=s==null?void 0:s.content,u=b.useMemo(()=>({getReadObject:d=>{var m,v;const h=(v=(m=a==null?void 0:a.read)==null?void 0:m.objects)==null?void 0:v.find(w=>w.objectName===d);return h?{object:h,getRequiredFields:()=>h.requiredFields??[],getOptionalFields:()=>h.optionalFields??[]}:(console.error(`Object ${d} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:d=>{var m,v;const h=(v=(m=a==null?void 0:a.write)==null?void 0:m.objects)==null?void 0:v.find(w=>w.objectName===d);return h?{object:h}:(console.error(`Object ${d} not found`),{object:null})},getCustomerFieldsForObject:d=>{var m,v;const h=(v=(m=a==null?void 0:a.read)==null?void 0:m.objects)==null?void 0:v.find(w=>w.objectName===d);return h?{allFields:h.allFieldsMetadata??{},getField:w=>{var O;const g=(O=h.allFieldsMetadata)==null?void 0:O[w];return g||(console.error(`Field ${w} not found`),null)}}:(console.error(`Object ${d} not found`),{allFields:null,getField:()=>null})}}),[(f=a==null?void 0:a.read)==null?void 0:f.objects,(l=a==null?void 0:a.write)==null?void 0:l.objects]);return{data:s,...u,isPending:t,isFetching:n,isError:r,isSuccess:o,error:i}}function dw(e){var m,v,w,g;const[t,n]=b.useState(e),r=b.useRef(void 0),{getReadObject:o,data:i}=pa(),{installation:s}=Nr(),a=b.useCallback(()=>t,[t]),u=b.useCallback((O,p)=>{var _,F;p.provider=p.provider||((_=i==null?void 0:i.content)==null?void 0:_.provider)||"";const y=p.read||{objects:{}},I=y.objects||{},x=I[O]||{},N=o(O),A={};return(F=N==null?void 0:N.getRequiredFields())==null||F.forEach(R=>{"fieldName"in R&&(A[R.fieldName]=!0)}),x.objectName=x.objectName||O,x.selectedFields=x.selectedFields||A,I[O]=x,y.objects=I,p.read=y,{read:y,objects:I,obj:x}},[o,(m=i==null?void 0:i.content)==null?void 0:m.provider]),f=b.useCallback(O=>{var p,y;return{object:(y=(p=t.read)==null?void 0:p.objects)==null?void 0:y[O],getSelectedField:I=>{var x,N,A,_;return!!((_=(A=(N=(x=t.read)==null?void 0:x.objects)==null?void 0:N[O])==null?void 0:A.selectedFields)!=null&&_[I])},setSelectedField:({fieldName:I,selected:x})=>{n(N=>Mt(N,A=>{const{obj:_}=u(O,A);_.selectedFields=_.selectedFields||{},_.selectedFields[I]=x,_.selectedFields[I]===!1&&delete _.selectedFields[I]}))},getFieldMapping:I=>{var x,N,A,_;return(_=(A=(N=(x=t.read)==null?void 0:x.objects)==null?void 0:N[O])==null?void 0:A.selectedFieldMappings)==null?void 0:_[I]},setFieldMapping:({fieldName:I,mapToName:x})=>{n(N=>Mt(N,A=>{const{obj:_}=u(O,A);_.selectedFieldMappings=_.selectedFieldMappings||{},_.selectedFieldMappings[x]=I}))}}},[(v=t.read)==null?void 0:v.objects,u]),l=b.useCallback(O=>{var N,A;const p=(A=(N=t.write)==null?void 0:N.objects)==null?void 0:A[O],y=_=>{const F=_.write||{},R=F.objects||{},D=R[O]||{objectName:O};return R[O]=D,F.objects=R,_.write=F,{write:F,objects:R,obj:D}},I=(_,F)=>{var R,D;return(D=(R=p==null?void 0:p.selectedFieldSettings)==null?void 0:R[_])==null?void 0:D[F]},x=(_,F,R)=>{n(D=>Mt(D,K=>{var L;const{obj:j}=y(K);j.selectedFieldSettings={...j.selectedFieldSettings,[_]:{...(L=j.selectedFieldSettings)==null?void 0:L[_],[F]:R}}}))};return{object:p,setEnableWrite:()=>{n(_=>Mt(_,F=>{const{obj:R}=y(F);R.objectName=O}))},setDisableWrite:()=>{n(_=>Mt(_,F=>{const{objects:R}=y(F);delete R[O]}))},getWriteObject:()=>{var _,F;return(F=(_=t.write)==null?void 0:_.objects)==null?void 0:F[O]},getSelectedFieldSettings:_=>{var F;return(F=p==null?void 0:p.selectedFieldSettings)==null?void 0:F[_]},setSelectedFieldSettings:({fieldName:_,settings:F})=>{n(R=>Mt(R,D=>{const{obj:K}=y(D),j=K.selectedFieldSettings||{};K.selectedFieldSettings={...j,[_]:F},F===void 0&&delete K.selectedFieldSettings[_]}))},getDefaultValues:_=>I(_,"default"),setDefaultValues:({fieldName:_,value:F})=>x(_,"default",F),getWriteOnCreateSetting:_=>I(_,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:_,value:F})=>x(_,"writeOnCreate",F),getWriteOnUpdateSetting:_=>I(_,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:_,value:F})=>x(_,"writeOnUpdate",F)}},[(w=t.write)==null?void 0:w.objects]),d=b.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(O=>Mt(O,p=>{p.proxy={enabled:!0}}))},setDisableProxy:()=>{n(O=>Mt(O,p=>{p.proxy={enabled:!1}}))},getProxyEnabled:()=>{var O;return((O=t.proxy)==null?void 0:O.enabled)||!1}}),[t.proxy]),h=b.useCallback(()=>{n(O=>Mt(O,p=>{var y;Object.assign(p,(y=s==null?void 0:s.config)==null?void 0:y.content)}))},[(g=s==null?void 0:s.config)==null?void 0:g.content]);return b.useEffect(()=>{s&&(console.debug("Installation found",{installation:s}),r.current?Cl(r.current,s)||(console.debug("Installation changed, resetting config",{previous:r.current,current:s}),h(),r.current=s):(r.current=s,h()))},[s,h]),{draft:t,get:a,reset:h,setDraft:n,readObject:f,writeObject:l,proxy:d}}const ha=b.createContext(null);function fw({children:e,initialConfig:t}){const n=dw(t);return c.jsx(ha.Provider,{value:n,children:e})}function pw(){const e=b.useContext(ha);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function hw(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=b.useContext(ha);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const Ol=b.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Tr(){const e=b.useContext(Ol);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function ma({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}){const s=b.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}),[t,n,r,o,i]);return c.jsx(Ol.Provider,{value:s,children:c.jsx(fw,{initialConfig:{},children:e})})}class qs{constructor(t){this.connectionApi=new Jv(t),this.installationApi=new Hv(t),this.integrationApi=new Wv(t),this.oAuthApi=new zv(t),this.projectApi=new Qv(t),this.providerApi=new Gv(t),this.providerAppApi=new Xv(t),this.revisionApi=new Yv(t)}}const Sl="2.9.6",mw="v1",to="https://api.withampersand.com";function _l(){try{const e=process.env.REACT_APP_AMP_SERVER;switch(e){case"local":return"http://localhost:8080";case"dev":return"https://dev-api.withampersand.com";case"staging":return"https://staging-api.withampersand.com";case"prod":return to;case"mock":return"http://127.0.0.1:4010";case"":return to;default:return e??to}}catch{return to}}const gw=(e,t)=>`${e}/${t}`;function yw(){return gw(_l(),mw)}const El=_l(),Nl=yw(),vw=new aa({basePath:Nl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Sl}});new qs(vw);const ww=e=>({header:"X-Api-Key",value:e}),bw=e=>{try{return{header:"Authorization",value:`Bearer ${e}`}}catch(t){throw console.error("Failed to get JWT token for API authentication:",t),new Error("Failed to authenticate with JWT token")}},Dc=(e,t)=>new aa({basePath:Nl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Sl,[e]:t}});function st(){const e=zu(),{getToken:t}=vh(),{consumerRef:n,groupRef:r}=Tr();return b.useCallback(async()=>{if(e){const i=ww(e),s=Dc(i.header,i.value);return new qs(s)}if(t){if(!n||!r)throw console.error("Unable to create JWT API service without consumerRef or groupRef.",{consumerRef:n,groupRef:r}),new Error("Unable to create JWT API service without consumerRef or groupRef.");const i=await t({consumerRef:n,groupRef:r}),s=bw(i),a=Dc(s.header,s.value);return new qs(a)}throw console.error("Unable to create API service without API key or JWT token."),new Error("Unable to create API service without API key or JWT token.")},[e,t,n,r])}const ga=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=je(),r=st();return Yn({queryKey:["amp","connections",n,e,t],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!e)throw new Error("Group reference not found.");if(!t)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:n,groupRef:e,provider:t})},retry:3,enabled:!!n&&!!e&&!!t})};function Iw(){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 Cw="_box_1p7c5_1",Mc={box:Cw};function Sn({children:e,className:t,style:n}){return c.jsx("div",{className:t?`${Mc.box} ${t}`:Mc.box,style:n,children:e})}const xw="_container_1wvzr_1",kc={container:xw};function si({children:e,className:t,style:n}){return c.jsx("div",{className:t?`${kc.container} ${t}`:kc.container,style:n,children:e})}const Ow="_errorBoxContainer_4sdb2_1",Sw="_errorBox_4sdb2_1",_w="_errorText_4sdb2_20",Us={errorBoxContainer:Ow,errorBox:Sw,errorText:_w};function Tl({message:e}){return c.jsx(Sn,{className:Us.errorBox,children:c.jsx("p",{className:Us.errorText,children:e})})}function Rl({message:e,children:t}){return c.jsxs(si,{className:Us.errorBoxContainer,children:[c.jsx(Iw,{}),c.jsx(Tl,{message:e}),t]})}const Ew="_loader_6ubm6_1",Nw={loader:Ew};function Tw(){return c.jsx("span",{className:Nw.loader})}function Si(){return c.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:c.jsx(Tw,{})})}function Al({children:e}){return c.jsx(si,{style:{maxWidth:"55rem"},children:c.jsx(Sn,{children:e})})}function ai(){return c.jsx(Al,{children:c.jsx(Si,{})})}function Jt({message:e,children:t}){return c.jsx(Al,{children:c.jsx(Rl,{message:e,children:t})})}function on(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Rw(e,t){return(t==null?void 0:t.displayName)??on(e)}const Aw=e=>e.split(`
6
+ `).filter(n=>n.trim()!==""),Fw=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null;function Pw(e){return!e||typeof e!="string"?"id_"+Math.random().toString(36).substr(2,9):e.toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").replace(/^[^a-z]/,"id-").substring(0,50)}const Dw=()=>{const[e,t]=b.useState(!1),n=b.useCallback(()=>{t(!0)},[t]),r=b.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},Fl=b.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{},resetComponent:()=>{}});function at(){const e=b.useContext(Fl);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Mw({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:u,fieldMapping:f,resetComponent:l}){const{data:d}=ko(),{setError:h,isError:m,removeError:v}=an(),{isIntegrationDeleted:w,setIntegrationDeleted:g,resetIntegrationDeleted:O}=Dw(),p=b.useMemo(()=>Fw(t,d||[]),[t,d]),{data:y,isLoading:I,isError:x,error:N}=da(t,o),A=(y==null?void 0:y[0])||null;b.useEffect(()=>{O()},[t,n,r,o,i,f]),b.useEffect(()=>{p===null&&(d!=null&&d.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,p,d]),b.useEffect(()=>{x?(h(we.INSTALLATION_LIST,(p==null?void 0:p.id)||""),He(N)):v(we.INSTALLATION_LIST,(p==null?void 0:p.id)||"")},[x,p,h,v,N]);const _=qe(),F=b.useCallback(()=>{_.invalidateQueries({queryKey:["amp","installations"]})},[_]),R=b.useCallback(j=>{_.setQueryData(["amp","installations"],[j]),_.invalidateQueries({queryKey:["amp","installations"]})},[_]),D=(p==null?void 0:p.id)||"",K=b.useMemo(()=>({integrationId:(p==null?void 0:p.id)||"",provider:(p==null?void 0:p.provider)||"",integrationObj:p,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:A||void 0,setInstallation:R,resetInstallations:F,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:u,isIntegrationDeleted:w,setIntegrationDeleted:g,fieldMapping:f,resetComponent:l}),[p,n,r,o,i,A,R,F,s,a,u,w,g,f,l]);if(I)return c.jsx(ai,{});if(p===null)return c.jsx(Jt,{message:`Integration "${t}" not found`});if(m(we.INSTALLATION_LIST,D)){const j=`Error retrieving installation information for integration "${(p==null?void 0:p.name)||"unknown"}"`;return c.jsx(Jt,{message:j})}return c.jsx(Fl.Provider,{value:K,children:e})}const Pl=b.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Qt=()=>{const e=b.useContext(Pl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Dl({groupRef:e,provider:t,children:n}){const r=qe(),{setError:o,isError:i}=an(),{projectIdOrName:s,isLoading:a}=Zn(),{integrationId:u,groupRef:f}=at(),{provider:l}=oi(u),{data:d,isLoading:h,isError:m,error:v}=ga({groupRef:e||f,provider:l||t}),w=d==null?void 0:d[0],g=b.useCallback(y=>{r.setQueryData(["amp","connections"],()=>y),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),O=b.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);b.useEffect(()=>{m?(o(we.CONNECTION_LIST,s,!0),He(v)):o(we.CONNECTION_LIST,s,!1)},[m,o,s,v]);const p=b.useMemo(()=>({connections:d||null,isConnectionsLoading:h,selectedConnection:w||null,setConnections:g,setSelectedConnection:O}),[d,h,w,g,O]);if(h||a)return c.jsx(ai,{});if(s&&i(we.PROJECT,s))return c.jsx(Jt,{message:`Error loading project ${s}`});if(s&&i(we.CONNECTION_LIST,s))return c.jsx(Jt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID or Project Name not found. ConnectionsProvider must be used within AmpersandProvider");return c.jsx(Pl.Provider,{value:p,children:n})}const Ml=()=>{const e=st(),t=qe(),[n,r]=b.useState(null);return{...On({mutationKey:["createInstallation"],mutationFn:async i=>(await e()).installationApi.createInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error creating installation"),He(i,r)}}),errorMsg:n}};function kw(e){return typeof e.provider=="string"}function jw(e){if(!kw(e))throw new Error("Config must have a provider field for creation");return e}function kl(){const{projectIdOrName:e}=je(),{groupRef:t,integrationNameOrId:n}=Tr(),{data:r}=oi(n),{connection:o}=fa(),{installation:i}=Nr(),s=qe(),{mutate:a,isIdle:u,isPending:f,error:l,errorMsg:d}=Ml();return{createInstallation:({config:m,onSuccess:v,onError:w,onSettled:g})=>{if(i)throw Error("Installation already created. Try updating instead.");if(!r)throw Error("No integration found");const O={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:o==null?void 0:o.id,config:{content:jw(m)}}};return a(O,{onSuccess:p=>{v==null||v(p)},onError:p=>{w==null||w(p)},onSettled:()=>{g==null||g(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:u,isPending:f,error:l,errorMsg:d}}const Lw=()=>{const e=st(),t=qe(),[n,r]=b.useState(null);return{...On({mutationKey:["updateInstallation"],mutationFn:async i=>(await e()).installationApi.updateInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error updating installation"),He(i,r)}}),errorMsg:n}};function jl(){const{projectIdOrName:e}=je(),{integrationNameOrId:t}=Tr(),{data:n}=oi(t),{installation:r}=Nr(),o=qe(),{mutate:i,isIdle:s,isPending:a,error:u,errorMsg:f}=Lw();return{updateInstallation:({config:d,onSuccess:h,onError:m,onSettled:v})=>{var y,I,x,N,A;if(!r)throw Error("Installation not created yet. Try creating the installation first.");if(!n)throw Error("No integration found");const w=[],g=Object.keys(((y=d==null?void 0:d.write)==null?void 0:y.objects)||{}).length,O=Object.keys(((N=(x=(I=r==null?void 0:r.config)==null?void 0:I.content)==null?void 0:x.write)==null?void 0:N.objects)||{}).length;if((g>0||g===0&&O>0)&&w.push("config.content.write.objects"),(A=d==null?void 0:d.read)!=null&&A.objects){const _=Object.keys(d.read.objects);w.push(..._.map(F=>`config.content.read.objects.${F}`))}const p={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:w,installation:{config:{content:d}}}};return i(p,{onSuccess:_=>{h==null||h(_)},onError:_=>{m==null||m(_)},onSettled:()=>{v==null||v(),o.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:u,errorMsg:f}}const Vw=()=>{const e=st(),t=qe(),[n,r]=b.useState(null);return{...On({mutationKey:["deleteInstallation"],mutationFn:async i=>(await e()).installationApi.deleteInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error deleting installation"),He(i,r)}}),errorMsg:n}};function $w(){const{projectIdOrName:e}=je(),{integrationNameOrId:t}=Tr(),{data:n}=oi(t),{installation:r}=Nr(),o=qe(),{mutate:i,isIdle:s,isPending:a,error:u,errorMsg:f}=Vw();return{deleteInstallation:({onSuccess:d,onError:h,onSettled:m})=>{if(!r)throw Error("Installation not found. Not able to delete installation.");if(!n)throw Error("No integration found");return i({projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id},{onSuccess:()=>{d==null||d()},onError:v=>{h==null||h(v)},onSettled:()=>{m==null||m(),o.invalidateQueries({queryKey:["amp","installations"]}),o.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:u,errorMsg:f}}function Ll(){const[e,t]=b.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var bo={exports:{}};bo.exports;(function(e,t){var n=9007199254740991,r="[object Arguments]",o="[object Function]",i="[object GeneratorFunction]",s="[object Map]",a="[object Object]",u="[object Promise]",f="[object Set]",l="[object WeakMap]",d="[object DataView]",h=/[\\^$.*+?()[\]{}|]/g,m=/^\[object .+?Constructor\]$/,v=typeof Hn=="object"&&Hn&&Hn.Object===Object&&Hn,w=typeof self=="object"&&self&&self.Object===Object&&self,g=v||w||Function("return this")(),O=t&&!t.nodeType&&t,p=O&&!0&&e&&!e.nodeType&&e,y=p&&p.exports===O;function I(J,pe){return J==null?void 0:J[pe]}function x(J){var pe=!1;if(J!=null&&typeof J.toString!="function")try{pe=!!(J+"")}catch{}return pe}function N(J,pe){return function(Se){return J(pe(Se))}}var A=Function.prototype,_=Object.prototype,F=g["__core-js_shared__"],R=function(){var J=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||"");return J?"Symbol(src)_1."+J:""}(),D=A.toString,K=_.hasOwnProperty,j=_.toString,L=RegExp("^"+D.call(K).replace(h,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),se=y?g.Buffer:void 0,re=_.propertyIsEnumerable,ge=se?se.isBuffer:void 0,de=N(Object.keys,Object),be=k(g,"DataView"),P=k(g,"Map"),$=k(g,"Promise"),H=k(g,"Set"),q=k(g,"WeakMap"),U=!re.call({valueOf:1},"valueOf"),V=Ce(be),G=Ce(P),Z=Ce($),Y=Ce(H),ee=Ce(q);function ne(J){return j.call(J)}function ce(J){if(!Ye(J)||z(J))return!1;var pe=yt(J)||x(J)?L:m;return pe.test(Ce(J))}function k(J,pe){var Se=I(J,pe);return ce(Se)?Se:void 0}var ve=ne;(be&&ve(new be(new ArrayBuffer(1)))!=d||P&&ve(new P)!=s||$&&ve($.resolve())!=u||H&&ve(new H)!=f||q&&ve(new q)!=l)&&(ve=function(J){var pe=j.call(J),Se=pe==a?J.constructor:void 0,ln=Se?Ce(Se):void 0;if(ln)switch(ln){case V:return d;case G:return s;case Z:return u;case Y:return f;case ee:return l}return pe});function z(J){return!!R&&R in J}function Xe(J){var pe=J&&J.constructor,Se=typeof pe=="function"&&pe.prototype||_;return J===Se}function Ce(J){if(J!=null){try{return D.call(J)}catch{}try{return J+""}catch{}}return""}function ct(J){return xe(J)&&K.call(J,"callee")&&(!re.call(J,"callee")||j.call(J)==r)}var Ue=Array.isArray;function rt(J){return J!=null&&vt(J.length)&&!yt(J)}function xe(J){return Ze(J)&&rt(J)}var ze=ge||De;function ft(J){if(rt(J)&&(Ue(J)||typeof J=="string"||typeof J.splice=="function"||ze(J)||ct(J)))return!J.length;var pe=ve(J);if(pe==s||pe==f)return!J.size;if(U||Xe(J))return!de(J).length;for(var Se in J)if(K.call(J,Se))return!1;return!0}function yt(J){var pe=Ye(J)?j.call(J):"";return pe==o||pe==i}function vt(J){return typeof J=="number"&&J>-1&&J%1==0&&J<=n}function Ye(J){var pe=typeof J;return!!J&&(pe=="object"||pe=="function")}function Ze(J){return!!J&&typeof J=="object"}function De(){return!1}e.exports=ft})(bo,bo.exports);var Kw=bo.exports;const qw=Mo(Kw),Qr="other",Io="manage-tab";function er(e){return!e.fieldName}function Vl(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Uw(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!er(n)&&!!n.fieldName))||null}function Bw(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>er(r)&&!!r.mapToName))||[]}function Jw(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>er(r)&&!!r.mapToName))||[]}function $l(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!er(n)&&!!n.fieldName))||null}const Kl=(e,t)=>{var n,r,o;return(o=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:o[t]};function Hw(e){return er(e)?e.mapToName:e.fieldName}const ql=(e,t)=>{var r,o,i;const n=[];return(i=(o=(r=t.content)==null?void 0:r.read)==null?void 0:o.objects)==null||i.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&on(s==null?void 0:s.objectName),completed:e?!!Kl(e,s.objectName):!1})}),n},Ul=e=>{var n;return{name:Qr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Ww(e,t){var i;const n=ql(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?Ul(e):void 0;return o&&n.push(o),n}function Bl(e,t,n){const r=(e==null?void 0:e.filter(i=>!(t!=null&&t[i==null?void 0:i.mapToName])))||[],o=r.map(i=>i.mapToName);return n(we.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function jc(e,t){return qw(e)?!0:Object.values(e).every(t)}function ya(e,t,n){const r=jc(e,n),o=jc(t,n);return r&&o?!0:r!==o?!1:Cl(e,t)}function Jl(e,t){return ya(e,t,n=>n===!1||n===void 0)}function Hl(e,t){return ya(e,t,n=>!n||n==="")}function Wl(e,t){return ya(e,t,n=>!n||typeof n!="object"?!0:Object.keys(n).length===0)}function zl(e,t){const n=new Set(Object.values(e).map(o=>o==null?void 0:o.objectName)),r=new Set(Object.values(t).map(o=>o==null?void 0:o.objectName));return n.size===r.size&&[...n].every(o=>r.has(o))}const zw=(e,t,n)=>{var v,w,g,O,p,y;if(!e)return null;const r=Vl(e,t),o=r&&Uw(r),i=r&&$l(r),s=r&&Bw(r),a=r&&Jw(r),u=(r==null?void 0:r.allFields)||[],f=(r==null?void 0:r.allFieldsMetadata)||{},l=n==null?void 0:n.content,d=((g=(w=(v=l==null?void 0:l.read)==null?void 0:v.objects)==null?void 0:w[t])==null?void 0:g.selectedValueMappings)||{},h=((y=(p=(O=l==null?void 0:l.read)==null?void 0:O.objects)==null?void 0:p[t])==null?void 0:y.selectedFieldMappings)||{},m=va(n,{content:{read:e}},t);return{allFields:u,allFieldsMetadata:f,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:m,selectedFieldMappings:h,selectedValueMappings:d}},Qw=(e,t)=>{var r,o;if(!e)return null;const n=(o=(r=t==null?void 0:t.content)==null?void 0:r.write)==null?void 0:o.objects;return{writeObjects:(e==null?void 0:e.objects)||[],selectedWriteObjects:n||{}}};function Ql(e,t,n){var i,s;const r=(i=e==null?void 0:e.content)==null?void 0:i.read,o=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:zw(r,t,n),write:Qw(o,n)}}const Gl=(e,t,n,r)=>{const o=Ql(e,n,t);r(n,o)},Gw=(e,t,n)=>{const r=Ww(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=Ql(e,i,t))}),n(o)},Xl=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(Hw(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},Yl=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n},Zl=(e,t)=>!t||!t[e]?[]:t[e],ed=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t},va=(e,t,n)=>{var f,l,d,h,m;if(!e||!t)return{};const r=(f=t==null?void 0:t.content)==null?void 0:f.read;if(!r)return{};const o=Vl(r,n),i=o&&$l(o),s=new Set((i==null?void 0:i.filter(v=>!er(v)&&!!v.fieldName).map(v=>v.fieldName))||[]),a=((m=(h=(d=(l=e==null?void 0:e.content)==null?void 0:l.read)==null?void 0:d.objects)==null?void 0:h[n])==null?void 0:m.selectedFields)||{};return Object.entries(a).reduce((v,[w,g])=>(s.has(w)&&(v[w]=g),v),{})},td=(e,t)=>{var r,o,i,s;return!e||!t?{}:((s=(i=(o=(r=e==null?void 0:e.content)==null?void 0:r.read)==null?void 0:o.objects)==null?void 0:i[t])==null?void 0:s.selectedFieldMappings)||{}};function nd(e,t){return t[e]||void 0}function Mi(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Xw=(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)},Yw=(e,t,n,r,o)=>{const i=Xl(e),s=Yl(e),a=Zl(t,o),u=ed(e),f=Xw(n,t);if(!f)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const l={createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,selectedFields:i,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:u||{},backfill:f.backfill}}}}};return Mi(n)&&(l.content.proxy={enabled:!0}),l},rd=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},Zw=e=>{const t=e.content.write;return t==null?void 0:t.objects},eb=(e,t,n)=>{if(!Zw(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=rd(e),i={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return Mi(t)&&(i.content.proxy={enabled:!0}),i};var id={exports:{}};/*!
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})()})(bd);var Kb=bd.exports;const $t=Uo(Kb),$b="_button_kwfiu_1",Ub="_danger_kwfiu_42",Vb="_ghost_kwfiu_47",ds={button:$b,danger:Ub,ghost:Vb};function ze({className:e,style:t,type:n,children:r,variant:o,...i}){const s=$t(ds.button,{[ds.danger]:o==="danger",[ds.ghost]:o==="ghost",[e||""]:!!e});return u.jsx("button",{type:n,className:s,style:t,...i,children:r})}const qb={backgroundColor:"var(--amp-colors-status-critical-muted)",borderColor:"var(--amp-colors-status-critical-muted)",color:"var(--amp-colors-status-critical-dark)",padding:".5rem 1rem"};function Ki({children:e,style:t}){return u.jsx(_n,{style:{...qb,...t},children:e})}const qo=e=>{const t=ct(),{provider:n}=ut(),r=e||n;return er({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},pt=e=>{const t=qo(e),{data:n}=t,{provider:r}=ut(),o=n&&pb(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function ln({error:e}){return e?u.jsx(Ki,{style:{marginTop:"2em"},children:e}):null}const Bb="_input_1ymb7_1",Hb="_inputError_1ymb7_27",fs={input:Bb,inputError:Hb};function Id({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?$t(fs.inputError,fs.input):fs.input;return u.jsx("input",{id:e,type:t,className:$t(i,n),...o})}function Jb(){return u.jsx("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:u.jsxs("g",{opacity:"0.5",children:[u.jsx("path",{d:"M14.2821 11.0004C14.2821 12.8154 12.8154 14.2821 11.0004 14.2821C9.18542 14.2821 7.71875 12.8154 7.71875 11.0004C7.71875 9.18542 9.18542 7.71875 11.0004 7.71875C12.8154 7.71875 14.2821 9.18542 14.2821 11.0004Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.9999 18.581C14.2357 18.581 17.2515 16.6743 19.3507 13.3743C20.1757 12.0818 20.1757 9.90932 19.3507 8.61682C17.2515 5.31682 14.2357 3.41016 10.9999 3.41016C7.76402 3.41016 4.74819 5.31682 2.64902 8.61682C1.82402 9.90932 1.82402 12.0818 2.64902 13.3743C4.74819 16.6743 7.76402 18.581 10.9999 18.581Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function Wb(){return u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[u.jsx("path",{d:"M13.3187 8.68036L8.68036 13.3187C8.06528 12.7036 7.71973 11.8694 7.71973 10.9995C7.71973 10.5688 7.80456 10.1423 7.96939 9.7444C8.13421 9.34648 8.3758 8.98491 8.68036 8.68036C8.98491 8.3758 9.34648 8.13421 9.7444 7.96939C10.1423 7.80456 10.5688 7.71973 10.9995 7.71973C11.8694 7.71973 12.7036 8.06528 13.3187 8.68036Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M16.3349 5.28895C14.7307 4.07895 12.8974 3.41895 10.9999 3.41895C7.76402 3.41895 4.74819 5.32561 2.64902 8.62561C1.82402 9.91811 1.82402 12.0906 2.64902 13.3831C3.37319 14.5198 4.21652 15.5006 5.13319 16.2889M7.71819 17.9023C8.76319 18.3423 9.87236 18.5806 10.9999 18.5806C14.2357 18.5806 17.2515 16.6739 19.3507 13.3739C20.1757 12.0814 20.1757 9.90895 19.3507 8.61645C19.0482 8.13978 18.7182 7.69061 18.379 7.26895",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M14.2172 11.6413C14.093 12.2808 13.7806 12.8685 13.32 13.3291C12.8594 13.7897 12.2716 14.1022 11.6322 14.2263M8.68051 13.3188L1.83301 20.1663M20.1663 1.83301L13.3188 8.68051",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function zb({id:e,name:t,placeholder:n="Password",onChange:r,value:o,className:i,isError:s}){const[a,c]=b.useState(!1),f=()=>c(d=>!d);return u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(Et.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:o,className:i,isError:s}),u.jsx(ze,{type:"button","aria-label":a?"Hide password":"Show password",style:{height:"2.5rem",width:"2.5rem",display:"flex",alignItems:"center",justifyContent:"center"},onClick:f,variant:"ghost",children:u.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?u.jsx(Wb,{}):u.jsx(Jb,{})})})]})}const Gb="_textarea_18zl4_1",Qb="_textareaError_18zl4_14",ps={textarea:Gb,textareaError:Qb};function Xb({className:e,isError:t=!1,...n}){const r=t?$t(ps.textareaError,ps.textarea):ps.textarea;return u.jsx("textarea",{className:$t(e,r),...n})}const Et={Input:Id,Textarea:Xb,PasswordInput:zb},Yb=()=>{const{projectIdOrName:e}=Le(),t=ct();return er({queryKey:["project",e,"entitlements"],queryFn:async()=>{if(!e)throw new Error("Project ID is required");return(await t()).projectApi.getProject({projectIdOrName:e,includeEntitlements:!0})},enabled:!!e})};function Cd(){var n,r;const{data:e}=Yb();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:u.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[u.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),u.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:u.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})})]})}function ir({children:e}){return u.jsx(li,{children:u.jsxs(_n,{children:[u.jsx("div",{style:{padding:"3rem 2rem"},children:e}),u.jsx(Cd,{})]})})}function or({children:e}){return u.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function Zb({children:e}){return u.jsx("p",{style:{padding:".5em 0"},children:e})}const eI="_link_oo2kv_1",tI={link:eI};function Ta({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return u.jsx("a",{className:$t(tI.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function No({url:e,providerDisplayName:t,credentialName:n}){return u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[u.jsx(Ta,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function Bo(e,t){const n={},r=[];if(e.forEach(o=>{const i=t[o.name];!i||i.trim()===""?r.push(o.displayName||o.name):n[o.name]={value:i,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function ei(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function Sd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var x,h;const[s,a]=b.useState({apiKey:""}),c=((x=t.metadata)==null?void 0:x.input)||[],f=y=>{const{name:I,value:S}=y.currentTarget;a(E=>({...E,[I]:S.trim()}))},{apiKey:d}=s,{providerName:l}=pt(e),p=d.length>0,m=ei(c,s),g=r||!p||!m,w=(h=t.apiKeyOpts)==null?void 0:h.docsURL,v=()=>{const y=Bo(c,s);n({apiKey:d,providerMetadata:y})};return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&u.jsx(No,{url:w,providerDisplayName:l||an(e),credentialName:"API key"}),u.jsx(Et.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:f}),c.map(y=>u.jsxs("div",{children:[y.docsURL&&u.jsx(No,{url:y.docsURL,providerDisplayName:l||an(e),credentialName:y.displayName||y.name}),u.jsx(Et.Input,{id:y.name,name:y.name,type:"text",placeholder:y.displayName||y.name,onChange:f})]},y.name)),u.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:g,type:i||"submit",onClick:v,variant:o,children:"Next"})]})}function nI({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=pt(e);return u.jsxs(ir,{children:[u.jsx(or,{children:`Set up ${i} integration`}),u.jsx(ln,{error:r}),u.jsx(Sd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function rI({...e}){return u.jsx(nI,{...e})}const iI={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 Ho({children:e,style:t}){return u.jsx(_n,{style:{...iI,...t},children:e})}const Aa=()=>{const e=ct(),t=qe(),[n,r]=b.useState(null);return{...En({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},oI="_divider_1kmoj_1",Gc={divider:oI};function Jo({className:e,style:t}){return u.jsx("hr",{className:e?`${Gc.divider} ${e}`:Gc.divider,style:t})}function Ft({string:e}){return u.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[u.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),u.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:u.jsx(Jo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function sI({provider:e}){const{projectIdOrName:t}=Le(),{providerName:n,data:r}=pt(e),{selectedConnection:o,isConnectionsLoading:i}=Yt(),{mutateAsync:s,isPending:a,error:c}=Aa(),[f,d]=b.useState(null),[l,p]=b.useState(!1),m=()=>p(!1),g=()=>{p(!0),d(null)},w=(c==null?void 0:c.message)||f||null,v=async x=>{m(),d(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:x.apiKey}}},{onError:h=>{console.error("Update connection error:",h),We(h,d)},onSuccess:()=>{g()}})}catch(h){console.error("Update connection caught error:",h),We(h,d)}};return r?u.jsxs(u.Fragment,{children:[u.jsx(Ft,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Update ${n} API Key`}),l&&u.jsx(Ho,{children:"Connection updated successfully"}),w&&u.jsx(Ki,{children:`Error updating connection ${w}`}),u.jsx(Sd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:v,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function xd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var v,x;const[i,s]=b.useState({username:"",password:""}),a=((v=t.metadata)==null?void 0:v.input)||[],{username:c,password:f}=i,{providerName:d}=pt(e),l=h=>{const{name:y,value:I}=h.currentTarget;s(S=>({...S,[y]:I.trim()}))},p=ei(a,i),m=r||!p,g=()=>{const h=Bo(a,i);n({user:c,pass:f,providerMetadata:h})},w=(x=t.basicOpts)==null?void 0:x.docsURL;return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&u.jsx(No,{url:w,providerDisplayName:d||an(e),credentialName:"credentials"}),u.jsx(Et.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:l}),u.jsx(Et.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:l}),a.map(h=>u.jsxs("div",{children:[h.docsURL&&u.jsx(No,{url:h.docsURL,providerDisplayName:d||an(e),credentialName:h.displayName||h.name}),u.jsx(Et.Input,{id:h.name,name:h.name,type:"text",placeholder:h.displayName||h.name,onChange:l})]},h.name)),u.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:m,type:"button",onClick:g,variant:o,children:"Next"})]})}function aI({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=pt(e);return u.jsxs(ir,{children:[u.jsx(or,{children:`Set up ${i} integration`}),u.jsx(ln,{error:r}),u.jsx(xd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function cI({...e}){return u.jsx(aI,{...e})}function uI({provider:e}){const{projectIdOrName:t}=Le(),{providerName:n,data:r}=pt(e),{selectedConnection:o,isConnectionsLoading:i}=Yt(),{mutateAsync:s,isPending:a,error:c}=Aa(),[f,d]=b.useState(null),[l,p]=b.useState(!1),m=()=>p(!1),g=()=>{p(!0),d(null)},w=(c==null?void 0:c.message)||f||null,v=async x=>{m(),d(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:x.user,password:x.pass}}}},{onError:h=>{console.error(h),We(h,d)},onSuccess:()=>{g()}})}catch(h){console.error(h),We(h,d)}};return r?u.jsxs(u.Fragment,{children:[u.jsx(Ft,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Update ${n} credentials`}),l&&u.jsx(Ho,{children:"Connection updated successfully"}),w&&u.jsx(Ki,{children:`Error updating connection: ${w}`}),u.jsx(xd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:v,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function Od({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:o}){var I;const[i,s]=b.useState({clientSecret:"",clientId:"",scopes:""}),[a,c]=b.useState(null),{data:f}=qo(e),d=((I=f==null?void 0:f.metadata)==null?void 0:I.input)||[],l=S=>{const{name:E,value:P}=S.currentTarget;s(_=>({..._,[E]:P.trim()})),c(null)},{clientSecret:p,clientId:m,scopes:g}=i,w=p.length>0,v=m.length>0,x=ei(d,i),h=n||!w||!v||!x,y=()=>{const S=Bo(d,i),E={clientId:m,clientSecret:p,providerMetadata:S};r&&g.length>0&&(E.scopes=hb(g)),t(E)};return u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[u.jsx(Et.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:l}),u.jsx(Et.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:l}),r&&u.jsx(Et.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:l}),d.map(S=>u.jsx(Et.Input,{id:S.name,name:S.name,type:"text",placeholder:S.displayName||S.name,onChange:l},S.name))]}),u.jsx(ln,{error:a}),u.jsx("br",{}),u.jsx(ze,{style:{width:"100%"},disabled:h,type:"button",onClick:y,variant:o,children:"Next"})]})}function lI({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return u.jsxs(ir,{children:[u.jsx(or,{children:`Set up ${o} integration`}),u.jsx(ln,{error:n}),u.jsx("br",{}),u.jsx(Od,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function dI({provider:e}){var h;const{projectIdOrName:t}=Le(),{selectedConnection:n,isConnectionsLoading:r}=Yt(),{providerName:o,data:i}=pt(e),{mutateAsync:s,isPending:a,error:c}=Aa(),[f,d]=b.useState(null),[l,p]=b.useState(!1),m=()=>{p(!1)},g=()=>{p(!0),d(null)},w=(h=i==null?void 0:i.oauth2Opts)==null?void 0:h.explicitScopesRequired,v=(c==null?void 0:c.message)||f||null,x=async y=>{m(),d(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret,scopes:y.scopes}}}}),g()}catch(I){We(I,d)}};return u.jsxs(u.Fragment,{children:[u.jsx(Ft,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Re-authenticate to ${o}`}),l&&u.jsx(Ho,{children:"Connection updated successfully"}),v&&u.jsx(Ki,{children:`Error updating connection ${v}`}),u.jsx(Od,{provider:o||"",handleSubmit:x,isButtonDisabled:a||r,explicitScopesRequired:w,buttonVariant:"ghost"})]})]})}const Qc=600,Xc=600,fI="AUTHORIZATION_SUCCEEDED",pI="AUTHORIZATION_FAILED";function hI(e,t,n,r){return b.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Qc)/2,i=window.screenY+(window.outerHeight-Xc)/2.5,s=`width=${Qc},height=${Xc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function mI(e,t,n,r){const o=qe();return b.useCallback(i=>{var s,a;if(i.origin===Hl){if(i.data.eventType===fI){const c=(s=i.data.data)==null?void 0:s.connection;c?(e(c),o.setQueriesData({queryKey:["amp","connections"]},()=>[c]),t==null||t.close(),r==null||r(),o.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:i})}i.data.eventType===pI&&(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 gI({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s,onWindowClose:a}){const[c,f]=b.useState(null),[d,l]=b.useState(null),p=qe(),m=b.useRef(null),g=mI(f,d,r,i),w=hI(n,l,g,t);b.useEffect(()=>{t&&!d&&!c&&!o&&!s&&(r==null||r(null),w())},[t,d,w,c,o,s,r]);const v=b.useCallback(()=>{p.invalidateQueries({queryKey:["amp","connections"]}),l(null),!c&&!o?console.error("Window closed and no connection was found. Please try again."):c&&(r==null||r(null)),a==null||a()},[c,o,r,a,p]);return b.useEffect(()=>{if(d)return m.current=setInterval(()=>{d!=null&&d.closed&&(m.current&&clearInterval(m.current),m.current=null,v())},500),()=>{m.current&&(clearInterval(m.current),m.current=null),window.removeEventListener("message",g)}},[v,d,g]),u.jsx("div",{children:e})}const yI=()=>{const e=ct(),t=qe();return En({mutationKey:["updateOauthConnection"],mutationFn:async n=>{const r=await e();if(!n.projectIdOrName||!n.connectionId)throw new Error("Project ID and connection ID are required");return r.oAuthApi.oauthUpdate(n)},onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function vI({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs("div",{style:{padding:"1rem 0"},children:[u.jsx("p",{children:`Re-authenticate to ${r}`}),u.jsx(ln,{error:t}),u.jsx(ze,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function wI({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Yt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=pt(e),{mutateAsync:s,isPending:a,error:c}=yI(),[f,d]=b.useState(null),[l,p]=b.useState(!1),[m,g]=b.useState(null),w=()=>{p(!1)},v=()=>{p(!0),d(null),g(null)},x=(c==null?void 0:c.message)||f||null,h=async()=>{w(),d(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});g(I)}catch(I){We(I,d)}},y=b.useCallback(I=>{d(I)},[]);return u.jsxs(u.Fragment,{children:[u.jsx(Ft,{string:"Update connection"}),l&&u.jsx(Ho,{children:"Connection updated successfully"}),u.jsx(gI,{windowTitle:`Connect to ${i}`,oauthUrl:m||null,onError:y,error:x,isSuccessConnect:l,onSuccessConnect:v,children:u.jsx(vI,{handleSubmit:h,error:x,providerName:i,isButtonDisabled:a||n||l})})]})}function Ra({provider:e}){var r;const{data:t}=qo(e);if((t==null?void 0:t.authType)===kc.Basic)return u.jsx(uI,{provider:e});if((t==null?void 0:t.authType)===kc.ApiKey)return u.jsx(sI,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===cs.AuthorizationCode||n===cs.AuthorizationCodePkce)return u.jsx(wI,{provider:e});if(n===cs.ClientCredentials)return u.jsx(dI,{provider:e})}return null}const bI=()=>{const e=ct(),t=qe(),[n,r]=b.useState(null);return{...En({mutationKey:["deleteConnection"],mutationFn:async i=>(await e()).connectionApi.deleteConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)},onError:i=>{console.error("Error deleting connection"),We(i,r)}}),errorMsg:n}};function Ed({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectIdOrName:s}=Le(),{selectedConnection:a}=Yt(),{mutate:c,isPending:f}=bI(),d=!s||!a||!a.id||f,l=async()=>{d||(console.warn("deleting connection",{projectIdOrName:s,connectionId:a==null?void 0:a.id}),c({projectIdOrName:s,connectionId:a==null?void 0:a.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),o()},onError:g=>{We(g,i)}}))},p=f?"Pending...":e;return u.jsx(ze,{type:"button",onClick:l,disabled:d,variant:t,style:n,children:p})}const _d=b.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),fi=()=>{const e=b.useContext(_d);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},II=()=>{var f;const e=qe(),t=ct(),{selectedConnection:n,isConnectionsLoading:r}=Yt(),{projectIdOrName:o}=Le(),{integrationId:i,integrationObj:s}=ut(),a=n==null?void 0:n.id,c=(f=s==null?void 0:s.latestRevision)==null?void 0:f.id;return b.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),er({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 CI({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=ut(),{isError:o,removeError:i,setError:s}=un(),a=(r==null?void 0:r.name)||n,[c,f]=b.useState(null),[d,l]=b.useState(null),{data:p,isLoading:m,isError:g,error:w}=II();b.useEffect(()=>{g?(s(we.HYDRATED_REVISION,a),We(w,f)):(i(we.HYDRATED_REVISION,a),f(null),l(null))},[g,a,s,i,w,f]);const v=b.useMemo(()=>{var h,y,I;return{hydratedRevision:p||null,loading:m,readAction:(h=p==null?void 0:p.content)==null?void 0:h.read,writeObjects:((I=(y=p==null?void 0:p.content)==null?void 0:y.write)==null?void 0:I.objects)||[]}},[p,m]);if(m)return u.jsx(di,{});const x=(r==null?void 0:r.provider)||"provider";if(o(we.HYDRATED_REVISION,a)){const h=(r==null?void 0:r.name)||n||"unknown integration",y=`${c?`: ${c}`:`Error retrieving objects from ${x} or integration details for ${h}`}`;return u.jsx(zt,{message:y,children:u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[u.jsx(Ra,{provider:x}),u.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),d&&u.jsx(Wl,{message:d}),u.jsx(Ed,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:I=>l(I)})]})})}return u.jsx(_d.Provider,{value:v,children:e})}const Nd=b.createContext(null);function Td(){const e=b.useContext(Nd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const Ad=b.createContext(()=>{});function SI(){const e=b.useContext(Ad);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const Rd=b.createContext(void 0),xI={};function Pa(){const e=b.useContext(Rd);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function OI({children:e}){const{installation:t}=ut(),{hydratedRevision:n,loading:r}=fi(),[o,i]=b.useState(xI),s=t==null?void 0:t.config;b.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&Db(n,s,i)},[n,r,s,o]);const a=b.useCallback((p,m)=>{i(g=>Tt(g,w=>{w[p]=Tt(w[p],m)}))},[i]),c=b.useCallback((p,m)=>{i(g=>Tt(g,w=>{w[p]=m}))},[i]),f=b.useCallback(()=>{i(Tt(p=>{const m=p.other.write;m&&(m.isWriteModified=!1)}))},[i]),d=b.useCallback(p=>{p===_r&&f()},[f]),l=b.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:d}),[o,c,d,a]);return u.jsx(Rd.Provider,{value:l,children:e})}const Zt=()=>{const{appName:e}=nr(),{objectConfigurationsState:t,setConfigureState:n}=Pa(),{selectedObjectName:r}=Td(),o=vd(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function xn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ye.apply(null,arguments)}function Xs(e,t){return Xs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Xs(e,t)}function EI(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Xs(e,t)}var Ys={exports:{}},so={exports:{}},Ee={};/** @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})()})(id);var tb=id.exports;const Lt=Mo(tb),nb="_button_kwfiu_1",rb="_danger_kwfiu_42",ib="_ghost_kwfiu_47",is={button:nb,danger:rb,ghost:ib};function We({className:e,style:t,type:n,children:r,variant:o,...i}){const s=Lt(is.button,{[is.danger]:o==="danger",[is.ghost]:o==="ghost",[e||""]:!!e});return c.jsx("button",{type:n,className:s,style:t,...i,children:r})}const ob={backgroundColor:"var(--amp-colors-status-critical-muted)",borderColor:"var(--amp-colors-status-critical-muted)",color:"var(--amp-colors-status-critical-dark)",padding:".5rem 1rem"};function ki({children:e,style:t}){return c.jsx(Sn,{style:{...ob,...t},children:e})}const jo=e=>{const t=st(),{provider:n}=at(),r=e||n;return Yn({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},dt=e=>{const t=jo(e),{data:n}=t,{provider:r}=at(),o=n&&Rw(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function cn({error:e}){return e?c.jsx(ki,{style:{marginTop:"2em"},children:e}):null}const sb="_input_1ymb7_1",ab="_inputError_1ymb7_27",os={input:sb,inputError:ab};function od({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Lt(os.inputError,os.input):os.input;return c.jsx("input",{id:e,type:t,className:Lt(i,n),...o})}function cb(){return c.jsx("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:c.jsxs("g",{opacity:"0.5",children:[c.jsx("path",{d:"M14.2821 11.0004C14.2821 12.8154 12.8154 14.2821 11.0004 14.2821C9.18542 14.2821 7.71875 12.8154 7.71875 11.0004C7.71875 9.18542 9.18542 7.71875 11.0004 7.71875C12.8154 7.71875 14.2821 9.18542 14.2821 11.0004Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10.9999 18.581C14.2357 18.581 17.2515 16.6743 19.3507 13.3743C20.1757 12.0818 20.1757 9.90932 19.3507 8.61682C17.2515 5.31682 14.2357 3.41016 10.9999 3.41016C7.76402 3.41016 4.74819 5.31682 2.64902 8.61682C1.82402 9.90932 1.82402 12.0818 2.64902 13.3743C4.74819 16.6743 7.76402 18.581 10.9999 18.581Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function ub(){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[c.jsx("path",{d:"M13.3187 8.68036L8.68036 13.3187C8.06528 12.7036 7.71973 11.8694 7.71973 10.9995C7.71973 10.5688 7.80456 10.1423 7.96939 9.7444C8.13421 9.34648 8.3758 8.98491 8.68036 8.68036C8.98491 8.3758 9.34648 8.13421 9.7444 7.96939C10.1423 7.80456 10.5688 7.71973 10.9995 7.71973C11.8694 7.71973 12.7036 8.06528 13.3187 8.68036Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M16.3349 5.28895C14.7307 4.07895 12.8974 3.41895 10.9999 3.41895C7.76402 3.41895 4.74819 5.32561 2.64902 8.62561C1.82402 9.91811 1.82402 12.0906 2.64902 13.3831C3.37319 14.5198 4.21652 15.5006 5.13319 16.2889M7.71819 17.9023C8.76319 18.3423 9.87236 18.5806 10.9999 18.5806C14.2357 18.5806 17.2515 16.6739 19.3507 13.3739C20.1757 12.0814 20.1757 9.90895 19.3507 8.61645C19.0482 8.13978 18.7182 7.69061 18.379 7.26895",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M14.2172 11.6413C14.093 12.2808 13.7806 12.8685 13.32 13.3291C12.8594 13.7897 12.2716 14.1022 11.6322 14.2263M8.68051 13.3188L1.83301 20.1663M20.1663 1.83301L13.3188 8.68051",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function lb({id:e,name:t,placeholder:n="Password",onChange:r,value:o,className:i,isError:s}){const[a,u]=b.useState(!1),f=()=>u(l=>!l);return c.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[c.jsx(Ot.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:o,className:i,isError:s}),c.jsx(We,{type:"button","aria-label":a?"Hide password":"Show password",style:{height:"2.5rem",width:"2.5rem",display:"flex",alignItems:"center",justifyContent:"center"},onClick:f,variant:"ghost",children:c.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?c.jsx(ub,{}):c.jsx(cb,{})})})]})}const db="_textarea_18zl4_1",fb="_textareaError_18zl4_14",ss={textarea:db,textareaError:fb};function pb({className:e,isError:t=!1,...n}){const r=t?Lt(ss.textareaError,ss.textarea):ss.textarea;return c.jsx("textarea",{className:Lt(e,r),...n})}const Ot={Input:od,Textarea:pb,PasswordInput:lb},hb=()=>{const{projectIdOrName:e}=je(),t=st();return Yn({queryKey:["project",e,"entitlements"],queryFn:async()=>{if(!e)throw new Error("Project ID is required");return(await t()).projectApi.getProject({projectIdOrName:e,includeEntitlements:!0})},enabled:!!e})};function sd(){var n,r;const{data:e}=hb();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:c.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[c.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),c.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:c.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})})]})}function tr({children:e}){return c.jsx(si,{children:c.jsxs(Sn,{children:[c.jsx("div",{style:{padding:"3rem 2rem"},children:e}),c.jsx(sd,{})]})})}function nr({children:e}){return c.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function mb({children:e}){return c.jsx("p",{style:{padding:".5em 0"},children:e})}const gb="_link_oo2kv_1",yb={link:gb};function wa({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return c.jsx("a",{className:Lt(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 Co({url:e,providerDisplayName:t,credentialName:n}){return c.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[c.jsx(wa,{href:e,newTab:!0,children:c.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function Lo(e,t){const n={},r=[];if(e.forEach(o=>{const i=t[o.name];!i||i.trim()===""?r.push(o.displayName||o.name):n[o.name]={value:i,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function Gr(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function ad({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var O,p;const[s,a]=b.useState({apiKey:""}),u=((O=t.metadata)==null?void 0:O.input)||[],f=y=>{const{name:I,value:x}=y.currentTarget;a(N=>({...N,[I]:x.trim()}))},{apiKey:l}=s,{providerName:d}=dt(e),h=l.length>0,m=Gr(u,s),v=r||!h||!m,w=(p=t.apiKeyOpts)==null?void 0:p.docsURL,g=()=>{const y=Lo(u,s);n({apiKey:l,providerMetadata:y})};return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&c.jsx(Co,{url:w,providerDisplayName:d||on(e),credentialName:"API key"}),c.jsx(Ot.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:f}),u.map(y=>c.jsxs("div",{children:[y.docsURL&&c.jsx(Co,{url:y.docsURL,providerDisplayName:d||on(e),credentialName:y.displayName||y.name}),c.jsx(Ot.Input,{id:y.name,name:y.name,type:"text",placeholder:y.displayName||y.name,onChange:f})]},y.name)),c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:v,type:i||"submit",onClick:g,variant:o,children:"Next"})]})}function vb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=dt(e);return c.jsxs(tr,{children:[c.jsx(nr,{children:`Set up ${i} integration`}),c.jsx(cn,{error:r}),c.jsx(ad,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function wb({...e}){return c.jsx(vb,{...e})}const bb={backgroundColor:"var(--amp-colors-status-success-muted)",borderColor:"var(--amp-colors-status-success-muted)",color:"var(--amp-colors-status-success-dark)",padding:".5rem 1rem"};function Vo({children:e,style:t}){return c.jsx(Sn,{style:{...bb,...t},children:e})}const ba=()=>{const e=st(),t=qe(),[n,r]=b.useState(null);return{...On({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},Ib="_divider_1kmoj_1",Lc={divider:Ib};function $o({className:e,style:t}){return c.jsx("hr",{className:e?`${Lc.divider} ${e}`:Lc.divider,style:t})}function Rt({string:e}){return c.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[c.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),c.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:c.jsx($o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Cb({provider:e}){const{projectIdOrName:t}=je(),{providerName:n,data:r}=dt(e),{selectedConnection:o,isConnectionsLoading:i}=Qt(),{mutateAsync:s,isPending:a,error:u}=ba(),[f,l]=b.useState(null),[d,h]=b.useState(!1),m=()=>h(!1),v=()=>{h(!0),l(null)},w=(u==null?void 0:u.message)||f||null,g=async O=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:O.apiKey}}},{onError:p=>{console.error("Update connection error:",p),He(p,l)},onSuccess:()=>{v()}})}catch(p){console.error("Update connection caught error:",p),He(p,l)}};return r?c.jsxs(c.Fragment,{children:[c.jsx(Rt,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${n} API Key`}),d&&c.jsx(Vo,{children:"Connection updated successfully"}),w&&c.jsx(ki,{children:`Error updating connection ${w}`}),c.jsx(ad,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function cd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var g,O;const[i,s]=b.useState({username:"",password:""}),a=((g=t.metadata)==null?void 0:g.input)||[],{username:u,password:f}=i,{providerName:l}=dt(e),d=p=>{const{name:y,value:I}=p.currentTarget;s(x=>({...x,[y]:I.trim()}))},h=Gr(a,i),m=r||!h,v=()=>{const p=Lo(a,i);n({user:u,pass:f,providerMetadata:p})},w=(O=t.basicOpts)==null?void 0:O.docsURL;return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&c.jsx(Co,{url:w,providerDisplayName:l||on(e),credentialName:"credentials"}),c.jsx(Ot.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:d}),c.jsx(Ot.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:d}),a.map(p=>c.jsxs("div",{children:[p.docsURL&&c.jsx(Co,{url:p.docsURL,providerDisplayName:l||on(e),credentialName:p.displayName||p.name}),c.jsx(Ot.Input,{id:p.name,name:p.name,type:"text",placeholder:p.displayName||p.name,onChange:d})]},p.name)),c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:m,type:"button",onClick:v,variant:o,children:"Next"})]})}function xb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=dt(e);return c.jsxs(tr,{children:[c.jsx(nr,{children:`Set up ${i} integration`}),c.jsx(cn,{error:r}),c.jsx(cd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function Ob({...e}){return c.jsx(xb,{...e})}function Sb({provider:e}){const{projectIdOrName:t}=je(),{providerName:n,data:r}=dt(e),{selectedConnection:o,isConnectionsLoading:i}=Qt(),{mutateAsync:s,isPending:a,error:u}=ba(),[f,l]=b.useState(null),[d,h]=b.useState(!1),m=()=>h(!1),v=()=>{h(!0),l(null)},w=(u==null?void 0:u.message)||f||null,g=async O=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:O.user,password:O.pass}}}},{onError:p=>{console.error(p),He(p,l)},onSuccess:()=>{v()}})}catch(p){console.error(p),He(p,l)}};return r?c.jsxs(c.Fragment,{children:[c.jsx(Rt,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${n} credentials`}),d&&c.jsx(Vo,{children:"Connection updated successfully"}),w&&c.jsx(ki,{children:`Error updating connection: ${w}`}),c.jsx(cd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function ud({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:o}){var I;const[i,s]=b.useState({clientSecret:"",clientId:"",scopes:""}),[a,u]=b.useState(null),{data:f}=jo(e),l=((I=f==null?void 0:f.metadata)==null?void 0:I.input)||[],d=x=>{const{name:N,value:A}=x.currentTarget;s(_=>({..._,[N]:A.trim()})),u(null)},{clientSecret:h,clientId:m,scopes:v}=i,w=h.length>0,g=m.length>0,O=Gr(l,i),p=n||!w||!g||!O,y=()=>{const x=Lo(l,i),N={clientId:m,clientSecret:h,providerMetadata:x};r&&v.length>0&&(N.scopes=Aw(v)),t(N)};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[c.jsx(Ot.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:d}),c.jsx(Ot.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:d}),r&&c.jsx(Ot.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:d}),l.map(x=>c.jsx(Ot.Input,{id:x.name,name:x.name,type:"text",placeholder:x.displayName||x.name,onChange:d},x.name))]}),c.jsx(cn,{error:a}),c.jsx("br",{}),c.jsx(We,{style:{width:"100%"},disabled:p,type:"button",onClick:y,variant:o,children:"Next"})]})}function _b({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return c.jsxs(tr,{children:[c.jsx(nr,{children:`Set up ${o} integration`}),c.jsx(cn,{error:n}),c.jsx("br",{}),c.jsx(ud,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function Eb({provider:e}){var p;const{projectIdOrName:t}=je(),{selectedConnection:n,isConnectionsLoading:r}=Qt(),{providerName:o,data:i}=dt(e),{mutateAsync:s,isPending:a,error:u}=ba(),[f,l]=b.useState(null),[d,h]=b.useState(!1),m=()=>{h(!1)},v=()=>{h(!0),l(null)},w=(p=i==null?void 0:i.oauth2Opts)==null?void 0:p.explicitScopesRequired,g=(u==null?void 0:u.message)||f||null,O=async y=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret,scopes:y.scopes}}}}),v()}catch(I){He(I,l)}};return c.jsxs(c.Fragment,{children:[c.jsx(Rt,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Re-authenticate to ${o}`}),d&&c.jsx(Vo,{children:"Connection updated successfully"}),g&&c.jsx(ki,{children:`Error updating connection ${g}`}),c.jsx(ud,{provider:o||"",handleSubmit:O,isButtonDisabled:a||r,explicitScopesRequired:w,buttonVariant:"ghost"})]})]})}const Vc=600,$c=600,Nb="AUTHORIZATION_SUCCEEDED",Tb="AUTHORIZATION_FAILED";function Rb(e,t,n,r){return b.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Vc)/2,i=window.screenY+(window.outerHeight-$c)/2.5,s=`width=${Vc},height=${$c},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Ab(e,t,n,r){const o=qe();return b.useCallback(i=>{var s,a;if(i.origin===El){if(i.data.eventType===Nb){const u=(s=i.data.data)==null?void 0:s.connection;u?(e(u),o.setQueriesData({queryKey:["amp","connections"]},()=>[u]),t==null||t.close(),r==null||r(),o.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:i})}i.data.eventType===Tb&&(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 Fb({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s,onWindowClose:a}){const[u,f]=b.useState(null),[l,d]=b.useState(null),h=qe(),m=b.useRef(null),v=Ab(f,l,r,i),w=Rb(n,d,v,t);b.useEffect(()=>{t&&!l&&!u&&!o&&!s&&(r==null||r(null),w())},[t,l,w,u,o,s,r]);const g=b.useCallback(()=>{h.invalidateQueries({queryKey:["amp","connections"]}),d(null),!u&&!o?console.error("Window closed and no connection was found. Please try again."):u&&(r==null||r(null)),a==null||a()},[u,o,r,a,h]);return b.useEffect(()=>{if(l)return m.current=setInterval(()=>{l!=null&&l.closed&&(m.current&&clearInterval(m.current),m.current=null,g())},500),()=>{m.current&&(clearInterval(m.current),m.current=null),window.removeEventListener("message",v)}},[g,l,v]),c.jsx("div",{children:e})}const Pb=()=>{const e=st(),t=qe();return On({mutationKey:["updateOauthConnection"],mutationFn:async n=>{const r=await e();if(!n.projectIdOrName||!n.connectionId)throw new Error("Project ID and connection ID are required");return r.oAuthApi.oauthUpdate(n)},onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function Db({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs("div",{style:{padding:"1rem 0"},children:[c.jsx("p",{children:`Re-authenticate to ${r}`}),c.jsx(cn,{error:t}),c.jsx(We,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Mb({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Qt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=dt(e),{mutateAsync:s,isPending:a,error:u}=Pb(),[f,l]=b.useState(null),[d,h]=b.useState(!1),[m,v]=b.useState(null),w=()=>{h(!1)},g=()=>{h(!0),l(null),v(null)},O=(u==null?void 0:u.message)||f||null,p=async()=>{w(),l(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});v(I)}catch(I){He(I,l)}},y=b.useCallback(I=>{l(I)},[]);return c.jsxs(c.Fragment,{children:[c.jsx(Rt,{string:"Update connection"}),d&&c.jsx(Vo,{children:"Connection updated successfully"}),c.jsx(Fb,{windowTitle:`Connect to ${i}`,oauthUrl:m||null,onError:y,error:O,isSuccessConnect:d,onSuccessConnect:g,children:c.jsx(Db,{handleSubmit:p,error:O,providerName:i,isButtonDisabled:a||n||d})})]})}function Ia({provider:e}){var r;const{data:t}=jo(e);if((t==null?void 0:t.authType)===Sc.Basic)return c.jsx(Sb,{provider:e});if((t==null?void 0:t.authType)===Sc.ApiKey)return c.jsx(Cb,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===ts.AuthorizationCode||n===ts.AuthorizationCodePkce)return c.jsx(Mb,{provider:e});if(n===ts.ClientCredentials)return c.jsx(Eb,{provider:e})}return null}const kb=()=>{const e=st(),t=qe(),[n,r]=b.useState(null);return{...On({mutationKey:["deleteConnection"],mutationFn:async i=>(await e()).connectionApi.deleteConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)},onError:i=>{console.error("Error deleting connection"),He(i,r)}}),errorMsg:n}};function ld({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectIdOrName:s}=je(),{selectedConnection:a}=Qt(),{mutate:u,isPending:f}=kb(),l=!s||!a||!a.id||f,d=async()=>{l||(console.warn("deleting connection",{projectIdOrName:s,connectionId:a==null?void 0:a.id}),u({projectIdOrName:s,connectionId:a==null?void 0:a.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),o()},onError:v=>{He(v,i)}}))},h=f?"Pending...":e;return c.jsx(We,{type:"button",onClick:d,disabled:l,variant:t,style:n,children:h})}const dd=b.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),ci=()=>{const e=b.useContext(dd);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},jb=()=>{var f;const e=qe(),t=st(),{selectedConnection:n,isConnectionsLoading:r}=Qt(),{projectIdOrName:o}=je(),{integrationId:i,integrationObj:s}=at(),a=n==null?void 0:n.id,u=(f=s==null?void 0:s.latestRevision)==null?void 0:f.id;return b.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),Yn({queryKey:["amp","hydratedRevision",o,i,u,a],queryFn:async()=>{if(!o)throw new Error("projectIdOrName is required");if(!i)throw new Error("integrationId is required");if(!u)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:o,integrationId:i,revisionId:u,connectionId:a})},retry:3,enabled:!!o&&!!i&&!!u&&!!a&&!r})};function Lb({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=at(),{isError:o,removeError:i,setError:s}=an(),a=(r==null?void 0:r.name)||n,[u,f]=b.useState(null),[l,d]=b.useState(null),{data:h,isLoading:m,isError:v,error:w}=jb();b.useEffect(()=>{v?(s(we.HYDRATED_REVISION,a),He(w,f)):(i(we.HYDRATED_REVISION,a),f(null),d(null))},[v,a,s,i,w,f]);const g=b.useMemo(()=>{var p,y,I;return{hydratedRevision:h||null,loading:m,readAction:(p=h==null?void 0:h.content)==null?void 0:p.read,writeObjects:((I=(y=h==null?void 0:h.content)==null?void 0:y.write)==null?void 0:I.objects)||[]}},[h,m]);if(m)return c.jsx(ai,{});const O=(r==null?void 0:r.provider)||"provider";if(o(we.HYDRATED_REVISION,a)){const p=(r==null?void 0:r.name)||n||"unknown integration",y=`${u?`: ${u}`:`Error retrieving objects from ${O} or integration details for ${p}`}`;return c.jsx(Jt,{message:y,children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[c.jsx(Ia,{provider:O}),c.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),l&&c.jsx(Tl,{message:l}),c.jsx(ld,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:I=>d(I)})]})})}return c.jsx(dd.Provider,{value:g,children:e})}const fd=b.createContext(null);function pd(){const e=b.useContext(fd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const hd=b.createContext(()=>{});function Vb(){const e=b.useContext(hd);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const md=b.createContext(void 0),$b={};function Ca(){const e=b.useContext(md);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Kb({children:e}){const{installation:t}=at(),{hydratedRevision:n,loading:r}=ci(),[o,i]=b.useState($b),s=t==null?void 0:t.config;b.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&Gw(n,s,i)},[n,r,s,o]);const a=b.useCallback((l,d)=>{i(h=>Mt(h,m=>{m[l]=Mt(m[l],d)}))},[i]),u=b.useCallback((l,d)=>{i(h=>Mt(h,m=>{m[l]=d}))},[i]),f=b.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:u}),[o,u,a]);return c.jsx(md.Provider,{value:f,children:e})}const Gt=()=>{const{appName:e}=Zn(),{objectConfigurationsState:t,setConfigureState:n}=Ca(),{selectedObjectName:r}=pd(),o=nd(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function Cn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ye.apply(null,arguments)}function Bs(e,t){return Bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Bs(e,t)}function qb(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Bs(e,t)}var Js={exports:{}},no={exports:{}},_e={};/** @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 Yc;function _I(){if(Yc)return Ee;Yc=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function y(S){if(typeof S=="object"&&S!==null){var E=S.$$typeof;switch(E){case t:switch(S=S.type,S){case c:case f:case r:case i:case o:case l:return S;default:switch(S=S&&S.$$typeof,S){case a:case d:case g:case m:case s:return S;default:return E}}case n:return E}}}function I(S){return y(S)===f}return Ee.AsyncMode=c,Ee.ConcurrentMode=f,Ee.ContextConsumer=a,Ee.ContextProvider=s,Ee.Element=t,Ee.ForwardRef=d,Ee.Fragment=r,Ee.Lazy=g,Ee.Memo=m,Ee.Portal=n,Ee.Profiler=i,Ee.StrictMode=o,Ee.Suspense=l,Ee.isAsyncMode=function(S){return I(S)||y(S)===c},Ee.isConcurrentMode=I,Ee.isContextConsumer=function(S){return y(S)===a},Ee.isContextProvider=function(S){return y(S)===s},Ee.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===t},Ee.isForwardRef=function(S){return y(S)===d},Ee.isFragment=function(S){return y(S)===r},Ee.isLazy=function(S){return y(S)===g},Ee.isMemo=function(S){return y(S)===m},Ee.isPortal=function(S){return y(S)===n},Ee.isProfiler=function(S){return y(S)===i},Ee.isStrictMode=function(S){return y(S)===o},Ee.isSuspense=function(S){return y(S)===l},Ee.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===r||S===f||S===i||S===o||S===l||S===p||typeof S=="object"&&S!==null&&(S.$$typeof===g||S.$$typeof===m||S.$$typeof===s||S.$$typeof===a||S.$$typeof===d||S.$$typeof===v||S.$$typeof===x||S.$$typeof===h||S.$$typeof===w)},Ee.typeOf=y,Ee}var _e={};/** @license React v16.13.1
17
+ */var Kc;function Ub(){if(Kc)return _e;Kc=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,u=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,p=e?Symbol.for("react.scope"):60119;function y(x){if(typeof x=="object"&&x!==null){var N=x.$$typeof;switch(N){case t:switch(x=x.type,x){case u:case f:case r:case i:case o:case d:return x;default:switch(x=x&&x.$$typeof,x){case a:case l:case v:case m:case s:return x;default:return N}}case n:return N}}}function I(x){return y(x)===f}return _e.AsyncMode=u,_e.ConcurrentMode=f,_e.ContextConsumer=a,_e.ContextProvider=s,_e.Element=t,_e.ForwardRef=l,_e.Fragment=r,_e.Lazy=v,_e.Memo=m,_e.Portal=n,_e.Profiler=i,_e.StrictMode=o,_e.Suspense=d,_e.isAsyncMode=function(x){return I(x)||y(x)===u},_e.isConcurrentMode=I,_e.isContextConsumer=function(x){return y(x)===a},_e.isContextProvider=function(x){return y(x)===s},_e.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===t},_e.isForwardRef=function(x){return y(x)===l},_e.isFragment=function(x){return y(x)===r},_e.isLazy=function(x){return y(x)===v},_e.isMemo=function(x){return y(x)===m},_e.isPortal=function(x){return y(x)===n},_e.isProfiler=function(x){return y(x)===i},_e.isStrictMode=function(x){return y(x)===o},_e.isSuspense=function(x){return y(x)===d},_e.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===r||x===f||x===i||x===o||x===d||x===h||typeof x=="object"&&x!==null&&(x.$$typeof===v||x.$$typeof===m||x.$$typeof===s||x.$$typeof===a||x.$$typeof===l||x.$$typeof===g||x.$$typeof===O||x.$$typeof===p||x.$$typeof===w)},_e.typeOf=y,_e}var Ee={};/** @license React v16.13.1
18
18
  * react-is.development.js
19
19
  *
20
20
  * Copyright (c) Facebook, Inc. and its affiliates.
21
21
  *
22
22
  * This source code is licensed under the MIT license found in the
23
23
  * LICENSE file in the root directory of this source tree.
24
- */var Zc;function NI(){return Zc||(Zc=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function y(k){return typeof k=="string"||typeof k=="function"||k===r||k===f||k===i||k===o||k===l||k===p||typeof k=="object"&&k!==null&&(k.$$typeof===g||k.$$typeof===m||k.$$typeof===s||k.$$typeof===a||k.$$typeof===d||k.$$typeof===v||k.$$typeof===x||k.$$typeof===h||k.$$typeof===w)}function I(k){if(typeof k=="object"&&k!==null){var ve=k.$$typeof;switch(ve){case t:var z=k.type;switch(z){case c:case f:case r:case i:case o:case l:return z;default:var Ye=z&&z.$$typeof;switch(Ye){case a:case d:case g:case m:case s:return Ye;default:return ve}}case n:return ve}}}var S=c,E=f,P=a,_=s,A=t,R=d,M=r,j=g,K=m,$=n,ce=i,re=o,pe=l,de=!1;function be(k){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),F(k)||I(k)===c}function F(k){return I(k)===f}function L(k){return I(k)===a}function B(k){return I(k)===s}function H(k){return typeof k=="object"&&k!==null&&k.$$typeof===t}function J(k){return I(k)===d}function U(k){return I(k)===r}function X(k){return I(k)===g}function ee(k){return I(k)===m}function Y(k){return I(k)===n}function te(k){return I(k)===i}function ne(k){return I(k)===o}function ue(k){return I(k)===l}_e.AsyncMode=S,_e.ConcurrentMode=E,_e.ContextConsumer=P,_e.ContextProvider=_,_e.Element=A,_e.ForwardRef=R,_e.Fragment=M,_e.Lazy=j,_e.Memo=K,_e.Portal=$,_e.Profiler=ce,_e.StrictMode=re,_e.Suspense=pe,_e.isAsyncMode=be,_e.isConcurrentMode=F,_e.isContextConsumer=L,_e.isContextProvider=B,_e.isElement=H,_e.isForwardRef=J,_e.isFragment=U,_e.isLazy=X,_e.isMemo=ee,_e.isPortal=Y,_e.isProfiler=te,_e.isStrictMode=ne,_e.isSuspense=ue,_e.isValidElementType=y,_e.typeOf=I}()),_e}var eu;function Pd(){return eu||(eu=1,process.env.NODE_ENV==="production"?so.exports=_I():so.exports=NI()),so.exports}/*
24
+ */var qc;function Bb(){return qc||(qc=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,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,u=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,p=e?Symbol.for("react.scope"):60119;function y(k){return typeof k=="string"||typeof k=="function"||k===r||k===f||k===i||k===o||k===d||k===h||typeof k=="object"&&k!==null&&(k.$$typeof===v||k.$$typeof===m||k.$$typeof===s||k.$$typeof===a||k.$$typeof===l||k.$$typeof===g||k.$$typeof===O||k.$$typeof===p||k.$$typeof===w)}function I(k){if(typeof k=="object"&&k!==null){var ve=k.$$typeof;switch(ve){case t:var z=k.type;switch(z){case u:case f:case r:case i:case o:case d:return z;default:var Xe=z&&z.$$typeof;switch(Xe){case a:case l:case v:case m:case s:return Xe;default:return ve}}case n:return ve}}}var x=u,N=f,A=a,_=s,F=t,R=l,D=r,K=v,j=m,L=n,se=i,re=o,ge=d,de=!1;function be(k){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),P(k)||I(k)===u}function P(k){return I(k)===f}function $(k){return I(k)===a}function H(k){return I(k)===s}function q(k){return typeof k=="object"&&k!==null&&k.$$typeof===t}function U(k){return I(k)===l}function V(k){return I(k)===r}function G(k){return I(k)===v}function Z(k){return I(k)===m}function Y(k){return I(k)===n}function ee(k){return I(k)===i}function ne(k){return I(k)===o}function ce(k){return I(k)===d}Ee.AsyncMode=x,Ee.ConcurrentMode=N,Ee.ContextConsumer=A,Ee.ContextProvider=_,Ee.Element=F,Ee.ForwardRef=R,Ee.Fragment=D,Ee.Lazy=K,Ee.Memo=j,Ee.Portal=L,Ee.Profiler=se,Ee.StrictMode=re,Ee.Suspense=ge,Ee.isAsyncMode=be,Ee.isConcurrentMode=P,Ee.isContextConsumer=$,Ee.isContextProvider=H,Ee.isElement=q,Ee.isForwardRef=U,Ee.isFragment=V,Ee.isLazy=G,Ee.isMemo=Z,Ee.isPortal=Y,Ee.isProfiler=ee,Ee.isStrictMode=ne,Ee.isSuspense=ce,Ee.isValidElementType=y,Ee.typeOf=I}()),Ee}var Uc;function gd(){return Uc||(Uc=1,process.env.NODE_ENV==="production"?no.exports=Ub():no.exports=Bb()),no.exports}/*
25
25
  object-assign
26
26
  (c) Sindre Sorhus
27
27
  @license MIT
28
- */var hs,tu;function TI(){if(tu)return hs;tu=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(c.join("")!=="0123456789")return!1;var f={};return"abcdefghijklmnopqrst".split("").forEach(function(d){f[d]=d}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return hs=o()?Object.assign:function(i,s){for(var a,c=r(i),f,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var l in a)t.call(a,l)&&(c[l]=a[l]);if(e){f=e(a);for(var p=0;p<f.length;p++)n.call(a,f[p])&&(c[f[p]]=a[f[p]])}}return c},hs}var ms,nu;function Fa(){if(nu)return ms;nu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ms=e,ms}var gs,ru;function Fd(){return ru||(ru=1,gs=Function.call.bind(Object.prototype.hasOwnProperty)),gs}var ys,iu;function AI(){if(iu)return ys;iu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Fa(),n={},r=Fd();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function o(i,s,a,c,f){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var l;try{if(typeof i[d]!="function"){var p=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}l=i[d](s,d,c,a,null,t)}catch(g){l=g}if(l&&!(l instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof l+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),l instanceof Error&&!(l.message in n)){n[l.message]=!0;var m=f?f():"";e("Failed "+a+" type: "+l.message+(m??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ys=o,ys}var vs,ou;function RI(){if(ou)return vs;ou=1;var e=Pd(),t=TI(),n=Fa(),r=Fd(),o=AI(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function s(){return null}return vs=function(a,c){var f=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function l(F){var L=F&&(f&&F[f]||F[d]);if(typeof L=="function")return L}var p="<<anonymous>>",m={array:x("array"),bigint:x("bigint"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:h(),arrayOf:y,element:I(),elementType:S(),instanceOf:E,node:R(),objectOf:_,oneOf:P,oneOfType:A,shape:j,exact:K};function g(F,L){return F===L?F!==0||1/F===1/L:F!==F&&L!==L}function w(F,L){this.message=F,this.data=L&&typeof L=="object"?L:{},this.stack=""}w.prototype=Error.prototype;function v(F){if(process.env.NODE_ENV!=="production")var L={},B=0;function H(U,X,ee,Y,te,ne,ue){if(Y=Y||p,ne=ne||ee,ue!==n){if(c){var k=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw k.name="Invariant Violation",k}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=Y+":"+ee;!L[ve]&&B<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ne+"` prop on `"+Y+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),L[ve]=!0,B++)}}return X[ee]==null?U?X[ee]===null?new w("The "+te+" `"+ne+"` is marked as required "+("in `"+Y+"`, but its value is `null`.")):new w("The "+te+" `"+ne+"` is marked as required in "+("`"+Y+"`, but its value is `undefined`.")):null:F(X,ee,Y,te,ne)}var J=H.bind(null,!1);return J.isRequired=H.bind(null,!0),J}function x(F){function L(B,H,J,U,X,ee){var Y=B[H],te=re(Y);if(te!==F){var ne=pe(Y);return new w("Invalid "+U+" `"+X+"` of type "+("`"+ne+"` supplied to `"+J+"`, expected ")+("`"+F+"`."),{expectedType:F})}return null}return v(L)}function h(){return v(s)}function y(F){function L(B,H,J,U,X){if(typeof F!="function")return new w("Property `"+X+"` of component `"+J+"` has invalid PropType notation inside arrayOf.");var ee=B[H];if(!Array.isArray(ee)){var Y=re(ee);return new w("Invalid "+U+" `"+X+"` of type "+("`"+Y+"` supplied to `"+J+"`, expected an array."))}for(var te=0;te<ee.length;te++){var ne=F(ee,te,J,U,X+"["+te+"]",n);if(ne instanceof Error)return ne}return null}return v(L)}function I(){function F(L,B,H,J,U){var X=L[B];if(!a(X)){var ee=re(X);return new w("Invalid "+J+" `"+U+"` of type "+("`"+ee+"` supplied to `"+H+"`, expected a single ReactElement."))}return null}return v(F)}function S(){function F(L,B,H,J,U){var X=L[B];if(!e.isValidElementType(X)){var ee=re(X);return new w("Invalid "+J+" `"+U+"` of type "+("`"+ee+"` supplied to `"+H+"`, expected a single ReactElement type."))}return null}return v(F)}function E(F){function L(B,H,J,U,X){if(!(B[H]instanceof F)){var ee=F.name||p,Y=be(B[H]);return new w("Invalid "+U+" `"+X+"` of type "+("`"+Y+"` supplied to `"+J+"`, expected ")+("instance of `"+ee+"`."))}return null}return v(L)}function P(F){if(!Array.isArray(F))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function L(B,H,J,U,X){for(var ee=B[H],Y=0;Y<F.length;Y++)if(g(ee,F[Y]))return null;var te=JSON.stringify(F,function(ue,k){var ve=pe(k);return ve==="symbol"?String(k):k});return new w("Invalid "+U+" `"+X+"` of value `"+String(ee)+"` "+("supplied to `"+J+"`, expected one of "+te+"."))}return v(L)}function _(F){function L(B,H,J,U,X){if(typeof F!="function")return new w("Property `"+X+"` of component `"+J+"` has invalid PropType notation inside objectOf.");var ee=B[H],Y=re(ee);if(Y!=="object")return new w("Invalid "+U+" `"+X+"` of type "+("`"+Y+"` supplied to `"+J+"`, expected an object."));for(var te in ee)if(r(ee,te)){var ne=F(ee,te,J,U,X+"."+te,n);if(ne instanceof Error)return ne}return null}return v(L)}function A(F){if(!Array.isArray(F))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var L=0;L<F.length;L++){var B=F[L];if(typeof B!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+de(B)+" at index "+L+"."),s}function H(J,U,X,ee,Y){for(var te=[],ne=0;ne<F.length;ne++){var ue=F[ne],k=ue(J,U,X,ee,Y,n);if(k==null)return null;k.data&&r(k.data,"expectedType")&&te.push(k.data.expectedType)}var ve=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new w("Invalid "+ee+" `"+Y+"` supplied to "+("`"+X+"`"+ve+"."))}return v(H)}function R(){function F(L,B,H,J,U){return $(L[B])?null:new w("Invalid "+J+" `"+U+"` supplied to "+("`"+H+"`, expected a ReactNode."))}return v(F)}function M(F,L,B,H,J){return new w((F||"React class")+": "+L+" type `"+B+"."+H+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+J+"`.")}function j(F){function L(B,H,J,U,X){var ee=B[H],Y=re(ee);if(Y!=="object")return new w("Invalid "+U+" `"+X+"` of type `"+Y+"` "+("supplied to `"+J+"`, expected `object`."));for(var te in F){var ne=F[te];if(typeof ne!="function")return M(J,U,X,te,pe(ne));var ue=ne(ee,te,J,U,X+"."+te,n);if(ue)return ue}return null}return v(L)}function K(F){function L(B,H,J,U,X){var ee=B[H],Y=re(ee);if(Y!=="object")return new w("Invalid "+U+" `"+X+"` of type `"+Y+"` "+("supplied to `"+J+"`, expected `object`."));var te=t({},B[H],F);for(var ne in te){var ue=F[ne];if(r(F,ne)&&typeof ue!="function")return M(J,U,X,ne,pe(ue));if(!ue)return new w("Invalid "+U+" `"+X+"` key `"+ne+"` supplied to `"+J+"`.\nBad object: "+JSON.stringify(B[H],null," ")+`
29
- Valid keys: `+JSON.stringify(Object.keys(F),null," "));var k=ue(ee,ne,J,U,X+"."+ne,n);if(k)return k}return null}return v(L)}function $(F){switch(typeof F){case"number":case"string":case"undefined":return!0;case"boolean":return!F;case"object":if(Array.isArray(F))return F.every($);if(F===null||a(F))return!0;var L=l(F);if(L){var B=L.call(F),H;if(L!==F.entries){for(;!(H=B.next()).done;)if(!$(H.value))return!1}else for(;!(H=B.next()).done;){var J=H.value;if(J&&!$(J[1]))return!1}}else return!1;return!0;default:return!1}}function ce(F,L){return F==="symbol"?!0:L?L["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&L instanceof Symbol:!1}function re(F){var L=typeof F;return Array.isArray(F)?"array":F instanceof RegExp?"object":ce(L,F)?"symbol":L}function pe(F){if(typeof F>"u"||F===null)return""+F;var L=re(F);if(L==="object"){if(F instanceof Date)return"date";if(F instanceof RegExp)return"regexp"}return L}function de(F){var L=pe(F);switch(L){case"array":case"object":return"an "+L;case"boolean":case"date":case"regexp":return"a "+L;default:return L}}function be(F){return!F.constructor||!F.constructor.name?p:F.constructor.name}return m.checkPropTypes=o,m.resetWarningCache=o.resetWarningCache,m.PropTypes=m,m},vs}var ws,su;function PI(){if(su)return ws;su=1;var e=Fa();function t(){}function n(){}return n.resetWarningCache=t,ws=function(){function r(s,a,c,f,d,l){if(l!==e){var p=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 p.name="Invariant Violation",p}}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},ws}if(process.env.NODE_ENV!=="production"){var FI=Pd(),DI=!0;Ys.exports=RI()(FI.isElement,DI)}else Ys.exports=PI()();var MI=Ys.exports;const W=Uo(MI);var Zs={exports:{}},Ne={};/**
28
+ */var as,Bc;function Jb(){if(Bc)return as;Bc=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 u=Object.getOwnPropertyNames(s).map(function(l){return s[l]});if(u.join("")!=="0123456789")return!1;var f={};return"abcdefghijklmnopqrst".split("").forEach(function(l){f[l]=l}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return as=o()?Object.assign:function(i,s){for(var a,u=r(i),f,l=1;l<arguments.length;l++){a=Object(arguments[l]);for(var d in a)t.call(a,d)&&(u[d]=a[d]);if(e){f=e(a);for(var h=0;h<f.length;h++)n.call(a,f[h])&&(u[f[h]]=a[f[h]])}}return u},as}var cs,Jc;function xa(){if(Jc)return cs;Jc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return cs=e,cs}var us,Hc;function yd(){return Hc||(Hc=1,us=Function.call.bind(Object.prototype.hasOwnProperty)),us}var ls,Wc;function Hb(){if(Wc)return ls;Wc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=xa(),n={},r=yd();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function o(i,s,a,u,f){if(process.env.NODE_ENV!=="production"){for(var l in i)if(r(i,l)){var d;try{if(typeof i[l]!="function"){var h=Error((u||"React class")+": "+a+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}d=i[l](s,l,u,a,null,t)}catch(v){d=v}if(d&&!(d instanceof Error)&&e((u||"React class")+": type specification of "+a+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in n)){n[d.message]=!0;var m=f?f():"";e("Failed "+a+" type: "+d.message+(m??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ls=o,ls}var ds,zc;function Wb(){if(zc)return ds;zc=1;var e=gd(),t=Jb(),n=xa(),r=yd(),o=Hb(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(a){var u="Warning: "+a;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}});function s(){return null}return ds=function(a,u){var f=typeof Symbol=="function"&&Symbol.iterator,l="@@iterator";function d(P){var $=P&&(f&&P[f]||P[l]);if(typeof $=="function")return $}var h="<<anonymous>>",m={array:O("array"),bigint:O("bigint"),bool:O("boolean"),func:O("function"),number:O("number"),object:O("object"),string:O("string"),symbol:O("symbol"),any:p(),arrayOf:y,element:I(),elementType:x(),instanceOf:N,node:R(),objectOf:_,oneOf:A,oneOfType:F,shape:K,exact:j};function v(P,$){return P===$?P!==0||1/P===1/$:P!==P&&$!==$}function w(P,$){this.message=P,this.data=$&&typeof $=="object"?$:{},this.stack=""}w.prototype=Error.prototype;function g(P){if(process.env.NODE_ENV!=="production")var $={},H=0;function q(V,G,Z,Y,ee,ne,ce){if(Y=Y||h,ne=ne||Z,ce!==n){if(u){var k=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw k.name="Invariant Violation",k}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=Y+":"+Z;!$[ve]&&H<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ne+"` prop on `"+Y+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),$[ve]=!0,H++)}}return G[Z]==null?V?G[Z]===null?new w("The "+ee+" `"+ne+"` is marked as required "+("in `"+Y+"`, but its value is `null`.")):new w("The "+ee+" `"+ne+"` is marked as required in "+("`"+Y+"`, but its value is `undefined`.")):null:P(G,Z,Y,ee,ne)}var U=q.bind(null,!1);return U.isRequired=q.bind(null,!0),U}function O(P){function $(H,q,U,V,G,Z){var Y=H[q],ee=re(Y);if(ee!==P){var ne=ge(Y);return new w("Invalid "+V+" `"+G+"` of type "+("`"+ne+"` supplied to `"+U+"`, expected ")+("`"+P+"`."),{expectedType:P})}return null}return g($)}function p(){return g(s)}function y(P){function $(H,q,U,V,G){if(typeof P!="function")return new w("Property `"+G+"` of component `"+U+"` has invalid PropType notation inside arrayOf.");var Z=H[q];if(!Array.isArray(Z)){var Y=re(Z);return new w("Invalid "+V+" `"+G+"` of type "+("`"+Y+"` supplied to `"+U+"`, expected an array."))}for(var ee=0;ee<Z.length;ee++){var ne=P(Z,ee,U,V,G+"["+ee+"]",n);if(ne instanceof Error)return ne}return null}return g($)}function I(){function P($,H,q,U,V){var G=$[H];if(!a(G)){var Z=re(G);return new w("Invalid "+U+" `"+V+"` of type "+("`"+Z+"` supplied to `"+q+"`, expected a single ReactElement."))}return null}return g(P)}function x(){function P($,H,q,U,V){var G=$[H];if(!e.isValidElementType(G)){var Z=re(G);return new w("Invalid "+U+" `"+V+"` of type "+("`"+Z+"` supplied to `"+q+"`, expected a single ReactElement type."))}return null}return g(P)}function N(P){function $(H,q,U,V,G){if(!(H[q]instanceof P)){var Z=P.name||h,Y=be(H[q]);return new w("Invalid "+V+" `"+G+"` of type "+("`"+Y+"` supplied to `"+U+"`, expected ")+("instance of `"+Z+"`."))}return null}return g($)}function A(P){if(!Array.isArray(P))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 $(H,q,U,V,G){for(var Z=H[q],Y=0;Y<P.length;Y++)if(v(Z,P[Y]))return null;var ee=JSON.stringify(P,function(ce,k){var ve=ge(k);return ve==="symbol"?String(k):k});return new w("Invalid "+V+" `"+G+"` of value `"+String(Z)+"` "+("supplied to `"+U+"`, expected one of "+ee+"."))}return g($)}function _(P){function $(H,q,U,V,G){if(typeof P!="function")return new w("Property `"+G+"` of component `"+U+"` has invalid PropType notation inside objectOf.");var Z=H[q],Y=re(Z);if(Y!=="object")return new w("Invalid "+V+" `"+G+"` of type "+("`"+Y+"` supplied to `"+U+"`, expected an object."));for(var ee in Z)if(r(Z,ee)){var ne=P(Z,ee,U,V,G+"."+ee,n);if(ne instanceof Error)return ne}return null}return g($)}function F(P){if(!Array.isArray(P))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var $=0;$<P.length;$++){var H=P[$];if(typeof H!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+de(H)+" at index "+$+"."),s}function q(U,V,G,Z,Y){for(var ee=[],ne=0;ne<P.length;ne++){var ce=P[ne],k=ce(U,V,G,Z,Y,n);if(k==null)return null;k.data&&r(k.data,"expectedType")&&ee.push(k.data.expectedType)}var ve=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new w("Invalid "+Z+" `"+Y+"` supplied to "+("`"+G+"`"+ve+"."))}return g(q)}function R(){function P($,H,q,U,V){return L($[H])?null:new w("Invalid "+U+" `"+V+"` supplied to "+("`"+q+"`, expected a ReactNode."))}return g(P)}function D(P,$,H,q,U){return new w((P||"React class")+": "+$+" type `"+H+"."+q+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+U+"`.")}function K(P){function $(H,q,U,V,G){var Z=H[q],Y=re(Z);if(Y!=="object")return new w("Invalid "+V+" `"+G+"` of type `"+Y+"` "+("supplied to `"+U+"`, expected `object`."));for(var ee in P){var ne=P[ee];if(typeof ne!="function")return D(U,V,G,ee,ge(ne));var ce=ne(Z,ee,U,V,G+"."+ee,n);if(ce)return ce}return null}return g($)}function j(P){function $(H,q,U,V,G){var Z=H[q],Y=re(Z);if(Y!=="object")return new w("Invalid "+V+" `"+G+"` of type `"+Y+"` "+("supplied to `"+U+"`, expected `object`."));var ee=t({},H[q],P);for(var ne in ee){var ce=P[ne];if(r(P,ne)&&typeof ce!="function")return D(U,V,G,ne,ge(ce));if(!ce)return new w("Invalid "+V+" `"+G+"` key `"+ne+"` supplied to `"+U+"`.\nBad object: "+JSON.stringify(H[q],null," ")+`
29
+ Valid keys: `+JSON.stringify(Object.keys(P),null," "));var k=ce(Z,ne,U,V,G+"."+ne,n);if(k)return k}return null}return g($)}function L(P){switch(typeof P){case"number":case"string":case"undefined":return!0;case"boolean":return!P;case"object":if(Array.isArray(P))return P.every(L);if(P===null||a(P))return!0;var $=d(P);if($){var H=$.call(P),q;if($!==P.entries){for(;!(q=H.next()).done;)if(!L(q.value))return!1}else for(;!(q=H.next()).done;){var U=q.value;if(U&&!L(U[1]))return!1}}else return!1;return!0;default:return!1}}function se(P,$){return P==="symbol"?!0:$?$["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&$ instanceof Symbol:!1}function re(P){var $=typeof P;return Array.isArray(P)?"array":P instanceof RegExp?"object":se($,P)?"symbol":$}function ge(P){if(typeof P>"u"||P===null)return""+P;var $=re(P);if($==="object"){if(P instanceof Date)return"date";if(P instanceof RegExp)return"regexp"}return $}function de(P){var $=ge(P);switch($){case"array":case"object":return"an "+$;case"boolean":case"date":case"regexp":return"a "+$;default:return $}}function be(P){return!P.constructor||!P.constructor.name?h:P.constructor.name}return m.checkPropTypes=o,m.resetWarningCache=o.resetWarningCache,m.PropTypes=m,m},ds}var fs,Qc;function zb(){if(Qc)return fs;Qc=1;var e=xa();function t(){}function n(){}return n.resetWarningCache=t,fs=function(){function r(s,a,u,f,l,d){if(d!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function 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},fs}if(process.env.NODE_ENV!=="production"){var Qb=gd(),Gb=!0;Js.exports=Wb()(Qb.isElement,Gb)}else Js.exports=zb()();var Xb=Js.exports;const W=Mo(Xb);var Hs={exports:{}},Ne={};/**
30
30
  * @license React
31
31
  * react-is.production.min.js
32
32
  *
@@ -34,7 +34,7 @@ Valid keys: `+JSON.stringify(Object.keys(F),null," "));var k=ue(ee,ne,J,U,X+"."
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 au;function kI(){if(au)return Ne;au=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),l=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g;g=Symbol.for("react.module.reference");function w(v){if(typeof v=="object"&&v!==null){var x=v.$$typeof;switch(x){case e:switch(v=v.type,v){case n:case o:case r:case f:case d:return v;default:switch(v=v&&v.$$typeof,v){case a:case s:case c:case p:case l:case i:return v;default:return x}}case t:return x}}}return Ne.ContextConsumer=s,Ne.ContextProvider=i,Ne.Element=e,Ne.ForwardRef=c,Ne.Fragment=n,Ne.Lazy=p,Ne.Memo=l,Ne.Portal=t,Ne.Profiler=o,Ne.StrictMode=r,Ne.Suspense=f,Ne.SuspenseList=d,Ne.isAsyncMode=function(){return!1},Ne.isConcurrentMode=function(){return!1},Ne.isContextConsumer=function(v){return w(v)===s},Ne.isContextProvider=function(v){return w(v)===i},Ne.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===e},Ne.isForwardRef=function(v){return w(v)===c},Ne.isFragment=function(v){return w(v)===n},Ne.isLazy=function(v){return w(v)===p},Ne.isMemo=function(v){return w(v)===l},Ne.isPortal=function(v){return w(v)===t},Ne.isProfiler=function(v){return w(v)===o},Ne.isStrictMode=function(v){return w(v)===r},Ne.isSuspense=function(v){return w(v)===f},Ne.isSuspenseList=function(v){return w(v)===d},Ne.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===n||v===o||v===r||v===f||v===d||v===m||typeof v=="object"&&v!==null&&(v.$$typeof===p||v.$$typeof===l||v.$$typeof===i||v.$$typeof===s||v.$$typeof===c||v.$$typeof===g||v.getModuleId!==void 0)},Ne.typeOf=w,Ne}var Te={};/**
37
+ */var Gc;function Yb(){if(Gc)return Ne;Gc=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"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),v;v=Symbol.for("react.module.reference");function w(g){if(typeof g=="object"&&g!==null){var O=g.$$typeof;switch(O){case e:switch(g=g.type,g){case n:case o:case r:case f:case l:return g;default:switch(g=g&&g.$$typeof,g){case a:case s:case u:case h:case d:case i:return g;default:return O}}case t:return O}}}return Ne.ContextConsumer=s,Ne.ContextProvider=i,Ne.Element=e,Ne.ForwardRef=u,Ne.Fragment=n,Ne.Lazy=h,Ne.Memo=d,Ne.Portal=t,Ne.Profiler=o,Ne.StrictMode=r,Ne.Suspense=f,Ne.SuspenseList=l,Ne.isAsyncMode=function(){return!1},Ne.isConcurrentMode=function(){return!1},Ne.isContextConsumer=function(g){return w(g)===s},Ne.isContextProvider=function(g){return w(g)===i},Ne.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},Ne.isForwardRef=function(g){return w(g)===u},Ne.isFragment=function(g){return w(g)===n},Ne.isLazy=function(g){return w(g)===h},Ne.isMemo=function(g){return w(g)===d},Ne.isPortal=function(g){return w(g)===t},Ne.isProfiler=function(g){return w(g)===o},Ne.isStrictMode=function(g){return w(g)===r},Ne.isSuspense=function(g){return w(g)===f},Ne.isSuspenseList=function(g){return w(g)===l},Ne.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===o||g===r||g===f||g===l||g===m||typeof g=="object"&&g!==null&&(g.$$typeof===h||g.$$typeof===d||g.$$typeof===i||g.$$typeof===s||g.$$typeof===u||g.$$typeof===v||g.getModuleId!==void 0)},Ne.typeOf=w,Ne}var Te={};/**
38
38
  * @license React
39
39
  * react-is.development.js
40
40
  *
@@ -42,11 +42,11 @@ Valid keys: `+JSON.stringify(Object.keys(F),null," "));var k=ue(ee,ne,J,U,X+"."
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 cu;function jI(){return cu||(cu=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),l=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g=!1,w=!1,v=!1,x=!1,h=!1,y;y=Symbol.for("react.module.reference");function I(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===o||h||z===r||z===f||z===d||x||z===m||g||w||v||typeof z=="object"&&z!==null&&(z.$$typeof===p||z.$$typeof===l||z.$$typeof===i||z.$$typeof===s||z.$$typeof===c||z.$$typeof===y||z.getModuleId!==void 0))}function S(z){if(typeof z=="object"&&z!==null){var Ye=z.$$typeof;switch(Ye){case e:var Ce=z.type;switch(Ce){case n:case o:case r:case f:case d:return Ce;default:var lt=Ce&&Ce.$$typeof;switch(lt){case a:case s:case c:case p:case l:case i:return lt;default:return Ye}}case t:return Ye}}}var E=s,P=i,_=e,A=c,R=n,M=p,j=l,K=t,$=o,ce=r,re=f,pe=d,de=!1,be=!1;function F(z){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function L(z){return be||(be=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function B(z){return S(z)===s}function H(z){return S(z)===i}function J(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function U(z){return S(z)===c}function X(z){return S(z)===n}function ee(z){return S(z)===p}function Y(z){return S(z)===l}function te(z){return S(z)===t}function ne(z){return S(z)===o}function ue(z){return S(z)===r}function k(z){return S(z)===f}function ve(z){return S(z)===d}Te.ContextConsumer=E,Te.ContextProvider=P,Te.Element=_,Te.ForwardRef=A,Te.Fragment=R,Te.Lazy=M,Te.Memo=j,Te.Portal=K,Te.Profiler=$,Te.StrictMode=ce,Te.Suspense=re,Te.SuspenseList=pe,Te.isAsyncMode=F,Te.isConcurrentMode=L,Te.isContextConsumer=B,Te.isContextProvider=H,Te.isElement=J,Te.isForwardRef=U,Te.isFragment=X,Te.isLazy=ee,Te.isMemo=Y,Te.isPortal=te,Te.isProfiler=ne,Te.isStrictMode=ue,Te.isSuspense=k,Te.isSuspenseList=ve,Te.isValidElementType=I,Te.typeOf=S}()),Te}process.env.NODE_ENV==="production"?Zs.exports=kI():Zs.exports=jI();var uu=Zs.exports;const lu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,du=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",bs=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return du(n.overflowY,t)||du(n.overflowX,t)||(r=>{const o=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!o&&(o.clientHeight<r.scrollHeight||o.clientWidth<r.scrollWidth)})(e)}return!1},ao=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,LI=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},KI=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{inline:s,boundary:a,skipOverflowHiddenElements:c}=t,f=typeof a=="function"?a:K=>K!==a;if(!lu(e))throw new TypeError("Invalid target");const d=document.scrollingElement||document.documentElement,l=[];let p=e;for(;lu(p)&&f(p);){if(p=LI(p),p===d){l.push(p);break}p!=null&&p===document.body&&bs(p)&&!bs(document.documentElement)||p!=null&&bs(p,c)&&l.push(p)}const m=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,g=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:w,scrollY:v}=window,{height:x,width:h,top:y,right:I,bottom:S,left:E}=e.getBoundingClientRect(),{top:P,right:_,left:A}=(K=>{const $=window.getComputedStyle(K);return{top:parseFloat($.scrollMarginTop)||0,right:parseFloat($.scrollMarginRight)||0,bottom:parseFloat($.scrollMarginBottom)||0,left:parseFloat($.scrollMarginLeft)||0}})(e);let R=y-P,M=s==="center"?E+h/2-A+_:s==="end"?I+_:E-A;const j=[];for(let K=0;K<l.length;K++){const $=l[K],{height:ce,width:re,top:pe,right:de,bottom:be,left:F}=$.getBoundingClientRect();if(y>=0&&E>=0&&S<=g&&I<=m&&y>=pe&&S<=be&&E>=F&&I<=de)return j;const L=getComputedStyle($),B=parseInt(L.borderLeftWidth,10),H=parseInt(L.borderTopWidth,10),J=parseInt(L.borderRightWidth,10),U=parseInt(L.borderBottomWidth,10);let X=0,ee=0;const Y="offsetWidth"in $?$.offsetWidth-$.clientWidth-B-J:0,te="offsetHeight"in $?$.offsetHeight-$.clientHeight-H-U:0,ne="offsetWidth"in $?$.offsetWidth===0?0:re/$.offsetWidth:0,ue="offsetHeight"in $?$.offsetHeight===0?0:ce/$.offsetHeight:0;if(d===$)X=ao(v,v+g,g,H,U,v+R,v+R+x,x),ee=s==="start"?M:s==="center"?M-m/2:s==="end"?M-m:ao(w,w+m,m,B,J,w+M,w+M+h,h),X=Math.max(0,X+v),ee=Math.max(0,ee+w);else{X=ao(pe,be,ce,H,U+te,R,R+x,x),ee=s==="start"?M-F-B:s==="center"?M-(F+re/2)+Y/2:s==="end"?M-de+J+Y:ao(F,de,re,B,J+Y,M,M+h,h);const{scrollLeft:k,scrollTop:ve}=$;X=ue===0?0:Math.max(0,Math.min(ve+X/ue,$.scrollHeight-ce/ue+te)),ee=ne===0?0:Math.max(0,Math.min(k+ee/ne,$.scrollWidth-re/ne+Y)),R+=ve-X,M+=k-ee}j.push({el:$,top:X,left:ee})}return j};var ti=function(){return ti=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},ti.apply(this,arguments)};var $I=0;function fu(e){return typeof e=="function"?e:At}function At(){}function Dd(e,t){if(e){var n=KI(e,{boundary:t});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function pu(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Da(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return o.cancel=r,o}function Qe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(i)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function Mr(){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 Md(){return String($I++)}function UI(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 hu(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function kd(e){return typeof e.type=="string"}function jd(e){return e.props}function VI(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var qI=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function co(e){e===void 0&&(e={});var t={};return qI.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function To(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=Ao(t,r)?t[r]:e[r],n},{})}function Ao(e,t){return e[t]!==void 0}function ea(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function BI(e){return Object.prototype.toString.call(e)==="[object Object]"}function pr(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=ni(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function ni(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?ni(t?i-1:0,t,n,r):-1}function Ro(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(pu(o,e,n)||r&&pu(o,n.document.activeElement,n))})}var Ma=At;process.env.NODE_ENV!=="production"&&(Ma=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 HI=Da(function(e){Ld(e).textContent=""},500);function Ld(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 Kd(e,t){if(!(!e||!t)){var n=Ld(t);n.textContent=e,HI(t)}}function JI(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var $d=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Ud=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Vd=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,mo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,go=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,qd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Bd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Hd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Jd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Wd=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,zd=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Gd=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Qd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,ta=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Xd=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Yd=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Zd=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,WI=Object.freeze({__proto__:null,blurButton:Xd,blurInput:zd,changeInput:Gd,clickButton:ta,clickItem:Wd,controlledPropUpdatedSelectedItem:Yd,itemMouseEnter:Vd,keyDownArrowDown:go,keyDownArrowUp:mo,keyDownEnd:Jd,keyDownEnter:Bd,keyDownEscape:qd,keyDownHome:Hd,keyDownSpaceButton:Qd,mouseUp:Ud,touchEnd:Zd,unknown:$d}),zI=["refKey","ref"],GI=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],QI=["onKeyDown","onBlur","onChange","onInput","onChangeText"],XI=["refKey","ref"],YI=["onMouseMove","onMouseDown","onClick","onPress","index","item"],ZI=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+Md(),i.menuId=i.props.menuId||i.id+"-menu",i.labelId=i.props.labelId||i.id+"-label",i.inputId=i.props.inputId||i.id+"-input",i.getItemId=i.props.getItemId||function(h){return i.id+"-item-"+h},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(h,y){var I=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(S){return S!==I}),h()},y);i.timeoutIds.push(I)},i.setItemCount=function(h){i.itemCount=h},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(h,y){var I=i.getItemNodeFromIndex(y);return I&&I.hasAttribute("disabled")},i.setHighlightedIndex=function(h,y){h===void 0&&(h=i.props.defaultHighlightedIndex),y===void 0&&(y={}),y=co(y),i.internalSetState(ye({highlightedIndex:h},y))},i.clearSelection=function(h){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},h)},i.selectItem=function(h,y,I){y=co(y),i.internalSetState(ye({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:h,inputValue:i.props.itemToString(h)},y),I)},i.selectItemAtIndex=function(h,y,I){var S=i.items[h];S!=null&&i.selectItem(S,y,I)},i.selectHighlightedItem=function(h,y){return i.selectItemAtIndex(i.getState().highlightedIndex,h,y)},i.internalSetState=function(h,y){var I,S,E={},P=typeof h=="function";return!P&&h.hasOwnProperty("inputValue")&&i.props.onInputValueChange(h.inputValue,ye({},i.getStateAndHelpers(),h)),i.setState(function(_){var A;_=i.getState(_);var R=P?h(_):h;R=i.props.stateReducer(_,R),I=R.hasOwnProperty("selectedItem");var M={};return I&&R.selectedItem!==_.selectedItem&&(S=R.selectedItem),(A=R).type||(A.type=$d),Object.keys(R).forEach(function(j){_[j]!==R[j]&&(E[j]=R[j]),j!=="type"&&(R[j],Ao(i.props,j)||(M[j]=R[j]))}),P&&R.hasOwnProperty("inputValue")&&i.props.onInputValueChange(R.inputValue,ye({},i.getStateAndHelpers(),R)),M},function(){fu(y)();var _=Object.keys(E).length>1;_&&i.props.onStateChange(E,i.getStateAndHelpers()),I&&i.props.onSelect(h.selectedItem,i.getStateAndHelpers()),S!==void 0&&i.props.onChange(S,i.getStateAndHelpers()),i.props.onUserAction(E,i.getStateAndHelpers())})},i.rootRef=function(h){return i._rootNode=h},i.getRootProps=function(h,y){var I,S=h===void 0?{}:h,E=S.refKey,P=E===void 0?"ref":E,_=S.ref,A=xn(S,zI),R=y===void 0?{}:y,M=R.suppressRefError,j=M===void 0?!1:M;i.getRootProps.called=!0,i.getRootProps.refKey=P,i.getRootProps.suppressRefError=j;var K=i.getState(),$=K.isOpen;return ye((I={},I[P]=Mr(_,i.rootRef),I.role="combobox",I["aria-expanded"]=$,I["aria-haspopup"]="listbox",I["aria-owns"]=$?i.menuId:void 0,I["aria-labelledby"]=i.labelId,I),A)},i.keyDownHandlers={ArrowDown:function(y){var I=this;if(y.preventDefault(),this.getState().isOpen){var S=y.shiftKey?5:1;this.moveHighlightedIndex(S,{type:go})}else this.internalSetState({isOpen:!0,type:go},function(){var E=I.getItemCount();if(E>0){var P=I.getState(),_=P.highlightedIndex,A=pr(_,1,{length:E},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:go})}})},ArrowUp:function(y){var I=this;if(y.preventDefault(),this.getState().isOpen){var S=y.shiftKey?-5:-1;this.moveHighlightedIndex(S,{type:mo})}else this.internalSetState({isOpen:!0,type:mo},function(){var E=I.getItemCount();if(E>0){var P=I.getState(),_=P.highlightedIndex,A=pr(_,-1,{length:E},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:mo})}})},Enter:function(y){if(y.which!==229){var I=this.getState(),S=I.isOpen,E=I.highlightedIndex;if(S&&E!=null){y.preventDefault();var P=this.items[E],_=this.getItemNodeFromIndex(E);if(P==null||_&&_.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Bd})}}},Escape:function(y){y.preventDefault(),this.reset(ye({type:qd},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=ye({},i.keyDownHandlers,{" ":function(y){y.preventDefault(),this.toggleMenu({type:Qd})}}),i.inputKeyDownHandlers=ye({},i.keyDownHandlers,{Home:function(y){var I=this.getState(),S=I.isOpen;if(S){y.preventDefault();var E=this.getItemCount();if(!(E<=0||!S)){var P=ni(0,!1,{length:E},this.isItemDisabled);this.setHighlightedIndex(P,{type:Hd})}}},End:function(y){var I=this.getState(),S=I.isOpen;if(S){y.preventDefault();var E=this.getItemCount();if(!(E<=0||!S)){var P=ni(E-1,!0,{length:E},this.isItemDisabled);this.setHighlightedIndex(P,{type:Jd})}}}}),i.getToggleButtonProps=function(h){var y=h===void 0?{}:h,I=y.onClick;y.onPress;var S=y.onKeyDown,E=y.onKeyUp,P=y.onBlur,_=xn(y,GI),A=i.getState(),R=A.isOpen,M={onClick:Qe(I,i.buttonHandleClick),onKeyDown:Qe(S,i.buttonHandleKeyDown),onKeyUp:Qe(E,i.buttonHandleKeyUp),onBlur:Qe(P,i.buttonHandleBlur)},j=_.disabled?{}:M;return ye({type:"button",role:"button","aria-label":R?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},j,_)},i.buttonHandleKeyUp=function(h){h.preventDefault()},i.buttonHandleKeyDown=function(h){var y=ea(h);i.buttonKeyDownHandlers[y]&&i.buttonKeyDownHandlers[y].call(i,h)},i.buttonHandleClick=function(h){if(h.preventDefault(),i.props.environment){var y=i.props.environment.document,I=y.body,S=y.activeElement;I&&I===S&&h.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:ta}):i.internalSetTimeout(function(){return i.toggleMenu({type:ta})})},i.buttonHandleBlur=function(h){var y=h.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var I=i.props.environment.document.activeElement;(I==null||I.id!==i.inputId)&&I!==y&&i.reset({type:Xd})}})},i.getLabelProps=function(h){return ye({htmlFor:i.inputId,id:i.labelId},h)},i.getInputProps=function(h){var y=h===void 0?{}:h,I=y.onKeyDown,S=y.onBlur,E=y.onChange,P=y.onInput;y.onChangeText;var _=xn(y,QI),A,R={};A="onChange";var M=i.getState(),j=M.inputValue,K=M.isOpen,$=M.highlightedIndex;if(!_.disabled){var ce;R=(ce={},ce[A]=Qe(E,P,i.inputHandleChange),ce.onKeyDown=Qe(I,i.inputHandleKeyDown),ce.onBlur=Qe(S,i.inputHandleBlur),ce)}return ye({"aria-autocomplete":"list","aria-activedescendant":K&&typeof $=="number"&&$>=0?i.getItemId($):void 0,"aria-controls":K?i.menuId:void 0,"aria-labelledby":_&&_["aria-label"]?void 0:i.labelId,autoComplete:"off",value:j,id:i.inputId},R,_)},i.inputHandleKeyDown=function(h){var y=ea(h);y&&i.inputKeyDownHandlers[y]&&i.inputKeyDownHandlers[y].call(i,h)},i.inputHandleChange=function(h){i.internalSetState({type:Gd,isOpen:!0,inputValue:h.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var h;if(!(i.isMouseDown||!i.props.environment)){var y=i.props.environment.document.activeElement,I=(y==null||(h=y.dataset)==null?void 0:h.toggle)&&i._rootNode&&i._rootNode.contains(y);I||i.reset({type:zd})}})},i.menuRef=function(h){i._menuNode=h},i.getMenuProps=function(h,y){var I,S=h===void 0?{}:h,E=S.refKey,P=E===void 0?"ref":E,_=S.ref,A=xn(S,XI),R=y===void 0?{}:y,M=R.suppressRefError,j=M===void 0?!1:M;return i.getMenuProps.called=!0,i.getMenuProps.refKey=P,i.getMenuProps.suppressRefError=j,ye((I={},I[P]=Mr(_,i.menuRef),I.role="listbox",I["aria-labelledby"]=A&&A["aria-label"]?void 0:i.labelId,I.id=i.menuId,I),A)},i.getItemProps=function(h){var y,I=h===void 0?{}:h,S=I.onMouseMove,E=I.onMouseDown,P=I.onClick;I.onPress;var _=I.index,A=I.item,R=A===void 0?process.env.NODE_ENV==="production"?void 0:VI("getItemProps","item"):A,M=xn(I,YI);_===void 0?(i.items.push(R),_=i.items.indexOf(R)):i.items[_]=R;var j="onClick",K=P,$=(y={onMouseMove:Qe(S,function(){_!==i.getState().highlightedIndex&&(i.setHighlightedIndex(_,{type:Vd}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:Qe(E,function(re){re.preventDefault()})},y[j]=Qe(K,function(){i.selectItemAtIndex(_,{type:Wd})}),y),ce=M.disabled?{onMouseDown:$.onMouseDown}:$;return ye({id:i.getItemId(_),role:"option","aria-selected":i.getState().highlightedIndex===_},ce,M)},i.clearItems=function(){i.items=[]},i.reset=function(h,y){h===void 0&&(h={}),h=co(h),i.internalSetState(function(I){var S=I.selectedItem;return ye({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(S)},h)},y)},i.toggleMenu=function(h,y){h===void 0&&(h={}),h=co(h),i.internalSetState(function(I){var S=I.isOpen;return ye({isOpen:!S},S&&{highlightedIndex:i.props.defaultHighlightedIndex},h)},function(){var I=i.getState(),S=I.isOpen,E=I.highlightedIndex;S&&i.getItemCount()>0&&typeof E=="number"&&i.setHighlightedIndex(E,h),fu(y)()})},i.openMenu=function(h){i.internalSetState({isOpen:!0},h)},i.closeMenu=function(h){i.internalSetState({isOpen:!1},h)},i.updateStatus=Da(function(){var h;if((h=i.props)!=null&&(h=h.environment)!=null&&h.document){var y=i.getState(),I=i.items[y.highlightedIndex],S=i.getItemCount(),E=i.props.getA11yStatusMessage(ye({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:S,highlightedItem:I},y));i.previousResultCount=S,Kd(E,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,f=c===void 0?a:c,d=s.defaultIsOpen,l=s.initialIsOpen,p=l===void 0?d:l,m=s.initialInputValue,g=m===void 0?"":m,w=s.initialSelectedItem,v=w===void 0?null:w,x=i.getState({highlightedIndex:f,isOpen:p,inputValue:g,selectedItem:v});return x.selectedItem!=null&&i.props.initialInputValue===void 0&&(x.inputValue=i.props.itemToString(x.selectedItem)),i.state=x,i}EI(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(i){clearTimeout(i)}),this.timeoutIds=[]},r.getState=function(i){return i===void 0&&(i=this.state),To(i,this.props)},r.getItemCount=function(){var i=this.items.length;return this.itemCount!=null?i=this.itemCount:this.props.itemCount!==void 0&&(i=this.props.itemCount),i},r.getItemNodeFromIndex=function(i){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(i)):null},r.scrollHighlightedItemIntoView=function(){{var i=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(i,this._menuNode)}},r.moveHighlightedIndex=function(i,s){var a=this.getItemCount(),c=this.getState(),f=c.highlightedIndex;if(a>0){var d=pr(f,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,f=i.isOpen,d=this.props.itemToString,l=this.id,p=this.getRootProps,m=this.getToggleButtonProps,g=this.getLabelProps,w=this.getMenuProps,v=this.getInputProps,x=this.getItemProps,h=this.openMenu,y=this.closeMenu,I=this.toggleMenu,S=this.selectItem,E=this.selectItemAtIndex,P=this.selectHighlightedItem,_=this.setHighlightedIndex,A=this.clearSelection,R=this.clearItems,M=this.reset,j=this.setItemCount,K=this.unsetItemCount,$=this.internalSetState;return{getRootProps:p,getToggleButtonProps:m,getLabelProps:g,getMenuProps:w,getInputProps:v,getItemProps:x,reset:M,openMenu:h,closeMenu:y,toggleMenu:I,selectItem:S,selectItemAtIndex:E,selectHighlightedItem:P,setHighlightedIndex:_,clearSelection:A,clearItems:R,setItemCount:j,unsetItemCount:K,setState:$,itemToString:d,id:l,highlightedIndex:s,inputValue:a,isOpen:f,selectedItem:c}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&mu(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 g=Ro(m.target,[i._rootNode,i._menuNode],i.props.environment);!g&&i.getState().isOpen&&i.reset({type:Ud},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},f=function(){i.isTouchMove=!0},d=function(m){var g=Ro(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!g&&i.getState().isOpen&&i.reset({type:Zd},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},l=this.props.environment;l.addEventListener("mousedown",s),l.addEventListener("mouseup",a),l.addEventListener("touchstart",c),l.addEventListener("touchmove",f),l.addEventListener("touchend",d),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),l.removeEventListener("mousedown",s),l.removeEventListener("mouseup",a),l.removeEventListener("touchstart",c),l.removeEventListener("touchmove",f),l.removeEventListener("touchend",d)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,f=s.highlightedIndex===void 0?i:s,d=f.highlightedIndex,l=c&&this.getState().isOpen&&!i.isOpen,p=c!==d;return l||p},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(Ma(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&mu(this._menuNode,this.getMenuProps)),Ao(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Yd,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=hu(this.props.children,At);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=hu(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&&eC(s,this.getRootProps),s;if(kd(s))return b.cloneElement(s,this.getRootProps(jd(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(b.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:UI,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&BI(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:At,onInputValueChange:At,onUserAction:At,onChange:At,onSelect:At,onOuterClick:At,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Dd},e.stateChangeTypes=WI,e}();process.env.NODE_ENV!=="production"&&(ZI.propTypes={children:W.func,defaultHighlightedIndex:W.number,defaultIsOpen:W.bool,initialHighlightedIndex:W.number,initialSelectedItem:W.any,initialInputValue:W.string,initialIsOpen:W.bool,getA11yStatusMessage:W.func,itemToString:W.func,onChange:W.func,onSelect:W.func,onStateChange:W.func,onInputValueChange:W.func,onUserAction:W.func,onOuterClick:W.func,selectedItemChanged:W.func,stateReducer:W.func,itemCount:W.number,id:W.string,environment:W.shape({addEventListener:W.func.isRequired,removeEventListener:W.func.isRequired,document:W.shape({createElement:W.func.isRequired,getElementById:W.func.isRequired,activeElement:W.any.isRequired,body:W.any.isRequired}).isRequired,Node:W.func.isRequired}),suppressRefError:W.bool,scrollIntoView:W.func,selectedItem:W.any,isOpen:W.bool,inputValue:W.string,highlightedIndex:W.number,labelId:W.string,inputId:W.string,menuId:W.string,getItemId:W.func});function mu(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 eC(e,t){var n=t.refKey,r=n!=="ref",o=!kd(e);o&&!r&&!uu.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+'"'),!uu.isForwardRef(e)&&!jd(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var ef={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function tC(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){nC(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(ye({type:o},i))}function nC(e,t,n,r){var o=t.props,i=t.type,s="on"+ka(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](ye({type:i},r))}function rC(e,t){return t.changes}var gu=Da(function(e,t){Kd(e,t)},200),iC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?b.useLayoutEffect:b.useEffect,oC="useId"in b?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+b.useId();n||(n=c);var f=b.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(d){return n+"-item-"+d},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return f.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+Md():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,f=b.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return f.current};function sC(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 ka(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function tf(e){var t=b.useRef(e);return t.current=e,t}function aC(e,t,n,r){var o=b.useRef(),i=b.useRef(),s=b.useCallback(function(m,g){i.current=g,m=To(m,g.props);var w=e(m,g),v=g.props.stateReducer(m,ye({},g,{changes:w}));return v},[e]),a=b.useReducer(s,t,n),c=a[0],f=a[1],d=tf(t),l=b.useCallback(function(m){return f(ye({props:d.current},m))},[d]),p=i.current;return b.useEffect(function(){var m=To(o.current,p==null?void 0:p.props),g=p&&o.current&&!r(m,c);g&&tC(p,m,c),o.current=c},[c,p,r]),[c,l]}var Ci={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:rC,scrollIntoView:Dd,environment:typeof window>"u"?void 0:window};function Qn(e,t,n){n===void 0&&(n=ef);var r=e["default"+ka(t)];return r!==void 0?r:n[t]}function Si(e,t,n){n===void 0&&(n=ef);var r=e[t];if(r!==void 0)return r;var o=e["initial"+ka(t)];return o!==void 0?o:Qn(e,t,n)}function cC(e){var t=Si(e,"selectedItem"),n=Si(e,"isOpen"),r=pC(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 xi(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,f=t.highlightedIndex;return r.length===0?-1:o!==void 0&&f===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:c?r.findIndex(function(d){return a(c)===a(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function uC(e,t,n){var r=b.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return b.useEffect(function(){if(!e)return At;var o=n.map(function(d){return d.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,Ro(d.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function f(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!Ro(d.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",f),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",f)}},[n,e,t]),r.current}var nf=function(){return At};process.env.NODE_ENV!=="production"&&(nf=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=b.useRef(n.reduce(function(s,a){return s[a]={},s},{}));b.useEffect(function(){Object.keys(o.current).forEach(function(s){var a=o.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var c=a.suppressRefError,f=a.refKey,d=a.elementRef;c||d!=null&&d.current||console.error('downshift: The ref prop "'+f+'" from '+s+" was not applied correctly on your element.")})},[]);var i=b.useCallback(function(s,a,c,f){o.current[s]={suppressRefError:a,refKey:c,elementRef:f}},[]);return i});function lC(e,t,n,r){r===void 0&&(r={});var o=r.document,i=Wo();b.useEffect(function(){if(!(!e||i||!o)){var s=e(t);gu(s,o)}},n),b.useEffect(function(){return function(){gu.cancel(),JI(o)}},[o])}function dC(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=b.useRef(!0);return iC(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var rf=At;process.env.NODE_ENV!=="production"&&(rf=function(t){var n=t.props,r=t.state,o=b.useRef(n),i=Wo();b.useEffect(function(){i||(Ma(r,o.current,n),o.current=n)},[r,n,i])});function yu(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return ye({isOpen:!1,highlightedIndex:-1},o&&ye({selectedItem:e.items[t],isOpen:Qn(e,"isOpen"),highlightedIndex:Qn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function fC(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Wo(){var e=b.useRef(!0);return b.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function na(e){var t=Qn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function pC(e){var t=Si(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var yo={environment:W.shape({addEventListener:W.func.isRequired,removeEventListener:W.func.isRequired,document:W.shape({createElement:W.func.isRequired,getElementById:W.func.isRequired,activeElement:W.any.isRequired,body:W.any.isRequired}).isRequired,Node:W.func.isRequired}),itemToString:W.func,itemToKey:W.func,stateReducer:W.func},of=ye({},yo,{getA11yStatusMessage:W.func,highlightedIndex:W.number,defaultHighlightedIndex:W.number,initialHighlightedIndex:W.number,isOpen:W.bool,defaultIsOpen:W.bool,initialIsOpen:W.bool,selectedItem:W.any,initialSelectedItem:W.any,defaultSelectedItem:W.any,id:W.string,labelId:W.string,menuId:W.string,getItemId:W.func,toggleButtonId:W.string,onSelectedItemChange:W.func,onHighlightedIndexChange:W.func,onStateChange:W.func,onIsOpenChange:W.func,scrollIntoView:W.func});function hC(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:xi(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:xi(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:na(o),isOpen:Qn(o,"isOpen"),selectedItem:Qn(o,"selectedItem"),inputValue:Qn(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return ye({},e,i)}ti(ti({},of),{items:W.array.isRequired,isItemDisabled:W.func});ti(ti({},Ci),{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 ja=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,La=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ka=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,$a=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Ua=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Va=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,qa=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Ba=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Ha=process.env.NODE_ENV!=="production"?"__input_change__":8,Po=process.env.NODE_ENV!=="production"?"__input_blur__":9,Ja=process.env.NODE_ENV!=="production"?"__input_click__":10,sf=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,af=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,Wa=process.env.NODE_ENV!=="production"?"__item_click__":13,cf=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,uf=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,lf=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,df=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,ff=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,za=process.env.NODE_ENV!=="production"?"__function_select_item__":19,pf=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,hf=process.env.NODE_ENV!=="production"?"__function_reset__":21,Ga=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,mf=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:Ga,FunctionCloseMenu:df,FunctionOpenMenu:lf,FunctionReset:hf,FunctionSelectItem:za,FunctionSetHighlightedIndex:ff,FunctionSetInputValue:pf,FunctionToggleMenu:uf,InputBlur:Po,InputChange:Ha,InputClick:Ja,InputKeyDownArrowDown:ja,InputKeyDownArrowUp:La,InputKeyDownEnd:Ua,InputKeyDownEnter:Ba,InputKeyDownEscape:Ka,InputKeyDownHome:$a,InputKeyDownPageDown:qa,InputKeyDownPageUp:Va,ItemClick:Wa,ItemMouseMove:af,MenuMouseLeave:sf,ToggleButtonClick:cf});function mC(e){var t=cC(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),ye({},t,{inputValue:r})}var gC=ye({},of,{items:W.array.isRequired,isItemDisabled:W.func,inputValue:W.string,defaultInputValue:W.string,initialInputValue:W.string,inputId:W.string,onInputValueChange:W.func});function yC(e,t,n,r){var o=b.useRef(),i=aC(e,t,n,r),s=i[0],a=i[1],c=Wo();return b.useEffect(function(){if(Ao(t,"selectedItem")){if(!c){var f=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);f&&a({type:Ga,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[To(s,t),a]}var gf=At;process.env.NODE_ENV!=="production"&&(gf=function(t,n){W.checkPropTypes(gC,t,"prop",n.name)});var vC=ye({},Ci,{isItemDisabled:function(){return!1}});function wC(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case Wa:s={isOpen:Qn(o,"isOpen"),highlightedIndex:na(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case ja:e.isOpen?s={highlightedIndex:pr(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:xi(o,e,1),isOpen:o.items.length>=0};break;case La:e.isOpen?i?s=yu(o,e.highlightedIndex):s={highlightedIndex:pr(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:xi(o,e,-1),isOpen:o.items.length>=0};break;case Ba:s=yu(o,e.highlightedIndex);break;case Ka:s=ye({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Va:s={highlightedIndex:pr(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case qa:s={highlightedIndex:pr(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case $a:s={highlightedIndex:ni(0,!1,o.items,o.isItemDisabled)};break;case Ua:s={highlightedIndex:ni(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case Po:s=ye({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=o.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case Ha:s={isOpen:!0,highlightedIndex:na(o),inputValue:t.inputValue};break;case Ja:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:xi(o,e,0)};break;case za:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case Ga:s={inputValue:t.inputValue};break;default:return hC(e,t,mf)}return ye({},e,s)}var bC=["onMouseLeave","refKey","ref"],IC=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],CC=["onClick","onPress","refKey","ref"],SC=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Qa.stateChangeTypes=mf;function Qa(e){e===void 0&&(e={}),gf(e,Qa);var t=ye({},vC,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=yC(wC,t,mC,fC),a=s[0],c=s[1],f=a.isOpen,d=a.highlightedIndex,l=a.selectedItem,p=a.inputValue,m=b.useRef(null),g=b.useRef({}),w=b.useRef(null),v=b.useRef(null),x=Wo(),h=oC(t),y=b.useRef(),I=tf({state:a,props:t}),S=b.useCallback(function(B){return g.current[h.getItemId(B)]},[h]);lC(i,a,[f,d,l,p],o);var E=dC({menuElement:m.current,highlightedIndex:d,isOpen:f,itemRefs:g,scrollIntoView:r,getItemNodeFromIndex:S});rf({props:t,state:a}),b.useEffect(function(){var B=Si(t,"isOpen");B&&w.current&&w.current.focus()},[]),b.useEffect(function(){x||(y.current=n.length)});var P=uC(o,b.useCallback(function(){I.current.state.isOpen&&c({type:Po,selectItem:!1})},[c,I]),b.useMemo(function(){return[m,v,w]},[m.current,v.current,w.current])),_=nf("getInputProps","getMenuProps");b.useEffect(function(){f||(g.current={})},[f]),b.useEffect(function(){var B;!f||!(o!=null&&o.document)||!(w!=null&&(B=w.current)!=null&&B.focus)||o.document.activeElement!==w.current&&w.current.focus()},[f,o]);var A=b.useMemo(function(){return{ArrowDown:function(H){H.preventDefault(),c({type:ja,altKey:H.altKey})},ArrowUp:function(H){H.preventDefault(),c({type:La,altKey:H.altKey})},Home:function(H){I.current.state.isOpen&&(H.preventDefault(),c({type:$a}))},End:function(H){I.current.state.isOpen&&(H.preventDefault(),c({type:Ua}))},Escape:function(H){var J=I.current.state;(J.isOpen||J.inputValue||J.selectedItem||J.highlightedIndex>-1)&&(H.preventDefault(),c({type:Ka}))},Enter:function(H){var J=I.current.state;!J.isOpen||H.which===229||(H.preventDefault(),c({type:Ba}))},PageUp:function(H){I.current.state.isOpen&&(H.preventDefault(),c({type:Va}))},PageDown:function(H){I.current.state.isOpen&&(H.preventDefault(),c({type:qa}))}}},[c,I]),R=b.useCallback(function(B){return ye({id:h.labelId,htmlFor:h.inputId},B)},[h]),M=b.useCallback(function(B,H){var J,U=B===void 0?{}:B,X=U.onMouseLeave,ee=U.refKey,Y=ee===void 0?"ref":ee,te=U.ref,ne=xn(U,bC),ue=H===void 0?{}:H,k=ue.suppressRefError,ve=k===void 0?!1:k;return _("getMenuProps",ve,Y,m),ye((J={},J[Y]=Mr(te,function(z){m.current=z}),J.id=h.menuId,J.role="listbox",J["aria-labelledby"]=ne&&ne["aria-label"]?void 0:""+h.labelId,J.onMouseLeave=Qe(X,function(){c({type:sf})}),J),ne)},[c,_,h]),j=b.useCallback(function(B){var H,J,U=B===void 0?{}:B,X=U.item,ee=U.index,Y=U.refKey,te=Y===void 0?"ref":Y,ne=U.ref,ue=U.onMouseMove,k=U.onMouseDown,ve=U.onClick;U.onPress;var z=U.disabled,Ye=xn(U,IC);z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ce=I.current,lt=Ce.props,Be=Ce.state,ot=sC(X,ee,lt.items,"Pass either item or index to getItemProps!"),Se=ot[0],Ge=ot[1],ht=lt.isItemDisabled(Se,Ge),wt="onClick",bt=ve,Ze=function(){P.isTouchEnd||Ge===Be.highlightedIndex||(E.current=!1,c({type:af,index:Ge,disabled:ht}))},et=function(){c({type:Wa,index:Ge})},De=function(he){return he.preventDefault()};return ye((H={},H[te]=Mr(ne,function(q){q&&(g.current[h.getItemId(Ge)]=q)}),H["aria-disabled"]=ht,H["aria-selected"]=Ge===Be.highlightedIndex,H.id=h.getItemId(Ge),H.role="option",H),!ht&&(J={},J[wt]=Qe(bt,et),J),{onMouseMove:Qe(ue,Ze),onMouseDown:Qe(k,De)},Ye)},[c,h,I,P,E]),K=b.useCallback(function(B){var H,J=B===void 0?{}:B,U=J.onClick;J.onPress;var X=J.refKey,ee=X===void 0?"ref":X,Y=J.ref,te=xn(J,CC),ne=I.current.state,ue=function(){c({type:cf})};return ye((H={},H[ee]=Mr(Y,function(k){v.current=k}),H["aria-controls"]=h.menuId,H["aria-expanded"]=ne.isOpen,H.id=h.toggleButtonId,H.tabIndex=-1,H),!te.disabled&&ye({},{onClick:Qe(U,ue)}),te)},[c,I,h]),$=b.useCallback(function(B,H){var J,U=B===void 0?{}:B,X=U.onKeyDown,ee=U.onChange,Y=U.onInput,te=U.onBlur;U.onChangeText;var ne=U.onClick,ue=U.refKey,k=ue===void 0?"ref":ue,ve=U.ref,z=xn(U,SC),Ye=H===void 0?{}:H,Ce=Ye.suppressRefError,lt=Ce===void 0?!1:Ce;_("getInputProps",lt,k,w);var Be=I.current.state,ot=function(De){var q=ea(De);q&&A[q]&&A[q](De)},Se=function(De){c({type:Ha,inputValue:De.target.value})},Ge=function(De){if(o!=null&&o.document&&Be.isOpen&&!P.isMouseDown){var q=De.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:Po,selectItem:!q})}},ht=function(){c({type:Ja})},wt="onChange",bt={};if(!z.disabled){var Ze;bt=(Ze={},Ze[wt]=Qe(ee,Y,Se),Ze.onKeyDown=Qe(X,ot),Ze.onBlur=Qe(te,Ge),Ze.onClick=Qe(ne,ht),Ze)}return ye((J={},J[k]=Mr(ve,function(et){w.current=et}),J["aria-activedescendant"]=Be.isOpen&&Be.highlightedIndex>-1?h.getItemId(Be.highlightedIndex):"",J["aria-autocomplete"]="list",J["aria-controls"]=h.menuId,J["aria-expanded"]=Be.isOpen,J["aria-labelledby"]=z&&z["aria-label"]?void 0:h.labelId,J.autoComplete="off",J.id=h.inputId,J.role="combobox",J.value=Be.inputValue,J),bt,z)},[c,h,o,A,I,P,_]),ce=b.useCallback(function(){c({type:uf})},[c]),re=b.useCallback(function(){c({type:df})},[c]),pe=b.useCallback(function(){c({type:lf})},[c]),de=b.useCallback(function(B){c({type:ff,highlightedIndex:B})},[c]),be=b.useCallback(function(B){c({type:za,selectedItem:B})},[c]),F=b.useCallback(function(B){c({type:pf,inputValue:B})},[c]),L=b.useCallback(function(){c({type:hf})},[c]);return{getItemProps:j,getLabelProps:R,getMenuProps:M,getInputProps:$,getToggleButtonProps:K,toggleMenu:ce,openMenu:pe,closeMenu:re,setHighlightedIndex:de,setInputValue:F,selectItem:be,reset:L,highlightedIndex:d,isOpen:f,selectedItem:l,inputValue:p}}yo.stateReducer,yo.itemToKey,yo.environment,W.array,W.array,W.array,W.func,W.number,W.number,W.number,W.func,W.func,W.string,W.string;Ci.itemToKey,Ci.stateReducer,Ci.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 xC="_comboboxContainer_1lcc8_1",OC="_inputContainer_1lcc8_12",EC="_input_1lcc8_12",_C="_toggleButton_1lcc8_33",NC="_menu_1lcc8_39",TC="_menuBottom_1lcc8_55",AC="_menuTop_1lcc8_61",RC="_menuItem_1lcc8_66",PC="_highlighted_1lcc8_73",FC="_selected_1lcc8_77",DC="_hidden_1lcc8_81",Bt={comboboxContainer:xC,inputContainer:OC,input:EC,toggleButton:_C,menu:NC,menuBottom:TC,menuTop:AC,menuItem:RC,highlighted:PC,selected:FC,hidden:DC};function MC(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function yf({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,c]=b.useState(e),f=b.useRef(null);b.useEffect(()=>c(e),[e]);const d=b.useCallback(E=>{(E==null?void 0:E.length)>0?c(e.filter(MC(E))):c(e)},[e]),{isOpen:l,getToggleButtonProps:p,getMenuProps:m,getInputProps:g,highlightedIndex:w,getItemProps:v,setInputValue:x}=Qa({items:a,selectedItem:t?e.find(E=>E.value===t):null,itemToString:E=>(E==null?void 0:E.label)||"",onInputValueChange:({inputValue:E})=>d(E),onSelectedItemChange:({selectedItem:E})=>{var P;n(E),(P=f.current)==null||P.blur()}}),h=()=>{x(""),c(e)},y=()=>h(),I=b.useMemo(()=>{var E;return(E=e.find(P=>P.value===t))==null?void 0:E.label},[e,t]),S=()=>{x(t&&I?I:"")};return u.jsxs("div",{style:{position:"relative",...i},children:[u.jsx("div",{className:Bt.comboboxContainer,children:u.jsxs("div",{className:Bt.inputContainer,children:[u.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:Bt.input,...g({onFocus:y,onBlur:S,ref:f})}),u.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:Bt.toggleButton,type:"button",...p(),children:l?u.jsx(u.Fragment,{children:"↑"}):u.jsx(u.Fragment,{children:"↓"})})]})}),u.jsx("ul",{className:`${Bt.menu} ${l&&e.length?"":Bt.hidden} ${s==="top"?Bt.menuTop:Bt.menuBottom}`,...m(),children:l&&a.map((E,P)=>u.jsx("li",{className:`${Bt.menuItem} ${w===P?Bt.highlighted:""} ${t===(E==null?void 0:E.value)?Bt.selected:""}`,...v({item:E,index:P}),children:u.jsx("span",{children:E.label})},E.id))})]})}const ri=Math.min,Cr=Math.max,Fo=Math.round,uo=Math.floor,Yn=e=>({x:e,y:e}),kC={left:"right",right:"left",bottom:"top",top:"bottom"},jC={start:"end",end:"start"};function ra(e,t,n){return Cr(e,ri(t,n))}function $i(e,t){return typeof e=="function"?e(t):e}function Nr(e){return e.split("-")[0]}function Ui(e){return e.split("-")[1]}function vf(e){return e==="x"?"y":"x"}function Xa(e){return e==="y"?"height":"width"}function ii(e){return["top","bottom"].includes(Nr(e))?"y":"x"}function Ya(e){return vf(ii(e))}function LC(e,t,n){n===void 0&&(n=!1);const r=Ui(e),o=Ya(e),i=Xa(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Do(s)),[s,Do(s)]}function KC(e){const t=Do(e);return[ia(e),t,ia(t)]}function ia(e){return e.replace(/start|end/g,t=>jC[t])}function $C(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 UC(e,t,n,r){const o=Ui(e);let i=$C(Nr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(ia)))),i}function Do(e){return e.replace(/left|right|bottom|top/g,t=>kC[t])}function VC(e){return{top:0,right:0,bottom:0,left:0,...e}}function wf(e){return typeof e!="number"?VC(e):{top:e,right:e,bottom:e,left:e}}function Mo(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 vu(e,t,n){let{reference:r,floating:o}=e;const i=ii(t),s=Ya(t),a=Xa(s),c=Nr(t),f=i==="y",d=r.x+r.width/2-o.width/2,l=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let m;switch(c){case"top":m={x:d,y:r.y-o.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:l};break;case"left":m={x:r.x-o.width,y:l};break;default:m={x:r.x,y:r.y}}switch(Ui(t)){case"start":m[s]-=p*(n&&f?-1:1);break;case"end":m[s]+=p*(n&&f?-1:1);break}return m}const qC=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let f=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:l}=vu(f,r,c),p=r,m={},g=0;for(let w=0;w<a.length;w++){const{name:v,fn:x}=a[w],{x:h,y,data:I,reset:S}=await x({x:d,y:l,initialPlacement:r,placement:p,strategy:o,middlewareData:m,rects:f,platform:s,elements:{reference:e,floating:t}});d=h??d,l=y??l,m={...m,[v]:{...m[v],...I}},S&&g<=50&&(g++,typeof S=="object"&&(S.placement&&(p=S.placement),S.rects&&(f=S.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:d,y:l}=vu(f,p,c)),w=-1)}return{x:d,y:l,placement:p,strategy:o,middlewareData:m}};async function bf(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:f="clippingAncestors",rootBoundary:d="viewport",elementContext:l="floating",altBoundary:p=!1,padding:m=0}=$i(t,e),g=wf(m),v=a[p?l==="floating"?"reference":"floating":l],x=Mo(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:f,rootBoundary:d,strategy:c})),h=l==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),I=await(i.isElement==null?void 0:i.isElement(y))?await(i.getScale==null?void 0:i.getScale(y))||{x:1,y:1}:{x:1,y:1},S=Mo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:h,offsetParent:y,strategy:c}):h);return{top:(x.top-S.top+g.top)/I.y,bottom:(S.bottom-x.bottom+g.bottom)/I.y,left:(x.left-S.left+g.left)/I.x,right:(S.right-x.right+g.right)/I.x}}const BC=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:c}=t,{element:f,padding:d=0}=$i(e,t)||{};if(f==null)return{};const l=wf(d),p={x:n,y:r},m=Ya(o),g=Xa(m),w=await s.getDimensions(f),v=m==="y",x=v?"top":"left",h=v?"bottom":"right",y=v?"clientHeight":"clientWidth",I=i.reference[g]+i.reference[m]-p[m]-i.floating[g],S=p[m]-i.reference[m],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let P=E?E[y]:0;(!P||!await(s.isElement==null?void 0:s.isElement(E)))&&(P=a.floating[y]||i.floating[g]);const _=I/2-S/2,A=P/2-w[g]/2-1,R=ri(l[x],A),M=ri(l[h],A),j=R,K=P-w[g]-M,$=P/2-w[g]/2+_,ce=ra(j,$,K),re=!c.arrow&&Ui(o)!=null&&$!==ce&&i.reference[g]/2-($<j?R:M)-w[g]/2<0,pe=re?$<j?$-j:$-K:0;return{[m]:p[m]+pe,data:{[m]:ce,centerOffset:$-ce-pe,...re&&{alignmentOffset:pe}},reset:re}}}),HC=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:f}=t,{mainAxis:d=!0,crossAxis:l=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:w=!0,...v}=$i(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=Nr(o),h=ii(a),y=Nr(a)===a,I=await(c.isRTL==null?void 0:c.isRTL(f.floating)),S=p||(y||!w?[Do(a)]:KC(a)),E=g!=="none";!p&&E&&S.push(...UC(a,w,g,I));const P=[a,...S],_=await bf(t,v),A=[];let R=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&A.push(_[x]),l){const $=LC(o,s,I);A.push(_[$[0]],_[$[1]])}if(R=[...R,{placement:o,overflows:A}],!A.every($=>$<=0)){var M,j;const $=(((M=i.flip)==null?void 0:M.index)||0)+1,ce=P[$];if(ce)return{data:{index:$,overflows:R},reset:{placement:ce}};let re=(j=R.filter(pe=>pe.overflows[0]<=0).sort((pe,de)=>pe.overflows[1]-de.overflows[1])[0])==null?void 0:j.placement;if(!re)switch(m){case"bestFit":{var K;const pe=(K=R.filter(de=>{if(E){const be=ii(de.placement);return be===h||be==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(be=>be>0).reduce((be,F)=>be+F,0)]).sort((de,be)=>de[1]-be[1])[0])==null?void 0:K[0];pe&&(re=pe);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}};async function JC(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Nr(n),a=Ui(n),c=ii(n)==="y",f=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,l=$i(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:g}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return a&&typeof g=="number"&&(m=a==="end"?g*-1:g),c?{x:m*d,y:p*f}:{x:p*f,y:m*d}}const WC=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 JC(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}}}}},zC=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:v=>{let{x,y:h}=v;return{x,y:h}}},...c}=$i(e,t),f={x:n,y:r},d=await bf(t,c),l=ii(Nr(o)),p=vf(l);let m=f[p],g=f[l];if(i){const v=p==="y"?"top":"left",x=p==="y"?"bottom":"right",h=m+d[v],y=m-d[x];m=ra(h,m,y)}if(s){const v=l==="y"?"top":"left",x=l==="y"?"bottom":"right",h=g+d[v],y=g-d[x];g=ra(h,g,y)}const w=a.fn({...t,[p]:m,[l]:g});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[p]:i,[l]:s}}}}}};function zo(){return typeof window<"u"}function pi(e){return If(e)?(e.nodeName||"").toLowerCase():"#document"}function Rt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dn(e){var t;return(t=(If(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function If(e){return zo()?e instanceof Node||e instanceof Rt(e).Node:!1}function Qt(e){return zo()?e instanceof Element||e instanceof Rt(e).Element:!1}function cn(e){return zo()?e instanceof HTMLElement||e instanceof Rt(e).HTMLElement:!1}function wu(e){return!zo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Rt(e).ShadowRoot}function Vi(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Xt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function GC(e){return["table","td","th"].includes(pi(e))}function Go(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Za(e){const t=ec(),n=Qt(e)?Xt(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 QC(e){let t=Zn(e);for(;cn(t)&&!oi(t);){if(Za(t))return t;if(Go(t))return null;t=Zn(t)}return null}function ec(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function oi(e){return["html","body","#document"].includes(pi(e))}function Xt(e){return Rt(e).getComputedStyle(e)}function Qo(e){return Qt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zn(e){if(pi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||wu(e)&&e.host||dn(e);return wu(t)?t.host:t}function Cf(e){const t=Zn(e);return oi(t)?e.ownerDocument?e.ownerDocument.body:e.body:cn(t)&&Vi(t)?t:Cf(t)}function Ai(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Cf(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Rt(o);if(i){const a=oa(s);return t.concat(s,s.visualViewport||[],Vi(o)?o:[],a&&n?Ai(a):[])}return t.concat(o,Ai(o,[],n))}function oa(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Sf(e){const t=Xt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=cn(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Fo(n)!==i||Fo(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function tc(e){return Qt(e)?e:e.contextElement}function jr(e){const t=tc(e);if(!cn(t))return Yn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Sf(t);let s=(i?Fo(n.width):n.width)/r,a=(i?Fo(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const XC=Yn(0);function xf(e){const t=Rt(e);return!ec()||!t.visualViewport?XC:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function YC(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Rt(e)?!1:t}function Tr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=tc(e);let s=Yn(1);t&&(r?Qt(r)&&(s=jr(r)):s=jr(e));const a=YC(i,n,r)?xf(i):Yn(0);let c=(o.left+a.x)/s.x,f=(o.top+a.y)/s.y,d=o.width/s.x,l=o.height/s.y;if(i){const p=Rt(i),m=r&&Qt(r)?Rt(r):r;let g=p,w=oa(g);for(;w&&r&&m!==g;){const v=jr(w),x=w.getBoundingClientRect(),h=Xt(w),y=x.left+(w.clientLeft+parseFloat(h.paddingLeft))*v.x,I=x.top+(w.clientTop+parseFloat(h.paddingTop))*v.y;c*=v.x,f*=v.y,d*=v.x,l*=v.y,c+=y,f+=I,g=Rt(w),w=oa(g)}}return Mo({width:d,height:l,x:c,y:f})}function ZC(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=dn(r),a=t?Go(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},f=Yn(1);const d=Yn(0),l=cn(r);if((l||!l&&!i)&&((pi(r)!=="body"||Vi(s))&&(c=Qo(r)),cn(r))){const p=Tr(r);f=jr(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+d.x,y:n.y*f.y-c.scrollTop*f.y+d.y}}function eS(e){return Array.from(e.getClientRects())}function sa(e,t){const n=Qo(e).scrollLeft;return t?t.left+n:Tr(dn(e)).left+n}function tS(e){const t=dn(e),n=Qo(e),r=e.ownerDocument.body,o=Cr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Cr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+sa(e);const a=-n.scrollTop;return Xt(r).direction==="rtl"&&(s+=Cr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function nS(e,t){const n=Rt(e),r=dn(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const f=ec();(!f||f&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function rS(e,t){const n=Tr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=cn(e)?jr(e):Yn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,f=r*i.y;return{width:s,height:a,x:c,y:f}}function bu(e,t,n){let r;if(t==="viewport")r=nS(e,n);else if(t==="document")r=tS(dn(e));else if(Qt(t))r=rS(t,n);else{const o=xf(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Mo(r)}function Of(e,t){const n=Zn(e);return n===t||!Qt(n)||oi(n)?!1:Xt(n).position==="fixed"||Of(n,t)}function iS(e,t){const n=t.get(e);if(n)return n;let r=Ai(e,[],!1).filter(a=>Qt(a)&&pi(a)!=="body"),o=null;const i=Xt(e).position==="fixed";let s=i?Zn(e):e;for(;Qt(s)&&!oi(s);){const a=Xt(s),c=Za(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Vi(s)&&!c&&Of(e,s))?r=r.filter(d=>d!==s):o=a,s=Zn(s)}return t.set(e,r),r}function oS(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Go(t)?[]:iS(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((f,d)=>{const l=bu(t,d,o);return f.top=Cr(l.top,f.top),f.right=ri(l.right,f.right),f.bottom=ri(l.bottom,f.bottom),f.left=Cr(l.left,f.left),f},bu(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function sS(e){const{width:t,height:n}=Sf(e);return{width:t,height:n}}function aS(e,t,n){const r=cn(t),o=dn(t),i=n==="fixed",s=Tr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Yn(0);if(r||!r&&!i)if((pi(t)!=="body"||Vi(o))&&(a=Qo(t)),r){const m=Tr(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&(c.x=sa(o));let f=0,d=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();d=m.top+a.scrollTop,f=m.left+a.scrollLeft-sa(o,m)}const l=s.left+a.scrollLeft-c.x-f,p=s.top+a.scrollTop-c.y-d;return{x:l,y:p,width:s.width,height:s.height}}function Is(e){return Xt(e).position==="static"}function Iu(e,t){if(!cn(e)||Xt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return dn(e)===n&&(n=n.ownerDocument.body),n}function Ef(e,t){const n=Rt(e);if(Go(e))return n;if(!cn(e)){let o=Zn(e);for(;o&&!oi(o);){if(Qt(o)&&!Is(o))return o;o=Zn(o)}return n}let r=Iu(e,t);for(;r&&GC(r)&&Is(r);)r=Iu(r,t);return r&&oi(r)&&Is(r)&&!Za(r)?n:r||QC(e)||n}const cS=async function(e){const t=this.getOffsetParent||Ef,n=this.getDimensions,r=await n(e.floating);return{reference:aS(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function uS(e){return Xt(e).direction==="rtl"}const lS={convertOffsetParentRelativeRectToViewportRelativeRect:ZC,getDocumentElement:dn,getClippingRect:oS,getOffsetParent:Ef,getElementRects:cS,getClientRects:eS,getDimensions:sS,getScale:jr,isElement:Qt,isRTL:uS};function dS(e,t){let n=null,r;const o=dn(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const{left:f,top:d,width:l,height:p}=e.getBoundingClientRect();if(a||t(),!l||!p)return;const m=uo(d),g=uo(o.clientWidth-(f+l)),w=uo(o.clientHeight-(d+p)),v=uo(f),h={rootMargin:-m+"px "+-g+"px "+-w+"px "+-v+"px",threshold:Cr(0,ri(1,c))||1};let y=!0;function I(S){const E=S[0].intersectionRatio;if(E!==c){if(!y)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{n=new IntersectionObserver(I,{...h,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,h)}n.observe(e)}return s(!0),i}function fS(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,f=tc(e),d=o||i?[...f?Ai(f):[],...Ai(t)]:[];d.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const l=f&&a?dS(f,n):null;let p=-1,m=null;s&&(m=new ResizeObserver(x=>{let[h]=x;h&&h.target===f&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var y;(y=m)==null||y.observe(t)})),n()}),f&&!c&&m.observe(f),m.observe(t));let g,w=c?Tr(e):null;c&&v();function v(){const x=Tr(e);w&&(x.x!==w.x||x.y!==w.y||x.width!==w.width||x.height!==w.height)&&n(),w=x,g=requestAnimationFrame(v)}return n(),()=>{var x;d.forEach(h=>{o&&h.removeEventListener("scroll",n),i&&h.removeEventListener("resize",n)}),l==null||l(),(x=m)==null||x.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const pS=WC,hS=zC,mS=HC,gS=BC,Cu=(e,t,n)=>{const r=new Map,o={platform:lS,...n},i={...o.platform,_c:r};return qC(e,t,{...o,platform:i})};/*
45
+ */var Xc;function Zb(){return Xc||(Xc=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),v=!1,w=!1,g=!1,O=!1,p=!1,y;y=Symbol.for("react.module.reference");function I(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===o||p||z===r||z===f||z===l||O||z===m||v||w||g||typeof z=="object"&&z!==null&&(z.$$typeof===h||z.$$typeof===d||z.$$typeof===i||z.$$typeof===s||z.$$typeof===u||z.$$typeof===y||z.getModuleId!==void 0))}function x(z){if(typeof z=="object"&&z!==null){var Xe=z.$$typeof;switch(Xe){case e:var Ce=z.type;switch(Ce){case n:case o:case r:case f:case l:return Ce;default:var ct=Ce&&Ce.$$typeof;switch(ct){case a:case s:case u:case h:case d:case i:return ct;default:return Xe}}case t:return Xe}}}var N=s,A=i,_=e,F=u,R=n,D=h,K=d,j=t,L=o,se=r,re=f,ge=l,de=!1,be=!1;function P(z){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function $(z){return be||(be=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function H(z){return x(z)===s}function q(z){return x(z)===i}function U(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function V(z){return x(z)===u}function G(z){return x(z)===n}function Z(z){return x(z)===h}function Y(z){return x(z)===d}function ee(z){return x(z)===t}function ne(z){return x(z)===o}function ce(z){return x(z)===r}function k(z){return x(z)===f}function ve(z){return x(z)===l}Te.ContextConsumer=N,Te.ContextProvider=A,Te.Element=_,Te.ForwardRef=F,Te.Fragment=R,Te.Lazy=D,Te.Memo=K,Te.Portal=j,Te.Profiler=L,Te.StrictMode=se,Te.Suspense=re,Te.SuspenseList=ge,Te.isAsyncMode=P,Te.isConcurrentMode=$,Te.isContextConsumer=H,Te.isContextProvider=q,Te.isElement=U,Te.isForwardRef=V,Te.isFragment=G,Te.isLazy=Z,Te.isMemo=Y,Te.isPortal=ee,Te.isProfiler=ne,Te.isStrictMode=ce,Te.isSuspense=k,Te.isSuspenseList=ve,Te.isValidElementType=I,Te.typeOf=x}()),Te}process.env.NODE_ENV==="production"?Hs.exports=Yb():Hs.exports=Zb();var Yc=Hs.exports;const Zc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,eu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",ps=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return eu(n.overflowY,t)||eu(n.overflowX,t)||(r=>{const o=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!o&&(o.clientHeight<r.scrollHeight||o.clientWidth<r.scrollWidth)})(e)}return!1},ro=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,eI=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},tI=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{inline:s,boundary:a,skipOverflowHiddenElements:u}=t,f=typeof a=="function"?a:j=>j!==a;if(!Zc(e))throw new TypeError("Invalid target");const l=document.scrollingElement||document.documentElement,d=[];let h=e;for(;Zc(h)&&f(h);){if(h=eI(h),h===l){d.push(h);break}h!=null&&h===document.body&&ps(h)&&!ps(document.documentElement)||h!=null&&ps(h,u)&&d.push(h)}const m=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,v=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:w,scrollY:g}=window,{height:O,width:p,top:y,right:I,bottom:x,left:N}=e.getBoundingClientRect(),{top:A,right:_,left:F}=(j=>{const L=window.getComputedStyle(j);return{top:parseFloat(L.scrollMarginTop)||0,right:parseFloat(L.scrollMarginRight)||0,bottom:parseFloat(L.scrollMarginBottom)||0,left:parseFloat(L.scrollMarginLeft)||0}})(e);let R=y-A,D=s==="center"?N+p/2-F+_:s==="end"?I+_:N-F;const K=[];for(let j=0;j<d.length;j++){const L=d[j],{height:se,width:re,top:ge,right:de,bottom:be,left:P}=L.getBoundingClientRect();if(y>=0&&N>=0&&x<=v&&I<=m&&y>=ge&&x<=be&&N>=P&&I<=de)return K;const $=getComputedStyle(L),H=parseInt($.borderLeftWidth,10),q=parseInt($.borderTopWidth,10),U=parseInt($.borderRightWidth,10),V=parseInt($.borderBottomWidth,10);let G=0,Z=0;const Y="offsetWidth"in L?L.offsetWidth-L.clientWidth-H-U:0,ee="offsetHeight"in L?L.offsetHeight-L.clientHeight-q-V:0,ne="offsetWidth"in L?L.offsetWidth===0?0:re/L.offsetWidth:0,ce="offsetHeight"in L?L.offsetHeight===0?0:se/L.offsetHeight:0;if(l===L)G=ro(g,g+v,v,q,V,g+R,g+R+O,O),Z=s==="start"?D:s==="center"?D-m/2:s==="end"?D-m:ro(w,w+m,m,H,U,w+D,w+D+p,p),G=Math.max(0,G+g),Z=Math.max(0,Z+w);else{G=ro(ge,be,se,q,V+ee,R,R+O,O),Z=s==="start"?D-P-H:s==="center"?D-(P+re/2)+Y/2:s==="end"?D-de+U+Y:ro(P,de,re,H,U+Y,D,D+p,p);const{scrollLeft:k,scrollTop:ve}=L;G=ce===0?0:Math.max(0,Math.min(ve+G/ce,L.scrollHeight-se/ce+ee)),Z=ne===0?0:Math.max(0,Math.min(k+Z/ne,L.scrollWidth-re/ne+Y)),R+=ve-G,D+=k-Z}K.push({el:L,top:G,left:Z})}return K};var Xr=function(){return Xr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Xr.apply(this,arguments)};var nI=0;function tu(e){return typeof e=="function"?e:Et}function Et(){}function vd(e,t){if(e){var n=tI(e,{boundary:t});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function nu(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Oa(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return o.cancel=r,o}function Qe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(i)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function Fr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(o){typeof o=="function"?o(r):o&&(o.current=r)})}}function wd(){return String(nI++)}function rI(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(n===1?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function ru(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function bd(e){return typeof e.type=="string"}function Id(e){return e.props}function iI(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var oI=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function io(e){e===void 0&&(e={});var t={};return oI.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function xo(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=Oo(t,r)?t[r]:e[r],n},{})}function Oo(e,t){return e[t]!==void 0}function Ws(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function sI(e){return Object.prototype.toString.call(e)==="[object Object]"}function lr(e,t,n,r,o){var i=n.length;if(i===0)return-1;var s=i-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var u=Yr(a,t<0,n,r,o);return u===-1?e>=i?-1:e:u}function Yr(e,t,n,r,o){o===void 0&&(o=!1);var i=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<i;a++)if(!r(n[a],a))return a;return o?Yr(t?i-1:0,t,n,r):-1}function So(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(nu(o,e,n)||r&&nu(o,n.document.activeElement,n))})}var Sa=Et;process.env.NODE_ENV!=="production"&&(Sa=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 aI=Oa(function(e){Cd(e).textContent=""},500);function Cd(e){var t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}function xd(e,t){if(!(!e||!t)){var n=Cd(t);n.textContent=e,aI(t)}}function cI(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Od=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Sd=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,_d=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,uo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,lo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Ed=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Nd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Td=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Rd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Ad=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Fd=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Pd=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Dd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,zs=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Md=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,kd=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,jd=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,uI=Object.freeze({__proto__:null,blurButton:Md,blurInput:Fd,changeInput:Pd,clickButton:zs,clickItem:Ad,controlledPropUpdatedSelectedItem:kd,itemMouseEnter:_d,keyDownArrowDown:lo,keyDownArrowUp:uo,keyDownEnd:Rd,keyDownEnter:Nd,keyDownEscape:Ed,keyDownHome:Td,keyDownSpaceButton:Dd,mouseUp:Sd,touchEnd:jd,unknown:Od}),lI=["refKey","ref"],dI=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],fI=["onKeyDown","onBlur","onChange","onInput","onChangeText"],pI=["refKey","ref"],hI=["onMouseMove","onMouseDown","onClick","onPress","index","item"],mI=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+wd(),i.menuId=i.props.menuId||i.id+"-menu",i.labelId=i.props.labelId||i.id+"-label",i.inputId=i.props.inputId||i.id+"-input",i.getItemId=i.props.getItemId||function(p){return i.id+"-item-"+p},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(p,y){var I=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(x){return x!==I}),p()},y);i.timeoutIds.push(I)},i.setItemCount=function(p){i.itemCount=p},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(p,y){var I=i.getItemNodeFromIndex(y);return I&&I.hasAttribute("disabled")},i.setHighlightedIndex=function(p,y){p===void 0&&(p=i.props.defaultHighlightedIndex),y===void 0&&(y={}),y=io(y),i.internalSetState(ye({highlightedIndex:p},y))},i.clearSelection=function(p){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},p)},i.selectItem=function(p,y,I){y=io(y),i.internalSetState(ye({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:p,inputValue:i.props.itemToString(p)},y),I)},i.selectItemAtIndex=function(p,y,I){var x=i.items[p];x!=null&&i.selectItem(x,y,I)},i.selectHighlightedItem=function(p,y){return i.selectItemAtIndex(i.getState().highlightedIndex,p,y)},i.internalSetState=function(p,y){var I,x,N={},A=typeof p=="function";return!A&&p.hasOwnProperty("inputValue")&&i.props.onInputValueChange(p.inputValue,ye({},i.getStateAndHelpers(),p)),i.setState(function(_){var F;_=i.getState(_);var R=A?p(_):p;R=i.props.stateReducer(_,R),I=R.hasOwnProperty("selectedItem");var D={};return I&&R.selectedItem!==_.selectedItem&&(x=R.selectedItem),(F=R).type||(F.type=Od),Object.keys(R).forEach(function(K){_[K]!==R[K]&&(N[K]=R[K]),K!=="type"&&(R[K],Oo(i.props,K)||(D[K]=R[K]))}),A&&R.hasOwnProperty("inputValue")&&i.props.onInputValueChange(R.inputValue,ye({},i.getStateAndHelpers(),R)),D},function(){tu(y)();var _=Object.keys(N).length>1;_&&i.props.onStateChange(N,i.getStateAndHelpers()),I&&i.props.onSelect(p.selectedItem,i.getStateAndHelpers()),x!==void 0&&i.props.onChange(x,i.getStateAndHelpers()),i.props.onUserAction(N,i.getStateAndHelpers())})},i.rootRef=function(p){return i._rootNode=p},i.getRootProps=function(p,y){var I,x=p===void 0?{}:p,N=x.refKey,A=N===void 0?"ref":N,_=x.ref,F=Cn(x,lI),R=y===void 0?{}:y,D=R.suppressRefError,K=D===void 0?!1:D;i.getRootProps.called=!0,i.getRootProps.refKey=A,i.getRootProps.suppressRefError=K;var j=i.getState(),L=j.isOpen;return ye((I={},I[A]=Fr(_,i.rootRef),I.role="combobox",I["aria-expanded"]=L,I["aria-haspopup"]="listbox",I["aria-owns"]=L?i.menuId:void 0,I["aria-labelledby"]=i.labelId,I),F)},i.keyDownHandlers={ArrowDown:function(y){var I=this;if(y.preventDefault(),this.getState().isOpen){var x=y.shiftKey?5:1;this.moveHighlightedIndex(x,{type:lo})}else this.internalSetState({isOpen:!0,type:lo},function(){var N=I.getItemCount();if(N>0){var A=I.getState(),_=A.highlightedIndex,F=lr(_,1,{length:N},I.isItemDisabled,!0);I.setHighlightedIndex(F,{type:lo})}})},ArrowUp:function(y){var I=this;if(y.preventDefault(),this.getState().isOpen){var x=y.shiftKey?-5:-1;this.moveHighlightedIndex(x,{type:uo})}else this.internalSetState({isOpen:!0,type:uo},function(){var N=I.getItemCount();if(N>0){var A=I.getState(),_=A.highlightedIndex,F=lr(_,-1,{length:N},I.isItemDisabled,!0);I.setHighlightedIndex(F,{type:uo})}})},Enter:function(y){if(y.which!==229){var I=this.getState(),x=I.isOpen,N=I.highlightedIndex;if(x&&N!=null){y.preventDefault();var A=this.items[N],_=this.getItemNodeFromIndex(N);if(A==null||_&&_.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Nd})}}},Escape:function(y){y.preventDefault(),this.reset(ye({type:Ed},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=ye({},i.keyDownHandlers,{" ":function(y){y.preventDefault(),this.toggleMenu({type:Dd})}}),i.inputKeyDownHandlers=ye({},i.keyDownHandlers,{Home:function(y){var I=this.getState(),x=I.isOpen;if(x){y.preventDefault();var N=this.getItemCount();if(!(N<=0||!x)){var A=Yr(0,!1,{length:N},this.isItemDisabled);this.setHighlightedIndex(A,{type:Td})}}},End:function(y){var I=this.getState(),x=I.isOpen;if(x){y.preventDefault();var N=this.getItemCount();if(!(N<=0||!x)){var A=Yr(N-1,!0,{length:N},this.isItemDisabled);this.setHighlightedIndex(A,{type:Rd})}}}}),i.getToggleButtonProps=function(p){var y=p===void 0?{}:p,I=y.onClick;y.onPress;var x=y.onKeyDown,N=y.onKeyUp,A=y.onBlur,_=Cn(y,dI),F=i.getState(),R=F.isOpen,D={onClick:Qe(I,i.buttonHandleClick),onKeyDown:Qe(x,i.buttonHandleKeyDown),onKeyUp:Qe(N,i.buttonHandleKeyUp),onBlur:Qe(A,i.buttonHandleBlur)},K=_.disabled?{}:D;return ye({type:"button",role:"button","aria-label":R?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},K,_)},i.buttonHandleKeyUp=function(p){p.preventDefault()},i.buttonHandleKeyDown=function(p){var y=Ws(p);i.buttonKeyDownHandlers[y]&&i.buttonKeyDownHandlers[y].call(i,p)},i.buttonHandleClick=function(p){if(p.preventDefault(),i.props.environment){var y=i.props.environment.document,I=y.body,x=y.activeElement;I&&I===x&&p.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:zs}):i.internalSetTimeout(function(){return i.toggleMenu({type:zs})})},i.buttonHandleBlur=function(p){var y=p.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var I=i.props.environment.document.activeElement;(I==null||I.id!==i.inputId)&&I!==y&&i.reset({type:Md})}})},i.getLabelProps=function(p){return ye({htmlFor:i.inputId,id:i.labelId},p)},i.getInputProps=function(p){var y=p===void 0?{}:p,I=y.onKeyDown,x=y.onBlur,N=y.onChange,A=y.onInput;y.onChangeText;var _=Cn(y,fI),F,R={};F="onChange";var D=i.getState(),K=D.inputValue,j=D.isOpen,L=D.highlightedIndex;if(!_.disabled){var se;R=(se={},se[F]=Qe(N,A,i.inputHandleChange),se.onKeyDown=Qe(I,i.inputHandleKeyDown),se.onBlur=Qe(x,i.inputHandleBlur),se)}return ye({"aria-autocomplete":"list","aria-activedescendant":j&&typeof L=="number"&&L>=0?i.getItemId(L):void 0,"aria-controls":j?i.menuId:void 0,"aria-labelledby":_&&_["aria-label"]?void 0:i.labelId,autoComplete:"off",value:K,id:i.inputId},R,_)},i.inputHandleKeyDown=function(p){var y=Ws(p);y&&i.inputKeyDownHandlers[y]&&i.inputKeyDownHandlers[y].call(i,p)},i.inputHandleChange=function(p){i.internalSetState({type:Pd,isOpen:!0,inputValue:p.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var p;if(!(i.isMouseDown||!i.props.environment)){var y=i.props.environment.document.activeElement,I=(y==null||(p=y.dataset)==null?void 0:p.toggle)&&i._rootNode&&i._rootNode.contains(y);I||i.reset({type:Fd})}})},i.menuRef=function(p){i._menuNode=p},i.getMenuProps=function(p,y){var I,x=p===void 0?{}:p,N=x.refKey,A=N===void 0?"ref":N,_=x.ref,F=Cn(x,pI),R=y===void 0?{}:y,D=R.suppressRefError,K=D===void 0?!1:D;return i.getMenuProps.called=!0,i.getMenuProps.refKey=A,i.getMenuProps.suppressRefError=K,ye((I={},I[A]=Fr(_,i.menuRef),I.role="listbox",I["aria-labelledby"]=F&&F["aria-label"]?void 0:i.labelId,I.id=i.menuId,I),F)},i.getItemProps=function(p){var y,I=p===void 0?{}:p,x=I.onMouseMove,N=I.onMouseDown,A=I.onClick;I.onPress;var _=I.index,F=I.item,R=F===void 0?process.env.NODE_ENV==="production"?void 0:iI("getItemProps","item"):F,D=Cn(I,hI);_===void 0?(i.items.push(R),_=i.items.indexOf(R)):i.items[_]=R;var K="onClick",j=A,L=(y={onMouseMove:Qe(x,function(){_!==i.getState().highlightedIndex&&(i.setHighlightedIndex(_,{type:_d}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:Qe(N,function(re){re.preventDefault()})},y[K]=Qe(j,function(){i.selectItemAtIndex(_,{type:Ad})}),y),se=D.disabled?{onMouseDown:L.onMouseDown}:L;return ye({id:i.getItemId(_),role:"option","aria-selected":i.getState().highlightedIndex===_},se,D)},i.clearItems=function(){i.items=[]},i.reset=function(p,y){p===void 0&&(p={}),p=io(p),i.internalSetState(function(I){var x=I.selectedItem;return ye({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(x)},p)},y)},i.toggleMenu=function(p,y){p===void 0&&(p={}),p=io(p),i.internalSetState(function(I){var x=I.isOpen;return ye({isOpen:!x},x&&{highlightedIndex:i.props.defaultHighlightedIndex},p)},function(){var I=i.getState(),x=I.isOpen,N=I.highlightedIndex;x&&i.getItemCount()>0&&typeof N=="number"&&i.setHighlightedIndex(N,p),tu(y)()})},i.openMenu=function(p){i.internalSetState({isOpen:!0},p)},i.closeMenu=function(p){i.internalSetState({isOpen:!1},p)},i.updateStatus=Oa(function(){var p;if((p=i.props)!=null&&(p=p.environment)!=null&&p.document){var y=i.getState(),I=i.items[y.highlightedIndex],x=i.getItemCount(),N=i.props.getA11yStatusMessage(ye({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:x,highlightedItem:I},y));i.previousResultCount=x,xd(N,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,u=s.initialHighlightedIndex,f=u===void 0?a:u,l=s.defaultIsOpen,d=s.initialIsOpen,h=d===void 0?l:d,m=s.initialInputValue,v=m===void 0?"":m,w=s.initialSelectedItem,g=w===void 0?null:w,O=i.getState({highlightedIndex:f,isOpen:h,inputValue:v,selectedItem:g});return O.selectedItem!=null&&i.props.initialInputValue===void 0&&(O.inputValue=i.props.itemToString(O.selectedItem)),i.state=O,i}qb(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(i){clearTimeout(i)}),this.timeoutIds=[]},r.getState=function(i){return i===void 0&&(i=this.state),xo(i,this.props)},r.getItemCount=function(){var i=this.items.length;return this.itemCount!=null?i=this.itemCount:this.props.itemCount!==void 0&&(i=this.props.itemCount),i},r.getItemNodeFromIndex=function(i){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(i)):null},r.scrollHighlightedItemIntoView=function(){{var i=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(i,this._menuNode)}},r.moveHighlightedIndex=function(i,s){var a=this.getItemCount(),u=this.getState(),f=u.highlightedIndex;if(a>0){var l=lr(f,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(l,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,u=i.selectedItem,f=i.isOpen,l=this.props.itemToString,d=this.id,h=this.getRootProps,m=this.getToggleButtonProps,v=this.getLabelProps,w=this.getMenuProps,g=this.getInputProps,O=this.getItemProps,p=this.openMenu,y=this.closeMenu,I=this.toggleMenu,x=this.selectItem,N=this.selectItemAtIndex,A=this.selectHighlightedItem,_=this.setHighlightedIndex,F=this.clearSelection,R=this.clearItems,D=this.reset,K=this.setItemCount,j=this.unsetItemCount,L=this.internalSetState;return{getRootProps:h,getToggleButtonProps:m,getLabelProps:v,getMenuProps:w,getInputProps:g,getItemProps:O,reset:D,openMenu:p,closeMenu:y,toggleMenu:I,selectItem:x,selectItemAtIndex:N,selectHighlightedItem:A,setHighlightedIndex:_,clearSelection:F,clearItems:R,setItemCount:K,unsetItemCount:j,setState:L,itemToString:l,id:d,highlightedIndex:s,inputValue:a,isOpen:f,selectedItem:u}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&iu(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(m){i.isMouseDown=!1;var v=So(m.target,[i._rootNode,i._menuNode],i.props.environment);!v&&i.getState().isOpen&&i.reset({type:Sd},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},u=function(){i.isTouchMove=!1},f=function(){i.isTouchMove=!0},l=function(m){var v=So(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!v&&i.getState().isOpen&&i.reset({type:jd},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},d=this.props.environment;d.addEventListener("mousedown",s),d.addEventListener("mouseup",a),d.addEventListener("touchstart",u),d.addEventListener("touchmove",f),d.addEventListener("touchend",l),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),d.removeEventListener("mousedown",s),d.removeEventListener("mouseup",a),d.removeEventListener("touchstart",u),d.removeEventListener("touchmove",f),d.removeEventListener("touchend",l)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,u=a.highlightedIndex,f=s.highlightedIndex===void 0?i:s,l=f.highlightedIndex,d=u&&this.getState().isOpen&&!i.isOpen,h=u!==l;return d||h},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(Sa(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&iu(this._menuNode,this.getMenuProps)),Oo(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:kd,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,i)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var i=ru(this.props.children,Et);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var s=ru(i(this.getStateAndHelpers()));if(!s)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&gI(s,this.getRootProps),s;if(bd(s))return b.cloneElement(s,this.getRootProps(Id(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(b.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:rI,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&sI(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:Et,onInputValueChange:Et,onUserAction:Et,onChange:Et,onSelect:Et,onOuterClick:Et,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:vd},e.stateChangeTypes=uI,e}();process.env.NODE_ENV!=="production"&&(mI.propTypes={children:W.func,defaultHighlightedIndex:W.number,defaultIsOpen:W.bool,initialHighlightedIndex:W.number,initialSelectedItem:W.any,initialInputValue:W.string,initialIsOpen:W.bool,getA11yStatusMessage:W.func,itemToString:W.func,onChange:W.func,onSelect:W.func,onStateChange:W.func,onInputValueChange:W.func,onUserAction:W.func,onOuterClick:W.func,selectedItemChanged:W.func,stateReducer:W.func,itemCount:W.number,id:W.string,environment:W.shape({addEventListener:W.func.isRequired,removeEventListener:W.func.isRequired,document:W.shape({createElement:W.func.isRequired,getElementById:W.func.isRequired,activeElement:W.any.isRequired,body:W.any.isRequired}).isRequired,Node:W.func.isRequired}),suppressRefError:W.bool,scrollIntoView:W.func,selectedItem:W.any,isOpen:W.bool,inputValue:W.string,highlightedIndex:W.number,labelId:W.string,inputId:W.string,menuId:W.string,getItemId:W.func});function iu(e,t){var n=t.refKey;e||console.error('downshift: The ref prop "'+n+'" from getMenuProps was not applied correctly on your menu element.')}function gI(e,t){var n=t.refKey,r=n!=="ref",o=!bd(e);o&&!r&&!Yc.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!o&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!Yc.isForwardRef(e)&&!Id(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Ld={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function yI(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){vI(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(ye({type:o},i))}function vI(e,t,n,r){var o=t.props,i=t.type,s="on"+_a(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](ye({type:i},r))}function wI(e,t){return t.changes}var ou=Oa(function(e,t){xd(e,t)},200),bI=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?b.useLayoutEffect:b.useEffect,II="useId"in b?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,u="downshift-"+b.useId();n||(n=u);var f=b.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(l){return n+"-item-"+l},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return f.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+wd():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,u=t.inputId,f=b.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(l){return r+"-item-"+l},toggleButtonId:a||r+"-toggle-button",inputId:u||r+"-input"});return f.current};function CI(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 _a(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Vd(e){var t=b.useRef(e);return t.current=e,t}function xI(e,t,n,r){var o=b.useRef(),i=b.useRef(),s=b.useCallback(function(m,v){i.current=v,m=xo(m,v.props);var w=e(m,v),g=v.props.stateReducer(m,ye({},v,{changes:w}));return g},[e]),a=b.useReducer(s,t,n),u=a[0],f=a[1],l=Vd(t),d=b.useCallback(function(m){return f(ye({props:l.current},m))},[l]),h=i.current;return b.useEffect(function(){var m=xo(o.current,h==null?void 0:h.props),v=h&&o.current&&!r(m,u);v&&yI(h,m,u),o.current=u},[u,h,r]),[u,d]}var wi={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:wI,scrollIntoView:vd,environment:typeof window>"u"?void 0:window};function zn(e,t,n){n===void 0&&(n=Ld);var r=e["default"+_a(t)];return r!==void 0?r:n[t]}function bi(e,t,n){n===void 0&&(n=Ld);var r=e[t];if(r!==void 0)return r;var o=e["initial"+_a(t)];return o!==void 0?o:zn(e,t,n)}function OI(e){var t=bi(e,"selectedItem"),n=bi(e,"isOpen"),r=TI(e),o=bi(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(i){return e.itemToKey(i)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:o}}function Ii(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,u=t.selectedItem,f=t.highlightedIndex;return r.length===0?-1:o!==void 0&&f===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:u?r.findIndex(function(l){return a(u)===a(l)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function SI(e,t,n){var r=b.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return b.useEffect(function(){if(!e)return Et;var o=n.map(function(l){return l.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(l){r.current.isMouseDown=!1,So(l.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function u(){r.current.isTouchMove=!0}function f(l){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!So(l.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",u),e.addEventListener("touchend",f),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",u),e.removeEventListener("touchend",f)}},[n,e,t]),r.current}var $d=function(){return Et};process.env.NODE_ENV!=="production"&&($d=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=b.useRef(n.reduce(function(s,a){return s[a]={},s},{}));b.useEffect(function(){Object.keys(o.current).forEach(function(s){var a=o.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var u=a.suppressRefError,f=a.refKey,l=a.elementRef;u||l!=null&&l.current||console.error('downshift: The ref prop "'+f+'" from '+s+" was not applied correctly on your element.")})},[]);var i=b.useCallback(function(s,a,u,f){o.current[s]={suppressRefError:a,refKey:u,elementRef:f}},[]);return i});function _I(e,t,n,r){r===void 0&&(r={});var o=r.document,i=Ko();b.useEffect(function(){if(!(!e||i||!o)){var s=e(t);ou(s,o)}},n),b.useEffect(function(){return function(){ou.cancel(),cI(o)}},[o])}function EI(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=b.useRef(!0);return bI(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Kd=Et;process.env.NODE_ENV!=="production"&&(Kd=function(t){var n=t.props,r=t.state,o=b.useRef(n),i=Ko();b.useEffect(function(){i||(Sa(r,o.current,n),o.current=n)},[r,n,i])});function su(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return ye({isOpen:!1,highlightedIndex:-1},o&&ye({selectedItem:e.items[t],isOpen:zn(e,"isOpen"),highlightedIndex:zn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function NI(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Ko(){var e=b.useRef(!0);return b.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Qs(e){var t=zn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function TI(e){var t=bi(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var fo={environment:W.shape({addEventListener:W.func.isRequired,removeEventListener:W.func.isRequired,document:W.shape({createElement:W.func.isRequired,getElementById:W.func.isRequired,activeElement:W.any.isRequired,body:W.any.isRequired}).isRequired,Node:W.func.isRequired}),itemToString:W.func,itemToKey:W.func,stateReducer:W.func},qd=ye({},fo,{getA11yStatusMessage:W.func,highlightedIndex:W.number,defaultHighlightedIndex:W.number,initialHighlightedIndex:W.number,isOpen:W.bool,defaultIsOpen:W.bool,initialIsOpen:W.bool,selectedItem:W.any,initialSelectedItem:W.any,defaultSelectedItem:W.any,id:W.string,labelId:W.string,menuId:W.string,getItemId:W.func,toggleButtonId:W.string,onSelectedItemChange:W.func,onHighlightedIndexChange:W.func,onStateChange:W.func,onIsOpenChange:W.func,scrollIntoView:W.func});function RI(e,t,n){var r=t.type,o=t.props,i;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ii(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:Ii(o,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:o.isItemDisabled(o.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:Qs(o),isOpen:zn(o,"isOpen"),selectedItem:zn(o,"selectedItem"),inputValue:zn(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return ye({},e,i)}Xr(Xr({},qd),{items:W.array.isRequired,isItemDisabled:W.func});Xr(Xr({},wi),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var Ea=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Na=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ta=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Ra=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Aa=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Fa=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Pa=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Da=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Ma=process.env.NODE_ENV!=="production"?"__input_change__":8,_o=process.env.NODE_ENV!=="production"?"__input_blur__":9,ka=process.env.NODE_ENV!=="production"?"__input_click__":10,Ud=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Bd=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ja=process.env.NODE_ENV!=="production"?"__item_click__":13,Jd=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Hd=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Wd=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,zd=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Qd=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,La=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Gd=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Xd=process.env.NODE_ENV!=="production"?"__function_reset__":21,Va=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Yd=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:Va,FunctionCloseMenu:zd,FunctionOpenMenu:Wd,FunctionReset:Xd,FunctionSelectItem:La,FunctionSetHighlightedIndex:Qd,FunctionSetInputValue:Gd,FunctionToggleMenu:Hd,InputBlur:_o,InputChange:Ma,InputClick:ka,InputKeyDownArrowDown:Ea,InputKeyDownArrowUp:Na,InputKeyDownEnd:Aa,InputKeyDownEnter:Da,InputKeyDownEscape:Ta,InputKeyDownHome:Ra,InputKeyDownPageDown:Pa,InputKeyDownPageUp:Fa,ItemClick:ja,ItemMouseMove:Bd,MenuMouseLeave:Ud,ToggleButtonClick:Jd});function AI(e){var t=OI(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),ye({},t,{inputValue:r})}var FI=ye({},qd,{items:W.array.isRequired,isItemDisabled:W.func,inputValue:W.string,defaultInputValue:W.string,initialInputValue:W.string,inputId:W.string,onInputValueChange:W.func});function PI(e,t,n,r){var o=b.useRef(),i=xI(e,t,n,r),s=i[0],a=i[1],u=Ko();return b.useEffect(function(){if(Oo(t,"selectedItem")){if(!u){var f=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);f&&a({type:Va,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[xo(s,t),a]}var Zd=Et;process.env.NODE_ENV!=="production"&&(Zd=function(t,n){W.checkPropTypes(FI,t,"prop",n.name)});var DI=ye({},wi,{isItemDisabled:function(){return!1}});function MI(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case ja:s={isOpen:zn(o,"isOpen"),highlightedIndex:Qs(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Ea:e.isOpen?s={highlightedIndex:lr(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:Ii(o,e,1),isOpen:o.items.length>=0};break;case Na:e.isOpen?i?s=su(o,e.highlightedIndex):s={highlightedIndex:lr(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:Ii(o,e,-1),isOpen:o.items.length>=0};break;case Da:s=su(o,e.highlightedIndex);break;case Ta:s=ye({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Fa:s={highlightedIndex:lr(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Pa:s={highlightedIndex:lr(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case Ra:s={highlightedIndex:Yr(0,!1,o.items,o.isItemDisabled)};break;case Aa:s={highlightedIndex:Yr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case _o:s=ye({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=o.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case Ma:s={isOpen:!0,highlightedIndex:Qs(o),inputValue:t.inputValue};break;case ka:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ii(o,e,0)};break;case La:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case Va:s={inputValue:t.inputValue};break;default:return RI(e,t,Yd)}return ye({},e,s)}var kI=["onMouseLeave","refKey","ref"],jI=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],LI=["onClick","onPress","refKey","ref"],VI=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];$a.stateChangeTypes=Yd;function $a(e){e===void 0&&(e={}),Zd(e,$a);var t=ye({},DI,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=PI(MI,t,AI,NI),a=s[0],u=s[1],f=a.isOpen,l=a.highlightedIndex,d=a.selectedItem,h=a.inputValue,m=b.useRef(null),v=b.useRef({}),w=b.useRef(null),g=b.useRef(null),O=Ko(),p=II(t),y=b.useRef(),I=Vd({state:a,props:t}),x=b.useCallback(function(H){return v.current[p.getItemId(H)]},[p]);_I(i,a,[f,l,d,h],o);var N=EI({menuElement:m.current,highlightedIndex:l,isOpen:f,itemRefs:v,scrollIntoView:r,getItemNodeFromIndex:x});Kd({props:t,state:a}),b.useEffect(function(){var H=bi(t,"isOpen");H&&w.current&&w.current.focus()},[]),b.useEffect(function(){O||(y.current=n.length)});var A=SI(o,b.useCallback(function(){I.current.state.isOpen&&u({type:_o,selectItem:!1})},[u,I]),b.useMemo(function(){return[m,g,w]},[m.current,g.current,w.current])),_=$d("getInputProps","getMenuProps");b.useEffect(function(){f||(v.current={})},[f]),b.useEffect(function(){var H;!f||!(o!=null&&o.document)||!(w!=null&&(H=w.current)!=null&&H.focus)||o.document.activeElement!==w.current&&w.current.focus()},[f,o]);var F=b.useMemo(function(){return{ArrowDown:function(q){q.preventDefault(),u({type:Ea,altKey:q.altKey})},ArrowUp:function(q){q.preventDefault(),u({type:Na,altKey:q.altKey})},Home:function(q){I.current.state.isOpen&&(q.preventDefault(),u({type:Ra}))},End:function(q){I.current.state.isOpen&&(q.preventDefault(),u({type:Aa}))},Escape:function(q){var U=I.current.state;(U.isOpen||U.inputValue||U.selectedItem||U.highlightedIndex>-1)&&(q.preventDefault(),u({type:Ta}))},Enter:function(q){var U=I.current.state;!U.isOpen||q.which===229||(q.preventDefault(),u({type:Da}))},PageUp:function(q){I.current.state.isOpen&&(q.preventDefault(),u({type:Fa}))},PageDown:function(q){I.current.state.isOpen&&(q.preventDefault(),u({type:Pa}))}}},[u,I]),R=b.useCallback(function(H){return ye({id:p.labelId,htmlFor:p.inputId},H)},[p]),D=b.useCallback(function(H,q){var U,V=H===void 0?{}:H,G=V.onMouseLeave,Z=V.refKey,Y=Z===void 0?"ref":Z,ee=V.ref,ne=Cn(V,kI),ce=q===void 0?{}:q,k=ce.suppressRefError,ve=k===void 0?!1:k;return _("getMenuProps",ve,Y,m),ye((U={},U[Y]=Fr(ee,function(z){m.current=z}),U.id=p.menuId,U.role="listbox",U["aria-labelledby"]=ne&&ne["aria-label"]?void 0:""+p.labelId,U.onMouseLeave=Qe(G,function(){u({type:Ud})}),U),ne)},[u,_,p]),K=b.useCallback(function(H){var q,U,V=H===void 0?{}:H,G=V.item,Z=V.index,Y=V.refKey,ee=Y===void 0?"ref":Y,ne=V.ref,ce=V.onMouseMove,k=V.onMouseDown,ve=V.onClick;V.onPress;var z=V.disabled,Xe=Cn(V,jI);z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ce=I.current,ct=Ce.props,Ue=Ce.state,rt=CI(G,Z,ct.items,"Pass either item or index to getItemProps!"),xe=rt[0],ze=rt[1],ft=ct.isItemDisabled(xe,ze),yt="onClick",vt=ve,Ye=function(){A.isTouchEnd||ze===Ue.highlightedIndex||(N.current=!1,u({type:Bd,index:ze,disabled:ft}))},Ze=function(){u({type:ja,index:ze})},De=function(pe){return pe.preventDefault()};return ye((q={},q[ee]=Fr(ne,function(J){J&&(v.current[p.getItemId(ze)]=J)}),q["aria-disabled"]=ft,q["aria-selected"]=ze===Ue.highlightedIndex,q.id=p.getItemId(ze),q.role="option",q),!ft&&(U={},U[yt]=Qe(vt,Ze),U),{onMouseMove:Qe(ce,Ye),onMouseDown:Qe(k,De)},Xe)},[u,p,I,A,N]),j=b.useCallback(function(H){var q,U=H===void 0?{}:H,V=U.onClick;U.onPress;var G=U.refKey,Z=G===void 0?"ref":G,Y=U.ref,ee=Cn(U,LI),ne=I.current.state,ce=function(){u({type:Jd})};return ye((q={},q[Z]=Fr(Y,function(k){g.current=k}),q["aria-controls"]=p.menuId,q["aria-expanded"]=ne.isOpen,q.id=p.toggleButtonId,q.tabIndex=-1,q),!ee.disabled&&ye({},{onClick:Qe(V,ce)}),ee)},[u,I,p]),L=b.useCallback(function(H,q){var U,V=H===void 0?{}:H,G=V.onKeyDown,Z=V.onChange,Y=V.onInput,ee=V.onBlur;V.onChangeText;var ne=V.onClick,ce=V.refKey,k=ce===void 0?"ref":ce,ve=V.ref,z=Cn(V,VI),Xe=q===void 0?{}:q,Ce=Xe.suppressRefError,ct=Ce===void 0?!1:Ce;_("getInputProps",ct,k,w);var Ue=I.current.state,rt=function(De){var J=Ws(De);J&&F[J]&&F[J](De)},xe=function(De){u({type:Ma,inputValue:De.target.value})},ze=function(De){if(o!=null&&o.document&&Ue.isOpen&&!A.isMouseDown){var J=De.relatedTarget===null&&o.document.activeElement!==o.document.body;u({type:_o,selectItem:!J})}},ft=function(){u({type:ka})},yt="onChange",vt={};if(!z.disabled){var Ye;vt=(Ye={},Ye[yt]=Qe(Z,Y,xe),Ye.onKeyDown=Qe(G,rt),Ye.onBlur=Qe(ee,ze),Ye.onClick=Qe(ne,ft),Ye)}return ye((U={},U[k]=Fr(ve,function(Ze){w.current=Ze}),U["aria-activedescendant"]=Ue.isOpen&&Ue.highlightedIndex>-1?p.getItemId(Ue.highlightedIndex):"",U["aria-autocomplete"]="list",U["aria-controls"]=p.menuId,U["aria-expanded"]=Ue.isOpen,U["aria-labelledby"]=z&&z["aria-label"]?void 0:p.labelId,U.autoComplete="off",U.id=p.inputId,U.role="combobox",U.value=Ue.inputValue,U),vt,z)},[u,p,o,F,I,A,_]),se=b.useCallback(function(){u({type:Hd})},[u]),re=b.useCallback(function(){u({type:zd})},[u]),ge=b.useCallback(function(){u({type:Wd})},[u]),de=b.useCallback(function(H){u({type:Qd,highlightedIndex:H})},[u]),be=b.useCallback(function(H){u({type:La,selectedItem:H})},[u]),P=b.useCallback(function(H){u({type:Gd,inputValue:H})},[u]),$=b.useCallback(function(){u({type:Xd})},[u]);return{getItemProps:K,getLabelProps:R,getMenuProps:D,getInputProps:L,getToggleButtonProps:j,toggleMenu:se,openMenu:ge,closeMenu:re,setHighlightedIndex:de,setInputValue:P,selectItem:be,reset:$,highlightedIndex:l,isOpen:f,selectedItem:d,inputValue:h}}fo.stateReducer,fo.itemToKey,fo.environment,W.array,W.array,W.array,W.func,W.number,W.number,W.number,W.func,W.func,W.string,W.string;wi.itemToKey,wi.stateReducer,wi.environment;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;const $I="_comboboxContainer_1lcc8_1",KI="_inputContainer_1lcc8_12",qI="_input_1lcc8_12",UI="_toggleButton_1lcc8_33",BI="_menu_1lcc8_39",JI="_menuBottom_1lcc8_55",HI="_menuTop_1lcc8_61",WI="_menuItem_1lcc8_66",zI="_highlighted_1lcc8_73",QI="_selected_1lcc8_77",GI="_hidden_1lcc8_81",qt={comboboxContainer:$I,inputContainer:KI,input:qI,toggleButton:UI,menu:BI,menuBottom:JI,menuTop:HI,menuItem:WI,highlighted:zI,selected:QI,hidden:GI};function XI(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function ef({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,u]=b.useState(e),f=b.useRef(null);b.useEffect(()=>u(e),[e]);const l=b.useCallback(N=>{(N==null?void 0:N.length)>0?u(e.filter(XI(N))):u(e)},[e]),{isOpen:d,getToggleButtonProps:h,getMenuProps:m,getInputProps:v,highlightedIndex:w,getItemProps:g,setInputValue:O}=$a({items:a,selectedItem:t?e.find(N=>N.value===t):null,itemToString:N=>(N==null?void 0:N.label)||"",onInputValueChange:({inputValue:N})=>l(N),onSelectedItemChange:({selectedItem:N})=>{var A;n(N),(A=f.current)==null||A.blur()}}),p=()=>{O(""),u(e)},y=()=>p(),I=b.useMemo(()=>{var N;return(N=e.find(A=>A.value===t))==null?void 0:N.label},[e,t]),x=()=>{O(t&&I?I:"")};return c.jsxs("div",{style:{position:"relative",...i},children:[c.jsx("div",{className:qt.comboboxContainer,children:c.jsxs("div",{className:qt.inputContainer,children:[c.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:qt.input,...v({onFocus:y,onBlur:x,ref:f})}),c.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:qt.toggleButton,type:"button",...h(),children:d?c.jsx(c.Fragment,{children:"↑"}):c.jsx(c.Fragment,{children:"↓"})})]})}),c.jsx("ul",{className:`${qt.menu} ${d&&e.length?"":qt.hidden} ${s==="top"?qt.menuTop:qt.menuBottom}`,...m(),children:d&&a.map((N,A)=>c.jsx("li",{className:`${qt.menuItem} ${w===A?qt.highlighted:""} ${t===(N==null?void 0:N.value)?qt.selected:""}`,...g({item:N,index:A}),children:c.jsx("span",{children:N.label})},N.id))})]})}const Zr=Math.min,Ir=Math.max,Eo=Math.round,oo=Math.floor,Gn=e=>({x:e,y:e}),YI={left:"right",right:"left",bottom:"top",top:"bottom"},ZI={start:"end",end:"start"};function Gs(e,t,n){return Ir(e,Zr(t,n))}function ji(e,t){return typeof e=="function"?e(t):e}function _r(e){return e.split("-")[0]}function Li(e){return e.split("-")[1]}function tf(e){return e==="x"?"y":"x"}function Ka(e){return e==="y"?"height":"width"}function ei(e){return["top","bottom"].includes(_r(e))?"y":"x"}function qa(e){return tf(ei(e))}function e0(e,t,n){n===void 0&&(n=!1);const r=Li(e),o=qa(e),i=Ka(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=No(s)),[s,No(s)]}function t0(e){const t=No(e);return[Xs(e),t,Xs(t)]}function Xs(e){return e.replace(/start|end/g,t=>ZI[t])}function n0(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 r0(e,t,n,r){const o=Li(e);let i=n0(_r(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Xs)))),i}function No(e){return e.replace(/left|right|bottom|top/g,t=>YI[t])}function i0(e){return{top:0,right:0,bottom:0,left:0,...e}}function nf(e){return typeof e!="number"?i0(e):{top:e,right:e,bottom:e,left:e}}function To(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function au(e,t,n){let{reference:r,floating:o}=e;const i=ei(t),s=qa(t),a=Ka(s),u=_r(t),f=i==="y",l=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let m;switch(u){case"top":m={x:l,y:r.y-o.height};break;case"bottom":m={x:l,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-o.width,y:d};break;default:m={x:r.x,y:r.y}}switch(Li(t)){case"start":m[s]-=h*(n&&f?-1:1);break;case"end":m[s]+=h*(n&&f?-1:1);break}return m}const o0=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),u=await(s.isRTL==null?void 0:s.isRTL(t));let f=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:d}=au(f,r,u),h=r,m={},v=0;for(let w=0;w<a.length;w++){const{name:g,fn:O}=a[w],{x:p,y,data:I,reset:x}=await O({x:l,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:f,platform:s,elements:{reference:e,floating:t}});l=p??l,d=y??d,m={...m,[g]:{...m[g],...I}},x&&v<=50&&(v++,typeof x=="object"&&(x.placement&&(h=x.placement),x.rects&&(f=x.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):x.rects),{x:l,y:d}=au(f,h,u)),w=-1)}return{x:l,y:d,placement:h,strategy:o,middlewareData:m}};async function rf(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:h=!1,padding:m=0}=ji(t,e),v=nf(m),g=a[h?d==="floating"?"reference":"floating":d],O=To(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(g)))==null||n?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:f,rootBoundary:l,strategy:u})),p=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),I=await(i.isElement==null?void 0:i.isElement(y))?await(i.getScale==null?void 0:i.getScale(y))||{x:1,y:1}:{x:1,y:1},x=To(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:p,offsetParent:y,strategy:u}):p);return{top:(O.top-x.top+v.top)/I.y,bottom:(x.bottom-O.bottom+v.bottom)/I.y,left:(O.left-x.left+v.left)/I.x,right:(x.right-O.right+v.right)/I.x}}const s0=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:u}=t,{element:f,padding:l=0}=ji(e,t)||{};if(f==null)return{};const d=nf(l),h={x:n,y:r},m=qa(o),v=Ka(m),w=await s.getDimensions(f),g=m==="y",O=g?"top":"left",p=g?"bottom":"right",y=g?"clientHeight":"clientWidth",I=i.reference[v]+i.reference[m]-h[m]-i.floating[v],x=h[m]-i.reference[m],N=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let A=N?N[y]:0;(!A||!await(s.isElement==null?void 0:s.isElement(N)))&&(A=a.floating[y]||i.floating[v]);const _=I/2-x/2,F=A/2-w[v]/2-1,R=Zr(d[O],F),D=Zr(d[p],F),K=R,j=A-w[v]-D,L=A/2-w[v]/2+_,se=Gs(K,L,j),re=!u.arrow&&Li(o)!=null&&L!==se&&i.reference[v]/2-(L<K?R:D)-w[v]/2<0,ge=re?L<K?L-K:L-j:0;return{[m]:h[m]+ge,data:{[m]:se,centerOffset:L-se-ge,...re&&{alignmentOffset:ge}},reset:re}}}),a0=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:u,elements:f}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:w=!0,...g}=ji(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const O=_r(o),p=ei(a),y=_r(a)===a,I=await(u.isRTL==null?void 0:u.isRTL(f.floating)),x=h||(y||!w?[No(a)]:t0(a)),N=v!=="none";!h&&N&&x.push(...r0(a,w,v,I));const A=[a,...x],_=await rf(t,g),F=[];let R=((r=i.flip)==null?void 0:r.overflows)||[];if(l&&F.push(_[O]),d){const L=e0(o,s,I);F.push(_[L[0]],_[L[1]])}if(R=[...R,{placement:o,overflows:F}],!F.every(L=>L<=0)){var D,K;const L=(((D=i.flip)==null?void 0:D.index)||0)+1,se=A[L];if(se)return{data:{index:L,overflows:R},reset:{placement:se}};let re=(K=R.filter(ge=>ge.overflows[0]<=0).sort((ge,de)=>ge.overflows[1]-de.overflows[1])[0])==null?void 0:K.placement;if(!re)switch(m){case"bestFit":{var j;const ge=(j=R.filter(de=>{if(N){const be=ei(de.placement);return be===p||be==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(be=>be>0).reduce((be,P)=>be+P,0)]).sort((de,be)=>de[1]-be[1])[0])==null?void 0:j[0];ge&&(re=ge);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}};async function c0(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=_r(n),a=Li(n),u=ei(n)==="y",f=["left","top"].includes(s)?-1:1,l=i&&u?-1:1,d=ji(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:v}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof v=="number"&&(m=a==="end"?v*-1:v),u?{x:m*l,y:h*f}:{x:h*f,y:m*l}}const u0=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,u=await c0(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:i+u.y,data:{...u,placement:s}}}}},l0=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x:O,y:p}=g;return{x:O,y:p}}},...u}=ji(e,t),f={x:n,y:r},l=await rf(t,u),d=ei(_r(o)),h=tf(d);let m=f[h],v=f[d];if(i){const g=h==="y"?"top":"left",O=h==="y"?"bottom":"right",p=m+l[g],y=m-l[O];m=Gs(p,m,y)}if(s){const g=d==="y"?"top":"left",O=d==="y"?"bottom":"right",p=v+l[g],y=v-l[O];v=Gs(p,v,y)}const w=a.fn({...t,[h]:m,[d]:v});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:i,[d]:s}}}}}};function qo(){return typeof window<"u"}function ui(e){return of(e)?(e.nodeName||"").toLowerCase():"#document"}function Nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function un(e){var t;return(t=(of(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function of(e){return qo()?e instanceof Node||e instanceof Nt(e).Node:!1}function Wt(e){return qo()?e instanceof Element||e instanceof Nt(e).Element:!1}function sn(e){return qo()?e instanceof HTMLElement||e instanceof Nt(e).HTMLElement:!1}function cu(e){return!qo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Nt(e).ShadowRoot}function Vi(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=zt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function d0(e){return["table","td","th"].includes(ui(e))}function Uo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Ua(e){const t=Ba(),n=Wt(e)?zt(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function f0(e){let t=Xn(e);for(;sn(t)&&!ti(t);){if(Ua(t))return t;if(Uo(t))return null;t=Xn(t)}return null}function Ba(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ti(e){return["html","body","#document"].includes(ui(e))}function zt(e){return Nt(e).getComputedStyle(e)}function Bo(e){return Wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xn(e){if(ui(e)==="html")return e;const t=e.assignedSlot||e.parentNode||cu(e)&&e.host||un(e);return cu(t)?t.host:t}function sf(e){const t=Xn(e);return ti(t)?e.ownerDocument?e.ownerDocument.body:e.body:sn(t)&&Vi(t)?t:sf(t)}function _i(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=sf(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Nt(o);if(i){const a=Ys(s);return t.concat(s,s.visualViewport||[],Vi(o)?o:[],a&&n?_i(a):[])}return t.concat(o,_i(o,[],n))}function Ys(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function af(e){const t=zt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=sn(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Eo(n)!==i||Eo(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Ja(e){return Wt(e)?e:e.contextElement}function Pr(e){const t=Ja(e);if(!sn(t))return Gn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=af(t);let s=(i?Eo(n.width):n.width)/r,a=(i?Eo(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const p0=Gn(0);function cf(e){const t=Nt(e);return!Ba()||!t.visualViewport?p0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function h0(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Nt(e)?!1:t}function Er(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Ja(e);let s=Gn(1);t&&(r?Wt(r)&&(s=Pr(r)):s=Pr(e));const a=h0(i,n,r)?cf(i):Gn(0);let u=(o.left+a.x)/s.x,f=(o.top+a.y)/s.y,l=o.width/s.x,d=o.height/s.y;if(i){const h=Nt(i),m=r&&Wt(r)?Nt(r):r;let v=h,w=Ys(v);for(;w&&r&&m!==v;){const g=Pr(w),O=w.getBoundingClientRect(),p=zt(w),y=O.left+(w.clientLeft+parseFloat(p.paddingLeft))*g.x,I=O.top+(w.clientTop+parseFloat(p.paddingTop))*g.y;u*=g.x,f*=g.y,l*=g.x,d*=g.y,u+=y,f+=I,v=Nt(w),w=Ys(v)}}return To({width:l,height:d,x:u,y:f})}function m0(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=un(r),a=t?Uo(t.floating):!1;if(r===s||a&&i)return n;let u={scrollLeft:0,scrollTop:0},f=Gn(1);const l=Gn(0),d=sn(r);if((d||!d&&!i)&&((ui(r)!=="body"||Vi(s))&&(u=Bo(r)),sn(r))){const h=Er(r);f=Pr(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+l.x,y:n.y*f.y-u.scrollTop*f.y+l.y}}function g0(e){return Array.from(e.getClientRects())}function Zs(e,t){const n=Bo(e).scrollLeft;return t?t.left+n:Er(un(e)).left+n}function y0(e){const t=un(e),n=Bo(e),r=e.ownerDocument.body,o=Ir(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Ir(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Zs(e);const a=-n.scrollTop;return zt(r).direction==="rtl"&&(s+=Ir(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function v0(e,t){const n=Nt(e),r=un(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,u=0;if(o){i=o.width,s=o.height;const f=Ba();(!f||f&&t==="fixed")&&(a=o.offsetLeft,u=o.offsetTop)}return{width:i,height:s,x:a,y:u}}function w0(e,t){const n=Er(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=sn(e)?Pr(e):Gn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,u=o*i.x,f=r*i.y;return{width:s,height:a,x:u,y:f}}function uu(e,t,n){let r;if(t==="viewport")r=v0(e,n);else if(t==="document")r=y0(un(e));else if(Wt(t))r=w0(t,n);else{const o=cf(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return To(r)}function uf(e,t){const n=Xn(e);return n===t||!Wt(n)||ti(n)?!1:zt(n).position==="fixed"||uf(n,t)}function b0(e,t){const n=t.get(e);if(n)return n;let r=_i(e,[],!1).filter(a=>Wt(a)&&ui(a)!=="body"),o=null;const i=zt(e).position==="fixed";let s=i?Xn(e):e;for(;Wt(s)&&!ti(s);){const a=zt(s),u=Ua(s);!u&&a.position==="fixed"&&(o=null),(i?!u&&!o:!u&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Vi(s)&&!u&&uf(e,s))?r=r.filter(l=>l!==s):o=a,s=Xn(s)}return t.set(e,r),r}function I0(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Uo(t)?[]:b0(t,this._c):[].concat(n),r],a=s[0],u=s.reduce((f,l)=>{const d=uu(t,l,o);return f.top=Ir(d.top,f.top),f.right=Zr(d.right,f.right),f.bottom=Zr(d.bottom,f.bottom),f.left=Ir(d.left,f.left),f},uu(t,a,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function C0(e){const{width:t,height:n}=af(e);return{width:t,height:n}}function x0(e,t,n){const r=sn(t),o=un(t),i=n==="fixed",s=Er(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const u=Gn(0);if(r||!r&&!i)if((ui(t)!=="body"||Vi(o))&&(a=Bo(t)),r){const m=Er(t,!0,i,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else o&&(u.x=Zs(o));let f=0,l=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();l=m.top+a.scrollTop,f=m.left+a.scrollLeft-Zs(o,m)}const d=s.left+a.scrollLeft-u.x-f,h=s.top+a.scrollTop-u.y-l;return{x:d,y:h,width:s.width,height:s.height}}function hs(e){return zt(e).position==="static"}function lu(e,t){if(!sn(e)||zt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return un(e)===n&&(n=n.ownerDocument.body),n}function lf(e,t){const n=Nt(e);if(Uo(e))return n;if(!sn(e)){let o=Xn(e);for(;o&&!ti(o);){if(Wt(o)&&!hs(o))return o;o=Xn(o)}return n}let r=lu(e,t);for(;r&&d0(r)&&hs(r);)r=lu(r,t);return r&&ti(r)&&hs(r)&&!Ua(r)?n:r||f0(e)||n}const O0=async function(e){const t=this.getOffsetParent||lf,n=this.getDimensions,r=await n(e.floating);return{reference:x0(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function S0(e){return zt(e).direction==="rtl"}const _0={convertOffsetParentRelativeRectToViewportRelativeRect:m0,getDocumentElement:un,getClippingRect:I0,getOffsetParent:lf,getElementRects:O0,getClientRects:g0,getDimensions:C0,getScale:Pr,isElement:Wt,isRTL:S0};function E0(e,t){let n=null,r;const o=un(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),i();const{left:f,top:l,width:d,height:h}=e.getBoundingClientRect();if(a||t(),!d||!h)return;const m=oo(l),v=oo(o.clientWidth-(f+d)),w=oo(o.clientHeight-(l+h)),g=oo(f),p={rootMargin:-m+"px "+-v+"px "+-w+"px "+-g+"px",threshold:Ir(0,Zr(1,u))||1};let y=!0;function I(x){const N=x[0].intersectionRatio;if(N!==u){if(!y)return s();N?s(!1,N):r=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{n=new IntersectionObserver(I,{...p,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,p)}n.observe(e)}return s(!0),i}function N0(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=Ja(e),l=o||i?[...f?_i(f):[],..._i(t)]:[];l.forEach(O=>{o&&O.addEventListener("scroll",n,{passive:!0}),i&&O.addEventListener("resize",n)});const d=f&&a?E0(f,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(O=>{let[p]=O;p&&p.target===f&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=m)==null||y.observe(t)})),n()}),f&&!u&&m.observe(f),m.observe(t));let v,w=u?Er(e):null;u&&g();function g(){const O=Er(e);w&&(O.x!==w.x||O.y!==w.y||O.width!==w.width||O.height!==w.height)&&n(),w=O,v=requestAnimationFrame(g)}return n(),()=>{var O;l.forEach(p=>{o&&p.removeEventListener("scroll",n),i&&p.removeEventListener("resize",n)}),d==null||d(),(O=m)==null||O.disconnect(),m=null,u&&cancelAnimationFrame(v)}}const T0=u0,R0=l0,A0=a0,F0=s0,du=(e,t,n)=>{const r=new Map,o={platform:_0,...n},i={...o.platform,_c:r};return o0(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 yS="react-tooltip-core-styles",vS="react-tooltip-base-styles",Su={core:!1,base:!1};function xu({css:e,id:t=vS,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||Su[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=yS),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)),Su[n]=!0}const Ou=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[pS(Number(o)),mS({fallbackAxisSideDirection:"start"}),hS({padding:5})],border:a,arrowSize:c=8})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const f=s;return n?(f.push(gS({element:n,padding:5})),Cu(e,t,{placement:r,strategy:i,middleware:f}).then(({x:d,y:l,placement:p,middlewareData:m})=>{var g,w;const v={left:`${d}px`,top:`${l}px`,border:a},{x,y:h}=(g=m.arrow)!==null&&g!==void 0?g:{x:0,y:0},y=(w={top:"bottom",right:"left",bottom:"top",left:"right"}[p.split("-")[0]])!==null&&w!==void 0?w:"bottom",I=a&&{borderBottom:a,borderRight:a};let S=0;if(a){const E=`${a}`.match(/(\d+)px/);S=E!=null&&E[1]?Number(E[1]):1}return{tooltipStyles:v,tooltipArrowStyles:{left:x!=null?`${x}px`:"",top:h!=null?`${h}px`:"",right:"",bottom:"",...I,[y]:`-${c/2+S}px`},place:p}})):Cu(e,t,{placement:"bottom",strategy:i,middleware:f}).then(({x:d,y:l,placement:p})=>({tooltipStyles:{left:`${d}px`,top:`${l}px`},tooltipArrowStyles:{},place:p}))},Eu=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),_u=(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},Nu=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",aa=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>aa(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Nu(e)||!Nu(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>aa(e[o],t[o]))},wS=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"})},Tu=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(wS(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},bS=typeof window<"u"?b.useLayoutEffect:b.useEffect,jt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},IS="DEFAULT_TOOLTIP_ID",CS={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},SS=b.createContext({getTooltipData:()=>CS});function _f(e=IS){return b.useContext(SS).getTooltipData(e)}var Fr={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},Cs={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 xS=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:c=10,events:f=["hover"],openOnClick:d=!1,positionStrategy:l="absolute",middlewares:p,wrapper:m,delayShow:g=0,delayHide:w=0,float:v=!1,hidden:x=!1,noArrow:h=!1,clickable:y=!1,closeOnEsc:I=!1,closeOnScroll:S=!1,closeOnResize:E=!1,openEvents:P,closeEvents:_,globalCloseEvents:A,imperativeModeOnly:R,style:M,position:j,afterShow:K,afterHide:$,disableTooltip:ce,content:re,contentWrapperRef:pe,isOpen:de,defaultIsOpen:be=!1,setIsOpen:F,activeAnchor:L,setActiveAnchor:B,border:H,opacity:J,arrowColor:U,arrowSize:X=8,role:ee="tooltip"})=>{var Y;const te=b.useRef(null),ne=b.useRef(null),ue=b.useRef(null),k=b.useRef(null),ve=b.useRef(null),[z,Ye]=b.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ce,lt]=b.useState(!1),[Be,ot]=b.useState(!1),[Se,Ge]=b.useState(null),ht=b.useRef(!1),wt=b.useRef(null),{anchorRefs:bt,setActiveAnchor:Ze}=_f(t),et=b.useRef(!1),[De,q]=b.useState([]),he=b.useRef(!1),Oe=d||f.includes("click"),fn=Oe||(P==null?void 0:P.click)||(P==null?void 0:P.dblclick)||(P==null?void 0:P.mousedown),pn=P?{...P}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!P&&Oe&&Object.assign(pn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const hn=_?{..._}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!_&&Oe&&Object.assign(hn,{mouseleave:!1,blur:!1,mouseout:!1});const It=A?{...A}:{escape:I||!1,scroll:S||!1,resize:E||!1,clickOutsideAnchor:fn||!1};R&&(Object.assign(pn,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(hn,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(It,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),bS(()=>(he.current=!0,()=>{he.current=!1}),[]);const Pe=G=>{he.current&&(G&&ot(!0),setTimeout(()=>{he.current&&(F==null||F(G),de===void 0&&lt(G))},10))};b.useEffect(()=>{if(de===void 0)return()=>null;de&&ot(!0);const G=setTimeout(()=>{lt(de)},10);return()=>{clearTimeout(G)}},[de]),b.useEffect(()=>{if(Ce!==ht.current)if(jt(ve),ht.current=Ce,Ce)K==null||K();else{const G=(ae=>{const le=ae.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,$e,Je]=le;return Number($e)*(Je==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));ve.current=setTimeout(()=>{ot(!1),Ge(null),$==null||$()},G+25)}},[Ce]);const sr=G=>{Ye(ae=>aa(ae,G)?ae:G)},Tn=(G=g)=>{jt(ue),Be?Pe(!0):ue.current=setTimeout(()=>{Pe(!0)},G)},An=(G=w)=>{jt(k),k.current=setTimeout(()=>{et.current||Pe(!1)},G)},_t=G=>{var ae;if(!G)return;const le=(ae=G.currentTarget)!==null&&ae!==void 0?ae:G.target;if(!(le!=null&&le.isConnected))return B(null),void Ze({current:null});g?Tn():Pe(!0),B(le),Ze({current:le}),jt(k)},mn=()=>{y?An(w||100):w?An():Pe(!1),jt(ue)},Rn=({x:G,y:ae})=>{var le;const $e={getBoundingClientRect:()=>({x:G,y:ae,width:0,height:0,top:ae,left:G,right:G,bottom:ae})};Ou({place:(le=Se==null?void 0:Se.place)!==null&&le!==void 0?le:a,offset:c,elementReference:$e,tooltipReference:te.current,tooltipArrowReference:ne.current,strategy:l,middlewares:p,border:H,arrowSize:X}).then(Je=>{sr(Je)})},Pn=G=>{if(!G)return;const ae=G,le={x:ae.clientX,y:ae.clientY};Rn(le),wt.current=le},gn=G=>{var ae;if(!Ce)return;const le=G.target;le.isConnected&&(!((ae=te.current)===null||ae===void 0)&&ae.contains(le)||[document.querySelector(`[id='${i}']`),...De].some($e=>$e==null?void 0:$e.contains(le))||(Pe(!1),jt(ue)))},en=_u(_t,50),Ke=_u(mn,50),dt=G=>{Ke.cancel(),en(G)},oe=()=>{en.cancel(),Ke()},me=b.useCallback(()=>{var G,ae;const le=(G=Se==null?void 0:Se.position)!==null&&G!==void 0?G:j;le?Rn(le):v?wt.current&&Rn(wt.current):L!=null&&L.isConnected&&Ou({place:(ae=Se==null?void 0:Se.place)!==null&&ae!==void 0?ae:a,offset:c,elementReference:L,tooltipReference:te.current,tooltipArrowReference:ne.current,strategy:l,middlewares:p,border:H,arrowSize:X}).then($e=>{he.current&&sr($e)})},[Ce,L,re,M,a,Se==null?void 0:Se.place,c,l,j,Se==null?void 0:Se.position,v,X]);b.useEffect(()=>{var G,ae;const le=new Set(bt);De.forEach(xe=>{ce!=null&&ce(xe)||le.add({current:xe})});const $e=document.querySelector(`[id='${i}']`);$e&&!(ce!=null&&ce($e))&&le.add({current:$e});const Je=()=>{Pe(!1)},tt=Tu(L),Dt=Tu(te.current);It.scroll&&(window.addEventListener("scroll",Je),tt==null||tt.addEventListener("scroll",Je),Dt==null||Dt.addEventListener("scroll",Je));let st=null;It.resize?window.addEventListener("resize",Je):L&&te.current&&(st=fS(L,te.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const Ct=xe=>{xe.key==="Escape"&&Pe(!1)};It.escape&&window.addEventListener("keydown",Ct),It.clickOutsideAnchor&&window.addEventListener("click",gn);const Re=[],Fn=xe=>!!(xe!=null&&xe.target&&(L!=null&&L.contains(xe.target))),Ut=xe=>{Ce&&Fn(xe)||_t(xe)},ts=xe=>{Ce&&Fn(xe)&&mn()},Hi=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Ji=["click","dblclick","mousedown","mouseup"];Object.entries(pn).forEach(([xe,Vt])=>{Vt&&(Hi.includes(xe)?Re.push({event:xe,listener:dt}):Ji.includes(xe)&&Re.push({event:xe,listener:Ut}))}),Object.entries(hn).forEach(([xe,Vt])=>{Vt&&(Hi.includes(xe)?Re.push({event:xe,listener:oe}):Ji.includes(xe)&&Re.push({event:xe,listener:ts}))}),v&&Re.push({event:"pointermove",listener:Pn});const Wi=()=>{et.current=!0},zi=()=>{et.current=!1,mn()},tn=y&&(hn.mouseout||hn.mouseleave);return tn&&((G=te.current)===null||G===void 0||G.addEventListener("mouseover",Wi),(ae=te.current)===null||ae===void 0||ae.addEventListener("mouseout",zi)),Re.forEach(({event:xe,listener:Vt})=>{le.forEach(hi=>{var ar;(ar=hi.current)===null||ar===void 0||ar.addEventListener(xe,Vt)})}),()=>{var xe,Vt;It.scroll&&(window.removeEventListener("scroll",Je),tt==null||tt.removeEventListener("scroll",Je),Dt==null||Dt.removeEventListener("scroll",Je)),It.resize?window.removeEventListener("resize",Je):st==null||st(),It.clickOutsideAnchor&&window.removeEventListener("click",gn),It.escape&&window.removeEventListener("keydown",Ct),tn&&((xe=te.current)===null||xe===void 0||xe.removeEventListener("mouseover",Wi),(Vt=te.current)===null||Vt===void 0||Vt.removeEventListener("mouseout",zi)),Re.forEach(({event:hi,listener:ar})=>{le.forEach(ns=>{var Dn;(Dn=ns.current)===null||Dn===void 0||Dn.removeEventListener(hi,ar)})})}},[L,me,Be,bt,De,P,_,A,Oe,g,w]),b.useEffect(()=>{var G,ae;let le=(ae=(G=Se==null?void 0:Se.anchorSelect)!==null&&G!==void 0?G:s)!==null&&ae!==void 0?ae:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const $e=new MutationObserver(Je=>{const tt=[],Dt=[];Je.forEach(st=>{if(st.type==="attributes"&&st.attributeName==="data-tooltip-id"&&(st.target.getAttribute("data-tooltip-id")===t?tt.push(st.target):st.oldValue===t&&Dt.push(st.target)),st.type==="childList"){if(L){const Ct=[...st.removedNodes].filter(Re=>Re.nodeType===1);if(le)try{Dt.push(...Ct.filter(Re=>Re.matches(le))),Dt.push(...Ct.flatMap(Re=>[...Re.querySelectorAll(le)]))}catch{}Ct.some(Re=>{var Fn;return!!(!((Fn=Re==null?void 0:Re.contains)===null||Fn===void 0)&&Fn.call(Re,L))&&(ot(!1),Pe(!1),B(null),jt(ue),jt(k),!0)})}if(le)try{const Ct=[...st.addedNodes].filter(Re=>Re.nodeType===1);tt.push(...Ct.filter(Re=>Re.matches(le))),tt.push(...Ct.flatMap(Re=>[...Re.querySelectorAll(le)]))}catch{}}}),(tt.length||Dt.length)&&q(st=>[...st.filter(Ct=>!Dt.includes(Ct)),...tt])});return $e.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{$e.disconnect()}},[t,s,Se==null?void 0:Se.anchorSelect,L]),b.useEffect(()=>{me()},[me]),b.useEffect(()=>{if(!(pe!=null&&pe.current))return()=>null;const G=new ResizeObserver(()=>{setTimeout(()=>me())});return G.observe(pe.current),()=>{G.disconnect()}},[re,pe==null?void 0:pe.current]),b.useEffect(()=>{var G;const ae=document.querySelector(`[id='${i}']`),le=[...De,ae];L&&le.includes(L)||B((G=De[0])!==null&&G!==void 0?G:ae)},[i,De,L]),b.useEffect(()=>(be&&Pe(!0),()=>{jt(ue),jt(k)}),[]),b.useEffect(()=>{var G;let ae=(G=Se==null?void 0:Se.anchorSelect)!==null&&G!==void 0?G:s;if(!ae&&t&&(ae=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ae)try{const le=Array.from(document.querySelectorAll(ae));q(le)}catch{q([])}},[t,s,Se==null?void 0:Se.anchorSelect]),b.useEffect(()=>{ue.current&&(jt(ue),Tn(g))},[g]);const mt=(Y=Se==null?void 0:Se.content)!==null&&Y!==void 0?Y:re,yn=Ce&&Object.keys(z.tooltipStyles).length>0;return b.useImperativeHandle(e,()=>({open:G=>{if(G!=null&&G.anchorSelect)try{document.querySelector(G.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${G.anchorSelect}" is not a valid CSS selector`)}Ge(G??null),G!=null&&G.delay?Tn(G.delay):Pe(!0)},close:G=>{G!=null&&G.delay?An(G.delay):Pe(!1)},activeAnchor:L,place:z.place,isOpen:!!(Be&&!x&&mt&&yn)})),Be&&!x&&mt?b.createElement(m,{id:t,role:ee,className:$t("react-tooltip",Fr.tooltip,Cs.tooltip,Cs[o],n,`react-tooltip__place-${z.place}`,Fr[yn?"show":"closing"],yn?"react-tooltip__show":"react-tooltip__closing",l==="fixed"&&Fr.fixed,y&&Fr.clickable),onTransitionEnd:G=>{jt(ve),Ce||G.propertyName!=="opacity"||(ot(!1),Ge(null),$==null||$())},style:{...M,...z.tooltipStyles,opacity:J!==void 0&&yn?J:void 0},ref:te},mt,b.createElement(m,{className:$t("react-tooltip-arrow",Fr.arrow,Cs.arrow,r,h&&Fr.noArrow),style:{...z.tooltipArrowStyles,background:U?`linear-gradient(to right bottom, transparent 50%, ${U} 50%)`:void 0,"--rt-arrow-size":`${X}px`},ref:ne})):null},OS=({content:e})=>b.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),ES=b.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:f="top",offset:d=10,wrapper:l="div",children:p=null,events:m=["hover"],openOnClick:g=!1,positionStrategy:w="absolute",middlewares:v,delayShow:x=0,delayHide:h=0,float:y=!1,hidden:I=!1,noArrow:S=!1,clickable:E=!1,closeOnEsc:P=!1,closeOnScroll:_=!1,closeOnResize:A=!1,openEvents:R,closeEvents:M,globalCloseEvents:j,imperativeModeOnly:K=!1,style:$,position:ce,isOpen:re,defaultIsOpen:pe=!1,disableStyleInjection:de=!1,border:be,opacity:F,arrowColor:L,arrowSize:B,setIsOpen:H,afterShow:J,afterHide:U,disableTooltip:X,role:ee="tooltip"},Y)=>{const[te,ne]=b.useState(r),[ue,k]=b.useState(o),[ve,z]=b.useState(f),[Ye,Ce]=b.useState(c),[lt,Be]=b.useState(d),[ot,Se]=b.useState(x),[Ge,ht]=b.useState(h),[wt,bt]=b.useState(y),[Ze,et]=b.useState(I),[De,q]=b.useState(l),[he,Oe]=b.useState(m),[fn,pn]=b.useState(w),[hn,It]=b.useState(null),[Pe,sr]=b.useState(null),Tn=b.useRef(de),{anchorRefs:An,activeAnchor:_t}=_f(e),mn=Ke=>Ke==null?void 0:Ke.getAttributeNames().reduce((dt,oe)=>{var me;return oe.startsWith("data-tooltip-")&&(dt[oe.replace(/^data-tooltip-/,"")]=(me=Ke==null?void 0:Ke.getAttribute(oe))!==null&&me!==void 0?me:null),dt},{}),Rn=Ke=>{const dt={place:oe=>{var me;z((me=oe)!==null&&me!==void 0?me:f)},content:oe=>{ne(oe??r)},html:oe=>{k(oe??o)},variant:oe=>{var me;Ce((me=oe)!==null&&me!==void 0?me:c)},offset:oe=>{Be(oe===null?d:Number(oe))},wrapper:oe=>{var me;q((me=oe)!==null&&me!==void 0?me:l)},events:oe=>{const me=oe==null?void 0:oe.split(" ");Oe(me??m)},"position-strategy":oe=>{var me;pn((me=oe)!==null&&me!==void 0?me:w)},"delay-show":oe=>{Se(oe===null?x:Number(oe))},"delay-hide":oe=>{ht(oe===null?h:Number(oe))},float:oe=>{bt(oe===null?y:oe==="true")},hidden:oe=>{et(oe===null?I:oe==="true")},"class-name":oe=>{It(oe)}};Object.values(dt).forEach(oe=>oe(null)),Object.entries(Ke).forEach(([oe,me])=>{var mt;(mt=dt[oe])===null||mt===void 0||mt.call(dt,me)})};b.useEffect(()=>{ne(r)},[r]),b.useEffect(()=>{k(o)},[o]),b.useEffect(()=>{z(f)},[f]),b.useEffect(()=>{Ce(c)},[c]),b.useEffect(()=>{Be(d)},[d]),b.useEffect(()=>{Se(x)},[x]),b.useEffect(()=>{ht(h)},[h]),b.useEffect(()=>{bt(y)},[y]),b.useEffect(()=>{et(I)},[I]),b.useEffect(()=>{pn(w)},[w]),b.useEffect(()=>{Tn.current!==de&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[de]),b.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:de==="core",disableBase:de}}))},[]),b.useEffect(()=>{var Ke;const dt=new Set(An);let oe=n;if(!oe&&e&&(oe=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),oe)try{document.querySelectorAll(oe).forEach(ae=>{dt.add({current:ae})})}catch{console.warn(`[react-tooltip] "${oe}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&dt.add({current:me}),!dt.size)return()=>null;const mt=(Ke=Pe??me)!==null&&Ke!==void 0?Ke:_t.current,yn=new MutationObserver(ae=>{ae.forEach(le=>{var $e;if(!mt||le.type!=="attributes"||!(!(($e=le.attributeName)===null||$e===void 0)&&$e.startsWith("data-tooltip-")))return;const Je=mn(mt);Rn(Je)})}),G={attributes:!0,childList:!1,subtree:!1};if(mt){const ae=mn(mt);Rn(ae),yn.observe(mt,G)}return()=>{yn.disconnect()}},[An,_t,Pe,t,n]),b.useEffect(()=>{$!=null&&$.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),be&&!Eu("border",`${be}`)&&console.warn(`[react-tooltip] "${be}" is not a valid \`border\`.`),$!=null&&$.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),F&&!Eu("opacity",`${F}`)&&console.warn(`[react-tooltip] "${F}" is not a valid \`opacity\`.`)},[]);let Pn=p;const gn=b.useRef(null);if(i){const Ke=i({content:(Pe==null?void 0:Pe.getAttribute("data-tooltip-content"))||te||null,activeAnchor:Pe});Pn=Ke?b.createElement("div",{ref:gn,className:"react-tooltip-content-wrapper"},Ke):null}else te&&(Pn=te);ue&&(Pn=b.createElement(OS,{content:ue}));const en={forwardRef:Y,id:e,anchorId:t,anchorSelect:n,className:$t(s,hn),classNameArrow:a,content:Pn,contentWrapperRef:gn,place:ve,variant:Ye,offset:lt,wrapper:De,events:he,openOnClick:g,positionStrategy:fn,middlewares:v,delayShow:ot,delayHide:Ge,float:wt,hidden:Ze,noArrow:S,clickable:E,closeOnEsc:P,closeOnScroll:_,closeOnResize:A,openEvents:R,closeEvents:M,globalCloseEvents:j,imperativeModeOnly:K,style:$,position:ce,isOpen:re,defaultIsOpen:pe,border:be,opacity:F,arrowColor:L,arrowSize:B,setIsOpen:H,afterShow:J,afterHide:U,disableTooltip:X,activeAnchor:Pe,setActiveAnchor:Ke=>sr(Ke),role:ee};return b.createElement(xS,{...en})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||xu({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s;--rt-arrow-size:8px}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit;z-index:-1}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||xu({css:`
51
- .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:var(--rt-arrow-size);height:var(--rt-arrow-size)}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function _S(){return u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[u.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[u.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),u.jsx("defs",{children:u.jsx("clipPath",{id:"clip0_2896_16290",children:u.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function Nf({id:e,tooltipText:t}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:_S()}),u.jsx(ES,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function NS(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};t.forEach(o=>{var a,c;const{field:i,value:s}=o;if(s===null){const f=n[i];delete n[i],f&&((a=e==null?void 0:e.read)!=null&&a.selectedValueMappings)&&e.read.selectedValueMappings[f]&&delete e.read.selectedValueMappings[f]}else{const f=n[i];n[i]=s,f&&f!==s&&((c=e==null?void 0:e.read)!=null&&c.selectedValueMappings)&&e.read.selectedValueMappings[f]&&delete e.read.selectedValueMappings[f]}})}function Ri(e,t,n){t(e,r=>NS(r,n))}const TS="Each field must be mapped to a unique value";function nc({field:e,onSelectChange:t,allFields:n}){var h;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Zt(),[s,a]=b.useState(!0),{isError:c,removeError:f,getError:d}=un(),l=(h=r==null?void 0:r.read)==null?void 0:h.selectedFieldMappings,p=l==null?void 0:l[e.mapToName];b.useEffect(()=>{e._default&&!p&&o&&r&&Ri(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,p,r]);const m=b.useMemo(()=>n.map(y=>({id:y.fieldName,label:y.displayName,value:y.fieldName})),[n]),g=u.jsx(yf,{disabled:s,items:m,selectedValue:p||null,onSelectedItemChange:y=>{t({target:{name:e.mapToName,value:y==null?void 0:y.value}})},placeholder:"Please select one",style:{width:"100%"}}),w=b.useCallback(()=>{o&&(Ri(o,i,[{field:e.mapToName,value:null}]),c(we.MAPPING,o)&&f(we.MAPPING,o))},[e.mapToName,o,i,c,f]),{hasDuplicationError:v,errorMessage:x}=b.useMemo(()=>{const y=d(we.MAPPING,o),I=Array.isArray(y)&&y.length>0&&y.includes(e.mapToName);return{hasDuplicationError:I,errorMessage:I?TS:""}},[o,d,e.mapToName]);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[u.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),u.jsx("span",{children:(e==null?void 0:e.prompt)&&u.jsx(Nf,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[g,u.jsx(ze,{type:"button",variant:"ghost",onClick:w,children:"Clear"})]})]},e.mapToName),v&&u.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",x," "]},e.mapToName)]})}const AS="_formControl_9qd8d_1",RS="_formLabel_9qd8d_5",PS="_formLabelRequired_9qd8d_11",FS="_formInput_9qd8d_16",DS="_formInputInvalid_9qd8d_20",MS="_formError_9qd8d_24",kS="_disabled_9qd8d_30",lr={formControl:AS,formLabel:RS,formLabelRequired:PS,formInput:FS,formInputInvalid:DS,formError:MS,disabled:kS};function Xo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return u.jsxs("div",{className:$t(lr.formControl,{[lr.disabled]:r}),children:[t&&u.jsx("label",{htmlFor:e,className:$t(lr.formLabel,{[lr.formLabelRequired]:n}),children:t}),u.jsx("div",{id:e,className:$t(lr.formInput,{[lr.formInputInvalid]:o}),children:s}),o&&i&&u.jsx("div",{className:lr.formError,role:"alert",children:i})]})}function Tf({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(we.MAPPING,t,a),!0}return!1}function jS({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>u.jsx(Xo,{id:r.mapToName,children:u.jsx(nc,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function LS(){var g,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Zt(),{isError:r,removeError:o,setError:i}=un(),s=((g=t==null?void 0:t.read)==null?void 0:g.allFields)||[],{fieldMapping:a}=ut(),c=(w=t==null?void 0:t.read)==null?void 0:w.selectedFieldMappings,f=v=>{const{value:x,name:h}=v.target;!x||Tf({selectedFieldMappings:c,selectedObjectName:e,fieldName:h,fieldValue:x,setError:i})||(e&&Ri(e,n,[{field:h,value:x}]),r(we.MAPPING,h)&&o(we.MAPPING,h),e&&r(we.MAPPING,e)&&o(we.MAPPING,e))},d=b.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(v=>!v.fieldName),[a,e]),l=b.useMemo(()=>{var h;return(((h=t==null?void 0:t.read)==null?void 0:h.optionalMapFields)||[]).filter(y=>!d.some(I=>I.mapToName===y.mapToName))},[t,d]),p=d.length>0;return l.length>0||p?u.jsxs(u.Fragment,{children:[u.jsx(Ft,{string:"Map the following optional fields"}),u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[l==null?void 0:l.map(v=>u.jsx(Xo,{id:v.mapToName,children:u.jsx(nc,{allFields:s,field:v,onSelectChange:f})},v.mapToName)),p&&u.jsx(jS,{dynamicFieldMappings:d,onSelectChange:f,allFields:s})]})]}):null}function KS(){var f;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Zt(),{isError:r,removeError:o,setError:i}=un(),s=(f=t==null?void 0:t.read)==null?void 0:f.selectedFieldMappings,a=d=>{const{value:l,name:p}=d.target;!l||Tf({selectedFieldMappings:s,selectedObjectName:e,fieldName:p,fieldValue:l,setError:i})||(e&&Ri(e,n,[{field:p,value:l}]),r(we.MAPPING,p)&&o(we.MAPPING,p),e&&r(we.MAPPING,e)&&o(we.MAPPING,e))},c=b.useMemo(()=>{var d;return((d=t==null?void 0:t.read)==null?void 0:d.requiredMapFields)||[]},[t]);return c!=null&&c.length?u.jsxs(u.Fragment,{children:[u.jsx(Ft,{string:"Map the following fields"}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(d=>{var l;return u.jsx(Xo,{id:d.mapToName,isInvalid:r(we.MAPPING,d.mapToName),errorMessage:"* required",children:u.jsx(nc,{allFields:((l=t==null?void 0:t.read)==null?void 0:l.allFields)||[],field:d,onSelectChange:a})},d.mapToName)})})]}):null}const $S=(e,t)=>e.filter(n=>!t.has(n));function US(){var p,m,g;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Zt(),{fieldMapping:r}=ut(),o=((p=t==null?void 0:t.read)==null?void 0:p.selectedFieldMappings)||{},i=Object.keys(o),s=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],a=((g=t==null?void 0:t.read)==null?void 0:g.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(w=>!w.fieldName):[],f=s.concat(c,a).map(w=>w.mapToName),d=new Set(f),l=$S(i,d);b.useEffect(()=>{e&&l.length&&Ri(e,n,l.map(w=>({field:w,value:null})))},[e,n,l])}const VS={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function qS({children:e,style:t}){return u.jsx(_n,{style:{...VS,...t},children:e})}function BS(){var f,d,l;const{data:e}=nr(),{hydratedRevision:t}=fi(),{selectedObjectName:n}=Zt(),{providerName:r}=pt(),o=e==null?void 0:e.appName,i=(l=(d=(f=t==null?void 0:t.content)==null?void 0:f.read)==null?void 0:d.objects)==null?void 0:l.find(p=>p.objectName===n),s=(i==null?void 0:i.displayName)||n&&an(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&an(a);return c&&o&&r?u.jsx(qS,{style:{marginTop:"1rem"},children:u.jsxs("p",{style:{margin:"1rem 0"},children:[u.jsx("b",{children:c})," in ",o," is mapped to"," ",u.jsx("b",{children:s})," in ",r,"."]})}):null}function Au(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Af(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Au(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():Au(e[o],null)}}}}function si(...e){return V.useCallback(Af(...e),e)}function Yo(e,t=[]){let n=[];function r(i,s){const a=V.createContext(s),c=n.length;n=[...n,s];const f=l=>{var x;const{scope:p,children:m,...g}=l,w=((x=p==null?void 0:p[e])==null?void 0:x[c])||a,v=V.useMemo(()=>g,Object.values(g));return u.jsx(w.Provider,{value:v,children:m})};f.displayName=i+"Provider";function d(l,p){var w;const m=((w=p==null?void 0:p[e])==null?void 0:w[c])||a,g=V.useContext(m);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${l}\` must be used within \`${i}\``)}return[f,d]}const o=()=>{const i=n.map(s=>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,HS(o,...t)]}function HS(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:f})=>{const l=c(i)[`__scope${f}`];return{...a,...l}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Gt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var Pi=globalThis!=null&&globalThis.document?V.useLayoutEffect:()=>{},JS=V[" useInsertionEffect ".trim().toString()]||Pi;function rc({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=WS({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const d=V.useRef(e!==void 0);V.useEffect(()=>{const l=d.current;l!==a&&console.warn(`${r} is changing from ${l?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const f=V.useCallback(d=>{var l;if(a){const p=zS(d)?d(e):d;p!==e&&((l=s.current)==null||l.call(s,p))}else i(d)},[a,e,i,s]);return[c,f]}function WS({defaultProp:e,onChange:t}){const[n,r]=V.useState(e),o=V.useRef(n),i=V.useRef(t);return JS(()=>{i.current=t},[t]),V.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function zS(e){return typeof e=="function"}function GS(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])}function QS(e){const[t,n]=V.useState(void 0);return Pi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const c=i.borderBoxSize,f=Array.isArray(c)?c[0]:c;s=f.inlineSize,a=f.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function XS(e,t){return V.useReducer((n,r)=>t[n][r]??n,e)}var ic=e=>{const{present:t,children:n}=e,r=YS(t),o=typeof n=="function"?n({present:r.isPresent}):V.Children.only(n),i=si(r.ref,ZS(o));return typeof n=="function"||r.isPresent?V.cloneElement(o,{ref:i}):null};ic.displayName="Presence";function YS(e){const[t,n]=V.useState(),r=V.useRef(null),o=V.useRef(e),i=V.useRef("none"),s=e?"mounted":"unmounted",[a,c]=XS(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return V.useEffect(()=>{const f=lo(r.current);i.current=a==="mounted"?f:"none"},[a]),Pi(()=>{const f=r.current,d=o.current;if(d!==e){const p=i.current,m=lo(f);e?c("MOUNT"):m==="none"||(f==null?void 0:f.display)==="none"?c("UNMOUNT"):c(d&&p!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Pi(()=>{if(t){let f;const d=t.ownerDocument.defaultView??window,l=m=>{const w=lo(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&w&&(c("ANIMATION_END"),!o.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",f=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},p=m=>{m.target===t&&(i.current=lo(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{d.clearTimeout(f),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:V.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function lo(e){return(e==null?void 0:e.animationName)||"none"}function ZS(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ca(e){const t=ex(e),n=V.forwardRef((r,o)=>{const{children:i,...s}=r,a=V.Children.toArray(i),c=a.find(nx);if(c){const f=c.props.children,d=a.map(l=>l===c?V.Children.count(f)>1?V.Children.only(null):V.isValidElement(f)?f.props.children:null:l);return u.jsx(t,{...s,ref:o,children:V.isValidElement(f)?V.cloneElement(f,void 0,d):null})}return u.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function ex(e){const t=V.forwardRef((n,r)=>{const{children:o,...i}=n;if(V.isValidElement(o)){const s=ix(o),a=rx(i,o.props);return o.type!==V.Fragment&&(a.ref=r?Af(r,s):s),V.cloneElement(o,a)}return V.Children.count(o)>1?V.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tx=Symbol("radix.slottable");function nx(e){return V.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tx}function rx(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const c=i(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function ix(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 ox=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Nn=ox.reduce((e,t)=>{const n=ca(`Primitive.${t}`),r=V.forwardRef((o,i)=>{const{asChild:s,...a}=o,c=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Zo="Checkbox",[sx,CO]=Yo(Zo),[ax,oc]=sx(Zo);function cx(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:a,onCheckedChange:c,required:f,value:d="on",internal_do_not_use_render:l}=e,[p,m]=rc({prop:n,defaultProp:o??!1,onChange:c,caller:Zo}),[g,w]=V.useState(null),[v,x]=V.useState(null),h=V.useRef(!1),y=g?!!s||!!g.closest("form"):!0,I={checked:p,disabled:i,setChecked:m,control:g,setControl:w,name:a,form:s,value:d,hasConsumerStoppedPropagationRef:h,required:f,defaultChecked:Xn(o)?!1:o,isFormControl:y,bubbleInput:v,setBubbleInput:x};return u.jsx(ax,{scope:t,...I,children:ux(l)?l(I):r})}var Rf="CheckboxTrigger",Pf=V.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:s,disabled:a,checked:c,required:f,setControl:d,setChecked:l,hasConsumerStoppedPropagationRef:p,isFormControl:m,bubbleInput:g}=oc(Rf,e),w=si(o,d),v=V.useRef(c);return V.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const h=()=>l(v.current);return x.addEventListener("reset",h),()=>x.removeEventListener("reset",h)}},[i,l]),u.jsx(Nn.button,{type:"button",role:"checkbox","aria-checked":Xn(c)?"mixed":c,"aria-required":f,"data-state":kf(c),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:w,onKeyDown:Gt(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:Gt(n,x=>{l(h=>Xn(h)?!0:!h),g&&m&&(p.current=x.isPropagationStopped(),p.current||x.stopPropagation())})})});Pf.displayName=Rf;var sc=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c,onCheckedChange:f,form:d,...l}=e;return u.jsx(cx,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:a,required:s,onCheckedChange:f,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:p})=>u.jsxs(u.Fragment,{children:[u.jsx(Pf,{...l,ref:t,__scopeCheckbox:n}),p&&u.jsx(Mf,{__scopeCheckbox:n})]})})});sc.displayName=Zo;var Ff="CheckboxIndicator",ac=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=oc(Ff,n);return u.jsx(ic,{present:r||Xn(i.checked)||i.checked===!0,children:u.jsx(Nn.span,{"data-state":kf(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});ac.displayName=Ff;var Df="CheckboxBubbleInput",Mf=V.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:s,required:a,disabled:c,name:f,value:d,form:l,bubbleInput:p,setBubbleInput:m}=oc(Df,e),g=si(n,m),w=GS(i),v=QS(r);V.useEffect(()=>{const h=p;if(!h)return;const y=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(y,"checked").set,E=!o.current;if(w!==i&&S){const P=new Event("click",{bubbles:E});h.indeterminate=Xn(i),S.call(h,Xn(i)?!1:i),h.dispatchEvent(P)}},[p,w,i,o]);const x=V.useRef(Xn(i)?!1:i);return u.jsx(Nn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??x.current,required:a,disabled:c,name:f,value:d,form:l,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Mf.displayName=Df;function ux(e){return typeof e=="function"}function Xn(e){return e==="indeterminate"}function kf(e){return Xn(e)?"indeterminate":e?"checked":"unchecked"}function jf(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 lx=["color"],Lf=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=jf(e,lx);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),b.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),dx=["color"],fx=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=jf(e,dx);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),b.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const px="_checkboxGroupContainer_hqfeu_1",hx="_stack_hqfeu_6",mx="_selectAllContainer_hqfeu_10",gx="_fieldContainer_hqfeu_17",yx="_checkbox_hqfeu_1",ai={checkboxGroupContainer:px,stack:hx,selectAllContainer:mx,fieldContainer:gx,checkbox:yx};function vx({id:e,isChecked:t,label:n,onCheckedChange:r}){return u.jsxs("div",{className:ai.fieldContainer,children:[u.jsx(sc,{className:ai.checkbox,id:e,onCheckedChange:r,checked:t,children:u.jsx(ac,{children:u.jsx(Lf,{})})}),u.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function wx({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return u.jsxs("div",{className:ai.selectAllContainer,children:[u.jsx(sc,{className:ai.checkbox,id:e,onCheckedChange:r,checked:o?"indeterminate":t,children:u.jsxs(ac,{children:[o&&u.jsx(fx,{}),t===!0&&u.jsx(Lf,{})]})}),u.jsx("label",{htmlFor:e,children:n})]})}function bx({children:e}){return u.jsx("div",{className:ai.checkboxGroupContainer,children:e})}function Ix({children:e}){return u.jsx("div",{className:ai.stack,children:e})}const Cx="_paginationContainer_1p51x_1",Sx="_pageInfo_1p51x_7",xx="_searchContainer_1p51x_13",Ox="_searchInput_1p51x_17",Ex="_noResults_1p51x_21",wi={paginationContainer:Cx,pageInfo:Sx,searchContainer:xx,searchInput:Ox,noResults:Ex};function Kf({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:o=!0,searchPlaceholder:i="Search fields..."}){const[s,a]=b.useState(1),[c,f]=b.useState(""),d=e.filter(y=>y.label.toLowerCase().includes(c.toLowerCase())),l=Math.ceil(d.length/n),p=(s-1)*n,m=p+n,g=d.slice(p,m),w=y=>{f(y),a(1)},v=y=>{d.forEach(I=>{t(I.id,y)})},x=d.length>0&&d.every(y=>y.isChecked),h=d.some(y=>y.isChecked);return u.jsxs(bx,{children:[o&&u.jsx("div",{className:wi.searchContainer,children:u.jsx(Id,{id:"field-search",type:"text",placeholder:i,value:c,onChange:y=>w(y.target.value),className:wi.searchInput})}),r&&e.length>=2&&u.jsx(wx,{id:"select-all-fields",isChecked:x,label:`Select all ${d.length} ${c?"matching ":""}fields`,onCheckedChange:v,isIndeterminate:h&&!x}),u.jsx(Ix,{children:g.map(y=>u.jsx(vx,{id:y.id,isChecked:y.isChecked,label:y.label,onCheckedChange:I=>t(y.id,I===!0)},y.id))}),l>1&&u.jsxs("div",{className:wi.paginationContainer,children:[u.jsx(ze,{type:"button",onClick:()=>a(y=>Math.max(1,y-1)),disabled:s===1,variant:"ghost",children:"<"}),u.jsxs("span",{className:wi.pageInfo,children:[s," of ",l]}),u.jsx(ze,{type:"button",onClick:()=>a(y=>Math.min(l,y+1)),disabled:s===l,variant:"ghost",children:">"})]}),d.length===0&&c&&u.jsxs("div",{className:wi.noResults,children:['No fields found matching "',c,'"']})]})}function _x(e,t,n){var o;const r=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};r[t]=n,n||delete r[t]}function Nx(e,t,n,r){t(e,o=>_x(o,n,r))}function Tx(){var f,d;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Zt(),o=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,i=(d=t==null?void 0:t.read)==null?void 0:d.optionalFields,s=(l,p)=>{r&&t&&Nx(r,n,l,p)},a=b.useMemo(()=>(i==null?void 0:i.filter(l=>!rr(l)&&"fieldName"in l&&"displayName"in l).map(l=>({id:l.fieldName,label:l.displayName,isChecked:!!(o!=null&&o[l.fieldName])})).sort((l,p)=>l.label.localeCompare(p.label)))||[],[i,o]);return!!(i&&i.length>0)&&u.jsxs(u.Fragment,{children:[u.jsx(Ft,{string:`${e} reads the following optional fields`}),u.jsx(Kf,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${i==null?void 0:i.length}`)]})}function Ax(){return u.jsx(Tx,{})}const Rx={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 Px({children:e,style:t,...n}){return u.jsx("span",{style:{...Rx,...t},...n,children:e})}function Fx(){var n,r,o;const{configureState:e}=Zt(),{appName:t}=nr();return u.jsxs(u.Fragment,{children:[u.jsx(Ft,{string:`${t} reads the following fields`}),u.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(r=(n=e==null?void 0:e.read)==null?void 0:n.requiredFields)!=null&&r.length?(o=e.read)==null?void 0:o.requiredFields.map(i=>rr(i)?null:u.jsx(Px,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function Dx(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 $f(e,t,n,r,o){t(e,i=>Dx(i,e,n,r,o))}function Ss(e){return e.mapToDisplayName||e.mapToName||e.fieldName||""}function Mx(e,t){if(!e.fieldName)return{isValid:!1,errorMessage:"Field name is missing"};const n=t==null?void 0:t.valueType;if(!["singleSelect","multiSelect"].includes(n||""))return{isValid:!1,errorMessage:"fieldName is not a singleSelect or multiSelect"};const r=t==null?void 0:t.values;if(!r)return{isValid:!1,errorMessage:"Field values array is missing"};const o=Object.keys(r).length,i=Object.keys((e==null?void 0:e.mappedValues)||[]).length;return o!==i?{isValid:!1,errorMessage:"field values and the values to be mapped are not of the same length"}:{isValid:!0}}function kx(e,t,n){const r=Object.values(t).filter(Boolean),o=t[n];return e.filter(i=>{const s=i.value===o,a=r.includes(i.value);return s||!a})}function jx({string:e,fieldName:t}){return u.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[u.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,u.jsx("b",{children:t})]}),u.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:u.jsx(Jo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Lx({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r}){var m;const{configureState:o,selectedObjectName:i,setConfigureState:s}=Zt(),a=b.useMemo(()=>{var g,w;return((w=(g=o==null?void 0:o.read)==null?void 0:g.selectedValueMappings)==null?void 0:w[n])||{}},[(m=o==null?void 0:o.read)==null?void 0:m.selectedValueMappings,n]),c=b.useMemo(()=>a==null?void 0:a[e.mappedValue],[a,e.mappedValue]),f=b.useMemo(()=>r.map(g=>({id:g.value,label:g.displayValue,value:g.value})),[r]),d=b.useCallback(g=>{g&&t({target:{name:e.mappedValue,value:g.value,fieldName:n}})},[t,n,e.mappedValue]),l=b.useMemo(()=>u.jsx(yf,{items:f,selectedValue:c||null,onSelectedItemChange:d,placeholder:"Please select one",style:{borderRadius:"8px",width:"100%"}},c),[c,f,d]),p=b.useCallback(()=>{i&&$f(i,s,e.mappedValue,"",n)},[i,s,e.mappedValue,n]);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[u.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:u.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[l,u.jsx(ze,{type:"button",variant:"ghost",onClick:p,children:"Clear"})]})]},e.mappedValue)}function Kx(){var c,f;const{fieldMapping:e}=ut(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Zt(),o=(c=n==null?void 0:n.read)==null?void 0:c.selectedFieldMappings,i=(f=n==null?void 0:n.read)==null?void 0:f.selectedValueMappings,s=b.useMemo(()=>{const d=t&&e?Object.values(e[t]||{}).flat().filter(l=>l.mappedValues).map(l=>({...l})):[];if(o)for(let l=0;l<d.length;l+=1){const{mapToName:p}=d[l];o!=null&&o[p]&&(d[l].fieldName=o[p])}return d},[t,e,o]),a=b.useCallback(d=>{const{value:l,name:p,fieldName:m}=d.target;l&&t&&$f(t,r,p,l,m)},[t,r]);return s!=null&&s.length?u.jsx(u.Fragment,{children:s.map(d=>{var m,g,w;const l=(g=(m=n==null?void 0:n.read)==null?void 0:m.allFieldsMetadata)==null?void 0:g[d.fieldName],p=Mx(d,l);return p.isValid?u.jsxs(u.Fragment,{children:[u.jsx(jx,{string:"Map the values for ",fieldName:Ss(d)}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:u.jsx(Xo,{id:Ss(d),children:(w=d==null?void 0:d.mappedValues)==null?void 0:w.map(v=>{const x=(l==null?void 0:l.values)||[],h=(i==null?void 0:i[d.fieldName])||{},y=kx(x,h,v.mappedValue);return u.jsx(Lx,{allValueOptions:y,mappedValue:v,onSelectChange:a,fieldName:(d==null?void 0:d.fieldName)||""},`${v.mappedValue}-${d.fieldName}`)})},Ss(d))})]}):(console.error(p.errorMessage,d),null)})}):null}const $x=!1;function Ux(){return US(),u.jsxs(u.Fragment,{children:[u.jsx(BS,{}),u.jsx(Fx,{}),u.jsx(KS,{}),u.jsx(LS,{}),u.jsx(Kx,{}),u.jsx(Ax,{}),$x]})}function Vx(e,t,n){var r,o,i;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const s=e.write.selectedWriteObjects;if(n&&(s[t]={objectName:t}),n||delete s[t],(i=(o=e==null?void 0:e.write)==null?void 0:o.savedConfig)!=null&&i.selectedWriteObjects){const a=e.write.savedConfig.selectedWriteObjects,f=!Rb(a,s);e.write.isWriteModified=f}}}function qx(e,t,n,r){t(e,o=>{Vx(o,n,r)})}function Bx(){var f,d;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Zt(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(d=n==null?void 0:n.write)==null?void 0:d.writeObjects,s=(l,p)=>{t&&n&&qx(t,r,l,p)},a=!!i,c=(i==null?void 0:i.map(l=>({id:l.objectName,label:l.displayName,isChecked:!!(o!=null&&o[l.objectName])})))||[];return a&&u.jsxs(u.Fragment,{children:[u.jsx(Ft,{string:`Allow ${e} to write to these objects`}),u.jsx(Kf,{items:c,onItemChange:s,showSelectAll:i.length>=2})]})}function Hx(){return u.jsx(u.Fragment,{children:u.jsx(Bx,{})})}function Uf({resetComponent:e,onDisconnectSuccess:t}){return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[u.jsx(Ft,{string:"Remove connection"}),u.jsx("p",{children:"Click to disconnect your connection from the provider."}),u.jsx(Ed,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const Jx="_authenticationRow_1g2ms_1",Wx="_field_1g2ms_8",zx="_value_1g2ms_12",xs={authenticationRow:Jx,field:Wx,value:zx};function Ru({label:e,value:t}){return u.jsxs("div",{className:xs.authenticationRow,children:[u.jsx("div",{className:xs.field,children:e}),u.jsx("div",{className:xs.value,children:t})]})}function Gx(){const{selectedConnection:e}=Yt(),{providerName:t}=pt(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return u.jsxs(u.Fragment,{children:[u.jsx(Ft,{string:"Connection details"}),u.jsxs("div",{style:{paddingBottom:"1rem"},children:[u.jsx(Ru,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),u.jsx(Ru,{label:"Status",value:an((e==null?void 0:e.status)||"")})]})]})}const Qx=()=>{const e=ct(),t=qe();return En({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:o})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:o}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),We(n)}})};function Vf({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=Le(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=ut(),[c,f]=b.useState(!1),d=!r||!o||!(i!=null&&i.id)||c,l=Qx(),p=async()=>{d||(f(!0),console.warn("uninstalling installation",{projectIdOrName:r,integrationId:o,installationId:i.id}),l.mutate({projectIdOrName:r,integrationId:o,installationId:i.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",i.id),a==null||a(i==null?void 0:i.id),s()},onSettled:()=>f(!1)}))},m=c?"Uninstalling...":e,g=u.jsx(ze,{type:"button",onClick:p,disabled:d,variant:t,style:n,children:m});return i!=null&&i.id?g:null}function Xx(){const{installation:e}=ut(),{providerName:t}=pt();return e?u.jsxs(u.Fragment,{children:[u.jsx(Ft,{string:"Uninstall entire integration"}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall the entire ",t," ","integration. You will lose any configuration you've set up."]}):u.jsx("p",{children:"You've successfully uninstalled the integration."}),u.jsx(Vf,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function Yx(){const{installation:e,resetComponent:t}=ut();return u.jsxs(u.Fragment,{children:[u.jsx(Gx,{}),u.jsx(Ra,{}),e&&u.jsx(Xx,{}),!e&&u.jsx(Uf,{resetComponent:t})]})}function qf({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var ce,re,pe,de,be,F,L,B;const{installation:i}=Ar(),{hydratedRevision:s,loading:a}=fi(),{configureState:c,selectedObjectName:f}=Zt(),d=i==null?void 0:i.config,l=d&&f&&!!od(d,f)||!1,p=f?yd(d,f):void 0,m=(ce=c==null?void 0:c.read)==null?void 0:ce.selectedFieldMappings,g=!ld(p,m),w=s&&f?Na(d,s,f):void 0,v=(re=c==null?void 0:c.read)==null?void 0:re.selectedOptionalFields,x=!ud(w,v),h=f?(F=(be=(de=(pe=d==null?void 0:d.content)==null?void 0:pe.read)==null?void 0:de.objects)==null?void 0:be[f])==null?void 0:F.selectedValueMappings:void 0,y=(L=c==null?void 0:c.read)==null?void 0:L.selectedValueMappings,I=!dd(h,y),S=x||g||I,E=(B=c==null?void 0:c.write)==null?void 0:B.isWriteModified,R=a||n||!c||!f||!(S||E||r||f!==_r&&!l),M=f===_r,j=f===_o,K=u.jsx(ze,{type:"submit",disabled:R,children:r?"Install":"Save"}),$=u.jsx(ze,{type:"button",onClick:t,disabled:R,variant:"ghost",children:"Reset"});return n?u.jsx(Ti,{}):u.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[u.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!j&&u.jsxs(u.Fragment,{children:[K,$]})}),u.jsxs(_n,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&u.jsx(Ki,{children:typeof o=="string"?o:"Installation Failed."}),a&&u.jsx(Ti,{}),s&&!M&&!j&&u.jsx(Ux,{}),s&&M&&!j&&u.jsx(Hx,{}),!a&&j&&u.jsx(Yx,{})]})]})}const Bf=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=ut(),{hydratedRevision:s,loading:a}=fi(),{selectedObjectName:c}=Td(),{selectedConnection:f}=Yt(),d=ol(),{projectIdOrName:l}=Le(),{resetBoundary:p,setErrors:m,setError:g,getError:w}=un(),{resetConfigureState:v,objectConfigurationsState:x,resetPendingConfigurationState:h}=Pa(),y=vd(c||"",x),{onNextIncompleteTab:I}=SI(),S=b.useCallback(()=>{p(we.INSTALLATION_MUTATION)},[p]),E=b.useCallback(_=>_?A=>{g(we.INSTALLATION_MUTATION,_,A)}:A=>{console.error("objectName is required to set installation error: ",A)},[g]),P=b.useCallback(_=>_?w(we.INSTALLATION_MUTATION,_):"",[w]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:f,apiKey:d,projectIdOrName:l,resetBoundary:p,setErrors:m,setMutateInstallationError:E,getMutateInstallationError:P,resetMutateInstallationErrorState:S,resetConfigureState:v,objectConfigurationsState:x,resetPendingConfigurationState:h,configureState:y,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:I}},Zx=void 0;function e0(){const{consumerRef:e,setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,selectedConnection:i,resetBoundary:s,setErrors:a,setMutateInstallationError:c,getMutateInstallationError:f,resetMutateInstallationErrorState:d,resetConfigureState:l,objectConfigurationsState:p,resetPendingConfigurationState:m,configureState:g,onInstallSuccess:w,onNextIncompleteTab:v}=Bf(),[x,h]=b.useState(!1),{createInstallation:y}=ed(),I=o===_r,S=f(o),E=b.useCallback(()=>{s(we.MAPPING),n!=null&&n.content&&!r&&o&&pd(n,Zx,o,l)},[s,n,r,o,l]);b.useEffect(()=>{!g&&(n!=null&&n.content)&&!r&&E()},[g,p,n,r,E]);const P=()=>{d();const{requiredMapFields:R,selectedFieldMappings:M}=(g==null?void 0:g.read)||{},{errorList:j}=cd(R,M,a);if(!(j.length>0))if(o&&(i!=null&&i.id)&&e&&n){h(!0);const K=kb(g,o,n,e);if(!K){console.error("Error when generating createConfig from configureState"),h(!1);return}y({config:K.content,onSuccess:$=>{t($),w==null||w($.id,$.config),h(!1),m(o),v()},onError:$=>{c(o)($.message),h(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},_=()=>{if(d(),o&&(i!=null&&i.id)&&e&&n){h(!0);const R=Lb(g,n,e);if(!R){console.error("Error when generating createConfig from configureState"),h(!1);return}y({config:R.content,onSuccess:M=>{t(M),w==null||w(M.id,M.config),h(!1),m(o),v()},onError:M=>{c(o)(M.message),h(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},A=R=>{R.preventDefault(),I?_():P()};return u.jsx(qf,{errorMsg:S,isCreateMode:!0,isLoading:x,onSave:A,onReset:E})}const t0=(e,t,n,r)=>{const o=hd(e),i=md(e),s=gd(e),a={content:{read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:r}}}}};return Li(n)&&(a.content||(a.content={}),a.content.proxy={enabled:!0}),a},n0=(e,t)=>{const r={content:{write:{objects:wd(e)}}};return Li(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r};function r0({installation:e}){const{setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,resetBoundary:i,setErrors:s,setMutateInstallationError:a,getMutateInstallationError:c,resetConfigureState:f,resetPendingConfigurationState:d,configureState:l,onUpdateSuccess:p,onNextIncompleteTab:m}=Bf(),{updateInstallation:g}=td(),[w,v]=b.useState(!1),x=o===_r,h=c(o),{config:y}=e,I=b.useCallback(()=>{i(we.MAPPING),n!=null&&n.content&&!r&&o&&pd(n,y,o,f)},[i,n,r,o,y,f]);b.useEffect(()=>{l||I()},[l,I]);const S=b.useMemo(()=>{var R,M,j;return(j=(M=(R=n==null?void 0:n.content)==null?void 0:R.read)==null?void 0:M.objects)==null?void 0:j.find(K=>(K==null?void 0:K.objectName)===o)},[n,o]),E=()=>{const{requiredMapFields:A,selectedFieldMappings:R}=(l==null?void 0:l.read)||{},{errorList:M}=cd(A,R,s);if(!(M.length>0))if(n&&l&&o&&S){v(!0);const j=t0(l,o,n,S.backfill);if(!j){console.error("Error when generating updateConfig from configureState"),v(!1);return}g({config:j.content,onSuccess:K=>{t(K),p==null||p(K.id,K.config),v(!1),d(o),m()},onError:K=>{a(o)(K.message),v(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},P=()=>{if(l&&n){v(!0);const A=n0(l,n);if(!A){console.error("Error when generating write updateConfig from configureState"),v(!1);return}g({config:A.content,onSuccess:R=>{t(R),p==null||p(R.id,R.config),v(!1),d(o),m()},onError:R=>{a(o)(R.message),v(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},_=A=>{A.preventDefault(),x?P():E()};return u.jsx(qf,{errorMsg:h,onSave:_,onReset:I,isLoading:w})}function i0(){const{integrationObj:e,installation:t}=ut();return e?t&&e?u.jsx(r0,{installation:t}):u.jsx(e0,{}):u.jsx(zl,{message:"We can't load the integration"})}function o0(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),u.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function cc({text:e,children:t}){return u.jsx(li,{children:u.jsxs(_n,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[u.jsx(o0,{}),u.jsx("p",{children:e}),t]})})}function s0({provider:e}){const{providerName:t}=pt(e),n=`You have successfully installed your ${t} integration.`;return u.jsx(cc,{text:n,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(Vf,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const a0=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function c0({children:e}){var S;const t=b.useRef(!1),{projectIdOrName:n}=Le(),{hydratedRevision:r,loading:o}=fi(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,onInstallSuccess:f,isIntegrationDeleted:d}=ut(),{mutate:l,isIdle:p,isPending:m,error:g,errorMsg:w}=Zl(),{selectedConnection:v,isConnectionsLoading:x}=Yt(),h=o||m||x,y=(S=r==null?void 0:r.content)==null?void 0:S.provider,I=a0(r);return b.useEffect(()=>{var E;if(!h&&!x&&r&&I&&!s&&v&&(i!=null&&i.id)&&!d&&y){const P={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:v==null?void 0:v.id,config:{content:{provider:y}}}};Li(r)===!0&&(P.installation.config.content.proxy=(E=r==null?void 0:r.content)==null?void 0:E.proxy),p&&!t.current&&(l(P,{onSuccess:_=>{f==null||f(_==null?void 0:_.id,_.config)}}),t.current=!0)}},[r,I,s,v,n,i==null?void 0:i.id,a,c,h,f,d,x,y,l,p]),I&&y&&s?u.jsx(s0,{provider:y}):g?u.jsx(zt,{message:w??"Create installation failed"}):i?h?u.jsx(di,{}):u.jsx("div",{children:e}):u.jsx(zt,{message:"We can't load the integration"})}function qi(){const e=ct(),t=qe();return En({mutationKey:["createConnection"],mutationFn:async n=>(await e()).connectionApi.generateConnection(n),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error creating connection and loading provider info"),We(n)}})}function u0({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Le(),f=qi(),d=b.useCallback(l=>{var w;const{apiKey:p,providerMetadata:m}=l,g={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(w=m==null?void 0:m.workspace)==null?void 0:w.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:p,...m&&{providerMetadata:m}}};f.mutate(g)},[c,i,o,r,n,e,f]);return a===null?u.jsx(rI,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function l0({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Le(),f=qi(),d=b.useCallback(l=>{var v;const{user:p,pass:m,providerMetadata:g}=l,w={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(v=g==null?void 0:g.workspace)==null?void 0:v.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:p,password:m},...g&&{providerMetadata:g}}};f.mutate(w)},[c,i,o,r,n,e,f]);return a===null?u.jsx(cI,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function Pu({url:e,prompt:t,inputName:n}){return u.jsx("p",{style:{color:"var(--amp-colors-text-muted)",display:"flex",justifyContent:"space-between"},children:u.jsxs("span",{children:[e?u.jsx(Ta,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:n})}):u.jsx("span",{children:n})," ",t&&u.jsx(Nf,{id:`docs-helper-text-${gb(n||(t==null?void 0:t.slice(0,50)))}`,tooltipText:t})]})})}function d0({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r}){var p,m;const[o,i]=b.useState({}),s=((p=e.metadata)==null?void 0:p.input)||[],a=g=>{const{name:w,value:v}=g.currentTarget;i(x=>({...x,[w]:v.trim()}))},c=ei(s,o),f=n||!c,d=((m=e.customOpts)==null?void 0:m.inputs)||[],l=()=>{const g=Bo(s,o),w=Object.fromEntries(d.map(v=>[v.name,o[v.name]]));t({customAuth:w,providerMetadata:g})};return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[d.map(g=>u.jsxs("div",{children:[u.jsx(Pu,{url:g.docsURL,prompt:g.prompt,inputName:g.displayName}),u.jsx(Et.PasswordInput,{id:g.name,name:g.name,onChange:a,placeholder:""})]},g.name)),s.map(g=>u.jsxs("div",{children:[g.docsURL&&u.jsx(Pu,{url:g.docsURL,prompt:g.displayName||g.name,inputName:g.displayName||an(g.name.toLowerCase())}),u.jsx(Et.Input,{id:g.name,name:g.name,type:"text",placeholder:"",onChange:a})]},g.name)),u.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"submit",onClick:l,variant:r,children:"Next"})]})}function f0({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r}){return u.jsxs(ir,{children:[u.jsx(or,{children:`Set up ${e.displayName} integration`}),u.jsx(ln,{error:n}),u.jsx(d0,{providerInfo:e,handleSubmit:t,isButtonDisabled:r})]})}function p0({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s}){const{projectIdOrName:a}=Le(),c=qi(),[f,d]=b.useState(null),l=b.useCallback(p=>{var v;const{customAuth:m,providerMetadata:g}=p;d(null);const w={projectIdOrName:a,generateConnectionParams:{providerWorkspaceRef:(v=g==null?void 0:g.workspace)==null?void 0:v.value,groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:m,...g&&{providerMetadata:g}}};c.mutate(w,{onError:x=>{We(x,d)},onSuccess:()=>{d(null)}})},[a,o,r,n,t,e.name,c]);return s===null?u.jsx(f0,{providerInfo:e,handleSubmit:l,error:f}):i}function h0({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:o,title:i}){if(!i&&!r)throw new Error("Either title or providerName is required");return u.jsxs(ir,{children:[u.jsx(or,{children:i||`Set up ${r} integration`}),u.jsx(ln,{error:t}),o,u.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function m0({...e}){return u.jsx(h0,{...e})}function g0({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=Le(),f=qi(),d=b.useCallback(()=>{const l={projectIdOrName:c,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};f.mutate(l)},[c,o,r,n,t,e,f]);return s===null?u.jsx(m0,{handleSubmit:d,error:null,providerName:a}):i}const y0=()=>{const e=ct(),t=qe();return En({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function v0({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs(ir,{children:[u.jsx(or,{children:`Set up ${r} integration`}),u.jsx(Zb,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),u.jsx(ln,{error:t}),u.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const w0="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function b0({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return u.jsxs(ir,{children:[u.jsx(or,{children:"Enter your Salesforce subdomain"}),u.jsx(Ta,{href:w0,newTab:!0,children:"What is my Salesforce subdomain?"}),u.jsx(ln,{error:n}),u.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[u.jsx(Et.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),u.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),u.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function I0({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return u.jsxs(ir,{children:[u.jsxs(or,{children:["Enter your ",o," workspace"]}),u.jsx(ln,{error:n}),u.jsx("br",{}),i.map(s=>u.jsx(Et.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),u.jsx("br",{}),u.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Fu=600,Du=600,Mu="salesforce";function C0({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var M;const{projectId:s}=nr(),a=qe(),c=b.useRef(null),[f,d]=b.useState(null),[l,p]=b.useState(""),[m,g]=b.useState({}),[w,v]=b.useState({}),{data:x}=qo(e),h=((M=x==null?void 0:x.metadata)==null?void 0:M.input)||[],{mutateAsync:y,isPending:I}=y0(),{isFetching:S,refetch:E}=Ea({groupRef:r,provider:e});b.useEffect(()=>{const j=K=>{var $,ce,re;K.origin===Hl&&((($=K.data)==null?void 0:$.eventType)==="AUTHORIZATION_SUCCEEDED"?(d(null),console.debug("New connection:",K.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((ce=K.data)==null?void 0:ce.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",K.data.data.error),a.invalidateQueries({queryKey:["amp","connections"]}),d(K.data.data.error||"An error occurred. Please try again.")),(re=c.current)==null||re.close())};return window.addEventListener("message",j),()=>window.removeEventListener("message",j)},[a]);const P=j=>{p(j),g(K=>({...K,workspace:j})),v(K=>({...K,workspace:{value:j,source:"input"}}))},_=(j,K)=>{g($=>({...$,[j]:K})),v($=>({...$,[j]:{value:K,source:"input"}}))},A=async()=>{var j;d(null);try{const{data:K}=await E();if(K&&K.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(h.length>0&&!ei(h,m)){d("Please fill in all required fields");return}try{const K=await y({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s||"",consumerName:n,groupName:o,providerWorkspaceRef:e===Mu?l:(j=w==null?void 0:w.workspace)==null?void 0:j.value,providerMetadata:w}});if(K){const $=window.screenX+(window.outerWidth-Fu)/2,ce=window.screenY+(window.outerHeight-Du)/2.5,re=`width=${Fu},height=${Du},left=${$},top=${ce}`;c.current=window.open(K,"OAuthPopup",re)}}catch(K){console.error(K),d(K instanceof Error?K.message:String(K)||"An error occurred. Please try again.")}},R=e===Mu?u.jsx(b0,{handleSubmit:A,setWorkspace:P,error:f,isButtonDisabled:l.length===0||I||S}):h.length>0?u.jsx(I0,{handleSubmit:A,setFormData:_,error:f,isButtonDisabled:!ei(h,m)||I||S,providerName:i,metadataFields:h}):u.jsx(v0,{handleSubmit:A,error:f,providerName:i,isButtonDisabled:I||S});return u.jsx("div",{children:R})}function S0({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:c}=Le(),f=qi(),[d,l]=b.useState(null),p=b.useCallback(m=>{var w,v;l(null);const g={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(v=(w=m.providerMetadata)==null?void 0:w.workspace)==null?void 0:v.value,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes},...m.providerMetadata&&{providerMetadata:m.providerMetadata}}};f.mutate(g,{onError:()=>l("Error loading provider info")})},[c,i,o,r,n,e,f]);return a===null?u.jsx(lI,{provider:e,providerName:t,handleSubmit:p,error:d,explicitScopesRequired:s}):u.jsx(Ti,{})}function x0({...e}){return u.jsx(S0,{...e})}const O0="authorizationCode",E0="authorizationCodePKCE",_0="clientCredentials";function N0({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=pt(e);if(t.oauth2Opts===void 0)return u.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:f,explicitScopesRequired:d}=t.oauth2Opts,l={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return f===O0||f===E0?u.jsx(C0,{...l}):f===_0?u.jsx(x0,{...l,explicitScopesRequired:d,selectedConnection:s,setSelectedConnection:a}):f==="password"?u.jsx("em",{children:"Password flow not supported yet"}):u.jsxs("em",{children:["Unsupported grant type: ",f]})}function T0(e){const{selectedConnection:t}=Yt();b.useEffect(()=>{e&&t&&e(t)},[e,t])}function A0({onSuccess:e}){T0(e)}function Hf({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:f,isLoading:d,isError:l,error:p,providerName:m,selectedProvider:g}=pt(e),{provider:w,isIntegrationDeleted:v}=ut(),{selectedConnection:x,setSelectedConnection:h}=Yt();A0({onSuccess:s});const y=qe(),I=f;b.useEffect(()=>{l&&(console.error("Error loading provider info."),We(p))},[l,p]);const S=b.useCallback(()=>{y.clear(),c()},[c,y]);if(!e&&!w)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(v)return u.jsx(cc,{text:"Integration successfully uninstalled.",children:u.jsx(ze,{type:"button",onClick:S,style:{width:"100%"},children:"Reinstall Integration"})});if(x)return i;if(d)return u.jsx(di,{});if(I==null)return u.jsx(zt,{message:"Provider info was not found."});const E={provider:g,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:x,setSelectedConnection:h,providerName:m,providerInfo:I,onDisconnectSuccess:a};return I.authType==="none"?u.jsx(g0,{...E,children:i}):I.authType==="basic"?u.jsx(l0,{...E,children:i}):I.authType==="apiKey"?u.jsx(u0,{...E,children:i}):I.authType==="custom"?u.jsx(p0,{...E,children:i}):u.jsx(N0,{...E})}function R0(e){const t=e+"CollectionProvider",[n,r]=Yo(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=w=>{const{scope:v,children:x}=w,h=b.useRef(null),y=b.useRef(new Map).current;return u.jsx(o,{scope:v,itemMap:y,collectionRef:h,children:x})};s.displayName=t;const a=e+"CollectionSlot",c=ca(a),f=b.forwardRef((w,v)=>{const{scope:x,children:h}=w,y=i(a,x),I=si(v,y.collectionRef);return u.jsx(c,{ref:I,children:h})});f.displayName=a;const d=e+"CollectionItemSlot",l="data-radix-collection-item",p=ca(d),m=b.forwardRef((w,v)=>{const{scope:x,children:h,...y}=w,I=b.useRef(null),S=si(v,I),E=i(d,x);return b.useEffect(()=>(E.itemMap.set(I,{ref:I,...y}),()=>void E.itemMap.delete(I))),u.jsx(p,{[l]:"",ref:S,children:h})});m.displayName=d;function g(w){const v=i(e+"CollectionConsumer",w);return b.useCallback(()=>{const h=v.collectionRef.current;if(!h)return[];const y=Array.from(h.querySelectorAll(`[${l}]`));return Array.from(v.itemMap.values()).sort((E,P)=>y.indexOf(E.ref.current)-y.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:f,ItemSlot:m},g,r]}var P0=V[" useId ".trim().toString()]||(()=>{}),F0=0;function Jf(e){const[t,n]=V.useState(P0());return Pi(()=>{n(r=>r??String(F0++))},[e]),e||(t?`radix-${t}`:"")}function D0(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)},[])}var M0=V.createContext(void 0);function Wf(e){const t=V.useContext(M0);return e||t||"ltr"}var Os="rovingFocusGroup.onEntryFocus",k0={bubbles:!1,cancelable:!0},Bi="RovingFocusGroup",[ua,zf,j0]=R0(Bi),[L0,Gf]=Yo(Bi,[j0]),[K0,$0]=L0(Bi),Qf=V.forwardRef((e,t)=>u.jsx(ua.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(ua.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(U0,{...e,ref:t})})}));Qf.displayName=Bi;var U0=V.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:d=!1,...l}=e,p=V.useRef(null),m=si(t,p),g=Wf(i),[w,v]=rc({prop:s,defaultProp:a??null,onChange:c,caller:Bi}),[x,h]=V.useState(!1),y=D0(f),I=zf(n),S=V.useRef(!1),[E,P]=V.useState(0);return V.useEffect(()=>{const _=p.current;if(_)return _.addEventListener(Os,y),()=>_.removeEventListener(Os,y)},[y]),u.jsx(K0,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:w,onItemFocus:V.useCallback(_=>v(_),[v]),onItemShiftTab:V.useCallback(()=>h(!0),[]),onFocusableItemAdd:V.useCallback(()=>P(_=>_+1),[]),onFocusableItemRemove:V.useCallback(()=>P(_=>_-1),[]),children:u.jsx(Nn.div,{tabIndex:x||E===0?-1:0,"data-orientation":r,...l,ref:m,style:{outline:"none",...e.style},onMouseDown:Gt(e.onMouseDown,()=>{S.current=!0}),onFocus:Gt(e.onFocus,_=>{const A=!S.current;if(_.target===_.currentTarget&&A&&!x){const R=new CustomEvent(Os,k0);if(_.currentTarget.dispatchEvent(R),!R.defaultPrevented){const M=I().filter(re=>re.focusable),j=M.find(re=>re.active),K=M.find(re=>re.id===w),ce=[j,K,...M].filter(Boolean).map(re=>re.ref.current);Zf(ce,d)}}S.current=!1}),onBlur:Gt(e.onBlur,()=>h(!1))})})}),Xf="RovingFocusGroupItem",Yf=V.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=Jf(),f=i||c,d=$0(Xf,n),l=d.currentTabStopId===f,p=zf(n),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:w}=d;return V.useEffect(()=>{if(r)return m(),()=>g()},[r,m,g]),u.jsx(ua.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:u.jsx(Nn.span,{tabIndex:l?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:Gt(e.onMouseDown,v=>{r?d.onItemFocus(f):v.preventDefault()}),onFocus:Gt(e.onFocus,()=>d.onItemFocus(f)),onKeyDown:Gt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const x=B0(v,d.orientation,d.dir);if(x!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let y=p().filter(I=>I.focusable).map(I=>I.ref.current);if(x==="last")y.reverse();else if(x==="prev"||x==="next"){x==="prev"&&y.reverse();const I=y.indexOf(v.currentTarget);y=d.loop?H0(y,I+1):y.slice(I+1)}setTimeout(()=>Zf(y))}}),children:typeof s=="function"?s({isCurrentTabStop:l,hasTabStop:w!=null}):s})})});Yf.displayName=Xf;var V0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function q0(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function B0(e,t,n){const r=q0(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return V0[r]}function Zf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function H0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var J0=Qf,W0=Yf,es="Tabs",[z0,SO]=Yo(es,[Gf]),ep=Gf(),[G0,uc]=z0(es),tp=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...f}=e,d=Wf(a),[l,p]=rc({prop:r,onChange:o,defaultProp:i??"",caller:es});return u.jsx(G0,{scope:n,baseId:Jf(),value:l,onValueChange:p,orientation:s,dir:d,activationMode:c,children:u.jsx(Nn.div,{dir:d,"data-orientation":s,...f,ref:t})})});tp.displayName=es;var np="TabsList",rp=V.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=uc(np,n),s=ep(n);return u.jsx(J0,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:u.jsx(Nn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});rp.displayName=np;var ip="TabsTrigger",op=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=uc(ip,n),a=ep(n),c=ap(s.baseId,r),f=cp(s.baseId,r),d=r===s.value;return u.jsx(W0,{asChild:!0,...a,focusable:!o,active:d,children:u.jsx(Nn.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":f,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:Gt(e.onMouseDown,l=>{!o&&l.button===0&&l.ctrlKey===!1?s.onValueChange(r):l.preventDefault()}),onKeyDown:Gt(e.onKeyDown,l=>{[" ","Enter"].includes(l.key)&&s.onValueChange(r)}),onFocus:Gt(e.onFocus,()=>{const l=s.activationMode!=="manual";!d&&!o&&l&&s.onValueChange(r)})})})});op.displayName=ip;var sp="TabsContent",Q0=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=uc(sp,n),c=ap(a.baseId,r),f=cp(a.baseId,r),d=r===a.value,l=V.useRef(d);return V.useEffect(()=>{const p=requestAnimationFrame(()=>l.current=!1);return()=>cancelAnimationFrame(p)},[]),u.jsx(ic,{present:o||d,children:({present:p})=>u.jsx(Nn.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!p,id:f,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:l.current?"0s":void 0},children:p&&i})})});Q0.displayName=sp;function ap(e,t){return`${e}-trigger-${t}`}function cp(e,t){return`${e}-content-${t}`}var X0=tp,Y0=rp,up=op;const Z0=u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[u.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),u.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function eO(e,t){return t?b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},b.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?Z0:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:u.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function tO(){return u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M8 11C9.65685 11 11 9.65685 11 8C11 6.34315 9.65685 5 8 5C6.34315 5 5 6.34315 5 8C5 9.65685 6.34315 11 8 11Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M12.3378 5.04365C12.4882 5.25907 12.62 5.48699 12.7315 5.7249L14.3503 6.6249C14.5524 7.5302 14.5545 8.4687 14.3565 9.3749L12.7315 10.2749C12.62 10.5128 12.4882 10.7407 12.3378 10.9562L12.369 12.8124C11.683 13.4375 10.871 13.9085 9.98776 14.1937L8.39401 13.2374C8.13185 13.2562 7.86868 13.2562 7.60651 13.2374L6.01901 14.1874C5.13295 13.9075 4.31832 13.4383 3.63151 12.8124L3.66276 10.9624C3.51356 10.744 3.38189 10.5141 3.26901 10.2749L1.65026 9.3749C1.44814 8.46961 1.446 7.53111 1.64401 6.6249L3.26901 5.7249C3.38056 5.48699 3.5123 5.25907 3.66276 5.04365L3.63151 3.1874C4.31754 2.56226 5.1295 2.09128 6.01276 1.80615L7.60651 2.7624C7.86868 2.74365 8.13185 2.74365 8.39401 2.7624L9.98151 1.8124C10.8676 2.09234 11.6822 2.5615 12.369 3.1874L12.3378 5.04365Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const nO="_tabsRoot_ktpr0_1",rO="_tabsList_ktpr0_6",iO="_tabTrigger_ktpr0_12",ko={tabsRoot:nO,tabsList:rO,tabTrigger:iO};function oO(){return u.jsxs(u.Fragment,{children:[u.jsx(Jo,{style:{margin:"1rem 0"}}),u.jsx(up,{value:_o,className:ko.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[u.jsx(tO,{}),u.jsx("span",{children:"Manage"})]})})]})}function lp({objectName:e,completed:t,pending:n,displayName:r}){return u.jsx(up,{value:e,className:ko.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[eO(t,n),u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsx("span",{children:r||e}),n&&u.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function sO({completed:e,pending:t,displayName:n}){return u.jsxs(u.Fragment,{children:[u.jsx(Jo,{style:{margin:"1rem 0"}}),u.jsx(lp,{objectName:_r,completed:e,pending:t,displayName:n},"other-write")]})}function aO({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var c,f;const{data:i}=$l(),{installation:s}=Ar(),a=s==null?void 0:s.config;return u.jsx(X0,{value:e,className:ko.tabsRoot,onValueChange:n,children:u.jsxs(Y0,{className:ko.tabsList,children:[t.map(d=>{var P,_,A,R,M,j;const l=(A=(_=(P=a==null?void 0:a.content)==null?void 0:P.read)==null?void 0:_.objects)==null?void 0:A[d.name],p=r==null?void 0:r[d.name],m=yd(a,d.name),g=(R=p==null?void 0:p.read)==null?void 0:R.selectedFieldMappings,w=!ld(m,g),v=i?Na(a,i,d.name):void 0,x=(M=p==null?void 0:p.read)==null?void 0:M.selectedOptionalFields,h=!ud(v,x),y=l==null?void 0:l.selectedValueMappings,I=(j=p==null?void 0:p.read)==null?void 0:j.selectedValueMappings,S=!dd(y,I),E=h||w||S||!1;return u.jsx(lp,{objectName:d.name,displayName:d.displayName,completed:d.completed,pending:E},d.name)}),o&&u.jsx(sO,{completed:o.completed,pending:((f=(c=r==null?void 0:r.other)==null?void 0:c.write)==null?void 0:f.isWriteModified)||!1,displayName:"Write"}),u.jsx(oO,{})]})})}function cO(e,t){return t===_o?{name:_o,completed:!1}:e.find(n=>n.name===t)}function uO({children:e}){var x;const{data:t}=nr(),{installation:n}=ut(),{providerName:r}=pt(),{hydratedRevision:o}=fi(),{objectConfigurationsState:i}=Pa(),[s,a]=b.useState(""),c=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,d=o&&sd(f,o),l=d!==null,p=!!((x=o==null?void 0:o.content)!=null&&x.write),m=p?ad(f):void 0,g=b.useMemo(()=>{const h=[...d||[]];return m&&p&&h.push(m),h},[d,m,p]),w=cO(g,s),v=b.useCallback(()=>{const h=g.find(y=>w!==y&&!y.completed);h&&a(h.name)},[g,w]);return b.useEffect(()=>{!s&&g.length>0&&a(g[0].name)},[g,s,v]),u.jsx(Ad.Provider,{value:v,children:u.jsx(Nd.Provider,{value:w==null?void 0:w.name,children:u.jsxs(li,{style:{maxWidth:"55rem"},children:[u.jsxs(_n,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[u.jsxs("div",{style:{width:"20rem"},children:[u.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),u.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),l&&u.jsx(aO,{value:s,readNavObjects:d,onValueChange:h=>a(h),objectConfigurationsState:i,writeNavObject:m})]}),e]}),u.jsx(Cd,{})]})})})}function lO({...e}){return u.jsx(uO,{...e})}const dO="_resetContainer_lkwv9_4",dp={resetContainer:dO},fO=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c})=>{var v;const{projectIdOrName:f,isLoading:d}=nr(),{isLoading:l}=Vo(),{isError:p,errorState:m}=un(),{seed:g,reset:w}=nd();return d||l?u.jsx(di,{}):p(we.PROJECT,f)?u.jsx(zt,{message:`Error loading project ${f}`}):p(we.INTEGRATION_LIST,f)?u.jsx(zt,{message:"Error retrieving integrations for the project, double check the API key"}):(v=m[we.INTEGRATION_LIST])!=null&&v.apiError?u.jsx(zt,{message:"Something went wrong, couldn't find integration information"}):u.jsx("div",{className:dp.resetContainer,children:u.jsx(vb,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,resetComponent:w,children:u.jsx(Yl,{children:u.jsx(Hf,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:w,children:u.jsx(CI,{resetComponent:w,children:u.jsx(c0,{children:u.jsx(OI,{children:u.jsx(lO,{children:u.jsx(i0,{})})})})})})})},g)})};function pO({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){const f={integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c};return u.jsx(Oa,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:u.jsx(fO,{...f})})}function hO(){return u.jsxs(li,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[u.jsx(Ti,{}),u.jsx("p",{children:"Redirecting"})]})}function mO({redirectURL:e,children:t}){return b.useEffect(()=>{e&&window.location.replace(e)},[e]),e?u.jsx(hO,{}):t}function gO({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=b.useState(!1);return u.jsxs(u.Fragment,{children:[r===!1&&u.jsxs(u.Fragment,{children:[u.jsx(Ft,{string:"Manage connection"}),u.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[u.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),u.jsx(ze,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&u.jsxs(u.Fragment,{children:[u.jsx(Ra,{provider:n}),u.jsx(Uf,{resetComponent:e,onDisconnectSuccess:t})]})]})}function yO({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=nr(),{providerName:o}=pt(e),i=`You have successfully connected your ${o} account to ${r}.`;return u.jsx(cc,{text:i,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:u.jsx(gO,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function vO({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:f,reset:d}=nd(),l=b.useCallback(p=>{s?s(p.id):c&&c(p)},[s,c]);return u.jsx("div",{className:dp.resetContainer,children:u.jsx(Oa,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:u.jsx(Yl,{groupRef:r,provider:e,children:u.jsx(Hf,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:l,onDisconnectSuccess:a,children:u.jsx(mO,{redirectURL:i,children:u.jsx(yO,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})})},f)}const wO=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=Ca(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,c=n==null?void 0:n[0],f=c==null?void 0:c.config;return b.useEffect(()=>{o&&We(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:f}};exports.AmpersandContext=ga;exports.AmpersandProvider=cm;exports.ConnectProvider=vO;exports.FieldSettingWriteOnCreateEnum=zm;exports.FieldSettingWriteOnUpdateEnum=Gm;exports.InstallIntegration=pO;exports.InstallationProvider=Oa;exports.useAmpersandProviderProps=Le;exports.useConfig=Xw;exports.useConnection=Sa;exports.useCreateInstallation=ed;exports.useDeleteInstallation=Sb;exports.useInstallation=Ar;exports.useIsIntegrationInstalled=wO;exports.useLocalConfig=Qw;exports.useManifest=Ul;exports.useUpdateInstallation=td;
50
+ */const P0="react-tooltip-core-styles",D0="react-tooltip-base-styles",fu={core:!1,base:!1};function pu({css:e,id:t=D0,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||fu[n]||n==="core"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=P0),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.id=t,u.type="text/css",s==="top"&&a.firstChild?a.insertBefore(u,a.firstChild):a.appendChild(u),u.styleSheet?u.styleSheet.cssText=e:u.appendChild(document.createTextNode(e)),fu[n]=!0}const hu=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[T0(Number(o)),A0({fallbackAxisSideDirection:"start"}),R0({padding:5})],border:a,arrowSize:u=8})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const f=s;return n?(f.push(F0({element:n,padding:5})),du(e,t,{placement:r,strategy:i,middleware:f}).then(({x:l,y:d,placement:h,middlewareData:m})=>{var v,w;const g={left:`${l}px`,top:`${d}px`,border:a},{x:O,y:p}=(v=m.arrow)!==null&&v!==void 0?v:{x:0,y:0},y=(w={top:"bottom",right:"left",bottom:"top",left:"right"}[h.split("-")[0]])!==null&&w!==void 0?w:"bottom",I=a&&{borderBottom:a,borderRight:a};let x=0;if(a){const N=`${a}`.match(/(\d+)px/);x=N!=null&&N[1]?Number(N[1]):1}return{tooltipStyles:g,tooltipArrowStyles:{left:O!=null?`${O}px`:"",top:p!=null?`${p}px`:"",right:"",bottom:"",...I,[y]:`-${u/2+x}px`},place:h}})):du(e,t,{placement:"bottom",strategy:i,middleware:f}).then(({x:l,y:d,placement:h})=>({tooltipStyles:{left:`${l}px`,top:`${d}px`},tooltipArrowStyles:{},place:h}))},mu=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),gu=(e,t,n)=>{let r=null;const o=function(...i){const s=()=>{r=null};!r&&(e.apply(this,i),r=setTimeout(s,t))};return o.cancel=()=>{r&&(clearTimeout(r),r=null)},o},yu=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",ea=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>ea(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!yu(e)||!yu(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>ea(e[o],t[o]))},M0=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some(n=>{const r=t.getPropertyValue(n);return r==="auto"||r==="scroll"})},vu=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(M0(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},k0=typeof window<"u"?b.useLayoutEffect:b.useEffect,Dt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},j0="DEFAULT_TOOLTIP_ID",L0={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},V0=b.createContext({getTooltipData:()=>L0});function df(e=j0){return b.useContext(V0).getTooltipData(e)}var Ar={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},ms={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const $0=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:u=10,events:f=["hover"],openOnClick:l=!1,positionStrategy:d="absolute",middlewares:h,wrapper:m,delayShow:v=0,delayHide:w=0,float:g=!1,hidden:O=!1,noArrow:p=!1,clickable:y=!1,closeOnEsc:I=!1,closeOnScroll:x=!1,closeOnResize:N=!1,openEvents:A,closeEvents:_,globalCloseEvents:F,imperativeModeOnly:R,style:D,position:K,afterShow:j,afterHide:L,disableTooltip:se,content:re,contentWrapperRef:ge,isOpen:de,defaultIsOpen:be=!1,setIsOpen:P,activeAnchor:$,setActiveAnchor:H,border:q,opacity:U,arrowColor:V,arrowSize:G=8,role:Z="tooltip"})=>{var Y;const ee=b.useRef(null),ne=b.useRef(null),ce=b.useRef(null),k=b.useRef(null),ve=b.useRef(null),[z,Xe]=b.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ce,ct]=b.useState(!1),[Ue,rt]=b.useState(!1),[xe,ze]=b.useState(null),ft=b.useRef(!1),yt=b.useRef(null),{anchorRefs:vt,setActiveAnchor:Ye}=df(t),Ze=b.useRef(!1),[De,J]=b.useState([]),pe=b.useRef(!1),Se=l||f.includes("click"),ln=Se||(A==null?void 0:A.click)||(A==null?void 0:A.dblclick)||(A==null?void 0:A.mousedown),dn=A?{...A}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!A&&Se&&Object.assign(dn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const fn=_?{..._}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!_&&Se&&Object.assign(fn,{mouseleave:!1,blur:!1,mouseout:!1});const wt=F?{...F}:{escape:I||!1,scroll:x||!1,resize:N||!1,clickOutsideAnchor:ln||!1};R&&(Object.assign(dn,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(fn,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(wt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),k0(()=>(pe.current=!0,()=>{pe.current=!1}),[]);const Fe=X=>{pe.current&&(X&&rt(!0),setTimeout(()=>{pe.current&&(P==null||P(X),de===void 0&&ct(X))},10))};b.useEffect(()=>{if(de===void 0)return()=>null;de&&rt(!0);const X=setTimeout(()=>{ct(de)},10);return()=>{clearTimeout(X)}},[de]),b.useEffect(()=>{if(Ce!==ft.current)if(Dt(ve),ft.current=Ce,Ce)j==null||j();else{const X=(ue=>{const le=ue.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,Ve,Je]=le;return Number(Ve)*(Je==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));ve.current=setTimeout(()=>{rt(!1),ze(null),L==null||L()},X+25)}},[Ce]);const rr=X=>{Xe(ue=>ea(ue,X)?ue:X)},En=(X=v)=>{Dt(ce),Ue?Fe(!0):ce.current=setTimeout(()=>{Fe(!0)},X)},Nn=(X=w)=>{Dt(k),k.current=setTimeout(()=>{Ze.current||Fe(!1)},X)},St=X=>{var ue;if(!X)return;const le=(ue=X.currentTarget)!==null&&ue!==void 0?ue:X.target;if(!(le!=null&&le.isConnected))return H(null),void Ye({current:null});v?En():Fe(!0),H(le),Ye({current:le}),Dt(k)},pn=()=>{y?Nn(w||100):w?Nn():Fe(!1),Dt(ce)},Tn=({x:X,y:ue})=>{var le;const Ve={getBoundingClientRect:()=>({x:X,y:ue,width:0,height:0,top:ue,left:X,right:X,bottom:ue})};hu({place:(le=xe==null?void 0:xe.place)!==null&&le!==void 0?le:a,offset:u,elementReference:Ve,tooltipReference:ee.current,tooltipArrowReference:ne.current,strategy:d,middlewares:h,border:q,arrowSize:G}).then(Je=>{rr(Je)})},Rn=X=>{if(!X)return;const ue=X,le={x:ue.clientX,y:ue.clientY};Tn(le),yt.current=le},hn=X=>{var ue;if(!Ce)return;const le=X.target;le.isConnected&&(!((ue=ee.current)===null||ue===void 0)&&ue.contains(le)||[document.querySelector(`[id='${i}']`),...De].some(Ve=>Ve==null?void 0:Ve.contains(le))||(Fe(!1),Dt(ce)))},Xt=gu(St,50),Le=gu(pn,50),ut=X=>{Le.cancel(),Xt(X)},ae=()=>{Xt.cancel(),Le()},he=b.useCallback(()=>{var X,ue;const le=(X=xe==null?void 0:xe.position)!==null&&X!==void 0?X:K;le?Tn(le):g?yt.current&&Tn(yt.current):$!=null&&$.isConnected&&hu({place:(ue=xe==null?void 0:xe.place)!==null&&ue!==void 0?ue:a,offset:u,elementReference:$,tooltipReference:ee.current,tooltipArrowReference:ne.current,strategy:d,middlewares:h,border:q,arrowSize:G}).then(Ve=>{pe.current&&rr(Ve)})},[Ce,$,re,D,a,xe==null?void 0:xe.place,u,d,K,xe==null?void 0:xe.position,g,G]);b.useEffect(()=>{var X,ue;const le=new Set(vt);De.forEach(Oe=>{se!=null&&se(Oe)||le.add({current:Oe})});const Ve=document.querySelector(`[id='${i}']`);Ve&&!(se!=null&&se(Ve))&&le.add({current:Ve});const Je=()=>{Fe(!1)},et=vu($),At=vu(ee.current);wt.scroll&&(window.addEventListener("scroll",Je),et==null||et.addEventListener("scroll",Je),At==null||At.addEventListener("scroll",Je));let it=null;wt.resize?window.addEventListener("resize",Je):$&&ee.current&&(it=N0($,ee.current,he,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const bt=Oe=>{Oe.key==="Escape"&&Fe(!1)};wt.escape&&window.addEventListener("keydown",bt),wt.clickOutsideAnchor&&window.addEventListener("click",hn);const Ae=[],An=Oe=>!!(Oe!=null&&Oe.target&&($!=null&&$.contains(Oe.target))),Vt=Oe=>{Ce&&An(Oe)||St(Oe)},Qo=Oe=>{Ce&&An(Oe)&&pn()},qi=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Ui=["click","dblclick","mousedown","mouseup"];Object.entries(dn).forEach(([Oe,$t])=>{$t&&(qi.includes(Oe)?Ae.push({event:Oe,listener:ut}):Ui.includes(Oe)&&Ae.push({event:Oe,listener:Vt}))}),Object.entries(fn).forEach(([Oe,$t])=>{$t&&(qi.includes(Oe)?Ae.push({event:Oe,listener:ae}):Ui.includes(Oe)&&Ae.push({event:Oe,listener:Qo}))}),g&&Ae.push({event:"pointermove",listener:Rn});const Bi=()=>{Ze.current=!0},Ji=()=>{Ze.current=!1,pn()},Yt=y&&(fn.mouseout||fn.mouseleave);return Yt&&((X=ee.current)===null||X===void 0||X.addEventListener("mouseover",Bi),(ue=ee.current)===null||ue===void 0||ue.addEventListener("mouseout",Ji)),Ae.forEach(({event:Oe,listener:$t})=>{le.forEach(li=>{var ir;(ir=li.current)===null||ir===void 0||ir.addEventListener(Oe,$t)})}),()=>{var Oe,$t;wt.scroll&&(window.removeEventListener("scroll",Je),et==null||et.removeEventListener("scroll",Je),At==null||At.removeEventListener("scroll",Je)),wt.resize?window.removeEventListener("resize",Je):it==null||it(),wt.clickOutsideAnchor&&window.removeEventListener("click",hn),wt.escape&&window.removeEventListener("keydown",bt),Yt&&((Oe=ee.current)===null||Oe===void 0||Oe.removeEventListener("mouseover",Bi),($t=ee.current)===null||$t===void 0||$t.removeEventListener("mouseout",Ji)),Ae.forEach(({event:li,listener:ir})=>{le.forEach(Go=>{var Fn;(Fn=Go.current)===null||Fn===void 0||Fn.removeEventListener(li,ir)})})}},[$,he,Ue,vt,De,A,_,F,Se,v,w]),b.useEffect(()=>{var X,ue;let le=(ue=(X=xe==null?void 0:xe.anchorSelect)!==null&&X!==void 0?X:s)!==null&&ue!==void 0?ue:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ve=new MutationObserver(Je=>{const et=[],At=[];Je.forEach(it=>{if(it.type==="attributes"&&it.attributeName==="data-tooltip-id"&&(it.target.getAttribute("data-tooltip-id")===t?et.push(it.target):it.oldValue===t&&At.push(it.target)),it.type==="childList"){if($){const bt=[...it.removedNodes].filter(Ae=>Ae.nodeType===1);if(le)try{At.push(...bt.filter(Ae=>Ae.matches(le))),At.push(...bt.flatMap(Ae=>[...Ae.querySelectorAll(le)]))}catch{}bt.some(Ae=>{var An;return!!(!((An=Ae==null?void 0:Ae.contains)===null||An===void 0)&&An.call(Ae,$))&&(rt(!1),Fe(!1),H(null),Dt(ce),Dt(k),!0)})}if(le)try{const bt=[...it.addedNodes].filter(Ae=>Ae.nodeType===1);et.push(...bt.filter(Ae=>Ae.matches(le))),et.push(...bt.flatMap(Ae=>[...Ae.querySelectorAll(le)]))}catch{}}}),(et.length||At.length)&&J(it=>[...it.filter(bt=>!At.includes(bt)),...et])});return Ve.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Ve.disconnect()}},[t,s,xe==null?void 0:xe.anchorSelect,$]),b.useEffect(()=>{he()},[he]),b.useEffect(()=>{if(!(ge!=null&&ge.current))return()=>null;const X=new ResizeObserver(()=>{setTimeout(()=>he())});return X.observe(ge.current),()=>{X.disconnect()}},[re,ge==null?void 0:ge.current]),b.useEffect(()=>{var X;const ue=document.querySelector(`[id='${i}']`),le=[...De,ue];$&&le.includes($)||H((X=De[0])!==null&&X!==void 0?X:ue)},[i,De,$]),b.useEffect(()=>(be&&Fe(!0),()=>{Dt(ce),Dt(k)}),[]),b.useEffect(()=>{var X;let ue=(X=xe==null?void 0:xe.anchorSelect)!==null&&X!==void 0?X:s;if(!ue&&t&&(ue=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ue)try{const le=Array.from(document.querySelectorAll(ue));J(le)}catch{J([])}},[t,s,xe==null?void 0:xe.anchorSelect]),b.useEffect(()=>{ce.current&&(Dt(ce),En(v))},[v]);const pt=(Y=xe==null?void 0:xe.content)!==null&&Y!==void 0?Y:re,mn=Ce&&Object.keys(z.tooltipStyles).length>0;return b.useImperativeHandle(e,()=>({open:X=>{if(X!=null&&X.anchorSelect)try{document.querySelector(X.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${X.anchorSelect}" is not a valid CSS selector`)}ze(X??null),X!=null&&X.delay?En(X.delay):Fe(!0)},close:X=>{X!=null&&X.delay?Nn(X.delay):Fe(!1)},activeAnchor:$,place:z.place,isOpen:!!(Ue&&!O&&pt&&mn)})),Ue&&!O&&pt?b.createElement(m,{id:t,role:Z,className:Lt("react-tooltip",Ar.tooltip,ms.tooltip,ms[o],n,`react-tooltip__place-${z.place}`,Ar[mn?"show":"closing"],mn?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&Ar.fixed,y&&Ar.clickable),onTransitionEnd:X=>{Dt(ve),Ce||X.propertyName!=="opacity"||(rt(!1),ze(null),L==null||L())},style:{...D,...z.tooltipStyles,opacity:U!==void 0&&mn?U:void 0},ref:ee},pt,b.createElement(m,{className:Lt("react-tooltip-arrow",Ar.arrow,ms.arrow,r,p&&Ar.noArrow),style:{...z.tooltipArrowStyles,background:V?`linear-gradient(to right bottom, transparent 50%, ${V} 50%)`:void 0,"--rt-arrow-size":`${G}px`},ref:ne})):null},K0=({content:e})=>b.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),q0=b.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:u="dark",place:f="top",offset:l=10,wrapper:d="div",children:h=null,events:m=["hover"],openOnClick:v=!1,positionStrategy:w="absolute",middlewares:g,delayShow:O=0,delayHide:p=0,float:y=!1,hidden:I=!1,noArrow:x=!1,clickable:N=!1,closeOnEsc:A=!1,closeOnScroll:_=!1,closeOnResize:F=!1,openEvents:R,closeEvents:D,globalCloseEvents:K,imperativeModeOnly:j=!1,style:L,position:se,isOpen:re,defaultIsOpen:ge=!1,disableStyleInjection:de=!1,border:be,opacity:P,arrowColor:$,arrowSize:H,setIsOpen:q,afterShow:U,afterHide:V,disableTooltip:G,role:Z="tooltip"},Y)=>{const[ee,ne]=b.useState(r),[ce,k]=b.useState(o),[ve,z]=b.useState(f),[Xe,Ce]=b.useState(u),[ct,Ue]=b.useState(l),[rt,xe]=b.useState(O),[ze,ft]=b.useState(p),[yt,vt]=b.useState(y),[Ye,Ze]=b.useState(I),[De,J]=b.useState(d),[pe,Se]=b.useState(m),[ln,dn]=b.useState(w),[fn,wt]=b.useState(null),[Fe,rr]=b.useState(null),En=b.useRef(de),{anchorRefs:Nn,activeAnchor:St}=df(e),pn=Le=>Le==null?void 0:Le.getAttributeNames().reduce((ut,ae)=>{var he;return ae.startsWith("data-tooltip-")&&(ut[ae.replace(/^data-tooltip-/,"")]=(he=Le==null?void 0:Le.getAttribute(ae))!==null&&he!==void 0?he:null),ut},{}),Tn=Le=>{const ut={place:ae=>{var he;z((he=ae)!==null&&he!==void 0?he:f)},content:ae=>{ne(ae??r)},html:ae=>{k(ae??o)},variant:ae=>{var he;Ce((he=ae)!==null&&he!==void 0?he:u)},offset:ae=>{Ue(ae===null?l:Number(ae))},wrapper:ae=>{var he;J((he=ae)!==null&&he!==void 0?he:d)},events:ae=>{const he=ae==null?void 0:ae.split(" ");Se(he??m)},"position-strategy":ae=>{var he;dn((he=ae)!==null&&he!==void 0?he:w)},"delay-show":ae=>{xe(ae===null?O:Number(ae))},"delay-hide":ae=>{ft(ae===null?p:Number(ae))},float:ae=>{vt(ae===null?y:ae==="true")},hidden:ae=>{Ze(ae===null?I:ae==="true")},"class-name":ae=>{wt(ae)}};Object.values(ut).forEach(ae=>ae(null)),Object.entries(Le).forEach(([ae,he])=>{var pt;(pt=ut[ae])===null||pt===void 0||pt.call(ut,he)})};b.useEffect(()=>{ne(r)},[r]),b.useEffect(()=>{k(o)},[o]),b.useEffect(()=>{z(f)},[f]),b.useEffect(()=>{Ce(u)},[u]),b.useEffect(()=>{Ue(l)},[l]),b.useEffect(()=>{xe(O)},[O]),b.useEffect(()=>{ft(p)},[p]),b.useEffect(()=>{vt(y)},[y]),b.useEffect(()=>{Ze(I)},[I]),b.useEffect(()=>{dn(w)},[w]),b.useEffect(()=>{En.current!==de&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[de]),b.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:de==="core",disableBase:de}}))},[]),b.useEffect(()=>{var Le;const ut=new Set(Nn);let ae=n;if(!ae&&e&&(ae=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ae)try{document.querySelectorAll(ae).forEach(ue=>{ut.add({current:ue})})}catch{console.warn(`[react-tooltip] "${ae}" is not a valid CSS selector`)}const he=document.querySelector(`[id='${t}']`);if(he&&ut.add({current:he}),!ut.size)return()=>null;const pt=(Le=Fe??he)!==null&&Le!==void 0?Le:St.current,mn=new MutationObserver(ue=>{ue.forEach(le=>{var Ve;if(!pt||le.type!=="attributes"||!(!((Ve=le.attributeName)===null||Ve===void 0)&&Ve.startsWith("data-tooltip-")))return;const Je=pn(pt);Tn(Je)})}),X={attributes:!0,childList:!1,subtree:!1};if(pt){const ue=pn(pt);Tn(ue),mn.observe(pt,X)}return()=>{mn.disconnect()}},[Nn,St,Fe,t,n]),b.useEffect(()=>{L!=null&&L.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),be&&!mu("border",`${be}`)&&console.warn(`[react-tooltip] "${be}" is not a valid \`border\`.`),L!=null&&L.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),P&&!mu("opacity",`${P}`)&&console.warn(`[react-tooltip] "${P}" is not a valid \`opacity\`.`)},[]);let Rn=h;const hn=b.useRef(null);if(i){const Le=i({content:(Fe==null?void 0:Fe.getAttribute("data-tooltip-content"))||ee||null,activeAnchor:Fe});Rn=Le?b.createElement("div",{ref:hn,className:"react-tooltip-content-wrapper"},Le):null}else ee&&(Rn=ee);ce&&(Rn=b.createElement(K0,{content:ce}));const Xt={forwardRef:Y,id:e,anchorId:t,anchorSelect:n,className:Lt(s,fn),classNameArrow:a,content:Rn,contentWrapperRef:hn,place:ve,variant:Xe,offset:ct,wrapper:De,events:pe,openOnClick:v,positionStrategy:ln,middlewares:g,delayShow:rt,delayHide:ze,float:yt,hidden:Ye,noArrow:x,clickable:N,closeOnEsc:A,closeOnScroll:_,closeOnResize:F,openEvents:R,closeEvents:D,globalCloseEvents:K,imperativeModeOnly:j,style:L,position:se,isOpen:re,defaultIsOpen:ge,border:be,opacity:P,arrowColor:$,arrowSize:H,setIsOpen:q,afterShow:U,afterHide:V,disableTooltip:G,activeAnchor:Fe,setActiveAnchor:Le=>rr(Le),role:Z};return b.createElement($0,{...Xt})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||pu({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s;--rt-arrow-size:8px}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit;z-index:-1}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||pu({css:`
51
+ .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:var(--rt-arrow-size);height:var(--rt-arrow-size)}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function U0(){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[c.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[c.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_2896_16290",children:c.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function ff({id:e,tooltipText:t}){return c.jsxs(c.Fragment,{children:[c.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:U0()}),c.jsx(q0,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function B0(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};t.forEach(o=>{var a,u;const{field:i,value:s}=o;if(s===null){const f=n[i];delete n[i],f&&((a=e==null?void 0:e.read)!=null&&a.selectedValueMappings)&&e.read.selectedValueMappings[f]&&delete e.read.selectedValueMappings[f]}else{const f=n[i];n[i]=s,f&&f!==s&&((u=e==null?void 0:e.read)!=null&&u.selectedValueMappings)&&e.read.selectedValueMappings[f]&&delete e.read.selectedValueMappings[f]}})}function Ei(e,t,n){t(e,r=>B0(r,n))}const J0="Each field must be mapped to a unique value";function Ha({field:e,onSelectChange:t,allFields:n}){var p;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Gt(),[s,a]=b.useState(!0),{isError:u,removeError:f,getError:l}=an(),d=(p=r==null?void 0:r.read)==null?void 0:p.selectedFieldMappings,h=d==null?void 0:d[e.mapToName];b.useEffect(()=>{e._default&&!h&&o&&r&&Ei(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,h,r]);const m=b.useMemo(()=>n.map(y=>({id:y.fieldName,label:y.displayName,value:y.fieldName})),[n]),v=c.jsx(ef,{disabled:s,items:m,selectedValue:h||null,onSelectedItemChange:y=>{t({target:{name:e.mapToName,value:y==null?void 0:y.value}})},placeholder:"Please select one",style:{width:"100%"}}),w=b.useCallback(()=>{o&&(Ei(o,i,[{field:e.mapToName,value:null}]),u(we.MAPPING,o)&&f(we.MAPPING,o))},[e.mapToName,o,i,u,f]),{hasDuplicationError:g,errorMessage:O}=b.useMemo(()=>{const y=l(we.MAPPING,o),I=Array.isArray(y)&&y.length>0&&y.includes(e.mapToName);return{hasDuplicationError:I,errorMessage:I?J0:""}},[o,l,e.mapToName]);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[c.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),c.jsx("span",{children:(e==null?void 0:e.prompt)&&c.jsx(ff,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[v,c.jsx(We,{type:"button",variant:"ghost",onClick:w,children:"Clear"})]})]},e.mapToName),g&&c.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",O," "]},e.mapToName)]})}const H0="_formControl_9qd8d_1",W0="_formLabel_9qd8d_5",z0="_formLabelRequired_9qd8d_11",Q0="_formInput_9qd8d_16",G0="_formInputInvalid_9qd8d_20",X0="_formError_9qd8d_24",Y0="_disabled_9qd8d_30",ar={formControl:H0,formLabel:W0,formLabelRequired:z0,formInput:Q0,formInputInvalid:G0,formError:X0,disabled:Y0};function Jo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return c.jsxs("div",{className:Lt(ar.formControl,{[ar.disabled]:r}),children:[t&&c.jsx("label",{htmlFor:e,className:Lt(ar.formLabel,{[ar.formLabelRequired]:n}),children:t}),c.jsx("div",{id:e,className:Lt(ar.formInput,{[ar.formInputInvalid]:o}),children:s}),o&&i&&c.jsx("div",{className:ar.formError,role:"alert",children:i})]})}function pf({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:o}){if(!e||!t)return!1;if(Object.values(e).some(s=>s===r&&s!==n)){console.error("Each field must be mapped to a unique value",e);const s=Object.keys(e).filter(u=>e[u]===r),a=[n,...s];return o(we.MAPPING,t,a),!0}return!1}function Z0({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>c.jsx(Jo,{id:r.mapToName,children:c.jsx(Ha,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function eC(){var v,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Gt(),{isError:r,removeError:o,setError:i}=an(),s=((v=t==null?void 0:t.read)==null?void 0:v.allFields)||[],{fieldMapping:a}=at(),u=(w=t==null?void 0:t.read)==null?void 0:w.selectedFieldMappings,f=g=>{const{value:O,name:p}=g.target;!O||pf({selectedFieldMappings:u,selectedObjectName:e,fieldName:p,fieldValue:O,setError:i})||(e&&Ei(e,n,[{field:p,value:O}]),r(we.MAPPING,p)&&o(we.MAPPING,p),e&&r(we.MAPPING,e)&&o(we.MAPPING,e))},l=b.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(g=>!g.fieldName),[a,e]),d=b.useMemo(()=>{var p;return(((p=t==null?void 0:t.read)==null?void 0:p.optionalMapFields)||[]).filter(y=>!l.some(I=>I.mapToName===y.mapToName))},[t,l]),h=l.length>0;return d.length>0||h?c.jsxs(c.Fragment,{children:[c.jsx(Rt,{string:"Map the following optional fields"}),c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d==null?void 0:d.map(g=>c.jsx(Jo,{id:g.mapToName,children:c.jsx(Ha,{allFields:s,field:g,onSelectChange:f})},g.mapToName)),h&&c.jsx(Z0,{dynamicFieldMappings:l,onSelectChange:f,allFields:s})]})]}):null}function tC(){var f;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Gt(),{isError:r,removeError:o,setError:i}=an(),s=(f=t==null?void 0:t.read)==null?void 0:f.selectedFieldMappings,a=l=>{const{value:d,name:h}=l.target;!d||pf({selectedFieldMappings:s,selectedObjectName:e,fieldName:h,fieldValue:d,setError:i})||(e&&Ei(e,n,[{field:h,value:d}]),r(we.MAPPING,h)&&o(we.MAPPING,h),e&&r(we.MAPPING,e)&&o(we.MAPPING,e))},u=b.useMemo(()=>{var l;return((l=t==null?void 0:t.read)==null?void 0:l.requiredMapFields)||[]},[t]);return u!=null&&u.length?c.jsxs(c.Fragment,{children:[c.jsx(Rt,{string:"Map the following fields"}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:u.map(l=>{var d;return c.jsx(Jo,{id:l.mapToName,isInvalid:r(we.MAPPING,l.mapToName),errorMessage:"* required",children:c.jsx(Ha,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:l,onSelectChange:a})},l.mapToName)})})]}):null}const nC=(e,t)=>e.filter(n=>!t.has(n));function rC(){var h,m,v;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Gt(),{fieldMapping:r}=at(),o=((h=t==null?void 0:t.read)==null?void 0:h.selectedFieldMappings)||{},i=Object.keys(o),s=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],a=((v=t==null?void 0:t.read)==null?void 0:v.optionalMapFields)||[],u=e&&r?Object.values(r[e]||{}).flat().filter(w=>!w.fieldName):[],f=s.concat(u,a).map(w=>w.mapToName),l=new Set(f),d=nC(i,l);b.useEffect(()=>{e&&d.length&&Ei(e,n,d.map(w=>({field:w,value:null})))},[e,n,d])}const iC={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function oC({children:e,style:t}){return c.jsx(Sn,{style:{...iC,...t},children:e})}function sC(){var f,l,d;const{data:e}=Zn(),{hydratedRevision:t}=ci(),{selectedObjectName:n}=Gt(),{providerName:r}=dt(),o=e==null?void 0:e.appName,i=(d=(l=(f=t==null?void 0:t.content)==null?void 0:f.read)==null?void 0:l.objects)==null?void 0:d.find(h=>h.objectName===n),s=(i==null?void 0:i.displayName)||n&&on(n),a=i==null?void 0:i.mapToName,u=(i==null?void 0:i.mapToDisplayName)||a&&on(a);return u&&o&&r?c.jsx(oC,{style:{marginTop:"1rem"},children:c.jsxs("p",{style:{margin:"1rem 0"},children:[c.jsx("b",{children:u})," in ",o," is mapped to"," ",c.jsx("b",{children:s})," in ",r,"."]})}):null}function wu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function hf(...e){return t=>{let n=!1;const r=e.map(o=>{const i=wu(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():wu(e[o],null)}}}}function ni(...e){return B.useCallback(hf(...e),e)}function Ho(e,t=[]){let n=[];function r(i,s){const a=B.createContext(s),u=n.length;n=[...n,s];const f=d=>{var O;const{scope:h,children:m,...v}=d,w=((O=h==null?void 0:h[e])==null?void 0:O[u])||a,g=B.useMemo(()=>v,Object.values(v));return c.jsx(w.Provider,{value:g,children:m})};f.displayName=i+"Provider";function l(d,h){var w;const m=((w=h==null?void 0:h[e])==null?void 0:w[u])||a,v=B.useContext(m);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[f,l]}const o=()=>{const i=n.map(s=>B.createContext(s));return function(a){const u=(a==null?void 0:a[e])||i;return B.useMemo(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return o.scopeName=e,[r,aC(o,...t)]}function aC(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:u,scopeName:f})=>{const d=u(i)[`__scope${f}`];return{...a,...d}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Ht(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var Ni=globalThis!=null&&globalThis.document?B.useLayoutEffect:()=>{},cC=B[" useInsertionEffect ".trim().toString()]||Ni;function Wa({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=uC({defaultProp:t,onChange:n}),a=e!==void 0,u=a?e:o;{const l=B.useRef(e!==void 0);B.useEffect(()=>{const d=l.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=a},[a,r])}const f=B.useCallback(l=>{var d;if(a){const h=lC(l)?l(e):l;h!==e&&((d=s.current)==null||d.call(s,h))}else i(l)},[a,e,i,s]);return[u,f]}function uC({defaultProp:e,onChange:t}){const[n,r]=B.useState(e),o=B.useRef(n),i=B.useRef(t);return cC(()=>{i.current=t},[t]),B.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function lC(e){return typeof e=="function"}function dC(e){const t=B.useRef({value:e,previous:e});return B.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function fC(e){const[t,n]=B.useState(void 0);return Ni(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const u=i.borderBoxSize,f=Array.isArray(u)?u[0]:u;s=f.inlineSize,a=f.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function pC(e,t){return B.useReducer((n,r)=>t[n][r]??n,e)}var za=e=>{const{present:t,children:n}=e,r=hC(t),o=typeof n=="function"?n({present:r.isPresent}):B.Children.only(n),i=ni(r.ref,mC(o));return typeof n=="function"||r.isPresent?B.cloneElement(o,{ref:i}):null};za.displayName="Presence";function hC(e){const[t,n]=B.useState(),r=B.useRef(null),o=B.useRef(e),i=B.useRef("none"),s=e?"mounted":"unmounted",[a,u]=pC(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return B.useEffect(()=>{const f=so(r.current);i.current=a==="mounted"?f:"none"},[a]),Ni(()=>{const f=r.current,l=o.current;if(l!==e){const h=i.current,m=so(f);e?u("MOUNT"):m==="none"||(f==null?void 0:f.display)==="none"?u("UNMOUNT"):u(l&&h!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Ni(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,d=m=>{const w=so(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&w&&(u("ANIMATION_END"),!o.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=m=>{m.target===t&&(i.current=so(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:B.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function so(e){return(e==null?void 0:e.animationName)||"none"}function mC(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ta(e){const t=gC(e),n=B.forwardRef((r,o)=>{const{children:i,...s}=r,a=B.Children.toArray(i),u=a.find(vC);if(u){const f=u.props.children,l=a.map(d=>d===u?B.Children.count(f)>1?B.Children.only(null):B.isValidElement(f)?f.props.children:null:d);return c.jsx(t,{...s,ref:o,children:B.isValidElement(f)?B.cloneElement(f,void 0,l):null})}return c.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function gC(e){const t=B.forwardRef((n,r)=>{const{children:o,...i}=n;if(B.isValidElement(o)){const s=bC(o),a=wC(i,o.props);return o.type!==B.Fragment&&(a.ref=r?hf(r,s):s),B.cloneElement(o,a)}return B.Children.count(o)>1?B.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yC=Symbol("radix.slottable");function vC(e){return B.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yC}function wC(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const u=i(...a);return o(...a),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function bC(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 IC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_n=IC.reduce((e,t)=>{const n=ta(`Primitive.${t}`),r=B.forwardRef((o,i)=>{const{asChild:s,...a}=o,u=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Wo="Checkbox",[CC,HO]=Ho(Wo),[xC,Qa]=CC(Wo);function OC(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:a,onCheckedChange:u,required:f,value:l="on",internal_do_not_use_render:d}=e,[h,m]=Wa({prop:n,defaultProp:o??!1,onChange:u,caller:Wo}),[v,w]=B.useState(null),[g,O]=B.useState(null),p=B.useRef(!1),y=v?!!s||!!v.closest("form"):!0,I={checked:h,disabled:i,setChecked:m,control:v,setControl:w,name:a,form:s,value:l,hasConsumerStoppedPropagationRef:p,required:f,defaultChecked:Qn(o)?!1:o,isFormControl:y,bubbleInput:g,setBubbleInput:O};return c.jsx(xC,{scope:t,...I,children:SC(d)?d(I):r})}var mf="CheckboxTrigger",gf=B.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:s,disabled:a,checked:u,required:f,setControl:l,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:v}=Qa(mf,e),w=ni(o,l),g=B.useRef(u);return B.useEffect(()=>{const O=i==null?void 0:i.form;if(O){const p=()=>d(g.current);return O.addEventListener("reset",p),()=>O.removeEventListener("reset",p)}},[i,d]),c.jsx(_n.button,{type:"button",role:"checkbox","aria-checked":Qn(u)?"mixed":u,"aria-required":f,"data-state":bf(u),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:w,onKeyDown:Ht(t,O=>{O.key==="Enter"&&O.preventDefault()}),onClick:Ht(n,O=>{d(p=>Qn(p)?!0:!p),v&&m&&(h.current=O.isPropagationStopped(),h.current||O.stopPropagation())})})});gf.displayName=mf;var Ga=B.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:u,onCheckedChange:f,form:l,...d}=e;return c.jsx(OC,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:a,required:s,onCheckedChange:f,name:r,form:l,value:u,internal_do_not_use_render:({isFormControl:h})=>c.jsxs(c.Fragment,{children:[c.jsx(gf,{...d,ref:t,__scopeCheckbox:n}),h&&c.jsx(wf,{__scopeCheckbox:n})]})})});Ga.displayName=Wo;var yf="CheckboxIndicator",Xa=B.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Qa(yf,n);return c.jsx(za,{present:r||Qn(i.checked)||i.checked===!0,children:c.jsx(_n.span,{"data-state":bf(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Xa.displayName=yf;var vf="CheckboxBubbleInput",wf=B.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:s,required:a,disabled:u,name:f,value:l,form:d,bubbleInput:h,setBubbleInput:m}=Qa(vf,e),v=ni(n,m),w=dC(i),g=fC(r);B.useEffect(()=>{const p=h;if(!p)return;const y=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(y,"checked").set,N=!o.current;if(w!==i&&x){const A=new Event("click",{bubbles:N});p.indeterminate=Qn(i),x.call(p,Qn(i)?!1:i),p.dispatchEvent(A)}},[h,w,i,o]);const O=B.useRef(Qn(i)?!1:i);return c.jsx(_n.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??O.current,required:a,disabled:u,name:f,value:l,form:d,...t,tabIndex:-1,ref:v,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});wf.displayName=vf;function SC(e){return typeof e=="function"}function Qn(e){return e==="indeterminate"}function bf(e){return Qn(e)?"indeterminate":e?"checked":"unchecked"}function Ya(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var _C=["color"],If=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Ya(e,_C);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),b.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),EC=["color"],NC=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Ya(e,EC);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),b.createElement("path",{d:"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"}))}),TC=["color"],RC=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Ya(e,TC);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),b.createElement("path",{d:"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const AC="_checkboxGroupContainer_hqfeu_1",FC="_stack_hqfeu_6",PC="_selectAllContainer_hqfeu_10",DC="_fieldContainer_hqfeu_17",MC="_checkbox_hqfeu_1",ri={checkboxGroupContainer:AC,stack:FC,selectAllContainer:PC,fieldContainer:DC,checkbox:MC};function kC({id:e,isChecked:t,label:n,onCheckedChange:r}){return c.jsxs("div",{className:ri.fieldContainer,children:[c.jsx(Ga,{className:ri.checkbox,id:e,onCheckedChange:r,checked:t,children:c.jsx(Xa,{children:c.jsx(If,{})})}),c.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function jC({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return c.jsxs("div",{className:ri.selectAllContainer,children:[c.jsx(Ga,{className:ri.checkbox,id:e,onCheckedChange:r,checked:o?"indeterminate":t,children:c.jsxs(Xa,{children:[o&&c.jsx(NC,{}),t===!0&&c.jsx(If,{})]})}),c.jsx("label",{htmlFor:e,children:n})]})}function LC({children:e}){return c.jsx("div",{className:ri.checkboxGroupContainer,children:e})}function VC({children:e}){return c.jsx("div",{className:ri.stack,children:e})}const $C="_paginationContainer_1p51x_1",KC="_pageInfo_1p51x_7",qC="_searchContainer_1p51x_13",UC="_searchInput_1p51x_17",BC="_noResults_1p51x_21",mi={paginationContainer:$C,pageInfo:KC,searchContainer:qC,searchInput:UC,noResults:BC};function Cf({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:o=!0,searchPlaceholder:i="Search fields..."}){const[s,a]=b.useState(1),[u,f]=b.useState(""),l=e.filter(y=>y.label.toLowerCase().includes(u.toLowerCase())),d=Math.ceil(l.length/n),h=(s-1)*n,m=h+n,v=l.slice(h,m),w=y=>{f(y),a(1)},g=y=>{l.forEach(I=>{t(I.id,y)})},O=l.length>0&&l.every(y=>y.isChecked),p=l.some(y=>y.isChecked);return c.jsxs(LC,{children:[o&&c.jsx("div",{className:mi.searchContainer,children:c.jsx(od,{id:"field-search",type:"text",placeholder:i,value:u,onChange:y=>w(y.target.value),className:mi.searchInput})}),r&&e.length>=2&&c.jsx(jC,{id:"select-all-fields",isChecked:O,label:`Select all ${l.length} ${u?"matching ":""}fields`,onCheckedChange:g,isIndeterminate:p&&!O}),c.jsx(VC,{children:v.map(y=>c.jsx(kC,{id:y.id,isChecked:y.isChecked,label:y.label,onCheckedChange:I=>t(y.id,I===!0)},y.id))}),d>1&&c.jsxs("div",{className:mi.paginationContainer,children:[c.jsx(We,{type:"button",onClick:()=>a(y=>Math.max(1,y-1)),disabled:s===1,variant:"ghost",children:"<"}),c.jsxs("span",{className:mi.pageInfo,children:[s," of ",d]}),c.jsx(We,{type:"button",onClick:()=>a(y=>Math.min(d,y+1)),disabled:s===d,variant:"ghost",children:">"})]}),l.length===0&&u&&c.jsxs("div",{className:mi.noResults,children:['No fields found matching "',u,'"']})]})}function JC(e,t,n){var o;const r=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};r[t]=n,n||delete r[t]}function HC(e,t,n,r){t(e,o=>JC(o,n,r))}function WC(){var f,l;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Gt(),o=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,i=(l=t==null?void 0:t.read)==null?void 0:l.optionalFields,s=(d,h)=>{r&&t&&HC(r,n,d,h)},a=b.useMemo(()=>(i==null?void 0:i.filter(d=>!er(d)&&"fieldName"in d&&"displayName"in d).map(d=>({id:d.fieldName,label:d.displayName,isChecked:!!(o!=null&&o[d.fieldName])})).sort((d,h)=>d.label.localeCompare(h.label)))||[],[i,o]);return!!(i&&i.length>0)&&c.jsxs(c.Fragment,{children:[c.jsx(Rt,{string:`${e} reads the following optional fields`}),c.jsx(Cf,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${i==null?void 0:i.length}`)]})}function zC(){return c.jsx(WC,{})}const QC={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 GC({children:e,style:t,...n}){return c.jsx("span",{style:{...QC,...t},...n,children:e})}const XC="_errorAlert_1tcao_1",YC="_errorHeader_1tcao_11",ZC="_errorIcon_1tcao_17",ex="_errorTitle_1tcao_24",tx="_errorMessage_1tcao_30",gi={errorAlert:XC,errorHeader:YC,errorIcon:ZC,errorTitle:ex,errorMessage:tx};function nx({error:e}){return c.jsxs("div",{className:gi.errorAlert,children:[c.jsxs("div",{className:gi.errorHeader,children:[c.jsx(RC,{className:gi.errorIcon}),c.jsx("span",{className:gi.errorTitle,children:"Unable to load object"})]}),c.jsx("div",{className:gi.errorMessage,children:e})]})}function rx(){var s,a,u;const{data:e}=pa(),{selectedObjectName:t}=Gt(),{appName:n}=Zn(),r=(u=(a=(s=e==null?void 0:e.content)==null?void 0:s.read)==null?void 0:a.objects)==null?void 0:u.find(f=>f.objectName===t),o=r==null?void 0:r.error,i=r==null?void 0:r.requiredFields;return o?c.jsx(nx,{error:o}):c.jsxs(c.Fragment,{children:[c.jsx(Rt,{string:`${n} reads the following fields`}),c.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:i!=null&&i.length?i.map(f=>er(f)?null:c.jsx(GC,{children:f.displayName},f.fieldName)):"There are no required fields."})]})}function ix(e,t,n,r,o){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[o]||(e.read.selectedValueMappings[o]={}),r===""&&e.read.selectedValueMappings[o][n]?delete e.read.selectedValueMappings[o][n]:e.read.selectedValueMappings[o][n]=r)}function xf(e,t,n,r,o){t(e,i=>ix(i,e,n,r,o))}function gs(e){return e.mapToDisplayName||e.mapToName||e.fieldName||""}function ox(e,t){if(!e.fieldName)return{isValid:!1,errorMessage:"Field name is missing"};const n=t==null?void 0:t.valueType;if(!["singleSelect","multiSelect"].includes(n||""))return{isValid:!1,errorMessage:"fieldName is not a singleSelect or multiSelect"};const r=t==null?void 0:t.values;if(!r)return{isValid:!1,errorMessage:"Field values array is missing"};const o=Object.keys(r).length,i=Object.keys((e==null?void 0:e.mappedValues)||[]).length;return o!==i?{isValid:!1,errorMessage:"field values and the values to be mapped are not of the same length"}:{isValid:!0}}function sx(e,t,n){const r=Object.values(t).filter(Boolean),o=t[n];return e.filter(i=>{const s=i.value===o,a=r.includes(i.value);return s||!a})}function ax({string:e,fieldName:t}){return c.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[c.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,c.jsx("b",{children:t})]}),c.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:c.jsx($o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function cx({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r}){var m;const{configureState:o,selectedObjectName:i,setConfigureState:s}=Gt(),a=b.useMemo(()=>{var v,w;return((w=(v=o==null?void 0:o.read)==null?void 0:v.selectedValueMappings)==null?void 0:w[n])||{}},[(m=o==null?void 0:o.read)==null?void 0:m.selectedValueMappings,n]),u=b.useMemo(()=>a==null?void 0:a[e.mappedValue],[a,e.mappedValue]),f=b.useMemo(()=>r.map(v=>({id:v.value,label:v.displayValue,value:v.value})),[r]),l=b.useCallback(v=>{v&&t({target:{name:e.mappedValue,value:v.value,fieldName:n}})},[t,n,e.mappedValue]),d=b.useMemo(()=>c.jsx(ef,{items:f,selectedValue:u||null,onSelectedItemChange:l,placeholder:"Please select one",style:{borderRadius:"8px",width:"100%"}},u),[u,f,l]),h=b.useCallback(()=>{i&&xf(i,s,e.mappedValue,"",n)},[i,s,e.mappedValue,n]);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[c.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:c.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[d,c.jsx(We,{type:"button",variant:"ghost",onClick:h,children:"Clear"})]})]},e.mappedValue)}function ux(){var u,f;const{fieldMapping:e}=at(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Gt(),o=(u=n==null?void 0:n.read)==null?void 0:u.selectedFieldMappings,i=(f=n==null?void 0:n.read)==null?void 0:f.selectedValueMappings,s=b.useMemo(()=>{const l=t&&e?Object.values(e[t]||{}).flat().filter(d=>d.mappedValues).map(d=>({...d})):[];if(o)for(let d=0;d<l.length;d+=1){const{mapToName:h}=l[d];o!=null&&o[h]&&(l[d].fieldName=o[h])}return l},[t,e,o]),a=b.useCallback(l=>{const{value:d,name:h,fieldName:m}=l.target;d&&t&&xf(t,r,h,d,m)},[t,r]);return s!=null&&s.length?c.jsx(c.Fragment,{children:s.map(l=>{var m,v,w;const d=(v=(m=n==null?void 0:n.read)==null?void 0:m.allFieldsMetadata)==null?void 0:v[l.fieldName],h=ox(l,d);return h.isValid?c.jsxs(c.Fragment,{children:[c.jsx(ax,{string:"Map the values for ",fieldName:gs(l)}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.jsx(Jo,{id:gs(l),children:(w=l==null?void 0:l.mappedValues)==null?void 0:w.map(g=>{const O=(d==null?void 0:d.values)||[],p=(i==null?void 0:i[l.fieldName])||{},y=sx(O,p,g.mappedValue);return c.jsx(cx,{allValueOptions:y,mappedValue:g,onSelectChange:a,fieldName:(l==null?void 0:l.fieldName)||""},`${g.mappedValue}-${l.fieldName}`)})},gs(l))})]}):(console.error(h.errorMessage,l),null)})}):null}const lx=!1;function dx(){return rC(),c.jsxs(c.Fragment,{children:[c.jsx(sC,{}),c.jsx(rx,{}),c.jsx(tC,{}),c.jsx(eC,{}),c.jsx(ux,{}),c.jsx(zC,{}),lx]})}function fx(e,t,n){var r;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const o=e.write.selectedWriteObjects;n&&(o[t]={objectName:t}),n||delete o[t]}}function px(e,t,n,r){t(e,o=>{fx(o,n,r)})}function hx(){var f,l;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Gt(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(l=n==null?void 0:n.write)==null?void 0:l.writeObjects,s=(d,h)=>{t&&n&&px(t,r,d,h)},a=!!i,u=(i==null?void 0:i.map(d=>({id:d.objectName,label:d.displayName,isChecked:!!(o!=null&&o[d.objectName])})))||[];return a&&c.jsxs(c.Fragment,{children:[c.jsx(Rt,{string:`Allow ${e} to write to these objects`}),c.jsx(Cf,{items:u,onItemChange:s,showSelectAll:i.length>=2})]})}function mx(){return c.jsx(c.Fragment,{children:c.jsx(hx,{})})}function Of({resetComponent:e,onDisconnectSuccess:t}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[c.jsx(Rt,{string:"Remove connection"}),c.jsx("p",{children:"Click to disconnect your connection from the provider."}),c.jsx(ld,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const gx="_authenticationRow_1g2ms_1",yx="_field_1g2ms_8",vx="_value_1g2ms_12",ys={authenticationRow:gx,field:yx,value:vx};function bu({label:e,value:t}){return c.jsxs("div",{className:ys.authenticationRow,children:[c.jsx("div",{className:ys.field,children:e}),c.jsx("div",{className:ys.value,children:t})]})}function wx(){const{selectedConnection:e}=Qt(),{providerName:t}=dt(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return c.jsxs(c.Fragment,{children:[c.jsx(Rt,{string:"Connection details"}),c.jsxs("div",{style:{paddingBottom:"1rem"},children:[c.jsx(bu,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),c.jsx(bu,{label:"Status",value:on((e==null?void 0:e.status)||"")})]})]})}const bx=()=>{const e=st(),t=qe();return On({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:o})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:o}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),He(n)}})};function Sf({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=je(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=at(),[u,f]=b.useState(!1),l=!r||!o||!(i!=null&&i.id)||u,d=bx(),h=async()=>{l||(f(!0),console.warn("uninstalling installation",{projectIdOrName:r,integrationId:o,installationId:i.id}),d.mutate({projectIdOrName:r,integrationId:o,installationId:i.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",i.id),a==null||a(i==null?void 0:i.id),s()},onSettled:()=>f(!1)}))},m=u?"Uninstalling...":e,v=c.jsx(We,{type:"button",onClick:h,disabled:l,variant:t,style:n,children:m});return i!=null&&i.id?v:null}function Ix(){const{installation:e}=at(),{providerName:t}=dt();return e?c.jsxs(c.Fragment,{children:[c.jsx(Rt,{string:"Uninstall entire integration"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?c.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall the entire ",t," ","integration. You will lose any configuration you've set up."]}):c.jsx("p",{children:"You've successfully uninstalled the integration."}),c.jsx(Sf,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function Cx(){const{installation:e,resetComponent:t}=at();return c.jsxs(c.Fragment,{children:[c.jsx(wx,{}),c.jsx(Ia,{}),e&&c.jsx(Ix,{}),!e&&c.jsx(Of,{resetComponent:t})]})}function _f({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var de,be,P,$,H,q,U,V,G,Z,Y,ee,ne,ce;const{installation:i}=Nr(),{hydratedRevision:s,loading:a}=ci(),{configureState:u,selectedObjectName:f}=Gt(),l=i==null?void 0:i.config,d=l&&f&&!!Kl(l,f)||!1,h=f?td(l,f):void 0,m=(de=u==null?void 0:u.read)==null?void 0:de.selectedFieldMappings,v=!Hl(h,m),w=s&&f?va(l,s,f):void 0,g=(be=u==null?void 0:u.read)==null?void 0:be.selectedOptionalFields,O=!Jl(w,g),p=f?(q=(H=($=(P=l==null?void 0:l.content)==null?void 0:P.read)==null?void 0:$.objects)==null?void 0:H[f])==null?void 0:q.selectedValueMappings:void 0,y=(U=u==null?void 0:u.read)==null?void 0:U.selectedValueMappings,I=!Wl(p,y),x=(G=(V=l==null?void 0:l.content)==null?void 0:V.write)==null?void 0:G.objects,N=(Z=u==null?void 0:u.write)==null?void 0:Z.selectedWriteObjects,A=!zl(x||{},N||{}),D=O||v||I||A||r||f!==Qr&&!d,K=!!((ce=(ne=(ee=(Y=s==null?void 0:s.content)==null?void 0:Y.read)==null?void 0:ee.objects)==null?void 0:ne.find(k=>k.objectName===f))!=null&&ce.error),j=a||n||!u||!f||!D||K,L=f===Qr,se=f===Io,re=c.jsx(We,{type:"submit",disabled:j,children:r?"Install":"Save"}),ge=c.jsx(We,{type:"button",onClick:t,disabled:j,variant:"ghost",children:"Reset"});return n?c.jsx(Si,{}):c.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[c.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!se&&c.jsxs(c.Fragment,{children:[re,ge]})}),c.jsxs(Sn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&c.jsx(ki,{children:typeof o=="string"?o:"Installation Failed."}),a&&c.jsx(Si,{}),s&&!L&&!se&&c.jsx(dx,{}),s&&L&&!se&&c.jsx(mx,{}),!a&&se&&c.jsx(Cx,{})]})]})}const Ef=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i,fieldMapping:s}=at(),{hydratedRevision:a,loading:u}=ci(),{selectedObjectName:f}=pd(),{selectedConnection:l}=Qt(),d=zu(),{projectIdOrName:h}=je(),{resetBoundary:m,setErrors:v,setError:w,getError:g}=an(),{resetConfigureState:O,objectConfigurationsState:p}=Ca(),y=nd(f||"",p),{onNextIncompleteTab:I}=Vb(),x=b.useCallback(()=>{m(we.INSTALLATION_MUTATION)},[m]),N=b.useCallback(_=>_?F=>{w(we.INSTALLATION_MUTATION,_,F)}:F=>{console.error("objectName is required to set installation error: ",F)},[w]),A=b.useCallback(_=>_?g(we.INSTALLATION_MUTATION,_):"",[g]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:a,loading:u,selectedObjectName:f,selectedConnection:l,apiKey:d,projectIdOrName:h,resetBoundary:m,setErrors:v,setMutateInstallationError:N,getMutateInstallationError:A,resetMutateInstallationErrorState:x,resetConfigureState:O,objectConfigurationsState:p,configureState:y,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:I,fieldMapping:s}},xx=void 0;function Ox(){const{consumerRef:e,setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,selectedConnection:i,resetBoundary:s,setErrors:a,setMutateInstallationError:u,getMutateInstallationError:f,resetMutateInstallationErrorState:l,resetConfigureState:d,objectConfigurationsState:h,configureState:m,onInstallSuccess:v,onNextIncompleteTab:w,fieldMapping:g}=Ef(),[O,p]=b.useState(!1),{createInstallation:y}=kl(),I=o===Qr,x=f(o),N=b.useCallback(()=>{s(we.MAPPING),n!=null&&n.content&&!r&&o&&Gl(n,xx,o,d)},[s,n,r,o,d]);b.useEffect(()=>{!m&&(n!=null&&n.content)&&!r&&N()},[m,h,n,r,N]);const A=()=>{l();const{requiredMapFields:R,selectedFieldMappings:D}=(m==null?void 0:m.read)||{},{errorList:K}=Bl(R,D,a);if(!(K.length>0))if(o&&(i!=null&&i.id)&&e&&n){p(!0);const j=Yw(m,o,n,e,g);if(!j){console.error("Error when generating createConfig from configureState"),p(!1);return}y({config:j.content,onSuccess:L=>{t(L),v==null||v(L.id,L.config),p(!1),w()},onError:L=>{u(o)(L.message),p(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},_=()=>{if(l(),o&&(i!=null&&i.id)&&e&&n){p(!0);const R=eb(m,n,e);if(!R){console.error("Error when generating createConfig from configureState"),p(!1);return}y({config:R.content,onSuccess:D=>{t(D),v==null||v(D.id,D.config),p(!1),w()},onError:D=>{u(o)(D.message),p(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},F=R=>{R.preventDefault(),I?_():A()};return c.jsx(_f,{errorMsg:x,isCreateMode:!0,isLoading:O,onSave:F,onReset:N})}const Sx=(e,t,n,r,o)=>{const i=Xl(e),s=Yl(e),a=Zl(t,o),u=ed(e),f={content:{read:{objects:{[t]:{objectName:t,selectedFields:i,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:u||{},backfill:r}}}}};return Mi(n)&&(f.content||(f.content={}),f.content.proxy={enabled:!0}),f},_x=(e,t)=>{const r={content:{write:{objects:rd(e)}}};return Mi(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r};function Ex({installation:e}){const{setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,resetBoundary:i,setErrors:s,setMutateInstallationError:a,getMutateInstallationError:u,resetConfigureState:f,configureState:l,onUpdateSuccess:d,onNextIncompleteTab:h,fieldMapping:m}=Ef(),{updateInstallation:v}=jl(),[w,g]=b.useState(!1),O=o===Qr,p=u(o),{config:y}=e,I=b.useCallback(()=>{i(we.MAPPING),n!=null&&n.content&&!r&&o&&Gl(n,y,o,f)},[i,n,r,o,y,f]);b.useEffect(()=>{l||I()},[l,I]);const x=b.useMemo(()=>{var R,D,K;return(K=(D=(R=n==null?void 0:n.content)==null?void 0:R.read)==null?void 0:D.objects)==null?void 0:K.find(j=>(j==null?void 0:j.objectName)===o)},[n,o]),N=()=>{const{requiredMapFields:F,selectedFieldMappings:R}=(l==null?void 0:l.read)||{},{errorList:D}=Bl(F,R,s);if(!(D.length>0))if(n&&l&&o&&x){g(!0);const K=Sx(l,o,n,x.backfill,m);if(!K){console.error("Error when generating updateConfig from configureState"),g(!1);return}v({config:K.content,onSuccess:j=>{t(j),d==null||d(j.id,j.config),g(!1),h()},onError:j=>{a(o)(j.message),g(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},A=()=>{if(l&&n){g(!0);const F=_x(l,n);if(!F){console.error("Error when generating write updateConfig from configureState"),g(!1);return}v({config:F.content,onSuccess:R=>{t(R),d==null||d(R.id,R.config),g(!1),h()},onError:R=>{a(o)(R.message),g(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},_=F=>{F.preventDefault(),O?A():N()};return c.jsx(_f,{errorMsg:p,onSave:_,onReset:I,isLoading:w})}function Nx(){const{integrationObj:e,installation:t}=at();return e?t&&e?c.jsx(Ex,{installation:t}):c.jsx(Ox,{}):c.jsx(Rl,{message:"We can't load the integration"})}function Tx(){return c.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),c.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Za({text:e,children:t}){return c.jsx(si,{children:c.jsxs(Sn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[c.jsx(Tx,{}),c.jsx("p",{children:e}),t]})})}function Rx({provider:e}){const{providerName:t}=dt(e),n=`You have successfully installed your ${t} integration.`;return c.jsx(Za,{text:n,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:c.jsx(Sf,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Ax=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function Fx({children:e}){var x;const t=b.useRef(!1),{projectIdOrName:n}=je(),{hydratedRevision:r,loading:o}=ci(),{integrationObj:i,installation:s,groupRef:a,consumerRef:u,onInstallSuccess:f,isIntegrationDeleted:l}=at(),{mutate:d,isIdle:h,isPending:m,error:v,errorMsg:w}=Ml(),{selectedConnection:g,isConnectionsLoading:O}=Qt(),p=o||m||O,y=(x=r==null?void 0:r.content)==null?void 0:x.provider,I=Ax(r);return b.useEffect(()=>{var N;if(!p&&!O&&r&&I&&!s&&g&&(i!=null&&i.id)&&!l&&y){const A={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:g==null?void 0:g.id,config:{content:{provider:y}}}};Mi(r)===!0&&(A.installation.config.content.proxy=(N=r==null?void 0:r.content)==null?void 0:N.proxy),h&&!t.current&&(d(A,{onSuccess:_=>{f==null||f(_==null?void 0:_.id,_.config)}}),t.current=!0)}},[r,I,s,g,n,i==null?void 0:i.id,a,u,p,f,l,O,y,d,h]),I&&y&&s?c.jsx(Rx,{provider:y}):v?c.jsx(Jt,{message:w??"Create installation failed"}):i?p?c.jsx(ai,{}):c.jsx("div",{children:e}):c.jsx(Jt,{message:"We can't load the integration"})}function $i(){const e=st(),t=qe();return On({mutationKey:["createConnection"],mutationFn:async n=>(await e()).connectionApi.generateConnection(n),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error creating connection and loading provider info"),He(n)}})}function Px({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:u}=je(),f=$i(),l=b.useCallback(d=>{var w;const{apiKey:h,providerMetadata:m}=d,v={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:(w=m==null?void 0:m.workspace)==null?void 0:w.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:h,...m&&{providerMetadata:m}}};f.mutate(v)},[u,i,o,r,n,e,f]);return a===null?c.jsx(wb,{provider:e,providerInfo:t,handleSubmit:l,error:null}):s}function Dx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:u}=je(),f=$i(),l=b.useCallback(d=>{var g;const{user:h,pass:m,providerMetadata:v}=d,w={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:(g=v==null?void 0:v.workspace)==null?void 0:g.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:h,password:m},...v&&{providerMetadata:v}}};f.mutate(w)},[u,i,o,r,n,e,f]);return a===null?c.jsx(Ob,{provider:e,providerInfo:t,handleSubmit:l,error:null}):s}function Iu({url:e,prompt:t,inputName:n}){return c.jsx("p",{style:{color:"var(--amp-colors-text-muted)",display:"flex",justifyContent:"space-between"},children:c.jsxs("span",{children:[e?c.jsx(wa,{href:e,newTab:!0,children:c.jsx("span",{style:{textDecoration:"underline"},children:n})}):c.jsx("span",{children:n})," ",t&&c.jsx(ff,{id:`docs-helper-text-${Pw(n||(t==null?void 0:t.slice(0,50)))}`,tooltipText:t})]})})}function Mx({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r}){var h,m;const[o,i]=b.useState({}),s=((h=e.metadata)==null?void 0:h.input)||[],a=v=>{const{name:w,value:g}=v.currentTarget;i(O=>({...O,[w]:g.trim()}))},u=Gr(s,o),f=n||!u,l=((m=e.customOpts)==null?void 0:m.inputs)||[],d=()=>{const v=Lo(s,o),w=Object.fromEntries(l.map(g=>[g.name,o[g.name]]));t({customAuth:w,providerMetadata:v})};return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[l.map(v=>c.jsxs("div",{children:[c.jsx(Iu,{url:v.docsURL,prompt:v.prompt,inputName:v.displayName}),c.jsx(Ot.PasswordInput,{id:v.name,name:v.name,onChange:a,placeholder:""})]},v.name)),s.map(v=>c.jsxs("div",{children:[v.docsURL&&c.jsx(Iu,{url:v.docsURL,prompt:v.displayName||v.name,inputName:v.displayName||on(v.name.toLowerCase())}),c.jsx(Ot.Input,{id:v.name,name:v.name,type:"text",placeholder:"",onChange:a})]},v.name)),c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"submit",onClick:d,variant:r,children:"Next"})]})}function kx({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r}){return c.jsxs(tr,{children:[c.jsx(nr,{children:`Set up ${e.displayName} integration`}),c.jsx(cn,{error:n}),c.jsx(Mx,{providerInfo:e,handleSubmit:t,isButtonDisabled:r})]})}function jx({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s}){const{projectIdOrName:a}=je(),u=$i(),[f,l]=b.useState(null),d=b.useCallback(h=>{var g;const{customAuth:m,providerMetadata:v}=h;l(null);const w={projectIdOrName:a,generateConnectionParams:{providerWorkspaceRef:(g=v==null?void 0:v.workspace)==null?void 0:g.value,groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:m,...v&&{providerMetadata:v}}};u.mutate(w,{onError:O=>{He(O,l)},onSuccess:()=>{l(null)}})},[a,o,r,n,t,e.name,u]);return s===null?c.jsx(kx,{providerInfo:e,handleSubmit:d,error:f}):i}function Lx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:o,title:i}){if(!i&&!r)throw new Error("Either title or providerName is required");return c.jsxs(tr,{children:[c.jsx(nr,{children:i||`Set up ${r} integration`}),c.jsx(cn,{error:t}),o,c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Vx({...e}){return c.jsx(Lx,{...e})}function $x({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:u}=je(),f=$i(),l=b.useCallback(()=>{const d={projectIdOrName:u,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};f.mutate(d)},[u,o,r,n,t,e,f]);return s===null?c.jsx(Vx,{handleSubmit:l,error:null,providerName:a}):i}const Kx=()=>{const e=st(),t=qe();return On({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function qx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs(tr,{children:[c.jsx(nr,{children:`Set up ${r} integration`}),c.jsx(mb,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),c.jsx(cn,{error:t}),c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const Ux="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Bx({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return c.jsxs(tr,{children:[c.jsx(nr,{children:"Enter your Salesforce subdomain"}),c.jsx(wa,{href:Ux,newTab:!0,children:"What is my Salesforce subdomain?"}),c.jsx(cn,{error:n}),c.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[c.jsx(Ot.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),c.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function Jx({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return c.jsxs(tr,{children:[c.jsxs(nr,{children:["Enter your ",o," workspace"]}),c.jsx(cn,{error:n}),c.jsx("br",{}),i.map(s=>c.jsx(Ot.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),c.jsx("br",{}),c.jsx(We,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Cu=600,xu=600,Ou="salesforce";function Hx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var D;const{projectId:s}=Zn(),a=qe(),u=b.useRef(null),[f,l]=b.useState(null),[d,h]=b.useState(""),[m,v]=b.useState({}),[w,g]=b.useState({}),{data:O}=jo(e),p=((D=O==null?void 0:O.metadata)==null?void 0:D.input)||[],{mutateAsync:y,isPending:I}=Kx(),{isFetching:x,refetch:N}=ga({groupRef:r,provider:e});b.useEffect(()=>{const K=j=>{var L,se,re;j.origin===El&&(((L=j.data)==null?void 0:L.eventType)==="AUTHORIZATION_SUCCEEDED"?(l(null),console.debug("New connection:",j.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((se=j.data)==null?void 0:se.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",j.data.data.error),a.invalidateQueries({queryKey:["amp","connections"]}),l(j.data.data.error||"An error occurred. Please try again.")),(re=u.current)==null||re.close())};return window.addEventListener("message",K),()=>window.removeEventListener("message",K)},[a]);const A=K=>{h(K),v(j=>({...j,workspace:K})),g(j=>({...j,workspace:{value:K,source:"input"}}))},_=(K,j)=>{v(L=>({...L,[K]:j})),g(L=>({...L,[K]:{value:j,source:"input"}}))},F=async()=>{var K;l(null);try{const{data:j}=await N();if(j&&j.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(p.length>0&&!Gr(p,m)){l("Please fill in all required fields");return}try{const j=await y({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s||"",consumerName:n,groupName:o,providerWorkspaceRef:e===Ou?d:(K=w==null?void 0:w.workspace)==null?void 0:K.value,providerMetadata:w}});if(j){const L=window.screenX+(window.outerWidth-Cu)/2,se=window.screenY+(window.outerHeight-xu)/2.5,re=`width=${Cu},height=${xu},left=${L},top=${se}`;u.current=window.open(j,"OAuthPopup",re)}}catch(j){console.error(j),l(j instanceof Error?j.message:String(j)||"An error occurred. Please try again.")}},R=e===Ou?c.jsx(Bx,{handleSubmit:F,setWorkspace:A,error:f,isButtonDisabled:d.length===0||I||x}):p.length>0?c.jsx(Jx,{handleSubmit:F,setFormData:_,error:f,isButtonDisabled:!Gr(p,m)||I||x,providerName:i,metadataFields:p}):c.jsx(qx,{handleSubmit:F,error:f,providerName:i,isButtonDisabled:I||x});return c.jsx("div",{children:R})}function Wx({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:u}=je(),f=$i(),[l,d]=b.useState(null),h=b.useCallback(m=>{var w,g;d(null);const v={projectIdOrName:u,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(g=(w=m.providerMetadata)==null?void 0:w.workspace)==null?void 0:g.value,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes},...m.providerMetadata&&{providerMetadata:m.providerMetadata}}};f.mutate(v,{onError:()=>d("Error loading provider info")})},[u,i,o,r,n,e,f]);return a===null?c.jsx(_b,{provider:e,providerName:t,handleSubmit:h,error:l,explicitScopesRequired:s}):c.jsx(Si,{})}function zx({...e}){return c.jsx(Wx,{...e})}const Qx="authorizationCode",Gx="authorizationCodePKCE",Xx="clientCredentials";function Yx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:u}=dt(e);if(t.oauth2Opts===void 0)return c.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:f,explicitScopesRequired:l}=t.oauth2Opts,d={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:u};return f===Qx||f===Gx?c.jsx(Hx,{...d}):f===Xx?c.jsx(zx,{...d,explicitScopesRequired:l,selectedConnection:s,setSelectedConnection:a}):f==="password"?c.jsx("em",{children:"Password flow not supported yet"}):c.jsxs("em",{children:["Unsupported grant type: ",f]})}function Zx(e){const{selectedConnection:t}=Qt();b.useEffect(()=>{e&&t&&e(t)},[e,t])}function eO({onSuccess:e}){Zx(e)}function Nf({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:u}){const{data:f,isLoading:l,isError:d,error:h,providerName:m,selectedProvider:v}=dt(e),{provider:w,isIntegrationDeleted:g}=at(),{selectedConnection:O,setSelectedConnection:p}=Qt();eO({onSuccess:s});const y=qe(),I=f;b.useEffect(()=>{d&&(console.error("Error loading provider info."),He(h))},[d,h]);const x=b.useCallback(()=>{y.clear(),u()},[u,y]);if(!e&&!w)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(g)return c.jsx(Za,{text:"Integration successfully uninstalled.",children:c.jsx(We,{type:"button",onClick:x,style:{width:"100%"},children:"Reinstall Integration"})});if(O)return i;if(l)return c.jsx(ai,{});if(I==null)return c.jsx(Jt,{message:"Provider info was not found."});const N={provider:v,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:O,setSelectedConnection:p,providerName:m,providerInfo:I,onDisconnectSuccess:a};return I.authType==="none"?c.jsx($x,{...N,children:i}):I.authType==="basic"?c.jsx(Dx,{...N,children:i}):I.authType==="apiKey"?c.jsx(Px,{...N,children:i}):I.authType==="custom"?c.jsx(jx,{...N,children:i}):c.jsx(Yx,{...N})}function tO(e){const t=e+"CollectionProvider",[n,r]=Ho(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=w=>{const{scope:g,children:O}=w,p=b.useRef(null),y=b.useRef(new Map).current;return c.jsx(o,{scope:g,itemMap:y,collectionRef:p,children:O})};s.displayName=t;const a=e+"CollectionSlot",u=ta(a),f=b.forwardRef((w,g)=>{const{scope:O,children:p}=w,y=i(a,O),I=ni(g,y.collectionRef);return c.jsx(u,{ref:I,children:p})});f.displayName=a;const l=e+"CollectionItemSlot",d="data-radix-collection-item",h=ta(l),m=b.forwardRef((w,g)=>{const{scope:O,children:p,...y}=w,I=b.useRef(null),x=ni(g,I),N=i(l,O);return b.useEffect(()=>(N.itemMap.set(I,{ref:I,...y}),()=>void N.itemMap.delete(I))),c.jsx(h,{[d]:"",ref:x,children:p})});m.displayName=l;function v(w){const g=i(e+"CollectionConsumer",w);return b.useCallback(()=>{const p=g.collectionRef.current;if(!p)return[];const y=Array.from(p.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((N,A)=>y.indexOf(N.ref.current)-y.indexOf(A.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:f,ItemSlot:m},v,r]}var nO=B[" useId ".trim().toString()]||(()=>{}),rO=0;function Tf(e){const[t,n]=B.useState(nO());return Ni(()=>{n(r=>r??String(rO++))},[e]),e||(t?`radix-${t}`:"")}function iO(e){const t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var oO=B.createContext(void 0);function Rf(e){const t=B.useContext(oO);return e||t||"ltr"}var vs="rovingFocusGroup.onEntryFocus",sO={bubbles:!1,cancelable:!0},Ki="RovingFocusGroup",[na,Af,aO]=tO(Ki),[cO,Ff]=Ho(Ki,[aO]),[uO,lO]=cO(Ki),Pf=B.forwardRef((e,t)=>c.jsx(na.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(na.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(dO,{...e,ref:t})})}));Pf.displayName=Ki;var dO=B.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...d}=e,h=B.useRef(null),m=ni(t,h),v=Rf(i),[w,g]=Wa({prop:s,defaultProp:a??null,onChange:u,caller:Ki}),[O,p]=B.useState(!1),y=iO(f),I=Af(n),x=B.useRef(!1),[N,A]=B.useState(0);return B.useEffect(()=>{const _=h.current;if(_)return _.addEventListener(vs,y),()=>_.removeEventListener(vs,y)},[y]),c.jsx(uO,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:w,onItemFocus:B.useCallback(_=>g(_),[g]),onItemShiftTab:B.useCallback(()=>p(!0),[]),onFocusableItemAdd:B.useCallback(()=>A(_=>_+1),[]),onFocusableItemRemove:B.useCallback(()=>A(_=>_-1),[]),children:c.jsx(_n.div,{tabIndex:O||N===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:Ht(e.onMouseDown,()=>{x.current=!0}),onFocus:Ht(e.onFocus,_=>{const F=!x.current;if(_.target===_.currentTarget&&F&&!O){const R=new CustomEvent(vs,sO);if(_.currentTarget.dispatchEvent(R),!R.defaultPrevented){const D=I().filter(re=>re.focusable),K=D.find(re=>re.active),j=D.find(re=>re.id===w),se=[K,j,...D].filter(Boolean).map(re=>re.ref.current);kf(se,l)}}x.current=!1}),onBlur:Ht(e.onBlur,()=>p(!1))})})}),Df="RovingFocusGroupItem",Mf=B.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,u=Tf(),f=i||u,l=lO(Df,n),d=l.currentTabStopId===f,h=Af(n),{onFocusableItemAdd:m,onFocusableItemRemove:v,currentTabStopId:w}=l;return B.useEffect(()=>{if(r)return m(),()=>v()},[r,m,v]),c.jsx(na.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:c.jsx(_n.span,{tabIndex:d?0:-1,"data-orientation":l.orientation,...a,ref:t,onMouseDown:Ht(e.onMouseDown,g=>{r?l.onItemFocus(f):g.preventDefault()}),onFocus:Ht(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:Ht(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){l.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const O=hO(g,l.orientation,l.dir);if(O!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let y=h().filter(I=>I.focusable).map(I=>I.ref.current);if(O==="last")y.reverse();else if(O==="prev"||O==="next"){O==="prev"&&y.reverse();const I=y.indexOf(g.currentTarget);y=l.loop?mO(y,I+1):y.slice(I+1)}setTimeout(()=>kf(y))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:w!=null}):s})})});Mf.displayName=Df;var fO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function pO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function hO(e,t,n){const r=pO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return fO[r]}function kf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function mO(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var gO=Pf,yO=Mf,zo="Tabs",[vO,WO]=Ho(zo,[Ff]),jf=Ff(),[wO,ec]=vO(zo),Lf=B.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:u="automatic",...f}=e,l=Rf(a),[d,h]=Wa({prop:r,onChange:o,defaultProp:i??"",caller:zo});return c.jsx(wO,{scope:n,baseId:Tf(),value:d,onValueChange:h,orientation:s,dir:l,activationMode:u,children:c.jsx(_n.div,{dir:l,"data-orientation":s,...f,ref:t})})});Lf.displayName=zo;var Vf="TabsList",$f=B.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=ec(Vf,n),s=jf(n);return c.jsx(gO,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:c.jsx(_n.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});$f.displayName=Vf;var Kf="TabsTrigger",qf=B.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=ec(Kf,n),a=jf(n),u=Bf(s.baseId,r),f=Jf(s.baseId,r),l=r===s.value;return c.jsx(yO,{asChild:!0,...a,focusable:!o,active:l,children:c.jsx(_n.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":f,"data-state":l?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...i,ref:t,onMouseDown:Ht(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Ht(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Ht(e.onFocus,()=>{const d=s.activationMode!=="manual";!l&&!o&&d&&s.onValueChange(r)})})})});qf.displayName=Kf;var Uf="TabsContent",bO=B.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=ec(Uf,n),u=Bf(a.baseId,r),f=Jf(a.baseId,r),l=r===a.value,d=B.useRef(l);return B.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),c.jsx(za,{present:o||l,children:({present:h})=>c.jsx(_n.div,{"data-state":l?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":u,hidden:!h,id:f,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&i})})});bO.displayName=Uf;function Bf(e,t){return`${e}-trigger-${t}`}function Jf(e,t){return`${e}-content-${t}`}var IO=Lf,CO=$f,Hf=qf;const xO=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 OO(e,t){return t?b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},b.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?xO:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:c.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function SO(){return c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M8 11C9.65685 11 11 9.65685 11 8C11 6.34315 9.65685 5 8 5C6.34315 5 5 6.34315 5 8C5 9.65685 6.34315 11 8 11Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M12.3378 5.04365C12.4882 5.25907 12.62 5.48699 12.7315 5.7249L14.3503 6.6249C14.5524 7.5302 14.5545 8.4687 14.3565 9.3749L12.7315 10.2749C12.62 10.5128 12.4882 10.7407 12.3378 10.9562L12.369 12.8124C11.683 13.4375 10.871 13.9085 9.98776 14.1937L8.39401 13.2374C8.13185 13.2562 7.86868 13.2562 7.60651 13.2374L6.01901 14.1874C5.13295 13.9075 4.31832 13.4383 3.63151 12.8124L3.66276 10.9624C3.51356 10.744 3.38189 10.5141 3.26901 10.2749L1.65026 9.3749C1.44814 8.46961 1.446 7.53111 1.64401 6.6249L3.26901 5.7249C3.38056 5.48699 3.5123 5.25907 3.66276 5.04365L3.63151 3.1874C4.31754 2.56226 5.1295 2.09128 6.01276 1.80615L7.60651 2.7624C7.86868 2.74365 8.13185 2.74365 8.39401 2.7624L9.98151 1.8124C10.8676 2.09234 11.6822 2.5615 12.369 3.1874L12.3378 5.04365Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const _O="_tabsRoot_ktpr0_1",EO="_tabsList_ktpr0_6",NO="_tabTrigger_ktpr0_12",Ro={tabsRoot:_O,tabsList:EO,tabTrigger:NO};function TO(){return c.jsxs(c.Fragment,{children:[c.jsx($o,{style:{margin:"1rem 0"}}),c.jsx(Hf,{value:Io,className:Ro.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[c.jsx(SO,{}),c.jsx("span",{children:"Manage"})]})})]})}function Wf({objectName:e,completed:t,pending:n,displayName:r}){return c.jsx(Hf,{value:e,className:Ro.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[OO(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 RO({completed:e,pending:t,displayName:n}){return c.jsxs(c.Fragment,{children:[c.jsx($o,{style:{margin:"1rem 0"}}),c.jsx(Wf,{objectName:Qr,completed:e,pending:t,displayName:n},"other-write")]})}function AO({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var l,d,h,m;const{data:i}=xl(),{installation:s}=Nr(),a=s==null?void 0:s.config,u=(d=(l=a==null?void 0:a.content)==null?void 0:l.write)==null?void 0:d.objects,f=(m=(h=r==null?void 0:r.other)==null?void 0:h.write)==null?void 0:m.selectedWriteObjects;return c.jsx(IO,{value:e,className:Ro.tabsRoot,onValueChange:n,children:c.jsxs(CO,{className:Ro.tabsList,children:[t.map(v=>{var D,K,j,L,se,re;const w=(j=(K=(D=a==null?void 0:a.content)==null?void 0:D.read)==null?void 0:K.objects)==null?void 0:j[v.name],g=r==null?void 0:r[v.name],O=td(a,v.name),p=(L=g==null?void 0:g.read)==null?void 0:L.selectedFieldMappings,y=!Hl(O,p),I=i?va(a,i,v.name):void 0,x=(se=g==null?void 0:g.read)==null?void 0:se.selectedOptionalFields,N=!Jl(I,x),A=w==null?void 0:w.selectedValueMappings,_=(re=g==null?void 0:g.read)==null?void 0:re.selectedValueMappings,F=!Wl(A,_),R=N||y||F||!1;return c.jsx(Wf,{objectName:v.name,displayName:v.displayName,completed:v.completed,pending:R},v.name)}),o&&(()=>{const v=!zl(u||{},f||{});return c.jsx(RO,{completed:o.completed,pending:v,displayName:"Write"})})(),c.jsx(TO,{})]})})}function FO(e,t){return t===Io?{name:Io,completed:!1}:e.find(n=>n.name===t)}function PO({children:e}){var O;const{data:t}=Zn(),{installation:n}=at(),{providerName:r}=dt(),{hydratedRevision:o}=ci(),{objectConfigurationsState:i}=Ca(),[s,a]=b.useState(""),u=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,l=o&&ql(f,o),d=l!==null,h=!!((O=o==null?void 0:o.content)!=null&&O.write),m=h?Ul(f):void 0,v=b.useMemo(()=>{const p=[...l||[]];return m&&h&&p.push(m),p},[l,m,h]),w=FO(v,s),g=b.useCallback(()=>{const p=v.find(y=>w!==y&&!y.completed);p&&a(p.name)},[v,w]);return b.useEffect(()=>{!s&&v.length>0&&a(v[0].name)},[v,s,g]),c.jsx(hd.Provider,{value:g,children:c.jsx(fd.Provider,{value:w==null?void 0:w.name,children:c.jsxs(si,{style:{maxWidth:"55rem"},children:[c.jsxs(Sn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[c.jsxs("div",{style:{width:"20rem"},children:[c.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),c.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:u}),d&&c.jsx(AO,{value:s,readNavObjects:l,onValueChange:p=>a(p),objectConfigurationsState:i,writeNavObject:m})]}),e]}),c.jsx(sd,{})]})})})}function DO({...e}){return c.jsx(PO,{...e})}const MO="_resetContainer_lkwv9_4",zf={resetContainer:MO},kO=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u})=>{var g;const{projectIdOrName:f,isLoading:l}=Zn(),{isLoading:d}=ko(),{isError:h,errorState:m}=an(),{seed:v,reset:w}=Ll();return l||d?c.jsx(ai,{}):h(we.PROJECT,f)?c.jsx(Jt,{message:`Error loading project ${f}`}):h(we.INTEGRATION_LIST,f)?c.jsx(Jt,{message:"Error retrieving integrations for the project, double check the API key"}):(g=m[we.INTEGRATION_LIST])!=null&&g.apiError?c.jsx(Jt,{message:"Something went wrong, couldn't find integration information"}):c.jsx("div",{className:zf.resetContainer,children:c.jsx(Mw,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u,resetComponent:w,children:c.jsx(Dl,{children:c.jsx(Nf,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:w,children:c.jsx(Lb,{resetComponent:w,children:c.jsx(Fx,{children:c.jsx(Kb,{children:c.jsx(DO,{children:c.jsx(Nx,{})})})})})})})},v)})};function jO({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u}){const f={integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:u};return c.jsx(ma,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:c.jsx(kO,{...f})})}function LO(){return c.jsxs(si,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[c.jsx(Si,{}),c.jsx("p",{children:"Redirecting"})]})}function VO({redirectURL:e,children:t}){return b.useEffect(()=>{e&&window.location.replace(e)},[e]),e?c.jsx(LO,{}):t}function $O({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=b.useState(!1);return c.jsxs(c.Fragment,{children:[r===!1&&c.jsxs(c.Fragment,{children:[c.jsx(Rt,{string:"Manage connection"}),c.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[c.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),c.jsx(We,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&c.jsxs(c.Fragment,{children:[c.jsx(Ia,{provider:n}),c.jsx(Of,{resetComponent:e,onDisconnectSuccess:t})]})]})}function KO({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Zn(),{providerName:o}=dt(e),i=`You have successfully connected your ${o} account to ${r}.`;return c.jsx(Za,{text:i,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:c.jsx($O,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function qO({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:u}){const{seed:f,reset:l}=Ll(),d=b.useCallback(h=>{s?s(h.id):u&&u(h)},[s,u]);return c.jsx("div",{className:zf.resetContainer,children:c.jsx(ma,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:c.jsx(Dl,{groupRef:r,provider:e,children:c.jsx(Nf,{resetComponent:l,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:d,onDisconnectSuccess:a,children:c.jsx(VO,{redirectURL:i,children:c.jsx(KO,{resetComponent:l,provider:e,onDisconnectSuccess:a})})})})})},f)}const UO=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=da(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,u=n==null?void 0:n[0],f=u==null?void 0:u.config;return b.useEffect(()=>{o&&He(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:f}};exports.AmpersandContext=sa;exports.AmpersandProvider=bh;exports.ConnectProvider=qO;exports.FieldSettingWriteOnCreateEnum=dm;exports.FieldSettingWriteOnUpdateEnum=fm;exports.InstallIntegration=jO;exports.InstallationProvider=ma;exports.useAmpersandProviderProps=je;exports.useConfig=hw;exports.useConnection=fa;exports.useCreateInstallation=kl;exports.useDeleteInstallation=$w;exports.useInstallation=Nr;exports.useIsIntegrationInstalled=UO;exports.useLocalConfig=pw;exports.useManifest=pa;exports.useUpdateInstallation=jl;
52
52
  //# sourceMappingURL=amp-react.cjs.js.map