@amp-labs/react 2.9.3 → 2.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/amp-react.cjs.js +13 -13
- package/build/amp-react.cjs.js.map +1 -1
- package/build/amp-react.es.js +6201 -5839
- package/build/amp-react.es.js.map +1 -1
- package/build/index.d.ts +66 -14
- package/build/style.css +1 -1
- package/package.json +3 -1
package/build/amp-react.cjs.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";var Rp=Object.defineProperty;var yc=e=>{throw TypeError(e)};var Pp=(e,t,n)=>t in e?Rp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Fe=(e,t,n)=>Pp(e,typeof t!="symbol"?t+"":t,n),rs=(e,t,n)=>t.has(e)||yc("Cannot "+n);var O=(e,t,n)=>(rs(e,t,"read from private field"),n?n.call(e):t.get(e)),oe=(e,t,n)=>t.has(e)?yc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Q=(e,t,n,r)=>(rs(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),fe=(e,t,n)=>(rs(e,t,"access private method"),n);var Zi=(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 Fp(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 $=Fp(b);var ai=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ir=typeof window>"u"||"Deno"in globalThis;function ht(){}function Dp(e,t){return typeof e=="function"?e(t):e}function Os(e){return typeof e=="number"&&e>=0&&e!==1/0}function qu(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Wn(e,t){return typeof e=="function"?e(t):e}function Lt(e,t){return typeof e=="function"?e(t):e}function vc(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==ua(s,t.options))return!1}else if(!xi(t.queryKey,s))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function wc(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Cr(t.options.mutationKey)!==Cr(i))return!1}else if(!xi(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function ua(e,t){return((t==null?void 0:t.queryKeyHashFn)||Cr)(e)}function Cr(e){return JSON.stringify(e,(t,n)=>_s(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function xi(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>xi(e[n],t[n])):!1}function Es(e,t){if(e===t)return e;const n=bc(e)&&bc(t);if(n||_s(e)&&_s(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]=Es(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 bc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function _s(e){if(!Ic(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Ic(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ic(e){return Object.prototype.toString.call(e)==="[object Object]"}function Mp(e){return new Promise(t=>{setTimeout(t,e)})}function Ns(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 Es(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 Es(e,t)}return t}function kp(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 Vu(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 Hu(e,t){return typeof e=="function"?e(...t):!!e}var fr,Ln,jr,Pu,Lp=(Pu=class extends ai{constructor(){super();oe(this,fr);oe(this,Ln);oe(this,jr);Q(this,jr,t=>{if(!Ir&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,Ln)||this.setEventListener(O(this,jr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Ln))==null||t.call(this),Q(this,Ln,void 0))}setEventListener(t){var n;Q(this,jr,t),(n=O(this,Ln))==null||n.call(this),Q(this,Ln,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(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 O(this,fr)=="boolean"?O(this,fr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},fr=new WeakMap,Ln=new WeakMap,jr=new WeakMap,Pu),la=new Lp,Lr,Kn,Kr,Fu,Kp=(Fu=class extends ai{constructor(){super();oe(this,Lr,!0);oe(this,Kn);oe(this,Kr);Q(this,Kr,t=>{if(!Ir&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){O(this,Kn)||this.setEventListener(O(this,Kr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Kn))==null||t.call(this),Q(this,Kn,void 0))}setEventListener(t){var n;Q(this,Kr,t),(n=O(this,Kn))==null||n.call(this),Q(this,Kn,t(this.setOnline.bind(this)))}setOnline(t){O(this,Lr)!==t&&(Q(this,Lr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,Lr)}},Lr=new WeakMap,Kn=new WeakMap,Kr=new WeakMap,Fu),bo=new Kp;function Ts(){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 $p(e){return Math.min(1e3*2**e,3e4)}function Bu(e){return(e??"online")==="online"?bo.isOnline():!0}var Ju=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Wu(e){let t=!1,n=0,r;const o=Ts(),i=()=>o.status!=="pending",s=w=>{var v;i()||(h(new Ju(w)),(v=e.abort)==null||v.call(e))},a=()=>{t=!0},c=()=>{t=!1},f=()=>la.isFocused()&&(e.networkMode==="always"||bo.isOnline())&&e.canRun(),d=()=>Bu(e.networkMode)&&e.canRun(),l=w=>{i()||(r==null||r(),o.resolve(w))},h=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 T;if(i())return;const p=e.retry??(Ir?0:3),y=e.retryDelay??$p,I=typeof y=="function"?y(n,x):y,S=p===!0||typeof p=="number"&&n<p||typeof p=="function"&&p(n,x);if(t||!S){h(x);return}n++,(T=e.onFail)==null||T.call(e,n,x),Mp(I).then(()=>f()?void 0:m()).then(()=>{t?h(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 Up=e=>setTimeout(e,0);function qp(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=Up;const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||s()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var ze=qp(),pr,Du,zu=(Du=class{constructor(){oe(this,pr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Os(this.gcTime)&&Q(this,pr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ir?1/0:5*60*1e3))}clearGcTimeout(){O(this,pr)&&(clearTimeout(O(this,pr)),Q(this,pr,void 0))}},pr=new WeakMap,Du),$r,Ur,jt,hr,Ye,Pi,mr,Jt,wn,Mu,Vp=(Mu=class extends zu{constructor(t){super();oe(this,Jt);oe(this,$r);oe(this,Ur);oe(this,jt);oe(this,hr);oe(this,Ye);oe(this,Pi);oe(this,mr);Q(this,mr,!1),Q(this,Pi,t.defaultOptions),this.setOptions(t.options),this.observers=[],Q(this,hr,t.client),Q(this,jt,O(this,hr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Q(this,$r,Hp(this.options)),this.state=t.state??O(this,$r),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,Ye))==null?void 0:t.promise}setOptions(t){this.options={...O(this,Pi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,jt).remove(this)}setData(t,n){const r=Ns(this.state.data,t,this.options);return fe(this,Jt,wn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){fe(this,Jt,wn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=O(this,Ye))==null?void 0:r.promise;return(o=O(this,Ye))==null||o.cancel(t),n?n.then(ht).catch(ht):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,$r))}isActive(){return this.observers.some(t=>Lt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wo||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Wn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!qu(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,Ye))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,Ye))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,jt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(O(this,Ye)&&(O(this,mr)?O(this,Ye).cancel({revert:!0}):O(this,Ye).cancelRetry()),this.scheduleGc()),O(this,jt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||fe(this,Jt,wn).call(this,{type:"invalidate"})}async fetch(t,n){var c,f,d,l,h,m,g,w,v,x,p,y;if(this.state.fetchStatus!=="idle"&&((c=O(this,Ye))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,Ye))return O(this,Ye).continueRetry(),O(this,Ye).promise}if(t&&this.setOptions(t),!this.options.queryFn){const I=this.observers.find(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,mr,!0),r.signal)})},i=()=>{const I=Vu(this.options,n),T=(()=>{const A={client:O(this,hr),queryKey:this.queryKey,meta:this.meta};return o(A),A})();return Q(this,mr,!1),this.options.persister?this.options.persister(I,T,this):I(T)},a=(()=>{const I={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,hr),state:this.state,fetchFn:i};return o(I),I})();(f=this.options.behavior)==null||f.onFetch(a,this),Q(this,Ur,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&fe(this,Jt,wn).call(this,{type:"fetch",meta:(l=a.fetchOptions)==null?void 0:l.meta}),Q(this,Ye,Wu({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onFail:(I,S)=>{fe(this,Jt,wn).call(this,{type:"failed",failureCount:I,error:S})},onPause:()=>{fe(this,Jt,wn).call(this,{type:"pause"})},onContinue:()=>{fe(this,Jt,wn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const I=await O(this,Ye).start();if(I===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(I),(m=(h=O(this,jt).config).onSuccess)==null||m.call(h,I,this),(w=(g=O(this,jt).config).onSettled)==null||w.call(g,I,this.state.error,this),I}catch(I){if(I instanceof Ju){if(I.silent)return O(this,Ye).promise;if(I.revert){if(this.setState({...O(this,Ur),fetchStatus:"idle"}),this.state.data===void 0)throw I;return this.state.data}}throw fe(this,Jt,wn).call(this,{type:"error",error:I}),(x=(v=O(this,jt).config).onError)==null||x.call(v,I,this),(y=(p=O(this,jt).config).onSettled)==null||y.call(p,this.state.data,I,this),I}finally{this.scheduleGc()}}},$r=new WeakMap,Ur=new WeakMap,jt=new WeakMap,hr=new WeakMap,Ye=new WeakMap,Pi=new WeakMap,mr=new WeakMap,Jt=new WeakSet,wn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...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,Ur,t.manual?o:void 0),o;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ze.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,jt).notify({query:this,type:"updated",action:t})})},Mu);function Qu(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Bu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Hp(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,ku,Bp=(ku=class extends ai{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??ua(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){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(){ze.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=>vc(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>vc(t,r)):n}notify(t){ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ze.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ze.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},nn=new WeakMap,ku),rn,ft,gr,on,jn,ju,Jp=(ju=class extends zu{constructor(t){super();oe(this,on);oe(this,rn);oe(this,ft);oe(this,gr);this.mutationId=t.mutationId,Q(this,ft,t.mutationCache),Q(this,rn,[]),this.state=t.state||Gu(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,rn).includes(t)||(O(this,rn).push(t),this.clearGcTimeout(),O(this,ft).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Q(this,rn,O(this,rn).filter(n=>n!==t)),this.scheduleGc(),O(this,ft).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,rn).length||(this.state.status==="pending"?this.scheduleGc():O(this,ft).remove(this))}continue(){var t;return((t=O(this,gr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,a,c,f,d,l,h,m,g,w,v,x,p,y,I,S,T,A,E;const n=()=>{fe(this,on,jn).call(this,{type:"continue"})};Q(this,gr,Wu({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(R,P)=>{fe(this,on,jn).call(this,{type:"failed",failureCount:R,error:P})},onPause:()=>{fe(this,on,jn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,ft).canRun(this)}));const r=this.state.status==="pending",o=!O(this,gr).canStart();try{if(r)n();else{fe(this,on,jn).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(i=O(this,ft).config).onMutate)==null?void 0:s.call(i,t,this));const P=await((c=(a=this.options).onMutate)==null?void 0:c.call(a,t));P!==this.state.context&&fe(this,on,jn).call(this,{type:"pending",context:P,variables:t,isPaused:o})}const R=await O(this,gr).start();return await((d=(f=O(this,ft).config).onSuccess)==null?void 0:d.call(f,R,t,this.state.context,this)),await((h=(l=this.options).onSuccess)==null?void 0:h.call(l,R,t,this.state.context)),await((g=(m=O(this,ft).config).onSettled)==null?void 0:g.call(m,R,null,this.state.variables,this.state.context,this)),await((v=(w=this.options).onSettled)==null?void 0:v.call(w,R,null,t,this.state.context)),fe(this,on,jn).call(this,{type:"success",data:R}),R}catch(R){try{throw await((p=(x=O(this,ft).config).onError)==null?void 0:p.call(x,R,t,this.state.context,this)),await((I=(y=this.options).onError)==null?void 0:I.call(y,R,t,this.state.context)),await((T=(S=O(this,ft).config).onSettled)==null?void 0:T.call(S,void 0,R,this.state.variables,this.state.context,this)),await((E=(A=this.options).onSettled)==null?void 0:E.call(A,void 0,R,t,this.state.context)),R}finally{fe(this,on,jn).call(this,{type:"error",error:R})}}finally{O(this,ft).runNext(this)}}},rn=new WeakMap,ft=new WeakMap,gr=new WeakMap,on=new WeakSet,jn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ze.batch(()=>{O(this,rn).forEach(r=>{r.onMutationUpdate(t)}),O(this,ft).notify({mutation:this,type:"updated",action:t})})},ju);function Gu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var bn,Wt,Fi,Lu,Wp=(Lu=class extends ai{constructor(t={}){super();oe(this,bn);oe(this,Wt);oe(this,Fi);this.config=t,Q(this,bn,new Set),Q(this,Wt,new Map),Q(this,Fi,0)}build(t,n,r){const o=new Jp({mutationCache:this,mutationId:++Zi(this,Fi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,bn).add(t);const n=eo(t);if(typeof n=="string"){const r=O(this,Wt).get(n);r?r.push(t):O(this,Wt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,bn).delete(t)){const n=eo(t);if(typeof n=="string"){const r=O(this,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=eo(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=eo(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(){ze.batch(()=>{O(this,bn).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,bn).clear(),O(this,Wt).clear()})}getAll(){return Array.from(O(this,bn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>wc(n,r))}findAll(t={}){return this.getAll().filter(n=>wc(t,n))}notify(t){ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ze.batch(()=>Promise.all(t.map(n=>n.continue().catch(ht))))}},bn=new WeakMap,Wt=new WeakMap,Fi=new WeakMap,Lu);function eo(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Cc(e){return{onFetch:(t,n)=>{var d,l,h,m,g;const r=t.options,o=(h=(l=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:l.fetchMore)==null?void 0:h.direction,i=((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=Vu(t.options,t.fetchOptions),p=async(y,I,S)=>{if(w)return Promise.reject();if(I==null&&y.pages.length)return Promise.resolve(y);const A=(()=>{const M={client:t.client,queryKey:t.queryKey,pageParam:I,direction:S?"backward":"forward",meta:t.options.meta};return v(M),M})(),E=await x(A),{maxPages:R}=t.options,P=S?jp:kp;return{pages:P(y.pages,E,R),pageParams:P(y.pageParams,I,R)}};if(o&&i.length){const y=o==="backward",I=y?zp:Sc,S={pages:i,pageParams:s},T=I(r,S);a=await p(S,T,y)}else{const y=e??i.length;do{const I=c===0?s[0]??r.initialPageParam:Sc(r,a);if(c>0&&I==null)break;a=await p(a,I),c++}while(c<y)}return a};t.options.persister?t.fetchFn=()=>{var 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 Sc(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 zp(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Ke,$n,Un,qr,Vr,qn,Hr,Br,Ku,Qp=(Ku=class{constructor(e={}){oe(this,Ke);oe(this,$n);oe(this,Un);oe(this,qr);oe(this,Vr);oe(this,qn);oe(this,Hr);oe(this,Br);Q(this,Ke,e.queryCache||new Bp),Q(this,$n,e.mutationCache||new Wp),Q(this,Un,e.defaultOptions||{}),Q(this,qr,new Map),Q(this,Vr,new Map),Q(this,qn,0)}mount(){Zi(this,qn)._++,O(this,qn)===1&&(Q(this,Hr,la.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ke).onFocus())})),Q(this,Br,bo.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ke).onOnline())})))}unmount(){var e,t;Zi(this,qn)._--,O(this,qn)===0&&((e=O(this,Hr))==null||e.call(this),Q(this,Hr,void 0),(t=O(this,Br))==null||t.call(this),Q(this,Br,void 0))}isFetching(e){return O(this,Ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,$n).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,Ke).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Wn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(this,Ke).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=O(this,Ke).get(r.queryHash),i=o==null?void 0:o.state.data,s=Dp(t,i);if(s!==void 0)return O(this,Ke).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return ze.batch(()=>O(this,Ke).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,Ke);ze.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,Ke);return ze.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ze.batch(()=>O(this,Ke).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(ht).catch(ht)}invalidateQueries(e,t={}){return ze.batch(()=>(O(this,Ke).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ze.batch(()=>O(this,Ke).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(ht)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(ht)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=O(this,Ke).build(this,t);return n.isStaleByTime(Wn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ht).catch(ht)}fetchInfiniteQuery(e){return e.behavior=Cc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ht).catch(ht)}ensureInfiniteQueryData(e){return e.behavior=Cc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return bo.isOnline()?O(this,$n).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Ke)}getMutationCache(){return O(this,$n)}getDefaultOptions(){return O(this,Un)}setDefaultOptions(e){Q(this,Un,e)}setQueryDefaults(e,t){O(this,qr).set(Cr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,qr).values()],n={};return t.forEach(r=>{xi(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,Vr).set(Cr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Vr).values()],n={};return t.forEach(r=>{xi(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,Un).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ua(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===wo&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Un).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Ke).clear(),O(this,$n).clear()}},Ke=new WeakMap,$n=new WeakMap,Un=new WeakMap,qr=new WeakMap,Vr=new WeakMap,qn=new WeakMap,Hr=new WeakMap,Br=new WeakMap,Ku),wt,ye,Di,pt,yr,Jr,In,Vn,Mi,Wr,zr,vr,wr,Hn,Qr,xe,wi,As,Rs,Ps,Fs,Ds,Ms,ks,Xu,$u,Gp=($u=class extends ai{constructor(t,n){super();oe(this,xe);oe(this,wt);oe(this,ye);oe(this,Di);oe(this,pt);oe(this,yr);oe(this,Jr);oe(this,In);oe(this,Vn);oe(this,Mi);oe(this,Wr);oe(this,zr);oe(this,vr);oe(this,wr);oe(this,Hn);oe(this,Qr,new Set);this.options=n,Q(this,wt,t),Q(this,Vn,null),Q(this,In,Ts()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,ye).addObserver(this),xc(O(this,ye),this.options)?fe(this,xe,wi).call(this):this.updateResult(),fe(this,xe,Fs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return js(O(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return js(O(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,fe(this,xe,Ds).call(this),fe(this,xe,Ms).call(this),O(this,ye).removeObserver(this)}setOptions(t){const n=this.options,r=O(this,ye);if(this.options=O(this,wt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Lt(this.options.enabled,O(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");fe(this,xe,ks).call(this),O(this,ye).setOptions(this.options),n._defaulted&&!vo(this.options,n)&&O(this,wt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ye),observer:this});const o=this.hasListeners();o&&Oc(O(this,ye),r,this.options,n)&&fe(this,xe,wi).call(this),this.updateResult(),o&&(O(this,ye)!==r||Lt(this.options.enabled,O(this,ye))!==Lt(n.enabled,O(this,ye))||Wn(this.options.staleTime,O(this,ye))!==Wn(n.staleTime,O(this,ye)))&&fe(this,xe,As).call(this);const i=fe(this,xe,Rs).call(this);o&&(O(this,ye)!==r||Lt(this.options.enabled,O(this,ye))!==Lt(n.enabled,O(this,ye))||i!==O(this,Hn))&&fe(this,xe,Ps).call(this,i)}getOptimisticResult(t){const n=O(this,wt).getQueryCache().build(O(this,wt),t),r=this.createResult(n,t);return Yp(this,r)&&(Q(this,pt,r),Q(this,Jr,this.options),Q(this,yr,O(this,ye).state)),r}getCurrentResult(){return O(this,pt)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),o==="promise"&&!this.options.experimental_prefetchInRender&&O(this,In).status==="pending"&&O(this,In).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(r,o))})}trackProp(t){O(this,Qr).add(t)}getCurrentQuery(){return O(this,ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=O(this,wt).defaultQueryOptions(t),r=O(this,wt).getQueryCache().build(O(this,wt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return fe(this,xe,wi).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,pt)))}createResult(t,n){var R;const r=O(this,ye),o=this.options,i=O(this,pt),s=O(this,yr),a=O(this,Jr),f=t!==r?t.state:O(this,Di),{state:d}=t;let l={...d},h=!1,m;if(n._optimisticResults){const P=this.hasListeners(),M=!P&&xc(t,n),U=P&&Oc(t,r,n,o);(M||U)&&(l={...l,...Qu(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 P;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(P=i.data,x=!0):P=typeof n.placeholderData=="function"?n.placeholderData((R=O(this,zr))==null?void 0:R.state.data,O(this,zr)):n.placeholderData,P!==void 0&&(v="success",m=Ns(i==null?void 0:i.data,P,n),h=!0)}if(n.select&&m!==void 0&&!x)if(i&&m===(s==null?void 0:s.data)&&n.select===O(this,Mi))m=O(this,Wr);else try{Q(this,Mi,n.select),m=n.select(m),m=Ns(i==null?void 0:i.data,m,n),Q(this,Wr,m),Q(this,Vn,null)}catch(P){Q(this,Vn,P)}O(this,Vn)&&(g=O(this,Vn),m=O(this,Wr),w=Date.now(),v="error");const p=l.fetchStatus==="fetching",y=v==="pending",I=v==="error",S=y&&p,T=m!==void 0,E={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:p,isRefetching:p&&!y,isLoadingError:I&&!T,isPaused:l.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:I&&T,isStale:da(t,n),refetch:this.refetch,promise:O(this,In),isEnabled:Lt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const P=k=>{E.status==="error"?k.reject(E.error):E.data!==void 0&&k.resolve(E.data)},M=()=>{const k=Q(this,In,E.promise=Ts());P(k)},U=O(this,In);switch(U.status){case"pending":t.queryHash===r.queryHash&&P(U);break;case"fulfilled":(E.status==="error"||E.data!==U.value)&&M();break;case"rejected":(E.status!=="error"||E.error!==U.reason)&&M();break}}return E}updateResult(){const t=O(this,pt),n=this.createResult(O(this,ye),this.options);if(Q(this,yr,O(this,ye).state),Q(this,Jr,this.options),O(this,yr).data!==void 0&&Q(this,zr,O(this,ye)),vo(n,t))return;Q(this,pt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!O(this,Qr).size)return!0;const s=new Set(i??O(this,Qr));return this.options.throwOnError&&s.add("error"),Object.keys(O(this,pt)).some(a=>{const c=a;return O(this,pt)[c]!==t[c]&&s.has(c)})};fe(this,xe,Xu).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&fe(this,xe,Fs).call(this)}},wt=new WeakMap,ye=new WeakMap,Di=new WeakMap,pt=new WeakMap,yr=new WeakMap,Jr=new WeakMap,In=new WeakMap,Vn=new WeakMap,Mi=new WeakMap,Wr=new WeakMap,zr=new WeakMap,vr=new WeakMap,wr=new WeakMap,Hn=new WeakMap,Qr=new WeakMap,xe=new WeakSet,wi=function(t){fe(this,xe,ks).call(this);let n=O(this,ye).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(ht)),n},As=function(){fe(this,xe,Ds).call(this);const t=Wn(this.options.staleTime,O(this,ye));if(Ir||O(this,pt).isStale||!Os(t))return;const r=qu(O(this,pt).dataUpdatedAt,t)+1;Q(this,vr,setTimeout(()=>{O(this,pt).isStale||this.updateResult()},r))},Rs=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ye)):this.options.refetchInterval)??!1},Ps=function(t){fe(this,xe,Ms).call(this),Q(this,Hn,t),!(Ir||Lt(this.options.enabled,O(this,ye))===!1||!Os(O(this,Hn))||O(this,Hn)===0)&&Q(this,wr,setInterval(()=>{(this.options.refetchIntervalInBackground||la.isFocused())&&fe(this,xe,wi).call(this)},O(this,Hn)))},Fs=function(){fe(this,xe,As).call(this),fe(this,xe,Ps).call(this,fe(this,xe,Rs).call(this))},Ds=function(){O(this,vr)&&(clearTimeout(O(this,vr)),Q(this,vr,void 0))},Ms=function(){O(this,wr)&&(clearInterval(O(this,wr)),Q(this,wr,void 0))},ks=function(){const t=O(this,wt).getQueryCache().build(O(this,wt),this.options);if(t===O(this,ye))return;const n=O(this,ye);Q(this,ye,t),Q(this,Di,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Xu=function(t){ze.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,pt))}),O(this,wt).getQueryCache().notify({query:O(this,ye),type:"observerResultsUpdated"})})},$u);function Xp(e,t){return Lt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function xc(e,t){return Xp(e,t)||e.state.data!==void 0&&js(e,t,t.refetchOnMount)}function js(e,t,n){if(Lt(t.enabled,e)!==!1&&Wn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&da(e,t)}return!1}function Oc(e,t,n,r){return(e!==t||Lt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&da(e,n)}function da(e,t){return Lt(t.enabled,e)!==!1&&e.isStaleByTime(Wn(t.staleTime,e))}function Yp(e,t){return!vo(e.getCurrentResult(),t)}var Bn,Jn,bt,Cn,xn,fo,Ls,Uu,Zp=(Uu=class extends ai{constructor(n,r){super();oe(this,xn);oe(this,Bn);oe(this,Jn);oe(this,bt);oe(this,Cn);Q(this,Bn,n),this.setOptions(r),this.bindMethods(),fe(this,xn,fo).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=O(this,Bn).defaultMutationOptions(n),vo(this.options,r)||O(this,Bn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,bt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Cr(r.mutationKey)!==Cr(this.options.mutationKey)?this.reset():((o=O(this,bt))==null?void 0:o.state.status)==="pending"&&O(this,bt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=O(this,bt))==null||n.removeObserver(this)}onMutationUpdate(n){fe(this,xn,fo).call(this),fe(this,xn,Ls).call(this,n)}getCurrentResult(){return O(this,Jn)}reset(){var n;(n=O(this,bt))==null||n.removeObserver(this),Q(this,bt,void 0),fe(this,xn,fo).call(this),fe(this,xn,Ls).call(this)}mutate(n,r){var o;return Q(this,Cn,r),(o=O(this,bt))==null||o.removeObserver(this),Q(this,bt,O(this,Bn).getMutationCache().build(O(this,Bn),this.options)),O(this,bt).addObserver(this),O(this,bt).execute(n)}},Bn=new WeakMap,Jn=new WeakMap,bt=new WeakMap,Cn=new WeakMap,xn=new WeakSet,fo=function(){var r;const n=((r=O(this,bt))==null?void 0:r.state)??Gu();Q(this,Jn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Ls=function(n){ze.batch(()=>{var r,o,i,s,a,c,f,d;if(O(this,Cn)&&this.hasListeners()){const l=O(this,Jn).variables,h=O(this,Jn).context;(n==null?void 0:n.type)==="success"?((o=(r=O(this,Cn)).onSuccess)==null||o.call(r,n.data,l,h),(s=(i=O(this,Cn)).onSettled)==null||s.call(i,n.data,null,l,h)):(n==null?void 0:n.type)==="error"&&((c=(a=O(this,Cn)).onError)==null||c.call(a,n.error,l,h),(d=(f=O(this,Cn)).onSettled)==null||d.call(f,void 0,n.error,l,h))}this.listeners.forEach(l=>{l(O(this,Jn))})})},Uu),Yu=$.createContext(void 0),$e=e=>{const t=$.useContext(Yu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},eh=({client:e,children:t})=>($.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(Yu.Provider,{value:e,children:t})),Zu=$.createContext(!1),th=()=>$.useContext(Zu);Zu.Provider;function nh(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var rh=$.createContext(nh()),ih=()=>$.useContext(rh),oh=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},sh=e=>{$.useEffect(()=>{e.clearReset()},[e])},ah=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||Hu(n,[e.error,r])),ch=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))}},uh=(e,t)=>e.isLoading&&e.isFetching&&!t,lh=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ec=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function dh(e,t,n){var l,h,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=th(),o=ih(),i=$e(),s=i.defaultQueryOptions(e);(h=(l=i.getDefaultOptions().queries)==null?void 0:l._experimental_beforeQuery)==null||h.call(l,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=r?"isRestoring":"optimistic",ch(s),oh(s,o),sh(o);const a=!i.getQueryCache().get(s.queryHash),[c]=$.useState(()=>new t(i,s)),f=c.getOptimisticResult(s),d=!r&&e.subscribed!==!1;if($.useSyncExternalStore($.useCallback(v=>{const x=d?c.subscribe(ze.batchCalls(v)):ht;return c.updateResult(),x},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),$.useEffect(()=>{c.setOptions(s)},[s,c]),lh(s,f))throw Ec(s,c,o);if(ah({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&&!Ir&&uh(f,r)){const v=a?Ec(s,c,o):(w=i.getQueryCache().get(s.queryHash))==null?void 0:w.promise;v==null||v.catch(ht).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?f:c.trackResult(f)}function Yn(e,t){return dh(e,Gp)}function On(e,t){const n=$e(),[r]=$.useState(()=>new Zp(n,e));$.useEffect(()=>{r.setOptions(e)},[r,e]);const o=$.useSyncExternalStore($.useCallback(s=>r.subscribe(ze.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=$.useCallback((s,a)=>{r.mutate(s,a).catch(ht)},[r]);if(o.error&&Hu(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const el=b.createContext(null),fh=el.Provider,tl=()=>b.useContext(el);var he=(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))(he||{});const nl=b.createContext(void 0);function un(){const e=b.useContext(nl);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const ph=(()=>{const e={};return Object.values(he).forEach(t=>{e[t]={}}),e})();function hh({children:e}){const[t,n]=b.useState(ph),r=b.useCallback((d,l,h=!0)=>{n(m=>{const g={...m};return g[d]=g[d]||{},g[d][l]=h,g})},[n]),o=b.useCallback((d,l)=>{var h;return!!((h=t[d])!=null&&h[l])},[t]),i=b.useCallback((d,l)=>{var h;return(h=t[d])==null?void 0:h[l]},[t]),s=b.useCallback((d,l)=>{n(h=>{var g;const m={...h};return(g=m[d])==null||delete g[l],m})},[n]),a=b.useCallback(d=>{n(l=>{const h={...l};return h[d]={},h})},[n]),c=b.useCallback((d,l)=>{n(h=>{const m={...h};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(nl.Provider,{value:f,children:e})}const to=new TextEncoder,Oi=new TextDecoder;function mh(...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 gh(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:Oi.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=Oi.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return gh(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class Zn extends Error{constructor(n,r){var o;super(n,r);Fe(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(o=Error.captureStackTrace)==null||o.call(Error,this,this.constructor)}}Fe(Zn,"code","ERR_JOSE_GENERIC");class Bt extends Zn{constructor(n,r,o="unspecified",i="unspecified"){super(n,{cause:{claim:o,reason:i,payload:r}});Fe(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");Fe(this,"claim");Fe(this,"reason");Fe(this,"payload");this.claim=o,this.reason=i,this.payload=r}}Fe(Bt,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Ks extends Zn{constructor(n,r,o="unspecified",i="unspecified"){super(n,{cause:{claim:o,reason:i,payload:r}});Fe(this,"code","ERR_JWT_EXPIRED");Fe(this,"claim");Fe(this,"reason");Fe(this,"payload");this.claim=o,this.reason=i,this.payload=r}}Fe(Ks,"code","ERR_JWT_EXPIRED");class rl extends Zn{constructor(){super(...arguments);Fe(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}Fe(rl,"code","ERR_JOSE_ALG_NOT_ALLOWED");class lr extends Zn{constructor(){super(...arguments);Fe(this,"code","ERR_JOSE_NOT_SUPPORTED")}}Fe(lr,"code","ERR_JOSE_NOT_SUPPORTED");class Xe extends Zn{constructor(){super(...arguments);Fe(this,"code","ERR_JWS_INVALID")}}Fe(Xe,"code","ERR_JWS_INVALID");class fa extends Zn{constructor(){super(...arguments);Fe(this,"code","ERR_JWT_INVALID")}}Fe(fa,"code","ERR_JWT_INVALID");class il extends Zn{constructor(n="signature verification failed",r){super(n,r);Fe(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}Fe(il,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function vn(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function gi(e,t){return e.name===t}function is(e){return parseInt(e.name.slice(4),10)}function yh(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function vh(e,t){if(!e.usages.includes(t))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function wh(e,t,n){switch(t){case"HS256":case"HS384":case"HS512":{if(!gi(e.algorithm,"HMAC"))throw vn("HMAC");const r=parseInt(t.slice(2),10);if(is(e.algorithm.hash)!==r)throw vn(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!gi(e.algorithm,"RSASSA-PKCS1-v1_5"))throw vn("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(is(e.algorithm.hash)!==r)throw vn(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!gi(e.algorithm,"RSA-PSS"))throw vn("RSA-PSS");const r=parseInt(t.slice(2),10);if(is(e.algorithm.hash)!==r)throw vn(`SHA-${r}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":{if(!gi(e.algorithm,"Ed25519"))throw vn("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!gi(e.algorithm,"ECDSA"))throw vn("ECDSA");const r=yh(t);if(e.algorithm.namedCurve!==r)throw vn(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}vh(e,n)}function ol(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 bh=(e,...t)=>ol("Key must be ",e,...t);function sl(e,t,...n){return ol(`Key for the ${e} algorithm must be `,t,...n)}function al(e){return(e==null?void 0:e[Symbol.toStringTag])==="CryptoKey"}function cl(e){return(e==null?void 0:e[Symbol.toStringTag])==="KeyObject"}const ul=e=>al(e)||cl(e),Ih=(...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 Ch(e){return typeof e=="object"&&e!==null}const Io=e=>{if(!Ch(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},Sh=(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 xh(e){let t,n;switch(e.kty){case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new lr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new lr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new lr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new lr('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}const Oh=async e=>{if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:t,keyUsages:n}=xh(e),r={...e};return delete r.alg,delete r.use,crypto.subtle.importKey("jwk",r,t,e.ext??!e.d,e.key_ops??n)},Eh=(e,t,n,r,o)=>{if(o.crit!==void 0&&(r==null?void 0:r.crit)===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(s=>typeof s!="string"||s.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;n!==void 0?i=new Map([...Object.entries(n),...t.entries()]):i=t;for(const s of r.crit){if(!i.has(s))throw new lr(`Extension Header Parameter "${s}" is not recognized`);if(o[s]===void 0)throw new e(`Extension Header Parameter "${s}" is missing`);if(i.get(s)&&r[s]===void 0)throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(r.crit)},_h=(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 pa(e){return Io(e)&&typeof e.kty=="string"}function Nh(e){return e.kty!=="oct"&&typeof e.d=="string"}function Th(e){return e.kty!=="oct"&&typeof e.d>"u"}function Ah(e){return e.kty==="oct"&&typeof e.k=="string"}let Mr;const _c=async(e,t,n,r=!1)=>{Mr||(Mr=new WeakMap);let o=Mr.get(e);if(o!=null&&o[n])return o[n];const i=await Oh({...t,alg:n});return r&&Object.freeze(e),o?o[n]=i:Mr.set(e,{[n]:i}),i},Rh=(e,t)=>{var s;Mr||(Mr=new WeakMap);let n=Mr.get(e);if(n!=null&&n[t])return n[t];const r=e.type==="public",o=!!r;let i;if(e.asymmetricKeyType==="x25519"){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if(e.asymmetricKeyType==="ed25519"){if(t!=="EdDSA"&&t!=="Ed25519")throw new TypeError("given KeyObject instance cannot be used for this algorithm");i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if(e.asymmetricKeyType==="rsa"){let a;switch(t){case"RSA-OAEP":a="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":a="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":a="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":a="SHA-512";break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:a},o,r?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:a},o,[r?"verify":"sign"])}if(e.asymmetricKeyType==="ec"){const c=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get((s=e.asymmetricKeyDetails)==null?void 0:s.namedCurve);if(!c)throw new TypeError("given KeyObject instance cannot be used for this algorithm");t==="ES256"&&c==="P-256"&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:c},o,[r?"verify":"sign"])),t==="ES384"&&c==="P-384"&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:c},o,[r?"verify":"sign"])),t==="ES512"&&c==="P-521"&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:c},o,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:c},o,r?[]:["deriveBits"]))}if(!i)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return n?n[t]=i:Mr.set(e,{[t]:i}),i},Ph=async(e,t)=>{if(e instanceof Uint8Array||al(e))return e;if(cl(e)){if(e.type==="secret")return e.export();if("toCryptoKey"in e&&typeof e.toCryptoKey=="function")try{return Rh(e,t)}catch(r){if(r instanceof TypeError)throw r}let n=e.export({format:"jwk"});return _c(e,n,t)}if(pa(e))return e.k?po(e.k):_c(e,e,t,!0);throw new Error("unreachable")},Fr=e=>e==null?void 0:e[Symbol.toStringTag],$s=(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},Fh=(e,t,n)=>{if(!(t instanceof Uint8Array)){if(pa(t)){if(Ah(t)&&$s(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(!ul(t))throw new TypeError(sl(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(t.type!=="secret")throw new TypeError(`${Fr(t)} instances for symmetric algorithms must be of type "secret"`)}},Dh=(e,t,n)=>{if(pa(t))switch(n){case"decrypt":case"sign":if(Nh(t)&&$s(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(Th(t)&&$s(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!ul(t))throw new TypeError(sl(e,t,"CryptoKey","KeyObject","JSON Web Key"));if(t.type==="secret")throw new TypeError(`${Fr(t)} instances for asymmetric algorithms must not be of type "secret"`);if(t.type==="public")switch(n){case"sign":throw new TypeError(`${Fr(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${Fr(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if(t.type==="private")switch(n){case"verify":throw new TypeError(`${Fr(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${Fr(t)} instances for asymmetric algorithm encryption must be of type "public"`)}},Mh=(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)?Fh(e,t,n):Dh(e,t,n)},kh=(e,t)=>{const n=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};default:throw new lr(`alg ${e} is not supported either by JOSE or your javascript runtime`)}},jh=async(e,t,n)=>{if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(bh(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[n])}return wh(t,e,n),t},Lh=async(e,t,n,r)=>{const o=await jh(e,t,"verify");Sh(e,o);const i=kh(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch{return!1}};async function Kh(e,t,n){if(!Io(e))throw new Xe("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new Xe('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new Xe("JWS Protected Header incorrect type");if(e.payload===void 0)throw new Xe("JWS Payload missing");if(typeof e.signature!="string")throw new Xe("JWS Signature missing or incorrect type");if(e.header!==void 0&&!Io(e.header))throw new Xe("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const v=po(e.protected);r=JSON.parse(Oi.decode(v))}catch{throw new Xe("JWS Protected Header is invalid")}if(!Ih(r,e.header))throw new Xe("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const o={...r,...e.header},i=Eh(Xe,new Map([["b64",!0]]),n==null?void 0:n.crit,r,o);let s=!0;if(i.has("b64")&&(s=r.b64,typeof s!="boolean"))throw new Xe('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:a}=o;if(typeof a!="string"||!a)throw new Xe('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&_h("algorithms",n.algorithms);if(c&&!c.has(a))throw new rl('"alg" (Algorithm) Header Parameter value not allowed');if(s){if(typeof e.payload!="string")throw new Xe("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new Xe("JWS Payload must be a string or an Uint8Array instance");let f=!1;typeof t=="function"&&(t=await t(r,e),f=!0),Mh(a,t,"verify");const d=mh(to.encode(e.protected??""),to.encode("."),typeof e.payload=="string"?to.encode(e.payload):e.payload);let l;try{l=po(e.signature)}catch{throw new Xe("Failed to base64url decode the signature")}const h=await Ph(t,a);if(!await Lh(a,h,l,d))throw new il;let g;if(s)try{g=po(e.payload)}catch{throw new Xe("Failed to base64url decode the payload")}else typeof e.payload=="string"?g=to.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:h}:w}async function $h(e,t,n){if(e instanceof Uint8Array&&(e=Oi.decode(e)),typeof e!="string")throw new Xe("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:s}=e.split(".");if(s!==3)throw new Xe("Invalid Compact JWS");const a=await Kh({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 Uh=e=>Math.floor(e.getTime()/1e3),ll=60,dl=ll*60,ha=dl*24,qh=ha*7,Vh=ha*365.25,Hh=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Nc=e=>{const t=Hh.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*ll);break;case"hour":case"hours":case"hr":case"hrs":case"h":o=Math.round(n*dl);break;case"day":case"days":case"d":o=Math.round(n*ha);break;case"week":case"weeks":case"w":o=Math.round(n*qh);break;default:o=Math.round(n*Vh);break}return t[1]==="-"||t[4]==="ago"?-o:o},Tc=e=>e.includes("/")?e.toLowerCase():`application/${e.toLowerCase()}`,Bh=(e,t)=>typeof e=="string"?t.includes(e):Array.isArray(e)?t.some(Set.prototype.has.bind(new Set(e))):!1;function Jh(e,t,n={}){let r;try{r=JSON.parse(Oi.decode(t))}catch{}if(!Io(r))throw new fa("JWT Claims Set must be a top-level JSON object");const{typ:o}=n;if(o&&(typeof e.typ!="string"||Tc(e.typ)!==Tc(o)))throw new Bt('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 Bt(`missing required "${g}" claim`,r,g,"missing");if(s&&!(Array.isArray(s)?s:[s]).includes(r.iss))throw new Bt('unexpected "iss" claim value',r,"iss","check_failed");if(a&&r.sub!==a)throw new Bt('unexpected "sub" claim value',r,"sub","check_failed");if(c&&!Bh(r.aud,typeof c=="string"?[c]:c))throw new Bt('unexpected "aud" claim value',r,"aud","check_failed");let l;switch(typeof n.clockTolerance){case"string":l=Nc(n.clockTolerance);break;case"number":l=n.clockTolerance;break;case"undefined":l=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:h}=n,m=Uh(h||new Date);if((r.iat!==void 0||f)&&typeof r.iat!="number")throw new Bt('"iat" claim must be a number',r,"iat","invalid");if(r.nbf!==void 0){if(typeof r.nbf!="number")throw new Bt('"nbf" claim must be a number',r,"nbf","invalid");if(r.nbf>m+l)throw new Bt('"nbf" claim timestamp check failed',r,"nbf","check_failed")}if(r.exp!==void 0){if(typeof r.exp!="number")throw new Bt('"exp" claim must be a number',r,"exp","invalid");if(r.exp<=m-l)throw new Ks('"exp" claim timestamp check failed',r,"exp","check_failed")}if(f){const g=m-r.iat,w=typeof f=="number"?f:Nc(f);if(g-l>w)throw new Ks('"iat" claim timestamp check failed (too far in the past)',r,"iat","check_failed");if(g<0-l)throw new Bt('"iat" claim timestamp check failed (it should be in the past)',r,"iat","check_failed")}return r}async function Wh(e,t,n){var s;const r=await $h(e,t,n);if((s=r.protectedHeader.crit)!=null&&s.includes("b64")&&r.protectedHeader.b64===!1)throw new fa("JWTs MUST NOT use unencoded payload");const i={payload:Jh(r.protectedHeader,r.payload,n),protectedHeader:r.protectedHeader};return typeof t=="function"?{...i,key:r.key}:i}const Us="amp-labs_jwt_",zh=10*60*1e3,Ac=(e,t)=>`${e}:${t}`,Rc=e=>`${Us}${e}`,fl=b.createContext(null),Qh=async e=>{try{const n=(await Wh(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 Gh({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(Us)){const l=d.replace(Us,""),h=sessionStorage.getItem(d);if(h)try{const m=JSON.parse(h);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=Ac(c,f),l=Date.now(),h=n.get(d);if(h&&h.expiresAt>l)return h.token;n.delete(d);const m=Rc(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=Ac(c,f),m=await Qh(d)||Date.now()+zh,g={token:d,expiresAt:m};r(w=>new Map(w).set(l,g));try{sessionStorage.setItem(Rc(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(fl.Provider,{value:a,children:t})}const Xh=()=>{const e=b.useContext(fl);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},ma=b.createContext(null);function De(){const e=b.useContext(ma);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
2
|
-
component is wrapped with AmpersandProvider`);return e}const Yh=new Qp;function Zh(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(eh,{client:Yh,children:u.jsx(ma.Provider,{value:a,children:u.jsx(hh,{children:u.jsx(Gh,{getTokenCallback:o||null,children:u.jsx(fh,{value:t||null,children:i})})})})})}const em="https://api.withampersand.com/v1".replace(/\/+$/,"");class ga{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:em}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||hl}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 tm=new ga,ko=class ko{constructor(t=tm){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 im(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(i=await s.post({fetch:this.fetchApi,url:o.url,init:o.init,response:i.clone()})||i);return i},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?ko.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:o}=await this.createFetchParams(t,n),i=await this.fetchApi(r,o);if(i&&i.status>=200&&i.status<300)return i;throw new pl(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:rm(a.body)||a.body instanceof URLSearchParams||nm(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};ko.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let sn=ko;function nm(e){return typeof Blob<"u"&&e instanceof Blob}function rm(e){return typeof FormData<"u"&&e instanceof FormData}class pl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class im extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ne extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function _(e,t){const n=e[t];return n!=null}function hl(e,t=""){return Object.keys(e).map(n=>ml(n,e[n],t)).filter(n=>n.length>0).join("&")}function ml(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 ml(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?hl(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function qe(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Re{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Gr{constructor(t){this.raw=t}async value(){}}class Pc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function om(e){return sm(e)}function sm(e,t){return e==null?e:{fieldUsed:_(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:_(e,"keyFormat")?e.keyFormat:void 0}}function am(e){return cm(e)}function cm(e,t){return e==null?e:{name:e.name,valuePrefix:_(e,"valuePrefix")?e.valuePrefix:void 0}}function um(e){return lm(e)}function lm(e,t){return e==null?e:{name:e.name}}function dm(e){return fm(e)}function fm(e,t){return e==null?e:{attachmentType:e.attachmentType,query:_(e,"query")?um(e.query):void 0,header:_(e,"header")?am(e.header):void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0}}function pm(e){return hm(e)}function hm(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,includeFullRecords:_(e,"includeFullRecords")?e.includeFullRecords:void 0}}function mm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function gm(e){return ym(e)}function ym(e,t){return e==null?e:{url:e.url,method:_(e,"method")?e.method:void 0,successStatusCodes:_(e,"successStatusCodes")?e.successStatusCodes:void 0}}const Fc={ApiKey:"apiKey",Basic:"basic"};function vm(e){return wm(e)}function wm(e,t){return e}function bm(e){return Im(e)}function Im(e,t){return e==null?e:{days:_(e,"days")?e.days:void 0,fullHistory:_(e,"fullHistory")?e.fullHistory:void 0}}function Cm(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function gl(e){return Sm(e)}function Sm(e,t){return e==null?e:{defaultPeriod:bm(e.defaultPeriod)}}function xm(e){if(e!==void 0)return e===null?null:{defaultPeriod:Cm(e.defaultPeriod)}}function Om(e){return Em(e)}function Em(e,t){return e==null?e:{days:_(e,"days")?e.days:void 0,fullHistory:_(e,"fullHistory")?e.fullHistory:void 0}}function _m(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Nm(e){return Tm(e)}function Tm(e,t){return e==null?e:{defaultPeriod:Om(e.defaultPeriod)}}function yl(e){if(e!==void 0)return e===null?null:{defaultPeriod:_m(e.defaultPeriod)}}function Am(e){return Rm(e)}function Rm(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,useModule:_(e,"useModule")?e.useModule:void 0}}function vl(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function Pm(e){return Fm(e)}function Fm(e,t){return e}function Dm(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:yl(e.backfill)}}function Mm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,Dm)}}function km(e){return jm(e)}function jm(e,t){return e==null?e:{stringValue:_(e,"stringValue")?e.stringValue:void 0,integerValue:_(e,"integerValue")?e.integerValue:void 0,booleanValue:_(e,"booleanValue")?e.booleanValue:void 0}}function Lm(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const Km={Always:"always",Never:"never"},$m={Always:"always",Never:"never"};function Um(e){return qm(e)}function qm(e,t){return e==null?e:{default:_(e,"default")?km(e.default):void 0,writeOnCreate:_(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:_(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function wl(e){if(e!==void 0)return e===null?null:{default:Lm(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function Vm(e){let t=!0;return t=t&&"value"in e,t}function Hm(e,t){return e==null?e:{value:e.value,applyOnUpdate:_(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Bm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Jm(e){let t=!0;return t=t&&"value"in e,t}function Wm(e,t){return e==null?e:{value:e.value,applyOnUpdate:_(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function zm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Qm(e){let t=!0;return t=t&&"value"in e,t}function Gm(e,t){return e==null?e:{value:e.value,applyOnUpdate:_(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Xm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Ym(e){return Zm(e)}function Zm(e,t){return e==null?e:{...Hm(e),...Wm(e),...Gm(e)}}function bl(e){if(e!==void 0)return e===null?null:Vm(e)?Bm(e):Jm(e)?zm(e):Qm(e)?Xm(e):{}}function eg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:qe(e.selectedValueDefaults,bl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:qe(e.selectedFieldSettings,wl)}}function tg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,eg)}}function ng(e){return rg(e)}function rg(e,t){return e==null?e:{enabled:e.enabled}}function ig(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function og(e){return sg(e)}function sg(e,t){return e==null?e:{enabled:e.enabled}}function ag(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function cg(e){return ug(e)}function ug(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:_(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:_(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function lg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function dg(e){return fg(e)}function fg(e,t){return e==null?e:{apiKeyAsBasic:_(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:_(e,"apiKeyAsBasicOpts")?om(e.apiKeyAsBasicOpts):void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0}}function pg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function hg(e){return mg(e)}function mg(e,t){return e==null?e:{value:e.value}}function gg(e){return yg(e)}function yg(e,t){return e==null?e:{brandingRemoval:_(e,"brandingRemoval")?hg(e.brandingRemoval):void 0}}function no(e){return vg(e)}function vg(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:_(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:_(e,"entitlements")?gg(e.entitlements):void 0}}function wg(e){return bg(e)}function bg(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Ig(e){return Cg(e)}function Cg(e,t){return e==null?e:{objectName:e.objectName,schedule:_(e,"schedule")?e.schedule:void 0,destination:_(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:_(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:_(e,"selectedFieldsAuto")?Pm(e.selectedFieldsAuto):void 0,backfill:_(e,"backfill")?Nm(e.backfill):void 0}}function Sg(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:yl(e.backfill)}}function xg(e){return Og(e)}function Og(e,t){return e==null?e:{objects:qe(e.objects,Ig)}}function Eg(e){if(e!==void 0)return e===null?null:{objects:qe(e.objects,Sg)}}function _g(e){return Ng(e)}function Ng(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:_(e,"createEvent")?ng(e.createEvent):void 0,updateEvent:_(e,"updateEvent")?cg(e.updateEvent):void 0,deleteEvent:_(e,"deleteEvent")?og(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:ig(e.createEvent),updateEvent:lg(e.updateEvent),deleteEvent:ag(e.deleteEvent)}}function Ag(e){return Rg(e)}function Rg(e,t){return e==null?e:{objects:qe(e.objects,_g)}}function Pg(e){if(e!==void 0)return e===null?null:{objects:qe(e.objects,Tg)}}function Fg(e){return Dg(e)}function Dg(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:_(e,"selectedValueDefaults")?qe(e.selectedValueDefaults,Ym):void 0,selectedFieldSettings:_(e,"selectedFieldSettings")?qe(e.selectedFieldSettings,Um):void 0}}function Mg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:qe(e.selectedValueDefaults,bl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:qe(e.selectedFieldSettings,wl)}}function kg(e){return jg(e)}function jg(e,t){return e==null?e:{objects:_(e,"objects")?qe(e.objects,Fg):void 0}}function Lg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qe(e.objects,Mg)}}function Kg(e){return $g(e)}function $g(e,t){return e==null?e:{provider:e.provider,module:_(e,"module")?e.module:void 0,read:_(e,"read")?xg(e.read):void 0,write:_(e,"write")?kg(e.write):void 0,proxy:_(e,"proxy")?Am(e.proxy):void 0,subscribe:_(e,"subscribe")?Ag(e.subscribe):void 0}}function Ug(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:Eg(e.read),write:Lg(e.write),proxy:vl(e.proxy),subscribe:Pg(e.subscribe)}}function qg(e){return Vg(e)}function Vg(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Kg(e.content)}}function Hg(e){return Bg(e)}function Bg(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0}}function Il(e){return Jg(e)}function Jg(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0}}function Wg(e){return zg(e)}function zg(e,t){return e==null?e:{token:e.token,issuedAt:_(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:_(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Qg(e){return Gg(e)}function Gg(e,t){return e==null?e:{token:e.token,issuedAt:_(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:_(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Xg(e){return Yg(e)}function Yg(e,t){return e==null?e:{accessToken:_(e,"accessToken")?Wg(e.accessToken):void 0,refreshToken:_(e,"refreshToken")?Qg(e.refreshToken):void 0,scopes:_(e,"scopes")?e.scopes:void 0}}function ho(e){return Zg(e)}function Zg(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:_(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:_(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0}}function ey(e){return ty(e)}function ty(e,t){return e==null?e:{value:e.value,source:e.source,displayName:_(e,"displayName")?e.displayName:void 0}}function ya(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function bi(e){return ny(e)}function ny(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:_(e,"providerApp")?ho(e.providerApp):void 0,group:Il(e.group),consumer:Hg(e.consumer),providerWorkspaceRef:_(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:_(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:_(e,"oauth2AuthorizationCode")?Xg(e.oauth2AuthorizationCode):void 0,apiKey:_(e,"apiKey")?e.apiKey:void 0,providerMetadata:_(e,"providerMetadata")?qe(e.providerMetadata,ey):void 0}}function Cl(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Sl(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function xl(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function ry(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 iy(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 Ol(e){if(e!==void 0)return e===null?null:{accessToken:ry(e.accessToken),refreshToken:iy(e.refreshToken),scopes:e.scopes}}function oy(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,ya),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:Sl(e.oauth2ClientCredentials),oauth2PasswordCredentials:xl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Ol(e.oauth2AuthorizationCode)}}function sy(e){return ay(e)}function ay(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0}}function cy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function uy(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Ug(e.content)}}function ly(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:uy(e.config)}}function dy(e){return fy(e)}function fy(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,useModule:_(e,"useModule")?e.useModule:void 0}}function py(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function hy(e){return my(e)}function my(e,t){return e==null?e:{mode:_(e,"mode")?e.mode:void 0,pageSize:_(e,"pageSize")?e.pageSize:void 0}}function gy(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function yy(e){let t=!0;return t=t&&"fieldName"in e,t}function vy(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function wy(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function by(e){let t=!0;return t=t&&"mapToName"in e,t}function El(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:_(e,"default")?e.default:void 0,prompt:_(e,"prompt")?e.prompt:void 0}}function Iy(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Dc(e){return Cy(e)}function Cy(e,t){return e==null?e:{...vy(e),...El(e)}}function Mc(e){if(e!==void 0)return e===null?null:yy(e)?wy(e):by(e)?Iy(e):{}}function _l(e){return Sy(e)}function Sy(e,t){return e}function xy(e){return Oy(e)}function Oy(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:_(e,"requiredFields")?e.requiredFields.map(Dc):void 0,optionalFields:_(e,"optionalFields")?e.optionalFields.map(Dc):void 0,optionalFieldsAuto:_(e,"optionalFieldsAuto")?_l(e.optionalFieldsAuto):void 0,backfill:_(e,"backfill")?gl(e.backfill):void 0,delivery:_(e,"delivery")?hy(e.delivery):void 0,enabled:_(e,"enabled")?e.enabled:void 0}}function Ey(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(Mc),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Mc),optionalFieldsAuto:e.optionalFieldsAuto,backfill:xm(e.backfill),delivery:gy(e.delivery),enabled:e.enabled}}function _y(e){return Ny(e)}function Ny(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(xy):void 0}}function Ty(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Ey)}}function Ay(e){return Ry(e)}function Ry(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0}}function Py(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fy(e){return Dy(e)}function Dy(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,watchFieldsAuto:_(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:_(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function My(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function ky(e){return jy(e)}function jy(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:_(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:_(e,"createEvent")?sy(e.createEvent):void 0,updateEvent:_(e,"updateEvent")?Fy(e.updateEvent):void 0,deleteEvent:_(e,"deleteEvent")?Ay(e.deleteEvent):void 0,associationChangeEvent:_(e,"associationChangeEvent")?pm(e.associationChangeEvent):void 0,otherEvents:_(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:cy(e.createEvent),updateEvent:My(e.updateEvent),deleteEvent:Py(e.deleteEvent),associationChangeEvent:mm(e.associationChangeEvent),otherEvents:e.otherEvents}}function Ky(e){return $y(e)}function $y(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(ky):void 0}}function Uy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Ly)}}function Nl(e){return qy(e)}function qy(e,t){return e==null?e:{allowAnyFields:_(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Vy(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Hy(e){return By(e)}function By(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:_(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:_(e,"valueDefaults")?Nl(e.valueDefaults):void 0}}function Jy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Vy(e.valueDefaults)}}function Wy(e){return zy(e)}function zy(e,t){return e==null?e:{objects:_(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(Jy)}}function Gy(e){return Xy(e)}function Xy(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:_(e,"displayName")?e.displayName:void 0,module:_(e,"module")?e.module:void 0,read:_(e,"read")?_y(e.read):void 0,write:_(e,"write")?Wy(e.write):void 0,proxy:_(e,"proxy")?dy(e.proxy):void 0,subscribe:_(e,"subscribe")?Ky(e.subscribe):void 0}}function Yy(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:Qy(e.write),proxy:py(e.proxy),subscribe:Uy(e.subscribe)}}function Zy(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Yy(e.content)}}function ev(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Zy(e.latestRevision)}}function tv(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function nv(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 rv(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function iv(e){return ov(e)}function ov(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function sv(e){return av(e)}function av(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:_(e,"prompt")?e.prompt:void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0}}function cv(e){return uv(e)}function uv(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function lv(e){return dv(e)}function dv(e,t){return e==null?e:{headers:_(e,"headers")?e.headers.map(iv):void 0,queryParams:_(e,"queryParams")?e.queryParams.map(cv):void 0,inputs:_(e,"inputs")?e.inputs.map(sv):void 0}}function fv(e){return pv(e)}function pv(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function hv(e){return mv(e)}function mv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:_(e,"valueType")?e.valueType:void 0,providerType:_(e,"providerType")?e.providerType:void 0,readOnly:_(e,"readOnly")?e.readOnly:void 0,values:_(e,"values")?e.values.map(fv):void 0}}function gv(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,ya),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:Sl(e.oauth2ClientCredentials),oauth2PasswordCredentials:xl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Ol(e.oauth2AuthorizationCode)}}function yv(e){return vv(e)}function vv(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,useModule:_(e,"useModule")?e.useModule:void 0}}function wv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function os(e){return bv(e)}function bv(e,t){return e==null?e:{...wv(e),...El(e)}}function Iv(e){return Cv(e)}function Cv(e,t){return e==null?e:{error:_(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:_(e,"requiredFields")?e.requiredFields.map(os):void 0,optionalFields:_(e,"optionalFields")?e.optionalFields.map(os):void 0,optionalFieldsAuto:_(e,"optionalFieldsAuto")?_l(e.optionalFieldsAuto):void 0,allFieldsMetadata:_(e,"allFieldsMetadata")?qe(e.allFieldsMetadata,hv):void 0,allFields:_(e,"allFields")?e.allFields.map(os):void 0,backfill:_(e,"backfill")?gl(e.backfill):void 0}}function Sv(e){return xv(e)}function xv(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(Iv):void 0}}function Ov(e){return Ev(e)}function Ev(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:_(e,"valueDefaults")?Nl(e.valueDefaults):void 0}}function _v(e){return Nv(e)}function Nv(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(Ov):void 0}}function Tv(e){return Av(e)}function Av(e,t){return e==null?e:{name:e.name,displayName:_(e,"displayName")?e.displayName:void 0,module:_(e,"module")?e.module:void 0,provider:e.provider,read:_(e,"read")?Sv(e.read):void 0,write:_(e,"write")?_v(e.write):void 0,proxy:_(e,"proxy")?yv(e.proxy):void 0}}function Rv(e){return Pv(e)}function Pv(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Tv(e.content)}}function yi(e){return Fv(e)}function Fv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:_(e,"group")?Il(e.group):void 0,healthStatus:e.healthStatus,connection:bi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,config:qg(e.config)}}function Dv(e){return Mv(e)}function Mv(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Gy(e.content)}}function ss(e){return kv(e)}function kv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Dv(e.latestRevision)}}function jv(e){return Lv(e)}function Lv(e,t){return e==null?e:{iconURL:_(e,"iconURL")?e.iconURL:void 0,logoURL:_(e,"logoURL")?e.logoURL:void 0}}function Kv(e){return $v(e)}function $v(e,t){return e==null?e:{iconURL:_(e,"iconURL")?e.iconURL:void 0,logoURL:_(e,"logoURL")?e.logoURL:void 0}}function Uv(e){return qv(e)}function qv(e,t){return e==null?e:{regular:_(e,"regular")?Kv(e.regular):void 0,darkMode:_(e,"darkMode")?jv(e.darkMode):void 0}}function Vv(e){return Hv(e)}function Hv(e,t){return e==null?e:{name:e.name,displayName:_(e,"displayName")?e.displayName:void 0,defaultValue:_(e,"defaultValue")?e.defaultValue:void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0,moduleDependencies:_(e,"moduleDependencies")?e.moduleDependencies:void 0}}function Bv(e){return Jv(e)}function Jv(e,t){return e==null?e:{name:e.name,moduleDependencies:_(e,"moduleDependencies")?e.moduleDependencies:void 0}}function Wv(e){return zv(e)}function zv(e,t){return e==null?e:{create:_(e,"create")?e.create:void 0,update:_(e,"update")?e.update:void 0,_delete:_(e,"delete")?e.delete:void 0,passThrough:_(e,"passThrough")?e.passThrough:void 0}}function Tl(e){return Qv(e)}function Qv(e,t){return e==null?e:{bulkWrite:wg(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:_(e,"subscribeSupport")?Wv(e.subscribeSupport):void 0}}function Gv(e){return Xv(e)}function Xv(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Tl(e.support)}}function Yv(e){return Zv(e)}function Zv(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:_(e,"capture")?e.capture:void 0}}function ew(e){return tw(e)}function tw(e,t){return e==null?e:{workspaceRefField:_(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:_(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:_(e,"scopesField")?e.scopesField:void 0,otherFields:_(e,"otherFields")?e.otherFields.map(Yv):void 0}}const as={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function nw(e){return rw(e)}function rw(e,t){return e==null?e:{grantType:e.grantType,authURL:_(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:_(e,"audience")?e.audience:void 0,tokenMetadataFields:ew(e.tokenMetadataFields),docsURL:_(e,"docsURL")?e.docsURL:void 0,authURLParams:_(e,"authURLParams")?e.authURLParams:void 0}}function iw(e){if(e!==void 0)return e===null?null:{projectId:e.projectId,provider:e.provider,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:qe(e.providerMetadata,ya),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function ow(e){return sw(e)}function sw(e,t){return e==null?e:{input:_(e,"input")?e.input.map(Vv):void 0,postAuthentication:_(e,"postAuthentication")?e.postAuthentication.map(Bv):void 0}}function aw(e){return cw(e)}function cw(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function kc(e){return uw(e)}function uw(e,t){return e==null?e:{name:e.name,authType:vm(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:_(e,"oauth2Opts")?nw(e.oauth2Opts):void 0,apiKeyOpts:_(e,"apiKeyOpts")?dm(e.apiKeyOpts):void 0,basicOpts:_(e,"basicOpts")?dg(e.basicOpts):void 0,customOpts:_(e,"customOpts")?lv(e.customOpts):void 0,support:Tl(e.support),providerOpts:e.providerOpts,authHealthCheck:_(e,"authHealthCheck")?gm(e.authHealthCheck):void 0,displayName:_(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:_(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:_(e,"media")?Uv(e.media):void 0,labels:_(e,"labels")?e.labels:void 0,subscribeOpts:_(e,"subscribeOpts")?aw(e.subscribeOpts):void 0,modules:_(e,"modules")?qe(e.modules,Gv):void 0,metadata:_(e,"metadata")?ow(e.metadata):void 0}}function lw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:oy(e.connection)}}function dw(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:Mm(e.read),write:tg(e.write),proxy:vl(e.proxy)}}function fw(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:dw(e.content)}}function pw(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:fw(e.config)}}function hw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:pw(e.installation)}}function mw(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function gw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:mw(e.project)}}function yw(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 vw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:yw(e.providerApp)}}class ww extends sn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new Gr(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:gv(t.generateConnectionParams)},n);return new Re(i,s=>bi(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new Re(i,s=>bi(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>s.map(bi))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}async updateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ne("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:lw(t.updateConnectionRequest)},n);return new Re(i,s=>bi(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class bw extends sn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ne("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:ly(t.installation)},n);return new Re(i,s=>yi(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ne("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:o,query:r},n);return new Gr(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ne("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:r},n);return new Re(i,s=>yi(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new Re(i,s=>s.map(yi))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async listInstallationsForProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallationsForProject.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>s.map(yi))}async listInstallationsForProject(t,n){return await(await this.listInstallationsForProjectRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ne("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ne("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:o,query:r,body:hw(t.installationUpdate)},n);return new Re(i,s=>yi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Iw extends sn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ne("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:pg(t.batchUpsertIntegrationsRequest)},n);return new Re(i,s=>s.map(ss))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ne("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:ev(t.integration)},n);return new Gr(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new Gr(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new ne("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getIntegration.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationIdOrName}".replace("{integrationIdOrName}",encodeURIComponent(String(t.integrationIdOrName))).replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>ss(s))}async getIntegration(t,n){return await(await this.getIntegrationRaw(t,n)).value()}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>s.map(ss))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Cw extends sn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ne("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:iw(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Re(i):new Pc(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new Re(i):new Pc(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Sw extends sn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ne("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:tv(t.project)},n);return new Re(i,s=>no(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>no(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};if(this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const i=this.configuration.accessToken,s=await i("Bearer",[]);s&&(r.Authorization=`Bearer ${s}`)}const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Re(o,i=>i.map(no))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ne("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:gw(t.projectUpdate)},n);return new Re(i,s=>no(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class xw extends sn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ne("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new Re(i,s=>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 Re(o,i=>qe(i,kc))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Ow extends sn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ne("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:nv(t.providerApp)},n);return new Re(i,s=>ho(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ne("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new Gr(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Re(i,s=>s.map(ho))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ne("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ne("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:vw(t.providerAppUpdate)},n);return new Re(i,s=>ho(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Ew extends sn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ne("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};if(o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:rv(t.revision)},n);return new Gr(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ne("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ne("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ne("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ne("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};if(this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key")),this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,a=await s("Bearer",[]);a&&(o.Authorization=`Bearer ${a}`)}const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:o,query:r},n);return new Re(i,s=>Rv(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var Al=Symbol.for("immer-nothing"),jc=Symbol.for("immer-draftable"),Tt=Symbol.for("immer-state"),_w=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Ct(e,...t){if(process.env.NODE_ENV!=="production"){const n=_w[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Xr=Object.getPrototypeOf;function Yr(e){return!!e&&!!e[Tt]}function Sr(e){var t;return e?Rl(e)||Array.isArray(e)||!!e[jc]||!!((t=e.constructor)!=null&&t[jc])||ki(e)||Lo(e):!1}var Nw=Object.prototype.constructor.toString();function Rl(e){if(!e||typeof e!="object")return!1;const t=Xr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Nw}function Co(e,t){jo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function jo(e){const t=e[Tt];return t?t.type_:Array.isArray(e)?1:ki(e)?2:Lo(e)?3:0}function qs(e,t){return jo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Pl(e,t,n){const r=jo(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 ki(e){return e instanceof Map}function Lo(e){return e instanceof Set}function ur(e){return e.copy_||e.base_}function Vs(e,t){if(ki(e))return new Map(e);if(Lo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Rl(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Tt];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){const s=o[i],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Xr(e),r)}else{const r=Xr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function va(e,t=!1){return Ko(e)||Yr(e)||!Sr(e)||(jo(e)>1&&Object.defineProperties(e,{set:{value:ro},add:{value:ro},clear:{value:ro},delete:{value:ro}}),Object.freeze(e),t&&Object.values(e).forEach(n=>va(n,!0))),e}function ro(){Ct(2)}function Ko(e){return Object.isFrozen(e)}var Aw={};function xr(e){const t=Aw[e];return t||Ct(0,e),t}var Ei;function Fl(){return Ei}function Rw(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Lc(e,t){t&&(xr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Hs(e){Bs(e),e.drafts_.forEach(Pw),e.drafts_=null}function Bs(e){e===Ei&&(Ei=e.parent_)}function Kc(e){return Ei=Rw(Ei,e)}function Pw(e){const t=e[Tt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function $c(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Tt].modified_&&(Hs(t),Ct(4)),Sr(e)&&(e=So(t,e),t.parent_||xo(t,e)),t.patches_&&xr("Patches").generateReplacementPatches_(n[Tt].base_,e,t.patches_,t.inversePatches_)):e=So(t,n,[]),Hs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Al?e:void 0}function So(e,t,n){if(Ko(t))return t;const r=t[Tt];if(!r)return Co(t,(o,i)=>Uc(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)=>Uc(e,r,o,a,c,n,s)),xo(e,o,!1),n&&e.patches_&&xr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Uc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&Ct(5),Yr(o)){const a=i&&t&&t.type_!==3&&!qs(t.assigned_,r)?i.concat(r):void 0,c=So(e,o,a);if(Pl(n,r,c),Yr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(Sr(o)&&!Ko(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;So(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(ki(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_&&va(t,n)}function Fw(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Fl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=wa;n&&(o=[r],i=_i);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var wa={get(e,t){if(t===Tt)return e;const n=ur(e);if(!qs(n,t))return Dw(e,n,t);const r=n[t];return e.finalized_||!Sr(r)?r:r===cs(e.base_,t)?(us(e),e.copy_[t]=Ws(r,e)):r},has(e,t){return t in ur(e)},ownKeys(e){return Reflect.ownKeys(ur(e))},set(e,t,n){const r=Dl(ur(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=cs(ur(e),t),i=o==null?void 0:o[Tt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Tw(n,o)&&(n!==void 0||qs(e.base_,t)))return!0;us(e),Js(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 cs(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,us(e),Js(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ur(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Ct(11)},getPrototypeOf(e){return Xr(e.base_)},setPrototypeOf(){Ct(12)}},_i={};Co(wa,(e,t)=>{_i[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});_i.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ct(13),_i.set.call(this,e,t,void 0)};_i.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ct(14),wa.set.call(this,e[0],t,n,e[0])};function cs(e,t){const n=e[Tt];return(n?ur(n):e)[t]}function Dw(e,t,n){var o;const r=Dl(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Dl(e,t){if(!(t in e))return;let n=Xr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Xr(n)}}function Js(e){e.modified_||(e.modified_=!0,e.parent_&&Js(e.parent_))}function us(e){e.copy_||(e.copy_=Vs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Mw=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(c=i,...f){return s.produce(c,d=>n.call(this,d,...f))}}typeof n!="function"&&Ct(6),r!==void 0&&typeof r!="function"&&Ct(7);let o;if(Sr(t)){const i=Kc(this),s=Ws(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Hs(i):Bs(i)}return Lc(i,r),$c(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===Al&&(o=void 0),this.autoFreeze_&&va(o,!0),r){const i=[],s=[];xr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else Ct(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Sr(e)||Ct(8),Yr(e)&&(e=kw(e));const t=Kc(this),n=Ws(e,void 0);return n[Tt].isManual_=!0,Bs(t),n}finishDraft(e,t){const n=e&&e[Tt];(!n||!n.isManual_)&&Ct(9);const{scope_:r}=n;return Lc(r,t),$c(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=xr("Patches").applyPatches_;return Yr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Ws(e,t){const n=ki(e)?xr("MapSet").proxyMap_(e,t):Lo(e)?xr("MapSet").proxySet_(e,t):Fw(e,t);return(t?t.scope_:Fl()).drafts_.push(n),n}function kw(e){return Yr(e)||Ct(10,e),Ml(e)}function Ml(e){if(!Sr(e)||Ko(e))return e;const t=e[Tt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Vs(e,!0);return Co(n,(r,o)=>{Pl(n,r,Ml(o))}),t&&(t.finalized_=!1),n}var jw=new Mw,It=jw.produce,io=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ba(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Oo={exports:{}};Oo.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",d="[object Boolean]",l="[object Date]",h="[object Error]",m="[object Function]",g="[object GeneratorFunction]",w="[object Map]",v="[object Number]",x="[object Null]",p="[object Object]",y="[object Promise]",I="[object Proxy]",S="[object RegExp]",T="[object Set]",A="[object String]",E="[object Symbol]",R="[object Undefined]",P="[object WeakMap]",M="[object ArrayBuffer]",U="[object DataView]",k="[object Float32Array]",j="[object Float64Array]",ae="[object Int8Array]",re="[object Int16Array]",ge="[object Int32Array]",me="[object Uint8Array]",Oe="[object Uint8ClampedArray]",F="[object Uint16Array]",q="[object Uint32Array]",J=/[\\^$.*+?()[\]{}|]/g,B=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,L={};L[k]=L[j]=L[ae]=L[re]=L[ge]=L[me]=L[Oe]=L[F]=L[q]=!0,L[a]=L[c]=L[M]=L[d]=L[U]=L[l]=L[h]=L[m]=L[w]=L[v]=L[p]=L[S]=L[T]=L[A]=L[P]=!1;var G=typeof io=="object"&&io&&io.Object===Object&&io,Z=typeof self=="object"&&self&&self.Object===Object&&self,Y=G||Z||Function("return this")(),ee=t&&!t.nodeType&&t,te=ee&&!0&&e&&!e.nodeType&&e,ue=te&&te.exports===ee,K=ue&&G.process,we=function(){try{return K&&K.binding&&K.binding("util")}catch{}}(),W=we&&we.isTypedArray;function ot(C,N){for(var D=-1,X=C==null?0:C.length,Ae=0,le=[];++D<X;){var Le=C[D];N(Le,D,C)&&(le[Ae++]=Le)}return le}function _e(C,N){for(var D=-1,X=N.length,Ae=C.length;++D<X;)C[Ae+D]=N[D];return C}function mt(C,N){for(var D=-1,X=C==null?0:C.length;++D<X;)if(N(C[D],D,C))return!0;return!1}function Je(C,N){for(var D=-1,X=Array(C);++D<C;)X[D]=N(D);return X}function gt(C){return function(N){return C(N)}}function Ee(C,N){return C.has(N)}function Ze(C,N){return C==null?void 0:C[N]}function xt(C){var N=-1,D=Array(C.size);return C.forEach(function(X,Ae){D[++N]=[Ae,X]}),D}function $t(C,N){return function(D){return C(N(D))}}function Rt(C){var N=-1,D=Array(C.size);return C.forEach(function(X){D[++N]=X}),D}var lt=Array.prototype,st=Function.prototype,Me=Object.prototype,Ue=Y["__core-js_shared__"],Pt=st.toString,et=Me.hasOwnProperty,Ar=function(){var C=/[^.]+$/.exec(Ue&&Ue.keys&&Ue.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),fn=Me.toString,pn=RegExp("^"+Pt.call(et).replace(J,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),yt=ue?Y.Buffer:void 0,Te=Y.Symbol,ir=Y.Uint8Array,Nn=Me.propertyIsEnumerable,Tn=lt.splice,Ot=Te?Te.toStringTag:void 0,hn=Object.getOwnPropertySymbols,An=yt?yt.isBuffer:void 0,Rn=$t(Object.keys,Object),mn=Rr(Y,"DataView"),en=Rr(Y,"Map"),ke=Rr(Y,"Promise"),at=Rr(Y,"Set"),ie=Rr(Y,"WeakMap"),de=Rr(Object,"create"),dt=sr(mn),gn=sr(en),z=sr(ke),se=sr(at),ce=sr(ie),je=Te?Te.prototype:void 0,Ve=je?je.valueOf:void 0;function Qe(C){var N=-1,D=C==null?0:C.length;for(this.clear();++N<D;){var X=C[N];this.set(X[0],X[1])}}function Ft(){this.__data__=de?de(null):{},this.size=0}function tt(C){var N=this.has(C)&&delete this.__data__[C];return this.size-=N?1:0,N}function vt(C){var N=this.__data__;if(de){var D=N[C];return D===r?void 0:D}return et.call(N,C)?N[C]:void 0}function Ne(C){var N=this.__data__;return de?N[C]!==void 0:et.call(N,C)}function Pn(C,N){var D=this.__data__;return this.size+=this.has(C)?0:1,D[C]=de&&N===void 0?r:N,this}Qe.prototype.clear=Ft,Qe.prototype.delete=tt,Qe.prototype.get=vt,Qe.prototype.has=Ne,Qe.prototype.set=Pn;function Ut(C){var N=-1,D=C==null?0:C.length;for(this.clear();++N<D;){var X=C[N];this.set(X[0],X[1])}}function es(){this.__data__=[],this.size=0}function Hi(C){var N=this.__data__,D=zi(N,C);if(D<0)return!1;var X=N.length-1;return D==X?N.pop():Tn.call(N,D,1),--this.size,!0}function Bi(C){var N=this.__data__,D=zi(N,C);return D<0?void 0:N[D][1]}function Ji(C){return zi(this.__data__,C)>-1}function Wi(C,N){var D=this.__data__,X=zi(D,C);return X<0?(++this.size,D.push([C,N])):D[X][1]=N,this}Ut.prototype.clear=es,Ut.prototype.delete=Hi,Ut.prototype.get=Bi,Ut.prototype.has=Ji,Ut.prototype.set=Wi;function tn(C){var N=-1,D=C==null?0:C.length;for(this.clear();++N<D;){var X=C[N];this.set(X[0],X[1])}}function ve(){this.size=0,this.__data__={hash:new Qe,map:new(en||Ut),string:new Qe}}function qt(C){var N=Qi(this,C).delete(C);return this.size-=N?1:0,N}function pi(C){return Qi(this,C).get(C)}function or(C){return Qi(this,C).has(C)}function ts(C,N){var D=Qi(this,C),X=D.size;return D.set(C,N),this.size+=D.size==X?0:1,this}tn.prototype.clear=ve,tn.prototype.delete=qt,tn.prototype.get=pi,tn.prototype.has=or,tn.prototype.set=ts;function Fn(C){var N=-1,D=C==null?0:C.length;for(this.__data__=new tn;++N<D;)this.add(C[N])}function rp(C){return this.__data__.set(C,r),this}function ip(C){return this.__data__.has(C)}Fn.prototype.add=Fn.prototype.push=rp,Fn.prototype.has=ip;function Dn(C){var N=this.__data__=new Ut(C);this.size=N.size}function op(){this.__data__=new Ut,this.size=0}function sp(C){var N=this.__data__,D=N.delete(C);return this.size=N.size,D}function ap(C){return this.__data__.get(C)}function cp(C){return this.__data__.has(C)}function up(C,N){var D=this.__data__;if(D instanceof Ut){var X=D.__data__;if(!en||X.length<n-1)return X.push([C,N]),this.size=++D.size,this;D=this.__data__=new tn(X)}return D.set(C,N),this.size=D.size,this}Dn.prototype.clear=op,Dn.prototype.delete=sp,Dn.prototype.get=ap,Dn.prototype.has=cp,Dn.prototype.set=up;function lp(C,N){var D=Gi(C),X=!D&&Op(C),Ae=!D&&!X&&ns(C),le=!D&&!X&&!Ae&&mc(C),Le=D||X||Ae||le,Ge=Le?Je(C.length,String):[],nt=Ge.length;for(var Pe in C)et.call(C,Pe)&&!(Le&&(Pe=="length"||Ae&&(Pe=="offset"||Pe=="parent")||le&&(Pe=="buffer"||Pe=="byteLength"||Pe=="byteOffset")||bp(Pe,nt)))&&Ge.push(Pe);return Ge}function zi(C,N){for(var D=C.length;D--;)if(dc(C[D][0],N))return D;return-1}function dp(C,N,D){var X=N(C);return Gi(C)?X:_e(X,D(C))}function hi(C){return C==null?C===void 0?R:x:Ot&&Ot in Object(C)?vp(C):xp(C)}function ac(C){return mi(C)&&hi(C)==a}function cc(C,N,D,X,Ae){return C===N?!0:C==null||N==null||!mi(C)&&!mi(N)?C!==C&&N!==N:fp(C,N,D,X,cc,Ae)}function fp(C,N,D,X,Ae,le){var Le=Gi(C),Ge=Gi(N),nt=Le?c:Mn(C),Pe=Ge?c:Mn(N);nt=nt==a?p:nt,Pe=Pe==a?p:Pe;var Et=nt==p,Vt=Pe==p,ct=nt==Pe;if(ct&&ns(C)){if(!ns(N))return!1;Le=!0,Et=!1}if(ct&&!Et)return le||(le=new Dn),Le||mc(C)?uc(C,N,D,X,Ae,le):gp(C,N,nt,D,X,Ae,le);if(!(D&o)){var Dt=Et&&et.call(C,"__wrapped__"),Mt=Vt&&et.call(N,"__wrapped__");if(Dt||Mt){var kn=Dt?C.value():C,yn=Mt?N.value():N;return le||(le=new Dn),Ae(kn,yn,D,X,le)}}return ct?(le||(le=new Dn),yp(C,N,D,X,Ae,le)):!1}function pp(C){if(!hc(C)||Cp(C))return!1;var N=fc(C)?pn:B;return N.test(sr(C))}function hp(C){return mi(C)&&pc(C.length)&&!!L[hi(C)]}function mp(C){if(!Sp(C))return Rn(C);var N=[];for(var D in Object(C))et.call(C,D)&&D!="constructor"&&N.push(D);return N}function uc(C,N,D,X,Ae,le){var Le=D&o,Ge=C.length,nt=N.length;if(Ge!=nt&&!(Le&&nt>Ge))return!1;var Pe=le.get(C);if(Pe&&le.get(N))return Pe==N;var Et=-1,Vt=!0,ct=D&i?new Fn:void 0;for(le.set(C,N),le.set(N,C);++Et<Ge;){var Dt=C[Et],Mt=N[Et];if(X)var kn=Le?X(Mt,Dt,Et,N,C,le):X(Dt,Mt,Et,C,N,le);if(kn!==void 0){if(kn)continue;Vt=!1;break}if(ct){if(!mt(N,function(yn,ar){if(!Ee(ct,ar)&&(Dt===yn||Ae(Dt,yn,D,X,le)))return ct.push(ar)})){Vt=!1;break}}else if(!(Dt===Mt||Ae(Dt,Mt,D,X,le))){Vt=!1;break}}return le.delete(C),le.delete(N),Vt}function gp(C,N,D,X,Ae,le,Le){switch(D){case U:if(C.byteLength!=N.byteLength||C.byteOffset!=N.byteOffset)return!1;C=C.buffer,N=N.buffer;case M:return!(C.byteLength!=N.byteLength||!le(new ir(C),new ir(N)));case d:case l:case v:return dc(+C,+N);case h:return C.name==N.name&&C.message==N.message;case S:case A:return C==N+"";case w:var Ge=xt;case T:var nt=X&o;if(Ge||(Ge=Rt),C.size!=N.size&&!nt)return!1;var Pe=Le.get(C);if(Pe)return Pe==N;X|=i,Le.set(C,N);var Et=uc(Ge(C),Ge(N),X,Ae,le,Le);return Le.delete(C),Et;case E:if(Ve)return Ve.call(C)==Ve.call(N)}return!1}function yp(C,N,D,X,Ae,le){var Le=D&o,Ge=lc(C),nt=Ge.length,Pe=lc(N),Et=Pe.length;if(nt!=Et&&!Le)return!1;for(var Vt=nt;Vt--;){var ct=Ge[Vt];if(!(Le?ct in N:et.call(N,ct)))return!1}var Dt=le.get(C);if(Dt&&le.get(N))return Dt==N;var Mt=!0;le.set(C,N),le.set(N,C);for(var kn=Le;++Vt<nt;){ct=Ge[Vt];var yn=C[ct],ar=N[ct];if(X)var gc=Le?X(ar,yn,ct,N,C,le):X(yn,ar,ct,C,N,le);if(!(gc===void 0?yn===ar||Ae(yn,ar,D,X,le):gc)){Mt=!1;break}kn||(kn=ct=="constructor")}if(Mt&&!kn){var Xi=C.constructor,Yi=N.constructor;Xi!=Yi&&"constructor"in C&&"constructor"in N&&!(typeof Xi=="function"&&Xi instanceof Xi&&typeof Yi=="function"&&Yi instanceof Yi)&&(Mt=!1)}return le.delete(C),le.delete(N),Mt}function lc(C){return dp(C,Np,wp)}function Qi(C,N){var D=C.__data__;return Ip(N)?D[typeof N=="string"?"string":"hash"]:D.map}function Rr(C,N){var D=Ze(C,N);return pp(D)?D:void 0}function vp(C){var N=et.call(C,Ot),D=C[Ot];try{C[Ot]=void 0;var X=!0}catch{}var Ae=fn.call(C);return X&&(N?C[Ot]=D:delete C[Ot]),Ae}var wp=hn?function(C){return C==null?[]:(C=Object(C),ot(hn(C),function(N){return Nn.call(C,N)}))}:Tp,Mn=hi;(mn&&Mn(new mn(new ArrayBuffer(1)))!=U||en&&Mn(new en)!=w||ke&&Mn(ke.resolve())!=y||at&&Mn(new at)!=T||ie&&Mn(new ie)!=P)&&(Mn=function(C){var N=hi(C),D=N==p?C.constructor:void 0,X=D?sr(D):"";if(X)switch(X){case dt:return U;case gn:return w;case z:return y;case se:return T;case ce:return P}return N});function bp(C,N){return N=N??s,!!N&&(typeof C=="number"||V.test(C))&&C>-1&&C%1==0&&C<N}function Ip(C){var N=typeof C;return N=="string"||N=="number"||N=="symbol"||N=="boolean"?C!=="__proto__":C===null}function Cp(C){return!!Ar&&Ar in C}function Sp(C){var N=C&&C.constructor,D=typeof N=="function"&&N.prototype||Me;return C===D}function xp(C){return fn.call(C)}function sr(C){if(C!=null){try{return Pt.call(C)}catch{}try{return C+""}catch{}}return""}function dc(C,N){return C===N||C!==C&&N!==N}var Op=ac(function(){return arguments}())?ac:function(C){return mi(C)&&et.call(C,"callee")&&!Nn.call(C,"callee")},Gi=Array.isArray;function Ep(C){return C!=null&&pc(C.length)&&!fc(C)}var ns=An||Ap;function _p(C,N){return cc(C,N)}function fc(C){if(!hc(C))return!1;var N=hi(C);return N==m||N==g||N==f||N==I}function pc(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=s}function hc(C){var N=typeof C;return C!=null&&(N=="object"||N=="function")}function mi(C){return C!=null&&typeof C=="object"}var mc=W?gt(W):hp;function Np(C){return Ep(C)?lp(C):mp(C)}function Tp(){return[]}function Ap(){return!1}e.exports=_p})(Oo,Oo.exports);var Lw=Oo.exports;const $o=ba(Lw),He=async(e,t)=>{var n;if(e instanceof pl){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
|
|
1
|
+
"use strict";var Qp=Object.defineProperty;var _c=e=>{throw TypeError(e)};var Xp=(e,t,n)=>t in e?Qp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var je=(e,t,n)=>Xp(e,typeof t!="symbol"?t+"":t,n),us=(e,t,n)=>t.has(e)||_c("Cannot "+n);var O=(e,t,n)=>(us(e,t,"read from private field"),n?n.call(e):t.get(e)),oe=(e,t,n)=>t.has(e)?_c("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),G=(e,t,n,r)=>(us(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),me=(e,t,n)=>(us(e,t,"access private method"),n);var oo=(e,t,n,r)=>({set _(o){G(e,t,o,n)},get _(){return O(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),b=require("react");require("react-dom");function Yp(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 H=Yp(b);var di=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(){}},Zp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},nn,gr,Hu,eh=(Hu=class{constructor(){oe(this,nn,Zp);oe(this,gr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&O(this,gr)&&e!==O(this,nn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:O(this,nn),provider:e}),G(this,nn,e),process.env.NODE_ENV!=="production"&&G(this,gr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&G(this,gr,!0),O(this,nn).setTimeout(e,t)}clearTimeout(e){O(this,nn).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&G(this,gr,!0),O(this,nn).setInterval(e,t)}clearInterval(e){O(this,nn).clearInterval(e)}},nn=new WeakMap,gr=new WeakMap,Hu),pr=new eh;function th(e){setTimeout(e,0)}var _r=typeof window>"u"||"Deno"in globalThis;function vt(){}function nh(e,t){return typeof e=="function"?e(t):e}function Rs(e){return typeof e=="number"&&e>=0&&e!==1/0}function tl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Qn(e,t){return typeof e=="function"?e(t):e}function Kt(e,t){return typeof e=="function"?e(t):e}function Nc(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==ga(s,t.options))return!1}else if(!Ti(t.queryKey,s))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function Tc(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Nr(t.options.mutationKey)!==Nr(i))return!1}else if(!Ti(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function ga(e,t){return((t==null?void 0:t.queryKeyHashFn)||Nr)(e)}function Nr(e){return JSON.stringify(e,(t,n)=>Fs(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Ti(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ti(e[n],t[n])):!1}var rh=Object.prototype.hasOwnProperty;function Ps(e,t){if(e===t)return e;const n=Ac(e)&&Ac(t);if(!n&&!(Fs(e)&&Fs(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 c=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:rh.call(e,l))&&c++;continue}if(d===null||h===null||typeof d!="object"||typeof h!="object"){a[l]=h;continue}const m=Ps(d,h);a[l]=m,m===d&&c++}return o===s&&c===o?e:a}function So(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 Ac(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Fs(e){if(!Rc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Rc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Rc(e){return Object.prototype.toString.call(e)==="[object Object]"}function ih(e){return new Promise(t=>{pr.setTimeout(t,e)})}function Ds(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 Ps(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 Ps(e,t)}return t}function oh(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function sh(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var xo=Symbol();function nl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===xo&&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===xo?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function rl(e,t){return typeof e=="function"?e(...t):!!e}var yr,Vn,Vr,Bu,ah=(Bu=class extends di{constructor(){super();oe(this,yr);oe(this,Vn);oe(this,Vr);G(this,Vr,t=>{if(!_r&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,Vn)||this.setEventListener(O(this,Vr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Vn))==null||t.call(this),G(this,Vn,void 0))}setEventListener(t){var n;G(this,Vr,t),(n=O(this,Vn))==null||n.call(this),G(this,Vn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,yr)!==t&&(G(this,yr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof O(this,yr)=="boolean"?O(this,yr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},yr=new WeakMap,Vn=new WeakMap,Vr=new WeakMap,Bu),ya=new ah;function Ms(){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 ch=th;function uh(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=ch;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=uh(),Ur,Un,qr,Ju,lh=(Ju=class extends di{constructor(){super();oe(this,Ur,!0);oe(this,Un);oe(this,qr);G(this,qr,t=>{if(!_r&&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,Un)||this.setEventListener(O(this,qr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Un))==null||t.call(this),G(this,Un,void 0))}setEventListener(t){var n;G(this,qr,t),(n=O(this,Un))==null||n.call(this),G(this,Un,t(this.setOnline.bind(this)))}setOnline(t){O(this,Ur)!==t&&(G(this,Ur,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,Ur)}},Ur=new WeakMap,Un=new WeakMap,qr=new WeakMap,Ju),Oo=new lh;function dh(e){return Math.min(1e3*2**e,3e4)}function il(e){return(e??"online")==="online"?Oo.isOnline():!0}var ks=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ol(e){let t=!1,n=0,r;const o=Ms(),i=()=>o.status!=="pending",s=w=>{var y;if(!i()){const x=new ks(w);h(x),(y=e.onCancel)==null||y.call(e,x)}},a=()=>{t=!0},c=()=>{t=!1},f=()=>ya.isFocused()&&(e.networkMode==="always"||Oo.isOnline())&&e.canRun(),l=()=>il(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 y;r=x=>{(i()||f())&&w(x)},(y=e.onPause)==null||y.call(e)}).then(()=>{var w;r=void 0,i()||(w=e.onContinue)==null||w.call(e)}),g=()=>{if(i())return;let w;const y=n===0?e.initialPromise:void 0;try{w=y??e.fn()}catch(x){w=Promise.reject(x)}Promise.resolve(w).then(d).catch(x=>{var N;if(i())return;const p=e.retry??(_r?0:3),v=e.retryDelay??dh,I=typeof v=="function"?v(n,x):v,S=p===!0||typeof p=="number"&&n<p||typeof p=="function"&&p(n,x);if(t||!S){h(x);return}n++,(N=e.onFail)==null||N.call(e,n,x),ih(I).then(()=>f()?void 0:m()).then(()=>{t?h(x):g()})})};return{promise:o,status:()=>o.status,cancel:s,continue:()=>(r==null||r(),o),cancelRetry:a,continueRetry:c,canStart:l,start:()=>(l()?g():m().then(g),o)}}var vr,Wu,sl=(Wu=class{constructor(){oe(this,vr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Rs(this.gcTime)&&G(this,vr,pr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(_r?1/0:5*60*1e3))}clearGcTimeout(){O(this,vr)&&(pr.clearTimeout(O(this,vr)),G(this,vr,void 0))}},vr=new WeakMap,Wu),wr,Hr,Lt,br,it,ji,Ir,Jt,In,zu,fh=(zu=class extends sl{constructor(t){super();oe(this,Jt);oe(this,wr);oe(this,Hr);oe(this,Lt);oe(this,br);oe(this,it);oe(this,ji);oe(this,Ir);G(this,Ir,!1),G(this,ji,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,br,t.client),G(this,Lt,O(this,br).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,wr,Pc(this.options)),this.state=t.state??O(this,wr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,it))==null?void 0:t.promise}setOptions(t){if(this.options={...O(this,ji),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Pc(this.options);n.data!==void 0&&(this.setData(n.data,{updatedAt:n.dataUpdatedAt,manual:!0}),G(this,wr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Lt).remove(this)}setData(t,n){const r=Ds(this.state.data,t,this.options);return me(this,Jt,In).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,Jt,In).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,wr))}isActive(){return this.observers.some(t=>Kt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===xo||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Qn(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:!tl(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,Ir)?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||me(this,Jt,In).call(this,{type:"invalidate"})}async fetch(t,n){var c,f,l,d,h,m,g,w,y,x,p,v;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:()=>(G(this,Ir,!0),r.signal)})},i=()=>{const I=nl(this.options,n),N=(()=>{const R={client:O(this,br),queryKey:this.queryKey,meta:this.meta};return o(R),R})();return G(this,Ir,!1),this.options.persister?this.options.persister(I,N,this):I(N)},a=(()=>{const I={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,br),state:this.state,fetchFn:i};return o(I),I})();(f=this.options.behavior)==null||f.onFetch(a,this),G(this,Hr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((l=a.fetchOptions)==null?void 0:l.meta))&&me(this,Jt,In).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),G(this,it,ol({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:I=>{I instanceof ks&&I.revert&&this.setState({...O(this,Hr),fetchStatus:"idle"}),r.abort()},onFail:(I,S)=>{me(this,Jt,In).call(this,{type:"failed",failureCount:I,error:S})},onPause:()=>{me(this,Jt,In).call(this,{type:"pause"})},onContinue:()=>{me(this,Jt,In).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=(h=O(this,Lt).config).onSuccess)==null||m.call(h,I,this),(w=(g=O(this,Lt).config).onSettled)==null||w.call(g,I,this.state.error,this),I}catch(I){if(I instanceof ks){if(I.silent)return O(this,it).promise;if(I.revert){if(this.state.data===void 0)throw I;return this.state.data}}throw me(this,Jt,In).call(this,{type:"error",error:I}),(x=(y=O(this,Lt).config).onError)==null||x.call(y,I,this),(v=(p=O(this,Lt).config).onSettled)==null||v.call(p,this.state.data,I,this),I}finally{this.scheduleGc()}}},wr=new WeakMap,Hr=new WeakMap,Lt=new WeakMap,br=new WeakMap,it=new WeakMap,ji=new WeakMap,Ir=new WeakMap,Jt=new WeakSet,In=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,...al(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return G(this,Hr,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})})},zu);function al(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:il(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Pc(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 St,Ie,Li,gt,Cr,Br,Cn,qn,Ki,Jr,Wr,Sr,xr,Hn,zr,Ae,xi,js,Ls,Ks,$s,Vs,Us,qs,cl,Gu,ph=(Gu=class extends di{constructor(t,n){super();oe(this,Ae);oe(this,St);oe(this,Ie);oe(this,Li);oe(this,gt);oe(this,Cr);oe(this,Br);oe(this,Cn);oe(this,qn);oe(this,Ki);oe(this,Jr);oe(this,Wr);oe(this,Sr);oe(this,xr);oe(this,Hn);oe(this,zr,new Set);this.options=n,G(this,St,t),G(this,qn,null),G(this,Cn,Ms()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,Ie).addObserver(this),Fc(O(this,Ie),this.options)?me(this,Ae,xi).call(this):this.updateResult(),me(this,Ae,$s).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Hs(O(this,Ie),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Hs(O(this,Ie),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,me(this,Ae,Vs).call(this),me(this,Ae,Us).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");me(this,Ae,qs).call(this),O(this,Ie).setOptions(this.options),n._defaulted&&!So(this.options,n)&&O(this,St).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,Ie),observer:this});const o=this.hasListeners();o&&Dc(O(this,Ie),r,this.options,n)&&me(this,Ae,xi).call(this),this.updateResult(),o&&(O(this,Ie)!==r||Kt(this.options.enabled,O(this,Ie))!==Kt(n.enabled,O(this,Ie))||Qn(this.options.staleTime,O(this,Ie))!==Qn(n.staleTime,O(this,Ie)))&&me(this,Ae,js).call(this);const i=me(this,Ae,Ls).call(this);o&&(O(this,Ie)!==r||Kt(this.options.enabled,O(this,Ie))!==Kt(n.enabled,O(this,Ie))||i!==O(this,Hn))&&me(this,Ae,Ks).call(this,i)}getOptimisticResult(t){const n=O(this,St).getQueryCache().build(O(this,St),t),r=this.createResult(n,t);return mh(this,r)&&(G(this,gt,r),G(this,Br,this.options),G(this,Cr,O(this,Ie).state)),r}getCurrentResult(){return O(this,gt)}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,zr).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 me(this,Ae,xi).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,gt)))}createResult(t,n){var P;const r=O(this,Ie),o=this.options,i=O(this,gt),s=O(this,Cr),a=O(this,Br),f=t!==r?t.state:O(this,Li),{state:l}=t;let d={...l},h=!1,m;if(n._optimisticResults){const A=this.hasListeners(),D=!A&&Fc(t,n),V=A&&Dc(t,r,n,o);(D||V)&&(d={...d,...al(l.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:g,errorUpdatedAt:w,status:y}=d;m=d.data;let x=!1;if(n.placeholderData!==void 0&&m===void 0&&y==="pending"){let A;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(A=i.data,x=!0):A=typeof n.placeholderData=="function"?n.placeholderData((P=O(this,Wr))==null?void 0:P.state.data,O(this,Wr)):n.placeholderData,A!==void 0&&(y="success",m=Ds(i==null?void 0:i.data,A,n),h=!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,Jr);else try{G(this,Ki,n.select),m=n.select(m),m=Ds(i==null?void 0:i.data,m,n),G(this,Jr,m),G(this,qn,null)}catch(A){G(this,qn,A)}O(this,qn)&&(g=O(this,qn),m=O(this,Jr),w=Date.now(),y="error");const p=d.fetchStatus==="fetching",v=y==="pending",I=y==="error",S=v&&p,N=m!==void 0,E={status:y,fetchStatus:d.fetchStatus,isPending:v,isSuccess:y==="success",isError:I,isInitialLoading:S,isLoading:S,data:m,dataUpdatedAt:d.dataUpdatedAt,error:g,errorUpdatedAt:w,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>f.dataUpdateCount||d.errorUpdateCount>f.errorUpdateCount,isFetching:p,isRefetching:p&&!v,isLoadingError:I&&!N,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:I&&N,isStale:va(t,n),refetch:this.refetch,promise:O(this,Cn),isEnabled:Kt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const A=j=>{E.status==="error"?j.reject(E.error):E.data!==void 0&&j.resolve(E.data)},D=()=>{const j=G(this,Cn,E.promise=Ms());A(j)},V=O(this,Cn);switch(V.status){case"pending":t.queryHash===r.queryHash&&A(V);break;case"fulfilled":(E.status==="error"||E.data!==V.value)&&D();break;case"rejected":(E.status!=="error"||E.error!==V.reason)&&D();break}}return E}updateResult(){const t=O(this,gt),n=this.createResult(O(this,Ie),this.options);if(G(this,Cr,O(this,Ie).state),G(this,Br,this.options),O(this,Cr).data!==void 0&&G(this,Wr,O(this,Ie)),So(n,t))return;G(this,gt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!O(this,zr).size)return!0;const s=new Set(i??O(this,zr));return this.options.throwOnError&&s.add("error"),Object.keys(O(this,gt)).some(a=>{const c=a;return O(this,gt)[c]!==t[c]&&s.has(c)})};me(this,Ae,cl).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&me(this,Ae,$s).call(this)}},St=new WeakMap,Ie=new WeakMap,Li=new WeakMap,gt=new WeakMap,Cr=new WeakMap,Br=new WeakMap,Cn=new WeakMap,qn=new WeakMap,Ki=new WeakMap,Jr=new WeakMap,Wr=new WeakMap,Sr=new WeakMap,xr=new WeakMap,Hn=new WeakMap,zr=new WeakMap,Ae=new WeakSet,xi=function(t){me(this,Ae,qs).call(this);let n=O(this,Ie).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(vt)),n},js=function(){me(this,Ae,Vs).call(this);const t=Qn(this.options.staleTime,O(this,Ie));if(_r||O(this,gt).isStale||!Rs(t))return;const r=tl(O(this,gt).dataUpdatedAt,t)+1;G(this,Sr,pr.setTimeout(()=>{O(this,gt).isStale||this.updateResult()},r))},Ls=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,Ie)):this.options.refetchInterval)??!1},Ks=function(t){me(this,Ae,Us).call(this),G(this,Hn,t),!(_r||Kt(this.options.enabled,O(this,Ie))===!1||!Rs(O(this,Hn))||O(this,Hn)===0)&&G(this,xr,pr.setInterval(()=>{(this.options.refetchIntervalInBackground||ya.isFocused())&&me(this,Ae,xi).call(this)},O(this,Hn)))},$s=function(){me(this,Ae,js).call(this),me(this,Ae,Ks).call(this,me(this,Ae,Ls).call(this))},Vs=function(){O(this,Sr)&&(pr.clearTimeout(O(this,Sr)),G(this,Sr,void 0))},Us=function(){O(this,xr)&&(pr.clearInterval(O(this,xr)),G(this,xr,void 0))},qs=function(){const t=O(this,St).getQueryCache().build(O(this,St),this.options);if(t===O(this,Ie))return;const n=O(this,Ie);G(this,Ie,t),G(this,Li,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},cl=function(t){Xe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,gt))}),O(this,St).getQueryCache().notify({query:O(this,Ie),type:"observerResultsUpdated"})})},Gu);function hh(e,t){return Kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Fc(e,t){return hh(e,t)||e.state.data!==void 0&&Hs(e,t,t.refetchOnMount)}function Hs(e,t,n){if(Kt(t.enabled,e)!==!1&&Qn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&va(e,t)}return!1}function Dc(e,t,n,r){return(e!==t||Kt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&va(e,n)}function va(e,t){return Kt(t.enabled,e)!==!1&&e.isStaleByTime(Qn(t.staleTime,e))}function mh(e,t){return!So(e.getCurrentResult(),t)}function Mc(e){return{onFetch:(t,n)=>{var l,d,h,m,g;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=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const f=async()=>{let w=!1;const y=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},x=nl(t.options,t.fetchOptions),p=async(v,I,S)=>{if(w)return Promise.reject();if(I==null&&v.pages.length)return Promise.resolve(v);const R=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:I,direction:S?"backward":"forward",meta:t.options.meta};return y(D),D})(),E=await x(R),{maxPages:P}=t.options,A=S?sh:oh;return{pages:A(v.pages,E,P),pageParams:A(v.pageParams,I,P)}};if(o&&i.length){const v=o==="backward",I=v?gh:kc,S={pages:i,pageParams:s},N=I(r,S);a=await p(S,N,v)}else{const v=e??i.length;do{const I=c===0?s[0]??r.initialPageParam:kc(r,a);if(c>0&&I==null)break;a=await p(a,I),c++}while(c<v)}return a};t.options.persister?t.fetchFn=()=>{var w,y;return(y=(w=t.options).persister)==null?void 0:y.call(w,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function kc(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 gh(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 $i,rn,yt,Or,on,$n,Qu,yh=(Qu=class extends sl{constructor(t){super();oe(this,on);oe(this,$i);oe(this,rn);oe(this,yt);oe(this,Or);G(this,$i,t.client),this.mutationId=t.mutationId,G(this,yt,t.mutationCache),G(this,rn,[]),this.state=t.state||ul(),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,yt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,rn,O(this,rn).filter(n=>n!==t)),this.scheduleGc(),O(this,yt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,rn).length||(this.state.status==="pending"?this.scheduleGc():O(this,yt).remove(this))}continue(){var t;return((t=O(this,Or))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,a,c,f,l,d,h,m,g,w,y,x,p,v,I,S,N,R,E,P;const n=()=>{me(this,on,$n).call(this,{type:"continue"})},r={client:O(this,$i),meta:this.options.meta,mutationKey:this.options.mutationKey};G(this,Or,ol({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(A,D)=>{me(this,on,$n).call(this,{type:"failed",failureCount:A,error:D})},onPause:()=>{me(this,on,$n).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,yt).canRun(this)}));const o=this.state.status==="pending",i=!O(this,Or).canStart();try{if(o)n();else{me(this,on,$n).call(this,{type:"pending",variables:t,isPaused:i}),await((a=(s=O(this,yt).config).onMutate)==null?void 0:a.call(s,t,this,r));const D=await((f=(c=this.options).onMutate)==null?void 0:f.call(c,t,r));D!==this.state.context&&me(this,on,$n).call(this,{type:"pending",context:D,variables:t,isPaused:i})}const A=await O(this,Or).start();return await((d=(l=O(this,yt).config).onSuccess)==null?void 0:d.call(l,A,t,this.state.context,this,r)),await((m=(h=this.options).onSuccess)==null?void 0:m.call(h,A,t,this.state.context,r)),await((w=(g=O(this,yt).config).onSettled)==null?void 0:w.call(g,A,null,this.state.variables,this.state.context,this,r)),await((x=(y=this.options).onSettled)==null?void 0:x.call(y,A,null,t,this.state.context,r)),me(this,on,$n).call(this,{type:"success",data:A}),A}catch(A){try{throw await((v=(p=O(this,yt).config).onError)==null?void 0:v.call(p,A,t,this.state.context,this,r)),await((S=(I=this.options).onError)==null?void 0:S.call(I,A,t,this.state.context,r)),await((R=(N=O(this,yt).config).onSettled)==null?void 0:R.call(N,void 0,A,this.state.variables,this.state.context,this,r)),await((P=(E=this.options).onSettled)==null?void 0:P.call(E,void 0,A,t,this.state.context,r)),A}finally{me(this,on,$n).call(this,{type:"error",error:A})}}finally{O(this,yt).runNext(this)}}},$i=new WeakMap,rn=new WeakMap,yt=new WeakMap,Or=new WeakMap,on=new WeakSet,$n=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Xe.batch(()=>{O(this,rn).forEach(r=>{r.onMutationUpdate(t)}),O(this,yt).notify({mutation:this,type:"updated",action:t})})},Qu);function ul(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Sn,Wt,Vi,Xu,vh=(Xu=class extends di{constructor(t={}){super();oe(this,Sn);oe(this,Wt);oe(this,Vi);this.config=t,G(this,Sn,new Set),G(this,Wt,new Map),G(this,Vi,0)}build(t,n,r){const o=new yh({client:t,mutationCache:this,mutationId:++oo(this,Vi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,Sn).add(t);const n=so(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,Sn).delete(t)){const n=so(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=so(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=so(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,Sn).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,Sn).clear(),O(this,Wt).clear()})}getAll(){return Array.from(O(this,Sn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Tc(n,r))}findAll(t={}){return this.getAll().filter(n=>Tc(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))))}},Sn=new WeakMap,Wt=new WeakMap,Vi=new WeakMap,Xu);function so(e){var t;return(t=e.options.scope)==null?void 0:t.id}var xn,Bn,xt,On,_n,yo,Bs,Yu,wh=(Yu=class extends di{constructor(n,r){super();oe(this,_n);oe(this,xn);oe(this,Bn);oe(this,xt);oe(this,On);G(this,xn,n),this.setOptions(r),this.bindMethods(),me(this,_n,yo).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,xn).defaultMutationOptions(n),So(this.options,r)||O(this,xn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,xt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Nr(r.mutationKey)!==Nr(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){me(this,_n,yo).call(this),me(this,_n,Bs).call(this,n)}getCurrentResult(){return O(this,Bn)}reset(){var n;(n=O(this,xt))==null||n.removeObserver(this),G(this,xt,void 0),me(this,_n,yo).call(this),me(this,_n,Bs).call(this)}mutate(n,r){var o;return G(this,On,r),(o=O(this,xt))==null||o.removeObserver(this),G(this,xt,O(this,xn).getMutationCache().build(O(this,xn),this.options)),O(this,xt).addObserver(this),O(this,xt).execute(n)}},xn=new WeakMap,Bn=new WeakMap,xt=new WeakMap,On=new WeakMap,_n=new WeakSet,yo=function(){var r;const n=((r=O(this,xt))==null?void 0:r.state)??ul();G(this,Bn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Bs=function(n){Xe.batch(()=>{var r,o,i,s,a,c,f,l;if(O(this,On)&&this.hasListeners()){const d=O(this,Bn).variables,h=O(this,Bn).context,m={client:O(this,xn),meta:this.options.meta,mutationKey:this.options.mutationKey};(n==null?void 0:n.type)==="success"?((o=(r=O(this,On)).onSuccess)==null||o.call(r,n.data,d,h,m),(s=(i=O(this,On)).onSettled)==null||s.call(i,n.data,null,d,h,m)):(n==null?void 0:n.type)==="error"&&((c=(a=O(this,On)).onError)==null||c.call(a,n.error,d,h,m),(l=(f=O(this,On)).onSettled)==null||l.call(f,void 0,n.error,d,h,m))}this.listeners.forEach(d=>{d(O(this,Bn))})})},Yu),sn,Zu,bh=(Zu=class extends di{constructor(t={}){super();oe(this,sn);this.config=t,G(this,sn,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??ga(o,n);let s=this.get(i);return s||(s=new fh({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){O(this,sn).has(t.queryHash)||(O(this,sn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,sn).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,sn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Xe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,sn).get(t)}getAll(){return[...O(this,sn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Nc(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Nc(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()})})}},sn=new WeakMap,Zu),Ue,Jn,Wn,Gr,Qr,zn,Xr,Yr,el,Ih=(el=class{constructor(e={}){oe(this,Ue);oe(this,Jn);oe(this,Wn);oe(this,Gr);oe(this,Qr);oe(this,zn);oe(this,Xr);oe(this,Yr);G(this,Ue,e.queryCache||new bh),G(this,Jn,e.mutationCache||new vh),G(this,Wn,e.defaultOptions||{}),G(this,Gr,new Map),G(this,Qr,new Map),G(this,zn,0)}mount(){oo(this,zn)._++,O(this,zn)===1&&(G(this,Xr,ya.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ue).onFocus())})),G(this,Yr,Oo.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ue).onOnline())})))}unmount(){var e,t;oo(this,zn)._--,O(this,zn)===0&&((e=O(this,Xr))==null||e.call(this),G(this,Xr,void 0),(t=O(this,Yr))==null||t.call(this),G(this,Yr,void 0))}isFetching(e){return O(this,Ue).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Jn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Ue).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,Ue).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Qn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(this,Ue).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,Ue).get(r.queryHash),i=o==null?void 0:o.state.data,s=nh(t,i);if(s!==void 0)return O(this,Ue).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Xe.batch(()=>O(this,Ue).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,Ue).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,Ue);Xe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,Ue);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,Ue).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(vt).catch(vt)}invalidateQueries(e,t={}){return Xe.batch(()=>(O(this,Ue).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,Ue).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,Ue).build(this,t);return n.isStaleByTime(Qn(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=Mc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(vt).catch(vt)}ensureInfiniteQueryData(e){return e.behavior=Mc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Oo.isOnline()?O(this,Jn).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Ue)}getMutationCache(){return O(this,Jn)}getDefaultOptions(){return O(this,Wn)}setDefaultOptions(e){G(this,Wn,e)}setQueryDefaults(e,t){O(this,Gr).set(Nr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,Gr).values()],n={};return t.forEach(r=>{Ti(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,Qr).set(Nr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Qr).values()],n={};return t.forEach(r=>{Ti(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,Wn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ga(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===xo&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Wn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Ue).clear(),O(this,Jn).clear()}},Ue=new WeakMap,Jn=new WeakMap,Wn=new WeakMap,Gr=new WeakMap,Qr=new WeakMap,zn=new WeakMap,Xr=new WeakMap,Yr=new WeakMap,el),ll=H.createContext(void 0),qe=e=>{const t=H.useContext(ll);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ch=({client:e,children:t})=>(H.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(ll.Provider,{value:e,children:t})),dl=H.createContext(!1),Sh=()=>H.useContext(dl);dl.Provider;function xh(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Oh=H.createContext(xh()),Eh=()=>H.useContext(Oh),_h=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Nh=e=>{H.useEffect(()=>{e.clearReset()},[e])},Th=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||rl(n,[e.error,r])),Ah=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))}},Rh=(e,t)=>e.isLoading&&e.isFetching&&!t,Ph=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,jc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Fh(e,t,n){var d,h,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=Sh(),o=Eh(),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",Ah(s),_h(s,o),Nh(o);const a=!i.getQueryCache().get(s.queryHash),[c]=H.useState(()=>new t(i,s)),f=c.getOptimisticResult(s),l=!r&&e.subscribed!==!1;if(H.useSyncExternalStore(H.useCallback(y=>{const x=l?c.subscribe(Xe.batchCalls(y)):vt;return c.updateResult(),x},[c,l]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),H.useEffect(()=>{c.setOptions(s)},[s,c]),Ph(s,f))throw jc(s,c,o);if(Th({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&&!_r&&Rh(f,r)){const y=a?jc(s,c,o):(w=i.getQueryCache().get(s.queryHash))==null?void 0:w.promise;y==null||y.catch(vt).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?f:c.trackResult(f)}function tr(e,t){return Fh(e,ph)}function Nn(e,t){const n=qe(),[r]=H.useState(()=>new wh(n,e));H.useEffect(()=>{r.setOptions(e)},[r,e]);const o=H.useSyncExternalStore(H.useCallback(s=>r.subscribe(Xe.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=H.useCallback((s,a)=>{r.mutate(s,a).catch(vt)},[r]);if(o.error&&rl(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const fl=b.createContext(null),Dh=fl.Provider,pl=()=>b.useContext(fl);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 hl=b.createContext(void 0);function ln(){const e=b.useContext(hl);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Mh=(()=>{const e={};return Object.values(we).forEach(t=>{e[t]={}}),e})();function kh({children:e}){const[t,n]=b.useState(Mh),r=b.useCallback((l,d,h=!0)=>{n(m=>{const g={...m};return g[l]=g[l]||{},g[l][d]=h,g})},[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 g;const m={...h};return(g=m[l])==null||delete g[d],m})},[n]),a=b.useCallback(l=>{n(d=>{const h={...d};return h[l]={},h})},[n]),c=b.useCallback((l,d)=>{n(h=>{const m={...h};return m[l]=m[l]||{},d.forEach(g=>{m[l][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(hl.Provider,{value:f,children:e})}const ao=new TextEncoder,Ai=new TextDecoder;function jh(...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 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 vo(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:Ai.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=Ai.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 nr 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(nr,"code","ERR_JOSE_GENERIC");class Bt extends nr{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(Bt,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Js extends nr{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(Js,"code","ERR_JWT_EXPIRED");class ml extends nr{constructor(){super(...arguments);je(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}je(ml,"code","ERR_JOSE_ALG_NOT_ALLOWED");class hr extends nr{constructor(){super(...arguments);je(this,"code","ERR_JOSE_NOT_SUPPORTED")}}je(hr,"code","ERR_JOSE_NOT_SUPPORTED");class rt extends nr{constructor(){super(...arguments);je(this,"code","ERR_JWS_INVALID")}}je(rt,"code","ERR_JWS_INVALID");class wa extends nr{constructor(){super(...arguments);je(this,"code","ERR_JWT_INVALID")}}je(wa,"code","ERR_JWT_INVALID");class gl extends nr{constructor(n="signature verification failed",r){super(n,r);je(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}je(gl,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function bn(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function bi(e,t){return e.name===t}function ls(e){return parseInt(e.name.slice(4),10)}function Kh(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 Vh(e,t,n){switch(t){case"HS256":case"HS384":case"HS512":{if(!bi(e.algorithm,"HMAC"))throw bn("HMAC");const r=parseInt(t.slice(2),10);if(ls(e.algorithm.hash)!==r)throw bn(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!bi(e.algorithm,"RSASSA-PKCS1-v1_5"))throw bn("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(ls(e.algorithm.hash)!==r)throw bn(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!bi(e.algorithm,"RSA-PSS"))throw bn("RSA-PSS");const r=parseInt(t.slice(2),10);if(ls(e.algorithm.hash)!==r)throw bn(`SHA-${r}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":{if(!bi(e.algorithm,"Ed25519"))throw bn("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!bi(e.algorithm,"ECDSA"))throw bn("ECDSA");const r=Kh(t);if(e.algorithm.namedCurve!==r)throw bn(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}$h(e,n)}function yl(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 Uh=(e,...t)=>yl("Key must be ",e,...t);function vl(e,t,...n){return yl(`Key for the ${e} algorithm must be `,t,...n)}function wl(e){return(e==null?void 0:e[Symbol.toStringTag])==="CryptoKey"}function bl(e){return(e==null?void 0:e[Symbol.toStringTag])==="KeyObject"}const Il=e=>wl(e)||bl(e),qh=(...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 Hh(e){return typeof e=="object"&&e!==null}const Eo=e=>{if(!Hh(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},Bh=(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 Jh(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 hr('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 hr('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 hr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new hr('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}const Wh=async e=>{if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:t,keyUsages:n}=Jh(e),r={...e};return delete r.alg,delete r.use,crypto.subtle.importKey("jwk",r,t,e.ext??!e.d,e.key_ops??n)},zh=(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 hr(`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)},Gh=(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 ba(e){return Eo(e)&&typeof e.kty=="string"}function Qh(e){return e.kty!=="oct"&&typeof e.d=="string"}function Xh(e){return e.kty!=="oct"&&typeof e.d>"u"}function Yh(e){return e.kty==="oct"&&typeof e.k=="string"}let Kr;const Lc=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 Wh({...t,alg:n});return r&&Object.freeze(e),o?o[n]=i:Kr.set(e,{[n]:i}),i},Zh=(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},em=async(e,t)=>{if(e instanceof Uint8Array||wl(e))return e;if(bl(e)){if(e.type==="secret")return e.export();if("toCryptoKey"in e&&typeof e.toCryptoKey=="function")try{return Zh(e,t)}catch(r){if(r instanceof TypeError)throw r}let n=e.export({format:"jwk"});return Lc(e,n,t)}if(ba(e))return e.k?vo(e.k):Lc(e,e,t,!0);throw new Error("unreachable")},jr=e=>e==null?void 0:e[Symbol.toStringTag],Ws=(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},tm=(e,t,n)=>{if(!(t instanceof Uint8Array)){if(ba(t)){if(Yh(t)&&Ws(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(!Il(t))throw new TypeError(vl(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(t.type!=="secret")throw new TypeError(`${jr(t)} instances for symmetric algorithms must be of type "secret"`)}},nm=(e,t,n)=>{if(ba(t))switch(n){case"decrypt":case"sign":if(Qh(t)&&Ws(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(Xh(t)&&Ws(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!Il(t))throw new TypeError(vl(e,t,"CryptoKey","KeyObject","JSON Web Key"));if(t.type==="secret")throw new TypeError(`${jr(t)} instances for asymmetric algorithms must not be of type "secret"`);if(t.type==="public")switch(n){case"sign":throw new TypeError(`${jr(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${jr(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if(t.type==="private")switch(n){case"verify":throw new TypeError(`${jr(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${jr(t)} instances for asymmetric algorithm encryption must be of type "public"`)}},rm=(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)?tm(e,t,n):nm(e,t,n)},im=(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 hr(`alg ${e} is not supported either by JOSE or your javascript runtime`)}},om=async(e,t,n)=>{if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(Uh(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[n])}return Vh(t,e,n),t},sm=async(e,t,n,r)=>{const o=await om(e,t,"verify");Bh(e,o);const i=im(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch{return!1}};async function am(e,t,n){if(!Eo(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&&!Eo(e.header))throw new rt("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const y=vo(e.protected);r=JSON.parse(Ai.decode(y))}catch{throw new rt("JWS Protected Header is invalid")}if(!qh(r,e.header))throw new rt("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const o={...r,...e.header},i=zh(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&&Gh("algorithms",n.algorithms);if(c&&!c.has(a))throw new ml('"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),rm(a,t,"verify");const l=jh(ao.encode(e.protected??""),ao.encode("."),typeof e.payload=="string"?ao.encode(e.payload):e.payload);let d;try{d=vo(e.signature)}catch{throw new rt("Failed to base64url decode the signature")}const h=await em(t,a);if(!await sm(a,h,d,l))throw new gl;let g;if(s)try{g=vo(e.payload)}catch{throw new rt("Failed to base64url decode the payload")}else typeof e.payload=="string"?g=ao.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:h}:w}async function cm(e,t,n){if(e instanceof Uint8Array&&(e=Ai.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 am({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 um=e=>Math.floor(e.getTime()/1e3),Cl=60,Sl=Cl*60,Ia=Sl*24,lm=Ia*7,dm=Ia*365.25,fm=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Kc=e=>{const t=fm.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]),r=t[3].toLowerCase();let o;switch(r){case"sec":case"secs":case"second":case"seconds":case"s":o=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":o=Math.round(n*Cl);break;case"hour":case"hours":case"hr":case"hrs":case"h":o=Math.round(n*Sl);break;case"day":case"days":case"d":o=Math.round(n*Ia);break;case"week":case"weeks":case"w":o=Math.round(n*lm);break;default:o=Math.round(n*dm);break}return t[1]==="-"||t[4]==="ago"?-o:o},$c=e=>e.includes("/")?e.toLowerCase():`application/${e.toLowerCase()}`,pm=(e,t)=>typeof e=="string"?t.includes(e):Array.isArray(e)?t.some(Set.prototype.has.bind(new Set(e))):!1;function hm(e,t,n={}){let r;try{r=JSON.parse(Ai.decode(t))}catch{}if(!Eo(r))throw new wa("JWT Claims Set must be a top-level JSON object");const{typ:o}=n;if(o&&(typeof e.typ!="string"||$c(e.typ)!==$c(o)))throw new Bt('unexpected "typ" JWT header value',r,"typ","check_failed");const{requiredClaims:i=[],issuer:s,subject:a,audience:c,maxTokenAge:f}=n,l=[...i];f!==void 0&&l.push("iat"),c!==void 0&&l.push("aud"),a!==void 0&&l.push("sub"),s!==void 0&&l.push("iss");for(const g of new Set(l.reverse()))if(!(g in r))throw new Bt(`missing required "${g}" claim`,r,g,"missing");if(s&&!(Array.isArray(s)?s:[s]).includes(r.iss))throw new Bt('unexpected "iss" claim value',r,"iss","check_failed");if(a&&r.sub!==a)throw new Bt('unexpected "sub" claim value',r,"sub","check_failed");if(c&&!pm(r.aud,typeof c=="string"?[c]:c))throw new Bt('unexpected "aud" claim value',r,"aud","check_failed");let d;switch(typeof n.clockTolerance){case"string":d=Kc(n.clockTolerance);break;case"number":d=n.clockTolerance;break;case"undefined":d=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:h}=n,m=um(h||new Date);if((r.iat!==void 0||f)&&typeof r.iat!="number")throw new Bt('"iat" claim must be a number',r,"iat","invalid");if(r.nbf!==void 0){if(typeof r.nbf!="number")throw new Bt('"nbf" claim must be a number',r,"nbf","invalid");if(r.nbf>m+d)throw new Bt('"nbf" claim timestamp check failed',r,"nbf","check_failed")}if(r.exp!==void 0){if(typeof r.exp!="number")throw new Bt('"exp" claim must be a number',r,"exp","invalid");if(r.exp<=m-d)throw new Js('"exp" claim timestamp check failed',r,"exp","check_failed")}if(f){const g=m-r.iat,w=typeof f=="number"?f:Kc(f);if(g-d>w)throw new Js('"iat" claim timestamp check failed (too far in the past)',r,"iat","check_failed");if(g<0-d)throw new Bt('"iat" claim timestamp check failed (it should be in the past)',r,"iat","check_failed")}return r}async function mm(e,t,n){var s;const r=await cm(e,t,n);if((s=r.protectedHeader.crit)!=null&&s.includes("b64")&&r.protectedHeader.b64===!1)throw new wa("JWTs MUST NOT use unencoded payload");const i={payload:hm(r.protectedHeader,r.payload,n),protectedHeader:r.protectedHeader};return typeof t=="function"?{...i,key:r.key}:i}const zs="amp-labs_jwt_",gm=10*60*1e3,Vc=(e,t)=>`${e}:${t}`,Uc=e=>`${zs}${e}`,xl=b.createContext(null),ym=async e=>{try{const n=(await mm(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 vm({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(l=>{if(l.startsWith(zs)){const d=l.replace(zs,""),h=sessionStorage.getItem(l);if(h)try{const m=JSON.parse(h);m.expiresAt>f?c.set(d,m):sessionStorage.removeItem(l)}catch{sessionStorage.removeItem(l)}}}),c.size>0&&r(c)}catch{console.warn("Failed to load JWT tokens from sessionStorage")}},[]);const o=b.useCallback((c,f)=>{const l=Vc(c,f),d=Date.now(),h=n.get(l);if(h&&h.expiresAt>d)return h.token;n.delete(l);const m=Uc(l),g=sessionStorage.getItem(m);if(g)try{const w=JSON.parse(g);if(w.expiresAt>d)return r(y=>new Map(y).set(l,w)),w.token;sessionStorage.removeItem(m)}catch{sessionStorage.removeItem(m)}return null},[n]),i=b.useCallback(async(c,f,l)=>{const d=Vc(c,f),m=await ym(l)||Date.now()+gm,g={token:l,expiresAt:m};r(w=>new Map(w).set(d,g));try{sessionStorage.setItem(Uc(d),JSON.stringify(g))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=b.useCallback(async({consumerRef:c,groupRef:f})=>{const l=o(c,f);if(l)return l;if(!e)throw new Error("JWT token callback not provided");try{const d=await e({consumerRef:c,groupRef:f});return await i(c,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 u.jsx(xl.Provider,{value:a,children:t})}const wm=()=>{const e=b.useContext(xl);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},Ca=b.createContext(null);function Le(){const e=b.useContext(Ca);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
2
|
+
component is wrapped with AmpersandProvider`);return e}const bm=new Ih;function Im(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(Ch,{client:bm,children:u.jsx(Ca.Provider,{value:a,children:u.jsx(kh,{children:u.jsx(vm,{getTokenCallback:o||null,children:u.jsx(Dh,{value:t||null,children:i})})})})})}const Cm="https://api.withampersand.com/v1".replace(/\/+$/,"");class Sa{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Cm}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||El}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Sm=new Sa,Uo=class Uo{constructor(t=Sm){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 Em(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(i=await s.post({fetch:this.fetchApi,url:o.url,init:o.init,response:i.clone()})||i);return i},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?Uo.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:o}=await this.createFetchParams(t,n),i=await this.fetchApi(r,o);if(i&&i.status>=200&&i.status<300)return i;throw new Ol(i,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const o=Object.assign({},this.configuration.headers,t.headers);Object.keys(o).forEach(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:Om(a.body)||a.body instanceof URLSearchParams||xm(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Uo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let an=Uo;function xm(e){return typeof Blob<"u"&&e instanceof Blob}function Om(e){return typeof FormData<"u"&&e instanceof FormData}class Ol extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Em 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,t){const n=e[t];return n!=null}function El(e,t=""){return Object.keys(e).map(n=>_l(n,e[n],t)).filter(n=>n.length>0).join("&")}function _l(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 _l(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?El(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 Zr{constructor(t){this.raw=t}async value(){}}class qc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function _m(e){return Nm(e)}function Nm(e,t){return e==null?e:{fieldUsed:_(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:_(e,"keyFormat")?e.keyFormat:void 0}}function Tm(e){return Am(e)}function Am(e,t){return e==null?e:{name:e.name,valuePrefix:_(e,"valuePrefix")?e.valuePrefix:void 0}}function Rm(e){return Pm(e)}function Pm(e,t){return e==null?e:{name:e.name}}function Fm(e){return Dm(e)}function Dm(e,t){return e==null?e:{attachmentType:e.attachmentType,query:_(e,"query")?Rm(e.query):void 0,header:_(e,"header")?Tm(e.header):void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0}}function Mm(e){return km(e)}function km(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,includeFullRecords:_(e,"includeFullRecords")?e.includeFullRecords:void 0}}function jm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function Lm(e){return Km(e)}function Km(e,t){return e==null?e:{url:e.url,method:_(e,"method")?e.method:void 0,successStatusCodes:_(e,"successStatusCodes")?e.successStatusCodes:void 0}}const Hc={ApiKey:"apiKey",Basic:"basic"};function $m(e){return Vm(e)}function Vm(e,t){return e}function Um(e){return qm(e)}function qm(e,t){return e==null?e:{days:_(e,"days")?e.days:void 0,fullHistory:_(e,"fullHistory")?e.fullHistory:void 0}}function Hm(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Nl(e){return Bm(e)}function Bm(e,t){return e==null?e:{defaultPeriod:Um(e.defaultPeriod)}}function Jm(e){if(e!==void 0)return e===null?null:{defaultPeriod:Hm(e.defaultPeriod)}}function Wm(e){return zm(e)}function zm(e,t){return e==null?e:{days:_(e,"days")?e.days:void 0,fullHistory:_(e,"fullHistory")?e.fullHistory:void 0}}function Gm(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Qm(e){return Xm(e)}function Xm(e,t){return e==null?e:{defaultPeriod:Wm(e.defaultPeriod)}}function Tl(e){if(e!==void 0)return e===null?null:{defaultPeriod:Gm(e.defaultPeriod)}}function Ym(e){return Zm(e)}function Zm(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,useModule:_(e,"useModule")?e.useModule:void 0}}function Al(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function eg(e){return tg(e)}function tg(e,t){return e==null?e:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function ng(e){if(e!==void 0)return e===null?null:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function rg(e){return ig(e)}function ig(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,prompt:_(e,"prompt")?e.prompt:void 0,mappedValues:_(e,"mappedValues")?e.mappedValues.map(eg):void 0,fieldName:_(e,"fieldName")?e.fieldName:void 0}}function Rl(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(ng),fieldName:e.fieldName}}function og(e){return sg(e)}function sg(e,t){return e}function ag(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(Rl),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Tl(e.backfill)}}function cg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Be(e.objects,ag)}}function ug(e){return lg(e)}function lg(e,t){return e==null?e:{stringValue:_(e,"stringValue")?e.stringValue:void 0,integerValue:_(e,"integerValue")?e.integerValue:void 0,booleanValue:_(e,"booleanValue")?e.booleanValue:void 0}}function dg(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const fg={Always:"always",Never:"never"},pg={Always:"always",Never:"never"};function hg(e){return mg(e)}function mg(e,t){return e==null?e:{default:_(e,"default")?ug(e.default):void 0,writeOnCreate:_(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:_(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function Pl(e){if(e!==void 0)return e===null?null:{default:dg(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function gg(e){let t=!0;return t=t&&"value"in e,t}function yg(e,t){return e==null?e:{value:e.value,applyOnUpdate:_(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function vg(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function wg(e){let t=!0;return t=t&&"value"in e,t}function bg(e,t){return e==null?e:{value:e.value,applyOnUpdate:_(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Ig(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Cg(e){let t=!0;return t=t&&"value"in e,t}function Sg(e,t){return e==null?e:{value:e.value,applyOnUpdate:_(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function xg(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Og(e){return Eg(e)}function Eg(e,t){return e==null?e:{...yg(e),...bg(e),...Sg(e)}}function Fl(e){if(e!==void 0)return e===null?null:gg(e)?vg(e):wg(e)?Ig(e):Cg(e)?xg(e):{}}function _g(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Be(e.selectedValueDefaults,Fl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Be(e.selectedFieldSettings,Pl)}}function Ng(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Be(e.objects,_g)}}function Tg(e){return Ag(e)}function Ag(e,t){return e==null?e:{enabled:e.enabled}}function Rg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Pg(e){return Fg(e)}function Fg(e,t){return e==null?e:{enabled:e.enabled}}function Dg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Mg(e){return kg(e)}function kg(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:_(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:_(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function jg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Lg(e){return Kg(e)}function Kg(e,t){return e==null?e:{apiKeyAsBasic:_(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:_(e,"apiKeyAsBasicOpts")?_m(e.apiKeyAsBasicOpts):void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0}}function $g(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Vg(e){return Ug(e)}function Ug(e,t){return e==null?e:{value:e.value}}function qg(e){return Hg(e)}function Hg(e,t){return e==null?e:{brandingRemoval:_(e,"brandingRemoval")?Vg(e.brandingRemoval):void 0}}function co(e){return Bg(e)}function Bg(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:_(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:_(e,"entitlements")?qg(e.entitlements):void 0}}function Jg(e){return Wg(e)}function Wg(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function zg(e){return Gg(e)}function Gg(e,t){return e==null?e:{objectName:e.objectName,schedule:_(e,"schedule")?e.schedule:void 0,destination:_(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:_(e,"selectedValueMappings")?e.selectedValueMappings:void 0,dynamicMappingsInput:_(e,"dynamicMappingsInput")?e.dynamicMappingsInput.map(rg):void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:_(e,"selectedFieldsAuto")?og(e.selectedFieldsAuto):void 0,backfill:_(e,"backfill")?Qm(e.backfill):void 0}}function Qg(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(Rl),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Tl(e.backfill)}}function Xg(e){return Yg(e)}function Yg(e,t){return e==null?e:{objects:Be(e.objects,zg)}}function Zg(e){if(e!==void 0)return e===null?null:{objects:Be(e.objects,Qg)}}function ey(e){return ty(e)}function ty(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:_(e,"createEvent")?Tg(e.createEvent):void 0,updateEvent:_(e,"updateEvent")?Mg(e.updateEvent):void 0,deleteEvent:_(e,"deleteEvent")?Pg(e.deleteEvent):void 0}}function ny(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:Rg(e.createEvent),updateEvent:jg(e.updateEvent),deleteEvent:Dg(e.deleteEvent)}}function ry(e){return iy(e)}function iy(e,t){return e==null?e:{objects:Be(e.objects,ey)}}function oy(e){if(e!==void 0)return e===null?null:{objects:Be(e.objects,ny)}}function sy(e){return ay(e)}function ay(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:_(e,"selectedValueDefaults")?Be(e.selectedValueDefaults,Og):void 0,selectedFieldSettings:_(e,"selectedFieldSettings")?Be(e.selectedFieldSettings,hg):void 0}}function cy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Be(e.selectedValueDefaults,Fl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Be(e.selectedFieldSettings,Pl)}}function uy(e){return ly(e)}function ly(e,t){return e==null?e:{objects:_(e,"objects")?Be(e.objects,sy):void 0}}function dy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Be(e.objects,cy)}}function fy(e){return py(e)}function py(e,t){return e==null?e:{provider:e.provider,module:_(e,"module")?e.module:void 0,read:_(e,"read")?Xg(e.read):void 0,write:_(e,"write")?uy(e.write):void 0,proxy:_(e,"proxy")?Ym(e.proxy):void 0,subscribe:_(e,"subscribe")?ry(e.subscribe):void 0}}function hy(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:Zg(e.read),write:dy(e.write),proxy:Al(e.proxy),subscribe:oy(e.subscribe)}}function my(e){return gy(e)}function gy(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:fy(e.content)}}function yy(e){return vy(e)}function vy(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0}}function Dl(e){return wy(e)}function wy(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0}}function by(e){return Iy(e)}function Iy(e,t){return e==null?e:{token:e.token,issuedAt:_(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:_(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Cy(e){return Sy(e)}function Sy(e,t){return e==null?e:{token:e.token,issuedAt:_(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:_(e,"expiresAt")?new Date(e.expiresAt):void 0}}function xy(e){return Oy(e)}function Oy(e,t){return e==null?e:{accessToken:_(e,"accessToken")?by(e.accessToken):void 0,refreshToken:_(e,"refreshToken")?Cy(e.refreshToken):void 0,scopes:_(e,"scopes")?e.scopes:void 0}}function wo(e){return Ey(e)}function Ey(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:_(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:_(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0}}function _y(e){return Ny(e)}function Ny(e,t){return e==null?e:{value:e.value,source:e.source,displayName:_(e,"displayName")?e.displayName:void 0}}function xa(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function Oi(e){return Ty(e)}function Ty(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:_(e,"providerApp")?wo(e.providerApp):void 0,group:Dl(e.group),consumer:yy(e.consumer),providerWorkspaceRef:_(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:_(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:_(e,"oauth2AuthorizationCode")?xy(e.oauth2AuthorizationCode):void 0,apiKey:_(e,"apiKey")?e.apiKey:void 0,providerMetadata:_(e,"providerMetadata")?Be(e.providerMetadata,_y):void 0}}function Ml(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function kl(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function jl(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 Ay(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 Ry(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 Ll(e){if(e!==void 0)return e===null?null:{accessToken:Ay(e.accessToken),refreshToken:Ry(e.refreshToken),scopes:e.scopes}}function Py(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Be(e.providerMetadata,xa),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:Ml(e.basicAuth),oauth2ClientCredentials:kl(e.oauth2ClientCredentials),oauth2PasswordCredentials:jl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Ll(e.oauth2AuthorizationCode)}}function Fy(e){return Dy(e)}function Dy(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0}}function My(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ky(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:hy(e.content)}}function jy(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:ky(e.config)}}function Ly(e){return Ky(e)}function Ky(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,useModule:_(e,"useModule")?e.useModule:void 0}}function $y(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function Vy(e){return Uy(e)}function Uy(e,t){return e==null?e:{mode:_(e,"mode")?e.mode:void 0,pageSize:_(e,"pageSize")?e.pageSize:void 0}}function qy(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Hy(e){let t=!0;return t=t&&"fieldName"in e,t}function By(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Jy(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Wy(e){let t=!0;return t=t&&"mapToName"in e,t}function Kl(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:_(e,"default")?e.default:void 0,prompt:_(e,"prompt")?e.prompt:void 0}}function zy(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Bc(e){return Gy(e)}function Gy(e,t){return e==null?e:{...By(e),...Kl(e)}}function Jc(e){if(e!==void 0)return e===null?null:Hy(e)?Jy(e):Wy(e)?zy(e):{}}function $l(e){return Qy(e)}function Qy(e,t){return e}function Xy(e){return Yy(e)}function Yy(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:_(e,"requiredFields")?e.requiredFields.map(Bc):void 0,optionalFields:_(e,"optionalFields")?e.optionalFields.map(Bc):void 0,optionalFieldsAuto:_(e,"optionalFieldsAuto")?$l(e.optionalFieldsAuto):void 0,backfill:_(e,"backfill")?Nl(e.backfill):void 0,delivery:_(e,"delivery")?Vy(e.delivery):void 0,enabled:_(e,"enabled")?e.enabled:void 0}}function Zy(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(Jc),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Jc),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Jm(e.backfill),delivery:qy(e.delivery),enabled:e.enabled}}function ev(e){return tv(e)}function tv(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(Xy):void 0}}function nv(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Zy)}}function rv(e){return iv(e)}function iv(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0}}function ov(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function sv(e){return av(e)}function av(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,watchFieldsAuto:_(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:_(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function cv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function uv(e){return lv(e)}function lv(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:_(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:_(e,"createEvent")?Fy(e.createEvent):void 0,updateEvent:_(e,"updateEvent")?sv(e.updateEvent):void 0,deleteEvent:_(e,"deleteEvent")?rv(e.deleteEvent):void 0,associationChangeEvent:_(e,"associationChangeEvent")?Mm(e.associationChangeEvent):void 0,otherEvents:_(e,"otherEvents")?e.otherEvents:void 0}}function dv(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:My(e.createEvent),updateEvent:cv(e.updateEvent),deleteEvent:ov(e.deleteEvent),associationChangeEvent:jm(e.associationChangeEvent),otherEvents:e.otherEvents}}function fv(e){return pv(e)}function pv(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(uv):void 0}}function hv(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(dv)}}function Vl(e){return mv(e)}function mv(e,t){return e==null?e:{allowAnyFields:_(e,"allowAnyFields")?e.allowAnyFields:void 0}}function gv(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function yv(e){return vv(e)}function vv(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:_(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:_(e,"valueDefaults")?Vl(e.valueDefaults):void 0}}function wv(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:gv(e.valueDefaults)}}function bv(e){return Iv(e)}function Iv(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(yv):void 0}}function Cv(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(wv)}}function Sv(e){return xv(e)}function xv(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:_(e,"displayName")?e.displayName:void 0,module:_(e,"module")?e.module:void 0,read:_(e,"read")?ev(e.read):void 0,write:_(e,"write")?bv(e.write):void 0,proxy:_(e,"proxy")?Ly(e.proxy):void 0,subscribe:_(e,"subscribe")?fv(e.subscribe):void 0}}function Ov(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:nv(e.read),write:Cv(e.write),proxy:$y(e.proxy),subscribe:hv(e.subscribe)}}function Ev(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Ov(e.content)}}function _v(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Ev(e.latestRevision)}}function Nv(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Tv(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 Av(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Rv(e){return Pv(e)}function Pv(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Fv(e){return Dv(e)}function Dv(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:_(e,"prompt")?e.prompt:void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0}}function Mv(e){return kv(e)}function kv(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function jv(e){return Lv(e)}function Lv(e,t){return e==null?e:{headers:_(e,"headers")?e.headers.map(Rv):void 0,queryParams:_(e,"queryParams")?e.queryParams.map(Mv):void 0,inputs:_(e,"inputs")?e.inputs.map(Fv):void 0}}function Kv(e){return $v(e)}function $v(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Vv(e){return Uv(e)}function Uv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:_(e,"valueType")?e.valueType:void 0,providerType:_(e,"providerType")?e.providerType:void 0,readOnly:_(e,"readOnly")?e.readOnly:void 0,values:_(e,"values")?e.values.map(Kv):void 0}}function qv(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Be(e.providerMetadata,xa),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:Ml(e.basicAuth),oauth2ClientCredentials:kl(e.oauth2ClientCredentials),oauth2PasswordCredentials:jl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Ll(e.oauth2AuthorizationCode)}}function Hv(e){return Bv(e)}function Bv(e,t){return e==null?e:{enabled:_(e,"enabled")?e.enabled:void 0,useModule:_(e,"useModule")?e.useModule:void 0}}function Jv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function ds(e){return Wv(e)}function Wv(e,t){return e==null?e:{...Jv(e),...Kl(e)}}function zv(e){return Gv(e)}function Gv(e,t){return e==null?e:{error:_(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:_(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:_(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:_(e,"requiredFields")?e.requiredFields.map(ds):void 0,optionalFields:_(e,"optionalFields")?e.optionalFields.map(ds):void 0,optionalFieldsAuto:_(e,"optionalFieldsAuto")?$l(e.optionalFieldsAuto):void 0,allFieldsMetadata:_(e,"allFieldsMetadata")?Be(e.allFieldsMetadata,Vv):void 0,allFields:_(e,"allFields")?e.allFields.map(ds):void 0,backfill:_(e,"backfill")?Nl(e.backfill):void 0}}function Qv(e){return Xv(e)}function Xv(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(zv):void 0}}function Yv(e){return Zv(e)}function Zv(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:_(e,"valueDefaults")?Vl(e.valueDefaults):void 0}}function ew(e){return tw(e)}function tw(e,t){return e==null?e:{objects:_(e,"objects")?e.objects.map(Yv):void 0}}function nw(e){return rw(e)}function rw(e,t){return e==null?e:{name:e.name,displayName:_(e,"displayName")?e.displayName:void 0,module:_(e,"module")?e.module:void 0,provider:e.provider,read:_(e,"read")?Qv(e.read):void 0,write:_(e,"write")?ew(e.write):void 0,proxy:_(e,"proxy")?Hv(e.proxy):void 0}}function iw(e){return ow(e)}function ow(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:nw(e.content)}}function Ii(e){return sw(e)}function sw(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:_(e,"group")?Dl(e.group):void 0,healthStatus:e.healthStatus,connection:Oi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,config:my(e.config)}}function aw(e){return cw(e)}function cw(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Sv(e.content)}}function fs(e){return uw(e)}function uw(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:_(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:aw(e.latestRevision)}}function lw(e){return dw(e)}function dw(e,t){return e==null?e:{iconURL:_(e,"iconURL")?e.iconURL:void 0,logoURL:_(e,"logoURL")?e.logoURL:void 0}}function fw(e){return pw(e)}function pw(e,t){return e==null?e:{iconURL:_(e,"iconURL")?e.iconURL:void 0,logoURL:_(e,"logoURL")?e.logoURL:void 0}}function hw(e){return mw(e)}function mw(e,t){return e==null?e:{regular:_(e,"regular")?fw(e.regular):void 0,darkMode:_(e,"darkMode")?lw(e.darkMode):void 0}}function gw(e){return yw(e)}function yw(e,t){return e==null?e:{name:e.name,displayName:_(e,"displayName")?e.displayName:void 0,defaultValue:_(e,"defaultValue")?e.defaultValue:void 0,docsURL:_(e,"docsURL")?e.docsURL:void 0,moduleDependencies:_(e,"moduleDependencies")?e.moduleDependencies:void 0}}function vw(e){return ww(e)}function ww(e,t){return e==null?e:{name:e.name,moduleDependencies:_(e,"moduleDependencies")?e.moduleDependencies:void 0}}function bw(e){return Iw(e)}function Iw(e,t){return e==null?e:{create:_(e,"create")?e.create:void 0,update:_(e,"update")?e.update:void 0,_delete:_(e,"delete")?e.delete:void 0,passThrough:_(e,"passThrough")?e.passThrough:void 0}}function Ul(e){return Cw(e)}function Cw(e,t){return e==null?e:{bulkWrite:Jg(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:_(e,"subscribeSupport")?bw(e.subscribeSupport):void 0}}function Sw(e){return xw(e)}function xw(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Ul(e.support)}}function Ow(e){return Ew(e)}function Ew(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:_(e,"capture")?e.capture:void 0}}function _w(e){return Nw(e)}function Nw(e,t){return e==null?e:{workspaceRefField:_(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:_(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:_(e,"scopesField")?e.scopesField:void 0,otherFields:_(e,"otherFields")?e.otherFields.map(Ow):void 0}}const ps={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function Tw(e){return Aw(e)}function Aw(e,t){return e==null?e:{grantType:e.grantType,authURL:_(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:_(e,"audience")?e.audience:void 0,tokenMetadataFields:_w(e.tokenMetadataFields),docsURL:_(e,"docsURL")?e.docsURL:void 0,authURLParams:_(e,"authURLParams")?e.authURLParams:void 0}}function Rw(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,xa),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function Pw(e){return Fw(e)}function Fw(e,t){return e==null?e:{input:_(e,"input")?e.input.map(gw):void 0,postAuthentication:_(e,"postAuthentication")?e.postAuthentication.map(vw):void 0}}function Dw(e){return Mw(e)}function Mw(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Wc(e){return kw(e)}function kw(e,t){return e==null?e:{name:e.name,authType:$m(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:_(e,"oauth2Opts")?Tw(e.oauth2Opts):void 0,apiKeyOpts:_(e,"apiKeyOpts")?Fm(e.apiKeyOpts):void 0,basicOpts:_(e,"basicOpts")?Lg(e.basicOpts):void 0,customOpts:_(e,"customOpts")?jv(e.customOpts):void 0,support:Ul(e.support),providerOpts:e.providerOpts,authHealthCheck:_(e,"authHealthCheck")?Lm(e.authHealthCheck):void 0,displayName:_(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:_(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:_(e,"media")?hw(e.media):void 0,labels:_(e,"labels")?e.labels:void 0,subscribeOpts:_(e,"subscribeOpts")?Dw(e.subscribeOpts):void 0,modules:_(e,"modules")?Be(e.modules,Sw):void 0,metadata:_(e,"metadata")?Pw(e.metadata):void 0}}function jw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:Py(e.connection)}}function Lw(e){if(e!==void 0)return e===null?null:{provider:e.provider,module:e.module,read:cg(e.read),write:Ng(e.write),proxy:Al(e.proxy)}}function Kw(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Lw(e.content)}}function $w(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Kw(e.config)}}function Vw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:$w(e.installation)}}function Uw(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function qw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Uw(e.project)}}function Hw(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 Bw(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Hw(e.providerApp)}}class Jw extends an{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 Zr(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:qv(t.generateConnectionParams)},n);return new Me(i,s=>Oi(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=>Oi(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(Oi))}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:jw(t.updateConnectionRequest)},n);return new Me(i,s=>Oi(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Ww extends an{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:jy(t.installation)},n);return new Me(i,s=>Ii(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 Zr(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=>Ii(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(Ii))}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(Ii))}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:Vw(t.installationUpdate)},n);return new Me(i,s=>Ii(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class zw extends an{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:$g(t.batchUpsertIntegrationsRequest)},n);return new Me(i,s=>s.map(fs))}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:_v(t.integration)},n);return new Zr(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 Zr(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=>fs(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(fs))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Gw extends an{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:Rw(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Me(i):new qc(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 qc(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Qw extends an{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:Nv(t.project)},n);return new Me(i,s=>co(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=>co(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(co))}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:qw(t.projectUpdate)},n);return new Me(i,s=>co(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Xw extends an{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=>Wc(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,Wc))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Yw extends an{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:Tv(t.providerApp)},n);return new Me(i,s=>wo(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 Zr(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(wo))}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:Bw(t.providerAppUpdate)},n);return new Me(i,s=>wo(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Zw extends an{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:Av(t.revision)},n);return new Zr(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=>iw(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var ql=Symbol.for("immer-nothing"),zc=Symbol.for("immer-draftable"),Rt=Symbol.for("immer-state"),eb=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=eb[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 ei=Object.getPrototypeOf;function ti(e){return!!e&&!!e[Rt]}function Tr(e){var t;return e?Hl(e)||Array.isArray(e)||!!e[zc]||!!((t=e.constructor)!=null&&t[zc])||Ui(e)||Ho(e):!1}var tb=Object.prototype.constructor.toString();function Hl(e){if(!e||typeof e!="object")return!1;const t=ei(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)===tb}function _o(e,t){qo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function qo(e){const t=e[Rt];return t?t.type_:Array.isArray(e)?1:Ui(e)?2:Ho(e)?3:0}function Gs(e,t){return qo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Bl(e,t,n){const r=qo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function nb(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ui(e){return e instanceof Map}function Ho(e){return e instanceof Set}function fr(e){return e.copy_||e.base_}function Qs(e,t){if(Ui(e))return new Map(e);if(Ho(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Hl(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Rt];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(ei(e),r)}else{const r=ei(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function Oa(e,t=!1){return Bo(e)||ti(e)||!Tr(e)||(qo(e)>1&&Object.defineProperties(e,{set:{value:uo},add:{value:uo},clear:{value:uo},delete:{value:uo}}),Object.freeze(e),t&&Object.values(e).forEach(n=>Oa(n,!0))),e}function uo(){Ot(2)}function Bo(e){return Object.isFrozen(e)}var rb={};function Ar(e){const t=rb[e];return t||Ot(0,e),t}var Ri;function Jl(){return Ri}function ib(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Gc(e,t){t&&(Ar("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Xs(e){Ys(e),e.drafts_.forEach(ob),e.drafts_=null}function Ys(e){e===Ri&&(Ri=e.parent_)}function Qc(e){return Ri=ib(Ri,e)}function ob(e){const t=e[Rt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Xc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Rt].modified_&&(Xs(t),Ot(4)),Tr(e)&&(e=No(t,e),t.parent_||To(t,e)),t.patches_&&Ar("Patches").generateReplacementPatches_(n[Rt].base_,e,t.patches_,t.inversePatches_)):e=No(t,n,[]),Xs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ql?e:void 0}function No(e,t,n){if(Bo(t))return t;const r=t[Rt];if(!r)return _o(t,(o,i)=>Yc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return To(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),_o(i,(a,c)=>Yc(e,r,o,a,c,n,s)),To(e,o,!1),n&&e.patches_&&Ar("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Yc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&Ot(5),ti(o)){const a=i&&t&&t.type_!==3&&!Gs(t.assigned_,r)?i.concat(r):void 0,c=No(e,o,a);if(Bl(n,r,c),ti(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(Tr(o)&&!Bo(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;No(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Ui(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&To(e,o)}}function To(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Oa(t,n)}function sb(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=Ea;n&&(o=[r],i=Pi);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var Ea={get(e,t){if(t===Rt)return e;const n=fr(e);if(!Gs(n,t))return ab(e,n,t);const r=n[t];return e.finalized_||!Tr(r)?r:r===hs(e.base_,t)?(ms(e),e.copy_[t]=ea(r,e)):r},has(e,t){return t in fr(e)},ownKeys(e){return Reflect.ownKeys(fr(e))},set(e,t,n){const r=Wl(fr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=hs(fr(e),t),i=o==null?void 0:o[Rt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(nb(n,o)&&(n!==void 0||Gs(e.base_,t)))return!0;ms(e),Zs(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 hs(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ms(e),Zs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=fr(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 ei(e.base_)},setPrototypeOf(){Ot(12)}},Pi={};_o(Ea,(e,t)=>{Pi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Pi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ot(13),Pi.set.call(this,e,t,void 0)};Pi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ot(14),Ea.set.call(this,e[0],t,n,e[0])};function hs(e,t){const n=e[Rt];return(n?fr(n):e)[t]}function ab(e,t,n){var o;const r=Wl(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Wl(e,t){if(!(t in e))return;let n=ei(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=ei(n)}}function Zs(e){e.modified_||(e.modified_=!0,e.parent_&&Zs(e.parent_))}function ms(e){e.copy_||(e.copy_=Qs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var cb=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,l=>n.call(this,l,...f))}}typeof n!="function"&&Ot(6),r!==void 0&&typeof r!="function"&&Ot(7);let o;if(Tr(t)){const i=Qc(this),s=ea(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Xs(i):Ys(i)}return Gc(i,r),Xc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===ql&&(o=void 0),this.autoFreeze_&&Oa(o,!0),r){const i=[],s=[];Ar("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){Tr(e)||Ot(8),ti(e)&&(e=ub(e));const t=Qc(this),n=ea(e,void 0);return n[Rt].isManual_=!0,Ys(t),n}finishDraft(e,t){const n=e&&e[Rt];(!n||!n.isManual_)&&Ot(9);const{scope_:r}=n;return Gc(r,t),Xc(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=Ar("Patches").applyPatches_;return ti(e)?r(e,t):this.produce(e,o=>r(o,t))}};function ea(e,t){const n=Ui(e)?Ar("MapSet").proxyMap_(e,t):Ho(e)?Ar("MapSet").proxySet_(e,t):sb(e,t);return(t?t.scope_:Jl()).drafts_.push(n),n}function ub(e){return ti(e)||Ot(10,e),zl(e)}function zl(e){if(!Tr(e)||Bo(e))return e;const t=e[Rt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Qs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Qs(e,!0);return _o(n,(r,o)=>{Bl(n,r,zl(o))}),t&&(t.finalized_=!1),n}var lb=new cb,jt=lb.produce,Gn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ao={exports:{}};Ao.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]",l="[object Boolean]",d="[object Date]",h="[object Error]",m="[object Function]",g="[object GeneratorFunction]",w="[object Map]",y="[object Number]",x="[object Null]",p="[object Object]",v="[object Promise]",I="[object Proxy]",S="[object RegExp]",N="[object Set]",R="[object String]",E="[object Symbol]",P="[object Undefined]",A="[object WeakMap]",D="[object ArrayBuffer]",V="[object DataView]",j="[object Float32Array]",L="[object Float64Array]",se="[object Int8Array]",re="[object Int16Array]",ge="[object Int32Array]",de="[object Uint8Array]",be="[object Uint8ClampedArray]",F="[object Uint16Array]",$="[object Uint32Array]",J=/[\\^$.*+?()[\]{}|]/g,U=/^\[object .+?Constructor\]$/,q=/^(?:0|[1-9]\d*)$/,K={};K[j]=K[L]=K[se]=K[re]=K[ge]=K[de]=K[be]=K[F]=K[$]=!0,K[a]=K[c]=K[D]=K[l]=K[V]=K[d]=K[h]=K[m]=K[w]=K[y]=K[p]=K[S]=K[N]=K[R]=K[A]=!1;var Q=typeof Gn=="object"&&Gn&&Gn.Object===Object&&Gn,Z=typeof self=="object"&&self&&self.Object===Object&&self,Y=Q||Z||Function("return this")(),ee=t&&!t.nodeType&&t,ne=ee&&!0&&e&&!e.nodeType&&e,ce=ne&&ne.exports===ee,k=ce&&Q.process,ve=function(){try{return k&&k.binding&&k.binding("util")}catch{}}(),z=ve&&ve.isTypedArray;function Ye(C,T){for(var M=-1,te=C==null?0:C.length,Fe=0,fe=[];++M<te;){var Ve=C[M];T(Ve,M,C)&&(fe[Fe++]=Ve)}return fe}function Ce(C,T){for(var M=-1,te=T.length,Fe=C.length;++M<te;)C[Fe+M]=T[M];return C}function lt(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 He(C,T){for(var M=-1,te=Array(C);++M<C;)te[M]=T(M);return te}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,M=Array(C.size);return C.forEach(function(te,Fe){M[++T]=[Fe,te]}),M}function wt(C,T){return function(M){return C(T(M))}}function bt(C){var T=-1,M=Array(C.size);return C.forEach(function(te){M[++T]=te}),M}var Ze=Array.prototype,et=Function.prototype,De=Object.prototype,B=Y["__core-js_shared__"],pe=et.toString,Oe=De.hasOwnProperty,pn=function(){var C=/[^.]+$/.exec(B&&B.keys&&B.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),hn=De.toString,mn=RegExp("^"+pe.call(Oe).replace(J,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),It=ce?Y.Buffer:void 0,Pe=Y.Symbol,ar=Y.Uint8Array,Rn=De.propertyIsEnumerable,Pn=Ze.splice,_t=Pe?Pe.toStringTag:void 0,gn=Object.getOwnPropertySymbols,Fn=It?It.isBuffer:void 0,Dn=wt(Object.keys,Object),yn=Mr(Y,"DataView"),en=Mr(Y,"Map"),Ke=Mr(Y,"Promise"),dt=Mr(Y,"Set"),ae=Mr(Y,"WeakMap"),he=Mr(Object,"create"),mt=ur(yn),vn=ur(en),X=ur(Ke),ue=ur(dt),le=ur(ae),$e=Pe?Pe.prototype:void 0,Je=$e?$e.valueOf:void 0;function tt(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 Ft(){this.__data__=he?he(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(he){var M=T[C];return M===r?void 0:M}return Oe.call(T,C)?T[C]:void 0}function Re(C){var T=this.__data__;return he?T[C]!==void 0:Oe.call(T,C)}function Mn(C,T){var M=this.__data__;return this.size+=this.has(C)?0:1,M[C]=he&&T===void 0?r:T,this}tt.prototype.clear=Ft,tt.prototype.delete=st,tt.prototype.get=Ct,tt.prototype.has=Re,tt.prototype.set=Mn;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 ss(){this.__data__=[],this.size=0}function Qi(C){var T=this.__data__,M=eo(T,C);if(M<0)return!1;var te=T.length-1;return M==te?T.pop():Pn.call(T,M,1),--this.size,!0}function Xi(C){var T=this.__data__,M=eo(T,C);return M<0?void 0:T[M][1]}function Yi(C){return eo(this.__data__,C)>-1}function Zi(C,T){var M=this.__data__,te=eo(M,C);return te<0?(++this.size,M.push([C,T])):M[te][1]=T,this}Vt.prototype.clear=ss,Vt.prototype.delete=Qi,Vt.prototype.get=Xi,Vt.prototype.has=Yi,Vt.prototype.set=Zi;function tn(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 xe(){this.size=0,this.__data__={hash:new tt,map:new(en||Vt),string:new tt}}function Ut(C){var T=to(this,C).delete(C);return this.size-=T?1:0,T}function yi(C){return to(this,C).get(C)}function cr(C){return to(this,C).has(C)}function as(C,T){var M=to(this,C),te=M.size;return M.set(C,T),this.size+=M.size==te?0:1,this}tn.prototype.clear=xe,tn.prototype.delete=Ut,tn.prototype.get=yi,tn.prototype.has=cr,tn.prototype.set=as;function kn(C){var T=-1,M=C==null?0:C.length;for(this.__data__=new tn;++T<M;)this.add(C[T])}function Cp(C){return this.__data__.set(C,r),this}function Sp(C){return this.__data__.has(C)}kn.prototype.add=kn.prototype.push=Cp,kn.prototype.has=Sp;function jn(C){var T=this.__data__=new Vt(C);this.size=T.size}function xp(){this.__data__=new Vt,this.size=0}function Op(C){var T=this.__data__,M=T.delete(C);return this.size=T.size,M}function Ep(C){return this.__data__.get(C)}function _p(C){return this.__data__.has(C)}function Np(C,T){var M=this.__data__;if(M instanceof Vt){var te=M.__data__;if(!en||te.length<n-1)return te.push([C,T]),this.size=++M.size,this;M=this.__data__=new tn(te)}return M.set(C,T),this.size=M.size,this}jn.prototype.clear=xp,jn.prototype.delete=Op,jn.prototype.get=Ep,jn.prototype.has=_p,jn.prototype.set=Np;function Tp(C,T){var M=no(C),te=!M&&Hp(C),Fe=!M&&!te&&cs(C),fe=!M&&!te&&!Fe&&Oc(C),Ve=M||te||Fe||fe,nt=Ve?He(C.length,String):[],at=nt.length;for(var ke in C)Oe.call(C,ke)&&!(Ve&&(ke=="length"||Fe&&(ke=="offset"||ke=="parent")||fe&&(ke=="buffer"||ke=="byteLength"||ke=="byteOffset")||Kp(ke,at)))&&nt.push(ke);return nt}function eo(C,T){for(var M=C.length;M--;)if(Ic(C[M][0],T))return M;return-1}function Ap(C,T,M){var te=T(C);return no(C)?te:Ce(te,M(C))}function vi(C){return C==null?C===void 0?P:x:_t&&_t in Object(C)?jp(C):qp(C)}function yc(C){return wi(C)&&vi(C)==a}function vc(C,T,M,te,Fe){return C===T?!0:C==null||T==null||!wi(C)&&!wi(T)?C!==C&&T!==T:Rp(C,T,M,te,vc,Fe)}function Rp(C,T,M,te,Fe,fe){var Ve=no(C),nt=no(T),at=Ve?c:Ln(C),ke=nt?c:Ln(T);at=at==a?p:at,ke=ke==a?p:ke;var Nt=at==p,qt=ke==p,ft=at==ke;if(ft&&cs(C)){if(!cs(T))return!1;Ve=!0,Nt=!1}if(ft&&!Nt)return fe||(fe=new jn),Ve||Oc(C)?wc(C,T,M,te,Fe,fe):Mp(C,T,at,M,te,Fe,fe);if(!(M&o)){var Dt=Nt&&Oe.call(C,"__wrapped__"),Mt=qt&&Oe.call(T,"__wrapped__");if(Dt||Mt){var Kn=Dt?C.value():C,wn=Mt?T.value():T;return fe||(fe=new jn),Fe(Kn,wn,M,te,fe)}}return ft?(fe||(fe=new jn),kp(C,T,M,te,Fe,fe)):!1}function Pp(C){if(!xc(C)||Vp(C))return!1;var T=Cc(C)?mn:U;return T.test(ur(C))}function Fp(C){return wi(C)&&Sc(C.length)&&!!K[vi(C)]}function Dp(C){if(!Up(C))return Dn(C);var T=[];for(var M in Object(C))Oe.call(C,M)&&M!="constructor"&&T.push(M);return T}function wc(C,T,M,te,Fe,fe){var Ve=M&o,nt=C.length,at=T.length;if(nt!=at&&!(Ve&&at>nt))return!1;var ke=fe.get(C);if(ke&&fe.get(T))return ke==T;var Nt=-1,qt=!0,ft=M&i?new kn:void 0;for(fe.set(C,T),fe.set(T,C);++Nt<nt;){var Dt=C[Nt],Mt=T[Nt];if(te)var Kn=Ve?te(Mt,Dt,Nt,T,C,fe):te(Dt,Mt,Nt,C,T,fe);if(Kn!==void 0){if(Kn)continue;qt=!1;break}if(ft){if(!lt(T,function(wn,lr){if(!Se(ft,lr)&&(Dt===wn||Fe(Dt,wn,M,te,fe)))return ft.push(lr)})){qt=!1;break}}else if(!(Dt===Mt||Fe(Dt,Mt,M,te,fe))){qt=!1;break}}return fe.delete(C),fe.delete(T),qt}function Mp(C,T,M,te,Fe,fe,Ve){switch(M){case V: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 ar(C),new ar(T)));case l:case d:case y:return Ic(+C,+T);case h:return C.name==T.name&&C.message==T.message;case S:case R:return C==T+"";case w:var nt=ht;case N:var at=te&o;if(nt||(nt=bt),C.size!=T.size&&!at)return!1;var ke=Ve.get(C);if(ke)return ke==T;te|=i,Ve.set(C,T);var Nt=wc(nt(C),nt(T),te,Fe,fe,Ve);return Ve.delete(C),Nt;case E:if(Je)return Je.call(C)==Je.call(T)}return!1}function kp(C,T,M,te,Fe,fe){var Ve=M&o,nt=bc(C),at=nt.length,ke=bc(T),Nt=ke.length;if(at!=Nt&&!Ve)return!1;for(var qt=at;qt--;){var ft=nt[qt];if(!(Ve?ft in T:Oe.call(T,ft)))return!1}var Dt=fe.get(C);if(Dt&&fe.get(T))return Dt==T;var Mt=!0;fe.set(C,T),fe.set(T,C);for(var Kn=Ve;++qt<at;){ft=nt[qt];var wn=C[ft],lr=T[ft];if(te)var Ec=Ve?te(lr,wn,ft,T,C,fe):te(wn,lr,ft,C,T,fe);if(!(Ec===void 0?wn===lr||Fe(wn,lr,M,te,fe):Ec)){Mt=!1;break}Kn||(Kn=ft=="constructor")}if(Mt&&!Kn){var ro=C.constructor,io=T.constructor;ro!=io&&"constructor"in C&&"constructor"in T&&!(typeof ro=="function"&&ro instanceof ro&&typeof io=="function"&&io instanceof io)&&(Mt=!1)}return fe.delete(C),fe.delete(T),Mt}function bc(C){return Ap(C,Wp,Lp)}function to(C,T){var M=C.__data__;return $p(T)?M[typeof T=="string"?"string":"hash"]:M.map}function Mr(C,T){var M=Ge(C,T);return Pp(M)?M:void 0}function jp(C){var T=Oe.call(C,_t),M=C[_t];try{C[_t]=void 0;var te=!0}catch{}var Fe=hn.call(C);return te&&(T?C[_t]=M:delete C[_t]),Fe}var Lp=gn?function(C){return C==null?[]:(C=Object(C),Ye(gn(C),function(T){return Rn.call(C,T)}))}:zp,Ln=vi;(yn&&Ln(new yn(new ArrayBuffer(1)))!=V||en&&Ln(new en)!=w||Ke&&Ln(Ke.resolve())!=v||dt&&Ln(new dt)!=N||ae&&Ln(new ae)!=A)&&(Ln=function(C){var T=vi(C),M=T==p?C.constructor:void 0,te=M?ur(M):"";if(te)switch(te){case mt:return V;case vn:return w;case X:return v;case ue:return N;case le:return A}return T});function Kp(C,T){return T=T??s,!!T&&(typeof C=="number"||q.test(C))&&C>-1&&C%1==0&&C<T}function $p(C){var T=typeof C;return T=="string"||T=="number"||T=="symbol"||T=="boolean"?C!=="__proto__":C===null}function Vp(C){return!!pn&&pn in C}function Up(C){var T=C&&C.constructor,M=typeof T=="function"&&T.prototype||De;return C===M}function qp(C){return hn.call(C)}function ur(C){if(C!=null){try{return pe.call(C)}catch{}try{return C+""}catch{}}return""}function Ic(C,T){return C===T||C!==C&&T!==T}var Hp=yc(function(){return arguments}())?yc:function(C){return wi(C)&&Oe.call(C,"callee")&&!Rn.call(C,"callee")},no=Array.isArray;function Bp(C){return C!=null&&Sc(C.length)&&!Cc(C)}var cs=Fn||Gp;function Jp(C,T){return vc(C,T)}function Cc(C){if(!xc(C))return!1;var T=vi(C);return T==m||T==g||T==f||T==I}function Sc(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=s}function xc(C){var T=typeof C;return C!=null&&(T=="object"||T=="function")}function wi(C){return C!=null&&typeof C=="object"}var Oc=z?ot(z):Fp;function Wp(C){return Bp(C)?Tp(C):Dp(C)}function zp(){return[]}function Gp(){return!1}e.exports=Jp})(Ao,Ao.exports);var db=Ao.exports;const Gl=Jo(db),We=async(e,t)=>{var n;if(e instanceof Ol){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
|
|
3
3
|
`))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const c=`${a} ${s!=null&&s.remedy?`
|
|
4
4
|
|
|
5
|
-
[Remedy] ${s.remedy}`:""}`;t&&t(c)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)};function Uo(){const e=rt(),{projectIdOrName:t}=De(),{setError:n,removeError:r}=un(),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(he.INTEGRATION_LIST,t)):r(he.INTEGRATION_LIST,t)},[o.isError,o.error,t,n,r]),o}const Ia=(e,t)=>{var s;const n=rt(),{projectIdOrName:r}=De(),{data:o}=Uo(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return Yn({queryKey:["amp","installations",r,i,t],queryFn:async()=>{if(!r)throw new Error("Project ID is required");if(!i)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await n()).installationApi.listInstallations({projectIdOrName:r,integrationId:i,groupRef:t})},enabled:!!r&&!!i&&!!t&&!!o&&o.length>0})},er=()=>{var o,i;const{setError:e}=un(),t=rt(),{projectIdOrName:n}=De(),r=Yn({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return b.useEffect(()=>{r.isError&&e(he.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=Ia(e,t),{isPending:r,isFetching:o,isError:i,isSuccess:s,error:a,data:c}=n;return{installation:c==null?void 0:c[0],isPending:r,isFetching:o,isError:i,isSuccess:s,error:a}}const ci=e=>{const t=Uo(),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}},Ca=()=>{const{groupRef:e,integrationNameOrId:t}=Tr(),{provider:n}=ci(t),r=Oa({groupRef:e,provider:n}),{isPending:o,isFetching:i,isError:s,isSuccess:a,error:c,data:f}=r;return{connection:f==null?void 0:f[0],error:c,isPending:o,isFetching:i,isError:s,isSuccess:a}},Kw=()=>{var h;const e=$e(),t=rt(),{connection:n,isPending:r,isFetching:o}=Ca(),{projectIdOrName:i}=De(),{integrationNameOrId:s}=Tr(),{data:a}=ci(s),c=n==null?void 0:n.id,f=a==null?void 0:a.id,d=(h=a==null?void 0:a.latestRevision)==null?void 0:h.id,l=r||o;return b.useEffect(()=>{c||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[c,e]),Yn({queryKey:["amp","hydratedRevision",i,f,d,c],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!f)throw new Error("integrationId is required");if(!d)throw new Error("revisionId is required");if(!c)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:f,revisionId:d,connectionId:c})},retry:3,enabled:!!i&&!!f&&!!d&&!!c&&!l})};function kl(){var f,d;const e=Kw(),{isPending:t,isFetching:n,isError:r,isSuccess:o,error:i,data:s}=e,a=s==null?void 0:s.content,c=b.useMemo(()=>({getReadObject:l=>{var m,g;const h=(g=(m=a==null?void 0:a.read)==null?void 0:m.objects)==null?void 0:g.find(w=>w.objectName===l);return h?{object:h,getRequiredFields:()=>h.requiredFields??[],getOptionalFields:()=>h.optionalFields??[]}:(console.error(`Object ${l} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:l=>{var m,g;const h=(g=(m=a==null?void 0:a.write)==null?void 0:m.objects)==null?void 0:g.find(w=>w.objectName===l);return h?{object:h}:(console.error(`Object ${l} not found`),{object:null})},getCustomerFieldsForObject:l=>{var m,g;const h=(g=(m=a==null?void 0:a.read)==null?void 0:m.objects)==null?void 0:g.find(w=>w.objectName===l);return h?{allFields:h.allFieldsMetadata??{},getField:w=>{var x;const v=(x=h.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 $w(e){var m,g,w,v;const[t,n]=b.useState(e),r=b.useRef(void 0),{getReadObject:o,data:i}=kl(),{installation:s}=Nr(),a=b.useCallback(()=>t,[t]),c=b.useCallback((x,p)=>{var E,R;p.provider=p.provider||((E=i==null?void 0:i.content)==null?void 0:E.provider)||"";const y=p.read||{objects:{}},I=y.objects||{},S=I[x]||{},T=o(x),A={};return(R=T==null?void 0:T.getRequiredFields())==null||R.forEach(P=>{"fieldName"in P&&(A[P.fieldName]=!0)}),S.objectName=S.objectName||x,S.selectedFields=S.selectedFields||A,I[x]=S,y.objects=I,p.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 p,y;return{object:(y=(p=t.read)==null?void 0:p.objects)==null?void 0:y[x],getSelectedField:I=>{var S,T,A,E;return!!((E=(A=(T=(S=t.read)==null?void 0:S.objects)==null?void 0:T[x])==null?void 0:A.selectedFields)!=null&&E[I])},setSelectedField:({fieldName:I,selected:S})=>{n(T=>It(T,A=>{const{obj:E}=c(x,A);E.selectedFields=E.selectedFields||{},E.selectedFields[I]=S,E.selectedFields[I]===!1&&delete E.selectedFields[I]}))},getFieldMapping:I=>{var S,T,A,E;return(E=(A=(T=(S=t.read)==null?void 0:S.objects)==null?void 0:T[x])==null?void 0:A.selectedFieldMappings)==null?void 0:E[I]},setFieldMapping:({fieldName:I,mapToName:S})=>{n(T=>It(T,A=>{const{obj:E}=c(x,A);E.selectedFieldMappings=E.selectedFieldMappings||{},E.selectedFieldMappings[S]=I}))}}},[(g=t.read)==null?void 0:g.objects,c]),d=b.useCallback(x=>{var T,A;const p=(A=(T=t.write)==null?void 0:T.objects)==null?void 0:A[x],y=E=>{const R=E.write||{},P=R.objects||{},M=P[x]||{objectName:x};return P[x]=M,R.objects=P,E.write=R,{write:R,objects:P,obj:M}},I=(E,R)=>{var P,M;return(M=(P=p==null?void 0:p.selectedFieldSettings)==null?void 0:P[E])==null?void 0:M[R]},S=(E,R,P)=>{n(M=>It(M,U=>{var j;const{obj:k}=y(U);k.selectedFieldSettings={...k.selectedFieldSettings,[E]:{...(j=k.selectedFieldSettings)==null?void 0:j[E],[R]:P}}}))};return{object:p,setEnableWrite:()=>{n(E=>It(E,R=>{const{obj:P}=y(R);P.objectName=x}))},setDisableWrite:()=>{n(E=>It(E,R=>{const{objects:P}=y(R);delete P[x]}))},getWriteObject:()=>{var E,R;return(R=(E=t.write)==null?void 0:E.objects)==null?void 0:R[x]},getSelectedFieldSettings:E=>{var R;return(R=p==null?void 0:p.selectedFieldSettings)==null?void 0:R[E]},setSelectedFieldSettings:({fieldName:E,settings:R})=>{n(P=>It(P,M=>{const{obj:U}=y(M),k=U.selectedFieldSettings||{};U.selectedFieldSettings={...k,[E]:R},R===void 0&&delete U.selectedFieldSettings[E]}))},getDefaultValues:E=>I(E,"default"),setDefaultValues:({fieldName:E,value:R})=>S(E,"default",R),getWriteOnCreateSetting:E=>I(E,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:E,value:R})=>S(E,"writeOnCreate",R),getWriteOnUpdateSetting:E=>I(E,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:E,value:R})=>S(E,"writeOnUpdate",R)}},[(w=t.write)==null?void 0:w.objects]),l=b.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(x=>It(x,p=>{p.proxy={enabled:!0}}))},setDisableProxy:()=>{n(x=>It(x,p=>{p.proxy={enabled:!1}}))},getProxyEnabled:()=>{var x;return((x=t.proxy)==null?void 0:x.enabled)||!1}}),[t.proxy]),h=b.useCallback(()=>{n(x=>It(x,p=>{var y;Object.assign(p,(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?$o(r.current,s)||(console.debug("Installation changed, resetting config",{previous:r.current,current:s}),h(),r.current=s):(r.current=s,h()))},[s,h]),{draft:t,get:a,reset:h,setDraft:n,readObject:f,writeObject:d,proxy:l}}const Sa=b.createContext(null);function Uw({children:e,initialConfig:t}){const n=$w(t);return u.jsx(Sa.Provider,{value:n,children:e})}function qw(){const e=b.useContext(Sa);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function Vw(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=b.useContext(Sa);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const jl=b.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Tr(){const e=b.useContext(jl);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function xa({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(jl.Provider,{value:s,children:u.jsx(Uw,{initialConfig:{},children:e})})}class zs{constructor(t){this.connectionApi=new ww(t),this.installationApi=new bw(t),this.integrationApi=new Iw(t),this.oAuthApi=new Cw(t),this.projectApi=new Sw(t),this.providerApi=new xw(t),this.providerAppApi=new Ow(t),this.revisionApi=new Ew(t)}}const Ll="2.9.3",Hw="v1",oo="https://api.withampersand.com";function Kl(){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 Bw=(e,t)=>`${e}/${t}`;function Jw(){return Bw(Kl(),Hw)}const $l=Kl(),Ul=Jw(),Ww=new ga({basePath:Ul,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Ll}});new zs(Ww);const zw=e=>({header:"X-Api-Key",value:e}),Qw=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")}},qc=(e,t)=>new ga({basePath:Ul,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Ll,[e]:t}});function rt(){const e=tl(),{getToken:t}=Xh(),{consumerRef:n,groupRef:r}=Tr();return b.useCallback(async()=>{if(e){const i=zw(e),s=qc(i.header,i.value);return new zs(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=Qw(i),a=qc(s.header,s.value);return new zs(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 Oa=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=De(),r=rt();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 Gw(){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 Xw="_box_1p7c5_1",Vc={box:Xw};function En({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Vc.box} ${t}`:Vc.box,style:n,children:e})}const Yw="_container_1wvzr_1",Hc={container:Yw};function ui({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Hc.container} ${t}`:Hc.container,style:n,children:e})}const Zw="_errorBoxContainer_4sdb2_1",eb="_errorBox_4sdb2_1",tb="_errorText_4sdb2_20",Qs={errorBoxContainer:Zw,errorBox:eb,errorText:tb};function ql({message:e}){return u.jsx(En,{className:Qs.errorBox,children:u.jsx("p",{className:Qs.errorText,children:e})})}function Vl({message:e,children:t}){return u.jsxs(ui,{className:Qs.errorBoxContainer,children:[u.jsx(Gw,{}),u.jsx(ql,{message:e}),t]})}const nb="_loader_6ubm6_1",rb={loader:nb};function ib(){return u.jsx("span",{className:rb.loader})}function Ni(){return u.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:u.jsx(ib,{})})}function Hl({children:e}){return u.jsx(ui,{style:{maxWidth:"55rem"},children:u.jsx(En,{children:e})})}function li(){return u.jsx(Hl,{children:u.jsx(Ni,{})})}function zt({message:e,children:t}){return u.jsx(Hl,{children:u.jsx(Vl,{message:e,children:t})})}function an(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ob(e,t){return(t==null?void 0:t.displayName)??an(e)}const sb=e=>e.split(`
|
|
6
|
-
`).filter(n=>n.trim()!==""),ab=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null;function cb(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 ub=()=>{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}},Bl=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 it(){const e=b.useContext(Bl);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function lb({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}=Uo(),{setError:h,isError:m,removeError:g}=un(),{isIntegrationDeleted:w,setIntegrationDeleted:v,resetIntegrationDeleted:x}=ub(),p=b.useMemo(()=>ab(t,l||[]),[t,l]),{data:y,isLoading:I,isError:S,error:T}=Ia(t,o),A=(y==null?void 0:y[0])||null;b.useEffect(()=>{x()},[t,n,r,o,i,f]),b.useEffect(()=>{p===null&&(l!=null&&l.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,p,l]),b.useEffect(()=>{S?(h(he.INSTALLATION_LIST,(p==null?void 0:p.id)||""),He(T)):g(he.INSTALLATION_LIST,(p==null?void 0:p.id)||"")},[S,p,h,g,T]);const E=$e(),R=b.useCallback(()=>{E.invalidateQueries({queryKey:["amp","installations"]})},[E]),P=b.useCallback(k=>{E.setQueryData(["amp","installations"],[k]),E.invalidateQueries({queryKey:["amp","installations"]})},[E]),M=(p==null?void 0:p.id)||"",U=b.useMemo(()=>({integrationId:(p==null?void 0:p.id)||"",provider:(p==null?void 0:p.provider)||"",integrationObj:p,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:A||void 0,setInstallation:P,resetInstallations:R,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:w,setIntegrationDeleted:v,fieldMapping:f,resetComponent:d}),[p,n,r,o,i,A,P,R,s,a,c,w,v,f,d]);if(I)return u.jsx(li,{});if(p===null)return u.jsx(zt,{message:`Integration "${t}" not found`});if(m(he.INSTALLATION_LIST,M)){const k=`Error retrieving installation information for integration "${(p==null?void 0:p.name)||"unknown"}"`;return u.jsx(zt,{message:k})}return u.jsx(Bl.Provider,{value:U,children:e})}const Jl=b.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Yt=()=>{const e=b.useContext(Jl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Wl({groupRef:e,provider:t,children:n}){const r=$e(),{setError:o,isError:i}=un(),{projectIdOrName:s,isLoading:a}=er(),{integrationId:c,groupRef:f}=it(),{provider:d}=ci(c),{data:l,isLoading:h,isError:m,error:g}=Oa({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(he.CONNECTION_LIST,s,!0),He(g)):o(he.CONNECTION_LIST,s,!1)},[m,o,s,g]);const p=b.useMemo(()=>({connections:l||null,isConnectionsLoading:h,selectedConnection:w||null,setConnections:v,setSelectedConnection:x}),[l,h,w,v,x]);if(h||a)return u.jsx(li,{});if(s&&i(he.PROJECT,s))return u.jsx(zt,{message:`Error loading project ${s}`});if(s&&i(he.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(Jl.Provider,{value:p,children:n})}const zl=()=>{const e=rt(),t=$e(),[n,r]=b.useState(null);return{...On({mutationKey:["createInstallation"],mutationFn:async i=>(await e()).installationApi.createInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error creating installation"),He(i,r)}}),errorMsg:n}};function db(e){return typeof e.provider=="string"}function fb(e){if(!db(e))throw new Error("Config must have a provider field for creation");return e}function Ql(){const{projectIdOrName:e}=De(),{groupRef:t,integrationNameOrId:n}=Tr(),{data:r}=ci(n),{connection:o}=Ca(),{installation:i}=Nr(),s=$e(),{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:fb(m)}}};return a(x,{onSuccess:p=>{g==null||g(p)},onError:p=>{w==null||w(p)},onSettled:()=>{v==null||v(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:c,isPending:f,error:d,errorMsg:l}}const pb=()=>{const e=rt(),t=$e(),[n,r]=b.useState(null);return{...On({mutationKey:["updateInstallation"],mutationFn:async i=>(await e()).installationApi.updateInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error updating installation"),He(i,r)}}),errorMsg:n}};function Gl(){const{projectIdOrName:e}=De(),{integrationNameOrId:t}=Tr(),{data:n}=ci(t),{installation:r}=Nr(),o=$e(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=pb();return{updateInstallation:({config:l,onSuccess:h,onError:m,onSettled:g})=>{var x,p;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"),(p=l==null?void 0:l.read)!=null&&p.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=>{h==null||h(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 hb=()=>{const e=rt(),t=$e(),[n,r]=b.useState(null);return{...On({mutationKey:["deleteInstallation"],mutationFn:async i=>(await e()).installationApi.deleteInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error deleting installation"),He(i,r)}}),errorMsg:n}};function mb(){const{projectIdOrName:e}=De(),{integrationNameOrId:t}=Tr(),{data:n}=ci(t),{installation:r}=Nr(),o=$e(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=hb();return{deleteInstallation:({onSuccess:l,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:()=>{l==null||l()},onError:g=>{h==null||h(g)},onSettled:()=>{m==null||m(),o.invalidateQueries({queryKey:["amp","installations"]}),o.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}function Xl(){const[e,t]=b.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const Or="other",Eo="manage-tab";function tr(e){return!e.fieldName}function gb(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function yb(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!tr(n)&&!!n.fieldName))||null}function vb(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>tr(r)&&!!r.mapToName))||[]}function wb(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>tr(r)&&!!r.mapToName))||[]}function bb(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!tr(n)&&!!n.fieldName))||null}const Yl=(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 Ib(e){return tr(e)?e.mapToName:e.fieldName}const Zl=(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?!!Yl(e,s.objectName):!1})}),n},ed=e=>{var n;return{name:Or,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Cb(e,t){var i;const n=Zl(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?ed(e):void 0;return o&&n.push(o),n}function td(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(he.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function Sb(e,t){return $o(e,t)}function nd(e,t){return $o(e,t)}const xb=(e,t,n)=>{var v,x,p,y,I,S,T,A,E;if(!e)return null;const r=gb(e,t),o=r&&yb(r),i=r&&bb(r),s=r&&vb(r),a=r&&wb(r),c=(r==null?void 0:r.allFields)||[],f=(r==null?void 0:r.allFieldsMetadata)||{},d=n==null?void 0:n.content,l=((p=(x=(v=d==null?void 0:d.read)==null?void 0:v.objects)==null?void 0:x[t])==null?void 0:p.selectedFields)||{},h=((S=(I=(y=d==null?void 0:d.read)==null?void 0:y.objects)==null?void 0:I[t])==null?void 0:S.selectedValueMappings)||{},m=((E=(A=(T=d==null?void 0:d.read)==null?void 0:T.objects)==null?void 0:A[t])==null?void 0:E.selectedFieldMappings)||{},g=Object.entries(l).reduce((R,[P,M])=>((i==null?void 0:i.some(k=>!tr(k)&&"fieldName"in k&&k.fieldName===P))&&(R[P]=M),R),{}),w={...m};return{allFields:c,allFieldsMetadata:f,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:g,selectedFieldMappings:m,selectedValueMappings:h,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:g,requiredMapFields:w}}},Ob=(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 rd(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:xb(r,t,n),write:Ob(o,n)}}const id=(e,t,n,r)=>{const o=rd(e,n,t);r(n,o)},Eb=(e,t,n)=>{const r=Cb(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=rd(e,i,t))}),n(o)},od=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(Ib(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},sd=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},ad=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function cd(e,t){return t[e]||void 0}function ji(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const _b=(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)},Nb=(e,t,n,r)=>{const o=od(e),i=sd(e),s=ad(e),a=_b(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 ji(n)&&(c.content.proxy={enabled:!0}),c},ud=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},Tb=e=>{const t=e.content.write;return t==null?void 0:t.objects},Ab=(e,t,n)=>{if(!Tb(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=ud(e),i={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return ji(t)&&(i.content.proxy={enabled:!0}),i};var ld={exports:{}};/*!
|
|
5
|
+
[Remedy] ${s.remedy}`:""}`;t&&t(c)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)};function Wo(){const e=ct(),{projectIdOrName:t}=Le(),{setError:n,removeError:r}=ln(),o=tr({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 _a=(e,t)=>{var s;const n=ct(),{projectIdOrName:r}=Le(),{data:o}=Wo(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return tr({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})},rr=()=>{var o,i;const{setError:e}=ln(),t=ct(),{projectIdOrName:n}=Le(),r=tr({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 Fr(){const{integrationNameOrId:e,groupRef:t}=Dr(),n=_a(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 fi=e=>{const t=Wo(),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}},Na=()=>{const{groupRef:e,integrationNameOrId:t}=Dr(),{provider:n}=fi(t),r=Pa({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}},Ql=()=>{var h;const e=qe(),t=ct(),{connection:n,isPending:r,isFetching:o}=Na(),{projectIdOrName:i}=Le(),{integrationNameOrId:s}=Dr(),{data:a}=fi(s),c=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(()=>{c||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[c,e]),tr({queryKey:["amp","hydratedRevision",i,f,l,c],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(!c)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:f,revisionId:l,connectionId:c})},retry:3,enabled:!!i&&!!f&&!!l&&!!c&&!d})};function Ta(){var f,l;const e=Ql(),{isPending:t,isFetching:n,isError:r,isSuccess:o,error:i,data:s}=e,a=s==null?void 0:s.content,c=b.useMemo(()=>({getReadObject:d=>{var m,g;const h=(g=(m=a==null?void 0:a.read)==null?void 0:m.objects)==null?void 0:g.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,g;const h=(g=(m=a==null?void 0:a.write)==null?void 0:m.objects)==null?void 0:g.find(w=>w.objectName===d);return h?{object:h}:(console.error(`Object ${d} not found`),{object:null})},getCustomerFieldsForObject:d=>{var m,g;const h=(g=(m=a==null?void 0:a.read)==null?void 0:m.objects)==null?void 0:g.find(w=>w.objectName===d);return h?{allFields:h.allFieldsMetadata??{},getField:w=>{var x;const y=(x=h.allFieldsMetadata)==null?void 0:x[w];return y||(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,...c,isPending:t,isFetching:n,isError:r,isSuccess:o,error:i}}function fb(e){var m,g,w,y;const[t,n]=b.useState(e),r=b.useRef(void 0),{getReadObject:o,data:i}=Ta(),{installation:s}=Fr(),a=b.useCallback(()=>t,[t]),c=b.useCallback((x,p)=>{var E,P;p.provider=p.provider||((E=i==null?void 0:i.content)==null?void 0:E.provider)||"";const v=p.read||{objects:{}},I=v.objects||{},S=I[x]||{},N=o(x),R={};return(P=N==null?void 0:N.getRequiredFields())==null||P.forEach(A=>{"fieldName"in A&&(R[A.fieldName]=!0)}),S.objectName=S.objectName||x,S.selectedFields=S.selectedFields||R,I[x]=S,v.objects=I,p.read=v,{read:v,objects:I,obj:S}},[o,(m=i==null?void 0:i.content)==null?void 0:m.provider]),f=b.useCallback(x=>{var p,v;return{object:(v=(p=t.read)==null?void 0:p.objects)==null?void 0:v[x],getSelectedField:I=>{var S,N,R,E;return!!((E=(R=(N=(S=t.read)==null?void 0:S.objects)==null?void 0:N[x])==null?void 0:R.selectedFields)!=null&&E[I])},setSelectedField:({fieldName:I,selected:S})=>{n(N=>jt(N,R=>{const{obj:E}=c(x,R);E.selectedFields=E.selectedFields||{},E.selectedFields[I]=S,E.selectedFields[I]===!1&&delete E.selectedFields[I]}))},getFieldMapping:I=>{var S,N,R,E;return(E=(R=(N=(S=t.read)==null?void 0:S.objects)==null?void 0:N[x])==null?void 0:R.selectedFieldMappings)==null?void 0:E[I]},setFieldMapping:({fieldName:I,mapToName:S})=>{n(N=>jt(N,R=>{const{obj:E}=c(x,R);E.selectedFieldMappings=E.selectedFieldMappings||{},E.selectedFieldMappings[S]=I}))}}},[(g=t.read)==null?void 0:g.objects,c]),l=b.useCallback(x=>{var N,R;const p=(R=(N=t.write)==null?void 0:N.objects)==null?void 0:R[x],v=E=>{const P=E.write||{},A=P.objects||{},D=A[x]||{objectName:x};return A[x]=D,P.objects=A,E.write=P,{write:P,objects:A,obj:D}},I=(E,P)=>{var A,D;return(D=(A=p==null?void 0:p.selectedFieldSettings)==null?void 0:A[E])==null?void 0:D[P]},S=(E,P,A)=>{n(D=>jt(D,V=>{var L;const{obj:j}=v(V);j.selectedFieldSettings={...j.selectedFieldSettings,[E]:{...(L=j.selectedFieldSettings)==null?void 0:L[E],[P]:A}}}))};return{object:p,setEnableWrite:()=>{n(E=>jt(E,P=>{const{obj:A}=v(P);A.objectName=x}))},setDisableWrite:()=>{n(E=>jt(E,P=>{const{objects:A}=v(P);delete A[x]}))},getWriteObject:()=>{var E,P;return(P=(E=t.write)==null?void 0:E.objects)==null?void 0:P[x]},getSelectedFieldSettings:E=>{var P;return(P=p==null?void 0:p.selectedFieldSettings)==null?void 0:P[E]},setSelectedFieldSettings:({fieldName:E,settings:P})=>{n(A=>jt(A,D=>{const{obj:V}=v(D),j=V.selectedFieldSettings||{};V.selectedFieldSettings={...j,[E]:P},P===void 0&&delete V.selectedFieldSettings[E]}))},getDefaultValues:E=>I(E,"default"),setDefaultValues:({fieldName:E,value:P})=>S(E,"default",P),getWriteOnCreateSetting:E=>I(E,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:E,value:P})=>S(E,"writeOnCreate",P),getWriteOnUpdateSetting:E=>I(E,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:E,value:P})=>S(E,"writeOnUpdate",P)}},[(w=t.write)==null?void 0:w.objects]),d=b.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(x=>jt(x,p=>{p.proxy={enabled:!0}}))},setDisableProxy:()=>{n(x=>jt(x,p=>{p.proxy={enabled:!1}}))},getProxyEnabled:()=>{var x;return((x=t.proxy)==null?void 0:x.enabled)||!1}}),[t.proxy]),h=b.useCallback(()=>{n(x=>jt(x,p=>{var v;Object.assign(p,(v=s==null?void 0:s.config)==null?void 0:v.content)}))},[(y=s==null?void 0:s.config)==null?void 0:y.content]);return b.useEffect(()=>{s&&(console.debug("Installation found",{installation:s}),r.current?Gl(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 Aa=b.createContext(null);function pb({children:e,initialConfig:t}){const n=fb(t);return u.jsx(Aa.Provider,{value:n,children:e})}function hb(){const e=b.useContext(Aa);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function mb(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=b.useContext(Aa);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const Xl=b.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Dr(){const e=b.useContext(Xl);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function Ra({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(Xl.Provider,{value:s,children:u.jsx(pb,{initialConfig:{},children:e})})}class ta{constructor(t){this.connectionApi=new Jw(t),this.installationApi=new Ww(t),this.integrationApi=new zw(t),this.oAuthApi=new Gw(t),this.projectApi=new Qw(t),this.providerApi=new Xw(t),this.providerAppApi=new Yw(t),this.revisionApi=new Zw(t)}}const Yl="2.9.5",gb="v1",lo="https://api.withampersand.com";function Zl(){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 lo;case"mock":return"http://127.0.0.1:4010";case"":return lo;default:return e??lo}}catch{return lo}}const yb=(e,t)=>`${e}/${t}`;function vb(){return yb(Zl(),gb)}const ed=Zl(),td=vb(),wb=new Sa({basePath:td,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Yl}});new ta(wb);const bb=e=>({header:"X-Api-Key",value:e}),Ib=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")}},Zc=(e,t)=>new Sa({basePath:td,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Yl,[e]:t}});function ct(){const e=pl(),{getToken:t}=wm(),{consumerRef:n,groupRef:r}=Dr();return b.useCallback(async()=>{if(e){const i=bb(e),s=Zc(i.header,i.value);return new ta(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=Ib(i),a=Zc(s.header,s.value);return new ta(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 Pa=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Le(),r=ct();return tr({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 Cb(){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 Sb="_box_1p7c5_1",eu={box:Sb};function Tn({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${eu.box} ${t}`:eu.box,style:n,children:e})}const xb="_container_1wvzr_1",tu={container:xb};function pi({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${tu.container} ${t}`:tu.container,style:n,children:e})}const Ob="_errorBoxContainer_4sdb2_1",Eb="_errorBox_4sdb2_1",_b="_errorText_4sdb2_20",na={errorBoxContainer:Ob,errorBox:Eb,errorText:_b};function nd({message:e}){return u.jsx(Tn,{className:na.errorBox,children:u.jsx("p",{className:na.errorText,children:e})})}function rd({message:e,children:t}){return u.jsxs(pi,{className:na.errorBoxContainer,children:[u.jsx(Cb,{}),u.jsx(nd,{message:e}),t]})}const Nb="_loader_6ubm6_1",Tb={loader:Nb};function Ab(){return u.jsx("span",{className:Tb.loader})}function Fi(){return u.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:u.jsx(Ab,{})})}function id({children:e}){return u.jsx(pi,{style:{maxWidth:"55rem"},children:u.jsx(Tn,{children:e})})}function hi(){return u.jsx(id,{children:u.jsx(Fi,{})})}function zt({message:e,children:t}){return u.jsx(id,{children:u.jsx(rd,{message:e,children:t})})}function cn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Rb(e,t){return(t==null?void 0:t.displayName)??cn(e)}const Pb=e=>e.split(`
|
|
6
|
+
`).filter(n=>n.trim()!==""),Fb=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null;function Db(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 Mb=()=>{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}},od=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(od);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function kb({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:f,resetComponent:l}){const{data:d}=Wo(),{setError:h,isError:m,removeError:g}=ln(),{isIntegrationDeleted:w,setIntegrationDeleted:y,resetIntegrationDeleted:x}=Mb(),p=b.useMemo(()=>Fb(t,d||[]),[t,d]),{data:v,isLoading:I,isError:S,error:N}=_a(t,o),R=(v==null?void 0:v[0])||null;b.useEffect(()=>{x()},[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(()=>{S?(h(we.INSTALLATION_LIST,(p==null?void 0:p.id)||""),We(N)):g(we.INSTALLATION_LIST,(p==null?void 0:p.id)||"")},[S,p,h,g,N]);const E=qe(),P=b.useCallback(()=>{E.invalidateQueries({queryKey:["amp","installations"]})},[E]),A=b.useCallback(j=>{E.setQueryData(["amp","installations"],[j]),E.invalidateQueries({queryKey:["amp","installations"]})},[E]),D=(p==null?void 0:p.id)||"",V=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:R||void 0,setInstallation:A,resetInstallations:P,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:w,setIntegrationDeleted:y,fieldMapping:f,resetComponent:l}),[p,n,r,o,i,R,A,P,s,a,c,w,y,f,l]);if(I)return u.jsx(hi,{});if(p===null)return u.jsx(zt,{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 u.jsx(zt,{message:j})}return u.jsx(od.Provider,{value:V,children:e})}const sd=b.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Yt=()=>{const e=b.useContext(sd);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function ad({groupRef:e,provider:t,children:n}){const r=qe(),{setError:o,isError:i}=ln(),{projectIdOrName:s,isLoading:a}=rr(),{integrationId:c,groupRef:f}=ut(),{provider:l}=fi(c),{data:d,isLoading:h,isError:m,error:g}=Pa({groupRef:e||f,provider:l||t}),w=d==null?void 0:d[0],y=b.useCallback(v=>{r.setQueryData(["amp","connections"],()=>v),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 p=b.useMemo(()=>({connections:d||null,isConnectionsLoading:h,selectedConnection:w||null,setConnections:y,setSelectedConnection:x}),[d,h,w,y,x]);if(h||a)return u.jsx(hi,{});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(sd.Provider,{value:p,children:n})}const cd=()=>{const e=ct(),t=qe(),[n,r]=b.useState(null);return{...Nn({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 jb(e){return typeof e.provider=="string"}function Lb(e){if(!jb(e))throw new Error("Config must have a provider field for creation");return e}function ud(){const{projectIdOrName:e}=Le(),{groupRef:t,integrationNameOrId:n}=Dr(),{data:r}=fi(n),{connection:o}=Na(),{installation:i}=Fr(),s=qe(),{mutate:a,isIdle:c,isPending:f,error:l,errorMsg:d}=cd();return{createInstallation:({config:m,onSuccess:g,onError:w,onSettled:y})=>{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:Lb(m)}}};return a(x,{onSuccess:p=>{g==null||g(p)},onError:p=>{w==null||w(p)},onSettled:()=>{y==null||y(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:c,isPending:f,error:l,errorMsg:d}}const Kb=()=>{const e=ct(),t=qe(),[n,r]=b.useState(null);return{...Nn({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 ld(){const{projectIdOrName:e}=Le(),{integrationNameOrId:t}=Dr(),{data:n}=fi(t),{installation:r}=Fr(),o=qe(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=Kb();return{updateInstallation:({config:d,onSuccess:h,onError:m,onSettled:g})=>{var v,I,S,N,R;if(!r)throw Error("Installation not created yet. Try creating the installation first.");if(!n)throw Error("No integration found");const w=[],y=Object.keys(((v=d==null?void 0:d.write)==null?void 0:v.objects)||{}).length,x=Object.keys(((N=(S=(I=r==null?void 0:r.config)==null?void 0:I.content)==null?void 0:S.write)==null?void 0:N.objects)||{}).length;if((y>0||y===0&&x>0)&&w.push("config.content.write.objects"),(R=d==null?void 0:d.read)!=null&&R.objects){const E=Object.keys(d.read.objects);w.push(...E.map(P=>`config.content.read.objects.${P}`))}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:E=>{h==null||h(E)},onError:E=>{m==null||m(E)},onSettled:()=>{g==null||g(),o.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}const $b=()=>{const e=ct(),t=qe(),[n,r]=b.useState(null);return{...Nn({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 Vb(){const{projectIdOrName:e}=Le(),{integrationNameOrId:t}=Dr(),{data:n}=fi(t),{installation:r}=Fr(),o=qe(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=$b();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:g=>{h==null||h(g)},onSettled:()=>{m==null||m(),o.invalidateQueries({queryKey:["amp","installations"]}),o.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}function dd(){const[e,t]=b.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Ro={exports:{}};Ro.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]",l="[object WeakMap]",d="[object DataView]",h=/[\\^$.*+?()[\]{}|]/g,m=/^\[object .+?Constructor\]$/,g=typeof Gn=="object"&&Gn&&Gn.Object===Object&&Gn,w=typeof self=="object"&&self&&self.Object===Object&&self,y=g||w||Function("return this")(),x=t&&!t.nodeType&&t,p=x&&!0&&e&&!e.nodeType&&e,v=p&&p.exports===x;function I(B,pe){return B==null?void 0:B[pe]}function S(B){var pe=!1;if(B!=null&&typeof B.toString!="function")try{pe=!!(B+"")}catch{}return pe}function N(B,pe){return function(Oe){return B(pe(Oe))}}var R=Function.prototype,E=Object.prototype,P=y["__core-js_shared__"],A=function(){var B=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||"");return B?"Symbol(src)_1."+B:""}(),D=R.toString,V=E.hasOwnProperty,j=E.toString,L=RegExp("^"+D.call(V).replace(h,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),se=v?y.Buffer:void 0,re=E.propertyIsEnumerable,ge=se?se.isBuffer:void 0,de=N(Object.keys,Object),be=k(y,"DataView"),F=k(y,"Map"),$=k(y,"Promise"),J=k(y,"Set"),U=k(y,"WeakMap"),q=!re.call({valueOf:1},"valueOf"),K=Ce(be),Q=Ce(F),Z=Ce($),Y=Ce(J),ee=Ce(U);function ne(B){return j.call(B)}function ce(B){if(!Ze(B)||z(B))return!1;var pe=wt(B)||S(B)?L:m;return pe.test(Ce(B))}function k(B,pe){var Oe=I(B,pe);return ce(Oe)?Oe:void 0}var ve=ne;(be&&ve(new be(new ArrayBuffer(1)))!=d||F&&ve(new F)!=s||$&&ve($.resolve())!=c||J&&ve(new J)!=f||U&&ve(new U)!=l)&&(ve=function(B){var pe=j.call(B),Oe=pe==a?B.constructor:void 0,pn=Oe?Ce(Oe):void 0;if(pn)switch(pn){case K:return d;case Q:return s;case Z:return c;case Y:return f;case ee:return l}return pe});function z(B){return!!A&&A in B}function Ye(B){var pe=B&&B.constructor,Oe=typeof pe=="function"&&pe.prototype||E;return B===Oe}function Ce(B){if(B!=null){try{return D.call(B)}catch{}try{return B+""}catch{}}return""}function lt(B){return Se(B)&&V.call(B,"callee")&&(!re.call(B,"callee")||j.call(B)==r)}var He=Array.isArray;function ot(B){return B!=null&&bt(B.length)&&!wt(B)}function Se(B){return et(B)&&ot(B)}var Ge=ge||De;function ht(B){if(ot(B)&&(He(B)||typeof B=="string"||typeof B.splice=="function"||Ge(B)||lt(B)))return!B.length;var pe=ve(B);if(pe==s||pe==f)return!B.size;if(q||Ye(B))return!de(B).length;for(var Oe in B)if(V.call(B,Oe))return!1;return!0}function wt(B){var pe=Ze(B)?j.call(B):"";return pe==o||pe==i}function bt(B){return typeof B=="number"&&B>-1&&B%1==0&&B<=n}function Ze(B){var pe=typeof B;return!!B&&(pe=="object"||pe=="function")}function et(B){return!!B&&typeof B=="object"}function De(){return!1}e.exports=ht})(Ro,Ro.exports);var Ub=Ro.exports;const qb=Jo(Ub),ni="other",Po="manage-tab";function ir(e){return!e.fieldName}function fd(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Hb(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!ir(n)&&!!n.fieldName))||null}function Bb(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>ir(r)&&!!r.mapToName))||[]}function Jb(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>ir(r)&&!!r.mapToName))||[]}function pd(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!ir(n)&&!!n.fieldName))||null}const hd=(e,t)=>{var n,r,o;return(o=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:o[t]};function Wb(e){return ir(e)?e.mapToName:e.fieldName}const md=(e,t)=>{var r,o,i;const n=[];return(i=(o=(r=t.content)==null?void 0:r.read)==null?void 0:o.objects)==null||i.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&cn(s==null?void 0:s.objectName),completed:e?!!hd(e,s.objectName):!1})}),n},gd=e=>{var n;return{name:ni,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function zb(e,t){var i;const n=md(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?gd(e):void 0;return o&&n.push(o),n}function yd(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 nu(e,t){return qb(e)?!0:Object.values(e).every(t)}function Fa(e,t,n){const r=nu(e,n),o=nu(t,n);return r&&o?!0:r!==o?!1:Gl(e,t)}function vd(e,t){return Fa(e,t,n=>n===!1||n===void 0)}function wd(e,t){return Fa(e,t,n=>!n||n==="")}function bd(e,t){return Fa(e,t,n=>!n||typeof n!="object"?!0:Object.keys(n).length===0)}function Id(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 Gb=(e,t,n)=>{var g,w,y,x,p,v;if(!e)return null;const r=fd(e,t),o=r&&Hb(r),i=r&&pd(r),s=r&&Bb(r),a=r&&Jb(r),c=(r==null?void 0:r.allFields)||[],f=(r==null?void 0:r.allFieldsMetadata)||{},l=n==null?void 0:n.content,d=((y=(w=(g=l==null?void 0:l.read)==null?void 0:g.objects)==null?void 0:w[t])==null?void 0:y.selectedValueMappings)||{},h=((v=(p=(x=l==null?void 0:l.read)==null?void 0:x.objects)==null?void 0:p[t])==null?void 0:v.selectedFieldMappings)||{},m=Da(n,{content:{read:e}},t);return{allFields:c,allFieldsMetadata:f,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:m,selectedFieldMappings:h,selectedValueMappings:d}},Qb=(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 Cd(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:Gb(r,t,n),write:Qb(o,n)}}const Sd=(e,t,n,r)=>{const o=Cd(e,n,t);r(n,o)},Xb=(e,t,n)=>{const r=zb(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=Cd(e,i,t))}),n(o)},xd=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(Wb(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},Od=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n},Ed=(e,t)=>!t||!t[e]?[]:t[e],_d=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t},Da=(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=fd(r,n),i=o&&pd(o),s=new Set((i==null?void 0:i.filter(g=>!ir(g)&&!!g.fieldName).map(g=>g.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((g,[w,y])=>(s.has(w)&&(g[w]=y),g),{})},Nd=(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 Td(e,t){return t[e]||void 0}function qi(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Yb=(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)},Zb=(e,t,n,r,o)=>{const i=xd(e),s=Od(e),a=Ed(t,o),c=_d(e),f=Yb(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:c||{},backfill:f.backfill}}}}};return qi(n)&&(l.content.proxy={enabled:!0}),l},Ad=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},eI=e=>{const t=e.content.write;return t==null?void 0:t.objects},tI=(e,t,n)=>{if(!eI(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=Ad(e),i={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return qi(t)&&(i.content.proxy={enabled:!0}),i};var Rd={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})()})(ld);var Rb=ld.exports;const Kt=ba(Rb),Pb="_button_kwfiu_1",Fb="_danger_kwfiu_42",Db="_ghost_kwfiu_47",ls={button:Pb,danger:Fb,ghost:Db};function Be({className:e,style:t,type:n,children:r,variant:o,...i}){const s=Kt(ls.button,{[ls.danger]:o==="danger",[ls.ghost]:o==="ghost",[e||""]:!!e});return u.jsx("button",{type:n,className:s,style:t,...i,children:r})}const Mb={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 Li({children:e,style:t}){return u.jsx(En,{style:{...Mb,...t},children:e})}const qo=e=>{const t=rt(),{provider:n}=it(),r=e||n;return Yn({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},ut=e=>{const t=qo(e),{data:n}=t,{provider:r}=it(),o=n&&ob(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function ln({error:e}){return e?u.jsx(Li,{style:{marginTop:"2em"},children:e}):null}const kb="_input_1ymb7_1",jb="_inputError_1ymb7_27",ds={input:kb,inputError:jb};function dd({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Kt(ds.inputError,ds.input):ds.input;return u.jsx("input",{id:e,type:t,className:Kt(i,n),...o})}function Lb(){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 Kb(){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 $b({id:e,name:t,placeholder:n="Password",onChange:r,value:o,className:i,isError:s}){const[a,c]=b.useState(!1),f=()=>c(d=>!d);return u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(St.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:o,className:i,isError:s}),u.jsx(Be,{type:"button","aria-label":a?"Hide password":"Show password",style:{height:"2.5rem",width:"2.5rem",display:"flex",alignItems:"center",justifyContent:"center"},onClick:f,variant:"ghost",children:u.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?u.jsx(Kb,{}):u.jsx(Lb,{})})})]})}const Ub="_textarea_18zl4_1",qb="_textareaError_18zl4_14",fs={textarea:Ub,textareaError:qb};function Vb({className:e,isError:t=!1,...n}){const r=t?Kt(fs.textareaError,fs.textarea):fs.textarea;return u.jsx("textarea",{className:Kt(e,r),...n})}const St={Input:dd,Textarea:Vb,PasswordInput:$b},Hb=()=>{const{projectIdOrName:e}=De(),t=rt();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 fd(){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:u.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[u.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),u.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:u.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})})]})}function nr({children:e}){return u.jsx(ui,{children:u.jsxs(En,{children:[u.jsx("div",{style:{padding:"3rem 2rem"},children:e}),u.jsx(fd,{})]})})}function rr({children:e}){return u.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function Bb({children:e}){return u.jsx("p",{style:{padding:".5em 0"},children:e})}const Jb="_link_oo2kv_1",Wb={link:Jb};function Ea({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return u.jsx("a",{className:Kt(Wb.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function _o({url:e,providerDisplayName:t,credentialName:n}){return u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[u.jsx(Ea,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function Vo(e,t){const n={},r=[];if(e.forEach(o=>{const i=t[o.name];!i||i.trim()===""?r.push(o.displayName||o.name):n[o.name]={value:i,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function Zr(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function pd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var x,p;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(T=>({...T,[I]:S.trim()}))},{apiKey:d}=s,{providerName:l}=ut(e),h=d.length>0,m=Zr(c,s),g=r||!h||!m,w=(p=t.apiKeyOpts)==null?void 0:p.docsURL,v=()=>{const y=Vo(c,s);n({apiKey:d,providerMetadata:y})};return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&u.jsx(_o,{url:w,providerDisplayName:l||an(e),credentialName:"API key"}),u.jsx(St.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:f}),c.map(y=>u.jsxs("div",{children:[y.docsURL&&u.jsx(_o,{url:y.docsURL,providerDisplayName:l||an(e),credentialName:y.displayName||y.name}),u.jsx(St.Input,{id:y.name,name:y.name,type:"text",placeholder:y.displayName||y.name,onChange:f})]},y.name)),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:g,type:i||"submit",onClick:v,variant:o,children:"Next"})]})}function zb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=ut(e);return u.jsxs(nr,{children:[u.jsx(rr,{children:`Set up ${i} integration`}),u.jsx(ln,{error:r}),u.jsx(pd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function Qb({...e}){return u.jsx(zb,{...e})}const Gb={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(En,{style:{...Gb,...t},children:e})}const _a=()=>{const e=rt(),t=$e(),[n,r]=b.useState(null);return{...On({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},Xb="_divider_1kmoj_1",Bc={divider:Xb};function Bo({className:e,style:t}){return u.jsx("hr",{className:e?`${Bc.divider} ${e}`:Bc.divider,style:t})}function At({string:e}){return u.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[u.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),u.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:u.jsx(Bo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Yb({provider:e}){const{projectIdOrName:t}=De(),{providerName:n,data:r}=ut(e),{selectedConnection:o,isConnectionsLoading:i}=Yt(),{mutateAsync:s,isPending:a,error:c}=_a(),[f,d]=b.useState(null),[l,h]=b.useState(!1),m=()=>h(!1),g=()=>{h(!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:p=>{console.error("Update connection error:",p),He(p,d)},onSuccess:()=>{g()}})}catch(p){console.error("Update connection caught error:",p),He(p,d)}};return r?u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Update ${n} API Key`}),l&&u.jsx(Ho,{children:"Connection updated successfully"}),w&&u.jsx(Li,{children:`Error updating connection ${w}`}),u.jsx(pd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:v,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function hd({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}=ut(e),l=p=>{const{name:y,value:I}=p.currentTarget;s(S=>({...S,[y]:I.trim()}))},h=Zr(a,i),m=r||!h,g=()=>{const p=Vo(a,i);n({user:c,pass:f,providerMetadata:p})},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(_o,{url:w,providerDisplayName:d||an(e),credentialName:"credentials"}),u.jsx(St.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:l}),u.jsx(St.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:l}),a.map(p=>u.jsxs("div",{children:[p.docsURL&&u.jsx(_o,{url:p.docsURL,providerDisplayName:d||an(e),credentialName:p.displayName||p.name}),u.jsx(St.Input,{id:p.name,name:p.name,type:"text",placeholder:p.displayName||p.name,onChange:l})]},p.name)),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:m,type:"button",onClick:g,variant:o,children:"Next"})]})}function Zb({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=ut(e);return u.jsxs(nr,{children:[u.jsx(rr,{children:`Set up ${i} integration`}),u.jsx(ln,{error:r}),u.jsx(hd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function eI({...e}){return u.jsx(Zb,{...e})}function tI({provider:e}){const{projectIdOrName:t}=De(),{providerName:n,data:r}=ut(e),{selectedConnection:o,isConnectionsLoading:i}=Yt(),{mutateAsync:s,isPending:a,error:c}=_a(),[f,d]=b.useState(null),[l,h]=b.useState(!1),m=()=>h(!1),g=()=>{h(!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:p=>{console.error(p),He(p,d)},onSuccess:()=>{g()}})}catch(p){console.error(p),He(p,d)}};return r?u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Update ${n} credentials`}),l&&u.jsx(Ho,{children:"Connection updated successfully"}),w&&u.jsx(Li,{children:`Error updating connection: ${w}`}),u.jsx(hd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:v,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function md({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:T,value:A}=S.currentTarget;s(E=>({...E,[T]:A.trim()})),c(null)},{clientSecret:h,clientId:m,scopes:g}=i,w=h.length>0,v=m.length>0,x=Zr(d,i),p=n||!w||!v||!x,y=()=>{const S=Vo(d,i),T={clientId:m,clientSecret:h,providerMetadata:S};r&&g.length>0&&(T.scopes=sb(g)),t(T)};return u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[u.jsx(St.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:l}),u.jsx(St.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:l}),r&&u.jsx(St.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:l}),d.map(S=>u.jsx(St.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(Be,{style:{width:"100%"},disabled:p,type:"button",onClick:y,variant:o,children:"Next"})]})}function nI({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return u.jsxs(nr,{children:[u.jsx(rr,{children:`Set up ${o} integration`}),u.jsx(ln,{error:n}),u.jsx("br",{}),u.jsx(md,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function rI({provider:e}){var p;const{projectIdOrName:t}=De(),{selectedConnection:n,isConnectionsLoading:r}=Yt(),{providerName:o,data:i}=ut(e),{mutateAsync:s,isPending:a,error:c}=_a(),[f,d]=b.useState(null),[l,h]=b.useState(!1),m=()=>{h(!1)},g=()=>{h(!0),d(null)},w=(p=i==null?void 0:i.oauth2Opts)==null?void 0:p.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){He(I,d)}};return u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Re-authenticate to ${o}`}),l&&u.jsx(Ho,{children:"Connection updated successfully"}),v&&u.jsx(Li,{children:`Error updating connection ${v}`}),u.jsx(md,{provider:o||"",handleSubmit:x,isButtonDisabled:a||r,explicitScopesRequired:w,buttonVariant:"ghost"})]})]})}const Jc=600,Wc=600,iI="AUTHORIZATION_SUCCEEDED",oI="AUTHORIZATION_FAILED";function sI(e,t,n,r){return b.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Jc)/2,i=window.screenY+(window.outerHeight-Wc)/2.5,s=`width=${Jc},height=${Wc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function aI(e,t,n,r){const o=$e();return b.useCallback(i=>{var s,a;if(i.origin===$l){if(i.data.eventType===iI){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===oI&&(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 cI({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s,onWindowClose:a}){const[c,f]=b.useState(null),[d,l]=b.useState(null),h=$e(),m=b.useRef(null),g=aI(f,d,r,i),w=sI(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(()=>{h.invalidateQueries({queryKey:["amp","connections"]}),l(null),!c&&!o?console.error("Window closed and no connection was found. Please try again."):c&&(r==null||r(null)),a==null||a()},[c,o,r,a,h]);return b.useEffect(()=>{if(d)return 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 uI=()=>{const e=rt(),t=$e();return On({mutationKey:["updateOauthConnection"],mutationFn:async n=>{const r=await e();if(!n.projectIdOrName||!n.connectionId)throw new Error("Project ID and connection ID are required");return r.oAuthApi.oauthUpdate(n)},onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function lI({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs("div",{style:{padding:"1rem 0"},children:[u.jsx("p",{children:`Re-authenticate to ${r}`}),u.jsx(ln,{error:t}),u.jsx(Be,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function dI({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Yt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=ut(e),{mutateAsync:s,isPending:a,error:c}=uI(),[f,d]=b.useState(null),[l,h]=b.useState(!1),[m,g]=b.useState(null),w=()=>{h(!1)},v=()=>{h(!0),d(null),g(null)},x=(c==null?void 0:c.message)||f||null,p=async()=>{w(),d(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});g(I)}catch(I){He(I,d)}},y=b.useCallback(I=>{d(I)},[]);return u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Update connection"}),l&&u.jsx(Ho,{children:"Connection updated successfully"}),u.jsx(cI,{windowTitle:`Connect to ${i}`,oauthUrl:m||null,onError:y,error:x,isSuccessConnect:l,onSuccessConnect:v,children:u.jsx(lI,{handleSubmit:p,error:x,providerName:i,isButtonDisabled:a||n||l})})]})}function Na({provider:e}){var r;const{data:t}=qo(e);if((t==null?void 0:t.authType)===Fc.Basic)return u.jsx(tI,{provider:e});if((t==null?void 0:t.authType)===Fc.ApiKey)return u.jsx(Yb,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===as.AuthorizationCode||n===as.AuthorizationCodePkce)return u.jsx(dI,{provider:e});if(n===as.ClientCredentials)return u.jsx(rI,{provider:e})}return null}const fI=()=>{const e=rt(),t=$e(),[n,r]=b.useState(null);return{...On({mutationKey:["deleteConnection"],mutationFn:async i=>(await e()).connectionApi.deleteConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)},onError:i=>{console.error("Error deleting connection"),He(i,r)}}),errorMsg:n}};function gd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectIdOrName:s}=De(),{selectedConnection:a}=Yt(),{mutate:c,isPending:f}=fI(),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=>{He(g,i)}}))},h=f?"Pending...":e;return u.jsx(Be,{type:"button",onClick:l,disabled:d,variant:t,style:n,children:h})}const yd=b.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),di=()=>{const e=b.useContext(yd);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},pI=()=>{var f;const e=$e(),t=rt(),{selectedConnection:n,isConnectionsLoading:r}=Yt(),{projectIdOrName:o}=De(),{integrationId:i,integrationObj:s}=it(),a=n==null?void 0:n.id,c=(f=s==null?void 0:s.latestRevision)==null?void 0:f.id;return b.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),Yn({queryKey:["amp","hydratedRevision",o,i,c,a],queryFn:async()=>{if(!o)throw new Error("projectIdOrName is required");if(!i)throw new Error("integrationId is required");if(!c)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:o,integrationId:i,revisionId:c,connectionId:a})},retry:3,enabled:!!o&&!!i&&!!c&&!!a&&!r})};function hI({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=it(),{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:h,isLoading:m,isError:g,error:w}=pI();b.useEffect(()=>{g?(s(he.HYDRATED_REVISION,a),He(w,f)):(i(he.HYDRATED_REVISION,a),f(null),l(null))},[g,a,s,i,w,f]);const v=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 u.jsx(li,{});const x=(r==null?void 0:r.provider)||"provider";if(o(he.HYDRATED_REVISION,a)){const p=(r==null?void 0:r.name)||n||"unknown integration",y=`${c?`: ${c}`:`Error retrieving objects from ${x} or integration details for ${p}`}`;return u.jsx(zt,{message:y,children:u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[u.jsx(Na,{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(ql,{message:d}),u.jsx(gd,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:I=>l(I)})]})})}return u.jsx(yd.Provider,{value:v,children:e})}const vd=b.createContext(null);function wd(){const e=b.useContext(vd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const bd=b.createContext(()=>{});function mI(){const e=b.useContext(bd);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const Id=b.createContext(void 0),gI={};function Ta(){const e=b.useContext(Id);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function yI({children:e}){const{installation:t}=it(),{hydratedRevision:n,loading:r}=di(),[o,i]=b.useState(gI),s=t==null?void 0:t.config;b.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&Eb(n,s,i)},[n,r,s,o]);const a=b.useCallback((m,g)=>{i(w=>It(w,v=>{v[m]=It(v[m],g)}))},[i]),c=b.useCallback((m,g)=>{i(w=>It(w,v=>{v[m]=g}))},[i]),f=b.useCallback(()=>{i(It(m=>{const g=m.other.write;g&&(g.isWriteModified=!1)}))},[i]),d=b.useCallback(m=>{i(It(g=>{var v;const w=(v=g[m])==null?void 0:v.read;w&&(w.isOptionalFieldsModified=!1,w.isRequiredMapFieldsModified=!1)}))},[i]),l=b.useCallback(m=>{m===Or?f():d(m)},[d,f]),h=b.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:l}),[o,c,l,a]);return u.jsx(Id.Provider,{value:h,children:e})}const Zt=()=>{const{appName:e}=er(),{objectConfigurationsState:t,setConfigureState:n}=Ta(),{selectedObjectName:r}=wd(),o=cd(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function Sn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function pe(){return pe=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},pe.apply(null,arguments)}function Gs(e,t){return Gs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Gs(e,t)}function vI(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Gs(e,t)}var Xs={exports:{}},so={exports:{}},be={};/** @license React v16.13.1
|
|
10
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)t.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Rd);var nI=Rd.exports;const $t=Jo(nI),rI="_button_kwfiu_1",iI="_danger_kwfiu_42",oI="_ghost_kwfiu_47",gs={button:rI,danger:iI,ghost:oI};function ze({className:e,style:t,type:n,children:r,variant:o,...i}){const s=$t(gs.button,{[gs.danger]:o==="danger",[gs.ghost]:o==="ghost",[e||""]:!!e});return u.jsx("button",{type:n,className:s,style:t,...i,children:r})}const sI={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 Hi({children:e,style:t}){return u.jsx(Tn,{style:{...sI,...t},children:e})}const zo=e=>{const t=ct(),{provider:n}=ut(),r=e||n;return tr({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=zo(e),{data:n}=t,{provider:r}=ut(),o=n&&Rb(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function dn({error:e}){return e?u.jsx(Hi,{style:{marginTop:"2em"},children:e}):null}const aI="_input_1ymb7_1",cI="_inputError_1ymb7_27",ys={input:aI,inputError:cI};function Pd({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?$t(ys.inputError,ys.input):ys.input;return u.jsx("input",{id:e,type:t,className:$t(i,n),...o})}function uI(){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 lI(){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 dI({id:e,name:t,placeholder:n="Password",onChange:r,value:o,className:i,isError:s}){const[a,c]=b.useState(!1),f=()=>c(l=>!l);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(lI,{}):u.jsx(uI,{})})})]})}const fI="_textarea_18zl4_1",pI="_textareaError_18zl4_14",vs={textarea:fI,textareaError:pI};function hI({className:e,isError:t=!1,...n}){const r=t?$t(vs.textareaError,vs.textarea):vs.textarea;return u.jsx("textarea",{className:$t(e,r),...n})}const Et={Input:Pd,Textarea:hI,PasswordInput:dI},mI=()=>{const{projectIdOrName:e}=Le(),t=ct();return tr({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 Fd(){var n,r;const{data:e}=mI();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 or({children:e}){return u.jsx(pi,{children:u.jsxs(Tn,{children:[u.jsx("div",{style:{padding:"3rem 2rem"},children:e}),u.jsx(Fd,{})]})})}function sr({children:e}){return u.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function gI({children:e}){return u.jsx("p",{style:{padding:".5em 0"},children:e})}const yI="_link_oo2kv_1",vI={link:yI};function Ma({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return u.jsx("a",{className:$t(vI.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function Fo({url:e,providerDisplayName:t,credentialName:n}){return u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[u.jsx(Ma,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function Go(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 ri(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function Dd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var x,p;const[s,a]=b.useState({apiKey:""}),c=((x=t.metadata)==null?void 0:x.input)||[],f=v=>{const{name:I,value:S}=v.currentTarget;a(N=>({...N,[I]:S.trim()}))},{apiKey:l}=s,{providerName:d}=pt(e),h=l.length>0,m=ri(c,s),g=r||!h||!m,w=(p=t.apiKeyOpts)==null?void 0:p.docsURL,y=()=>{const v=Go(c,s);n({apiKey:l,providerMetadata:v})};return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&u.jsx(Fo,{url:w,providerDisplayName:d||cn(e),credentialName:"API key"}),u.jsx(Et.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:f}),c.map(v=>u.jsxs("div",{children:[v.docsURL&&u.jsx(Fo,{url:v.docsURL,providerDisplayName:d||cn(e),credentialName:v.displayName||v.name}),u.jsx(Et.Input,{id:v.name,name:v.name,type:"text",placeholder:v.displayName||v.name,onChange:f})]},v.name)),u.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:g,type:i||"submit",onClick:y,variant:o,children:"Next"})]})}function wI({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=pt(e);return u.jsxs(or,{children:[u.jsx(sr,{children:`Set up ${i} integration`}),u.jsx(dn,{error:r}),u.jsx(Dd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function bI({...e}){return u.jsx(wI,{...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 Qo({children:e,style:t}){return u.jsx(Tn,{style:{...II,...t},children:e})}const ka=()=>{const e=ct(),t=qe(),[n,r]=b.useState(null);return{...Nn({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},CI="_divider_1kmoj_1",ru={divider:CI};function Xo({className:e,style:t}){return u.jsx("hr",{className:e?`${ru.divider} ${e}`:ru.divider,style:t})}function Pt({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(Xo,{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}=ka(),[f,l]=b.useState(null),[d,h]=b.useState(!1),m=()=>h(!1),g=()=>{h(!0),l(null)},w=(c==null?void 0:c.message)||f||null,y=async x=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:x.apiKey}}},{onError:p=>{console.error("Update connection error:",p),We(p,l)},onSuccess:()=>{g()}})}catch(p){console.error("Update connection caught error:",p),We(p,l)}};return r?u.jsxs(u.Fragment,{children:[u.jsx(Pt,{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`}),d&&u.jsx(Qo,{children:"Connection updated successfully"}),w&&u.jsx(Hi,{children:`Error updating connection ${w}`}),u.jsx(Dd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:y,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function Md({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var y,x;const[i,s]=b.useState({username:"",password:""}),a=((y=t.metadata)==null?void 0:y.input)||[],{username:c,password:f}=i,{providerName:l}=pt(e),d=p=>{const{name:v,value:I}=p.currentTarget;s(S=>({...S,[v]:I.trim()}))},h=ri(a,i),m=r||!h,g=()=>{const p=Go(a,i);n({user:c,pass:f,providerMetadata:p})},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(Fo,{url:w,providerDisplayName:l||cn(e),credentialName:"credentials"}),u.jsx(Et.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:d}),u.jsx(Et.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:d}),a.map(p=>u.jsxs("div",{children:[p.docsURL&&u.jsx(Fo,{url:p.docsURL,providerDisplayName:l||cn(e),credentialName:p.displayName||p.name}),u.jsx(Et.Input,{id:p.name,name:p.name,type:"text",placeholder:p.displayName||p.name,onChange:d})]},p.name)),u.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:m,type:"button",onClick:g,variant:o,children:"Next"})]})}function xI({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=pt(e);return u.jsxs(or,{children:[u.jsx(sr,{children:`Set up ${i} integration`}),u.jsx(dn,{error:r}),u.jsx(Md,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function OI({...e}){return u.jsx(xI,{...e})}function EI({provider:e}){const{projectIdOrName:t}=Le(),{providerName:n,data:r}=pt(e),{selectedConnection:o,isConnectionsLoading:i}=Yt(),{mutateAsync:s,isPending:a,error:c}=ka(),[f,l]=b.useState(null),[d,h]=b.useState(!1),m=()=>h(!1),g=()=>{h(!0),l(null)},w=(c==null?void 0:c.message)||f||null,y=async x=>{m(),l(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:p=>{console.error(p),We(p,l)},onSuccess:()=>{g()}})}catch(p){console.error(p),We(p,l)}};return r?u.jsxs(u.Fragment,{children:[u.jsx(Pt,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Update ${n} credentials`}),d&&u.jsx(Qo,{children:"Connection updated successfully"}),w&&u.jsx(Hi,{children:`Error updating connection: ${w}`}),u.jsx(Md,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:y,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function kd({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}=zo(e),l=((I=f==null?void 0:f.metadata)==null?void 0:I.input)||[],d=S=>{const{name:N,value:R}=S.currentTarget;s(E=>({...E,[N]:R.trim()})),c(null)},{clientSecret:h,clientId:m,scopes:g}=i,w=h.length>0,y=m.length>0,x=ri(l,i),p=n||!w||!y||!x,v=()=>{const S=Go(l,i),N={clientId:m,clientSecret:h,providerMetadata:S};r&&g.length>0&&(N.scopes=Pb(g)),t(N)};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:d}),u.jsx(Et.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:d}),r&&u.jsx(Et.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:d}),l.map(S=>u.jsx(Et.Input,{id:S.name,name:S.name,type:"text",placeholder:S.displayName||S.name,onChange:d},S.name))]}),u.jsx(dn,{error:a}),u.jsx("br",{}),u.jsx(ze,{style:{width:"100%"},disabled:p,type:"button",onClick:v,variant:o,children:"Next"})]})}function _I({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return u.jsxs(or,{children:[u.jsx(sr,{children:`Set up ${o} integration`}),u.jsx(dn,{error:n}),u.jsx("br",{}),u.jsx(kd,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function NI({provider:e}){var p;const{projectIdOrName:t}=Le(),{selectedConnection:n,isConnectionsLoading:r}=Yt(),{providerName:o,data:i}=pt(e),{mutateAsync:s,isPending:a,error:c}=ka(),[f,l]=b.useState(null),[d,h]=b.useState(!1),m=()=>{h(!1)},g=()=>{h(!0),l(null)},w=(p=i==null?void 0:i.oauth2Opts)==null?void 0:p.explicitScopesRequired,y=(c==null?void 0:c.message)||f||null,x=async v=>{m(),l(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:v.clientId,clientSecret:v.clientSecret,scopes:v.scopes}}}}),g()}catch(I){We(I,l)}};return u.jsxs(u.Fragment,{children:[u.jsx(Pt,{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}`}),d&&u.jsx(Qo,{children:"Connection updated successfully"}),y&&u.jsx(Hi,{children:`Error updating connection ${y}`}),u.jsx(kd,{provider:o||"",handleSubmit:x,isButtonDisabled:a||r,explicitScopesRequired:w,buttonVariant:"ghost"})]})]})}const iu=600,ou=600,TI="AUTHORIZATION_SUCCEEDED",AI="AUTHORIZATION_FAILED";function RI(e,t,n,r){return b.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-iu)/2,i=window.screenY+(window.outerHeight-ou)/2.5,s=`width=${iu},height=${ou},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function PI(e,t,n,r){const o=qe();return b.useCallback(i=>{var s,a;if(i.origin===ed){if(i.data.eventType===TI){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===AI&&(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 FI({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),[l,d]=b.useState(null),h=qe(),m=b.useRef(null),g=PI(f,l,r,i),w=RI(n,d,g,t);b.useEffect(()=>{t&&!l&&!c&&!o&&!s&&(r==null||r(null),w())},[t,l,w,c,o,s,r]);const y=b.useCallback(()=>{h.invalidateQueries({queryKey:["amp","connections"]}),d(null),!c&&!o?console.error("Window closed and no connection was found. Please try again."):c&&(r==null||r(null)),a==null||a()},[c,o,r,a,h]);return b.useEffect(()=>{if(l)return m.current=setInterval(()=>{l!=null&&l.closed&&(m.current&&clearInterval(m.current),m.current=null,y())},500),()=>{m.current&&(clearInterval(m.current),m.current=null),window.removeEventListener("message",g)}},[y,l,g]),u.jsx("div",{children:e})}const DI=()=>{const e=ct(),t=qe();return Nn({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 MI({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs("div",{style:{padding:"1rem 0"},children:[u.jsx("p",{children:`Re-authenticate to ${r}`}),u.jsx(dn,{error:t}),u.jsx(ze,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function kI({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}=DI(),[f,l]=b.useState(null),[d,h]=b.useState(!1),[m,g]=b.useState(null),w=()=>{h(!1)},y=()=>{h(!0),l(null),g(null)},x=(c==null?void 0:c.message)||f||null,p=async()=>{w(),l(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});g(I)}catch(I){We(I,l)}},v=b.useCallback(I=>{l(I)},[]);return u.jsxs(u.Fragment,{children:[u.jsx(Pt,{string:"Update connection"}),d&&u.jsx(Qo,{children:"Connection updated successfully"}),u.jsx(FI,{windowTitle:`Connect to ${i}`,oauthUrl:m||null,onError:v,error:x,isSuccessConnect:d,onSuccessConnect:y,children:u.jsx(MI,{handleSubmit:p,error:x,providerName:i,isButtonDisabled:a||n||d})})]})}function ja({provider:e}){var r;const{data:t}=zo(e);if((t==null?void 0:t.authType)===Hc.Basic)return u.jsx(EI,{provider:e});if((t==null?void 0:t.authType)===Hc.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===ps.AuthorizationCode||n===ps.AuthorizationCodePkce)return u.jsx(kI,{provider:e});if(n===ps.ClientCredentials)return u.jsx(NI,{provider:e})}return null}const jI=()=>{const e=ct(),t=qe(),[n,r]=b.useState(null);return{...Nn({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 jd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectIdOrName:s}=Le(),{selectedConnection:a}=Yt(),{mutate:c,isPending:f}=jI(),l=!s||!a||!a.id||f,d=async()=>{l||(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)}}))},h=f?"Pending...":e;return u.jsx(ze,{type:"button",onClick:d,disabled:l,variant:t,style:n,children:h})}const Ld=b.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),mi=()=>{const e=b.useContext(Ld);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},LI=()=>{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]),tr({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 KI({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=ut(),{isError:o,removeError:i,setError:s}=ln(),a=(r==null?void 0:r.name)||n,[c,f]=b.useState(null),[l,d]=b.useState(null),{data:h,isLoading:m,isError:g,error:w}=LI();b.useEffect(()=>{g?(s(we.HYDRATED_REVISION,a),We(w,f)):(i(we.HYDRATED_REVISION,a),f(null),d(null))},[g,a,s,i,w,f]);const y=b.useMemo(()=>{var p,v,I;return{hydratedRevision:h||null,loading:m,readAction:(p=h==null?void 0:h.content)==null?void 0:p.read,writeObjects:((I=(v=h==null?void 0:h.content)==null?void 0:v.write)==null?void 0:I.objects)||[]}},[h,m]);if(m)return u.jsx(hi,{});const x=(r==null?void 0:r.provider)||"provider";if(o(we.HYDRATED_REVISION,a)){const p=(r==null?void 0:r.name)||n||"unknown integration",v=`${c?`: ${c}`:`Error retrieving objects from ${x} or integration details for ${p}`}`;return u.jsx(zt,{message:v,children:u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[u.jsx(ja,{provider:x}),u.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),l&&u.jsx(nd,{message:l}),u.jsx(jd,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:I=>d(I)})]})})}return u.jsx(Ld.Provider,{value:y,children:e})}const Kd=b.createContext(null);function $d(){const e=b.useContext(Kd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const Vd=b.createContext(()=>{});function $I(){const e=b.useContext(Vd);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const Ud=b.createContext(void 0),VI={};function La(){const e=b.useContext(Ud);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function UI({children:e}){const{installation:t}=ut(),{hydratedRevision:n,loading:r}=mi(),[o,i]=b.useState(VI),s=t==null?void 0:t.config;b.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&Xb(n,s,i)},[n,r,s,o]);const a=b.useCallback((l,d)=>{i(h=>jt(h,m=>{m[l]=jt(m[l],d)}))},[i]),c=b.useCallback((l,d)=>{i(h=>jt(h,m=>{m[l]=d}))},[i]),f=b.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c}),[o,c,a]);return u.jsx(Ud.Provider,{value:f,children:e})}const Zt=()=>{const{appName:e}=rr(),{objectConfigurationsState:t,setConfigureState:n}=La(),{selectedObjectName:r}=$d(),o=Td(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function En(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 ra(e,t){return ra=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ra(e,t)}function qI(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ra(e,t)}var ia={exports:{}},fo={exports:{}},Ee={};/** @license React v16.13.1
|
|
11
11
|
* react-is.production.min.js
|
|
12
12
|
*
|
|
13
13
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var su;function HI(){if(su)return Ee;su=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,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,g=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,p=e?Symbol.for("react.scope"):60119;function v(S){if(typeof S=="object"&&S!==null){var N=S.$$typeof;switch(N){case t:switch(S=S.type,S){case c:case f:case r:case i:case o:case d:return S;default:switch(S=S&&S.$$typeof,S){case a:case l:case g:case m:case s:return S;default:return N}}case n:return N}}}function I(S){return v(S)===f}return Ee.AsyncMode=c,Ee.ConcurrentMode=f,Ee.ContextConsumer=a,Ee.ContextProvider=s,Ee.Element=t,Ee.ForwardRef=l,Ee.Fragment=r,Ee.Lazy=g,Ee.Memo=m,Ee.Portal=n,Ee.Profiler=i,Ee.StrictMode=o,Ee.Suspense=d,Ee.isAsyncMode=function(S){return I(S)||v(S)===c},Ee.isConcurrentMode=I,Ee.isContextConsumer=function(S){return v(S)===a},Ee.isContextProvider=function(S){return v(S)===s},Ee.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===t},Ee.isForwardRef=function(S){return v(S)===l},Ee.isFragment=function(S){return v(S)===r},Ee.isLazy=function(S){return v(S)===g},Ee.isMemo=function(S){return v(S)===m},Ee.isPortal=function(S){return v(S)===n},Ee.isProfiler=function(S){return v(S)===i},Ee.isStrictMode=function(S){return v(S)===o},Ee.isSuspense=function(S){return v(S)===d},Ee.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===r||S===f||S===i||S===o||S===d||S===h||typeof S=="object"&&S!==null&&(S.$$typeof===g||S.$$typeof===m||S.$$typeof===s||S.$$typeof===a||S.$$typeof===l||S.$$typeof===y||S.$$typeof===x||S.$$typeof===p||S.$$typeof===w)},Ee.typeOf=v,Ee}var _e={};/** @license React v16.13.1
|
|
18
18
|
* react-is.development.js
|
|
19
19
|
*
|
|
20
20
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
21
21
|
*
|
|
22
22
|
* This source code is licensed under the MIT license found in the
|
|
23
23
|
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*/var
|
|
24
|
+
*/var au;function BI(){return au||(au=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,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,g=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,p=e?Symbol.for("react.scope"):60119;function v(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===g||k.$$typeof===m||k.$$typeof===s||k.$$typeof===a||k.$$typeof===l||k.$$typeof===y||k.$$typeof===x||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 c:case f:case r:case i:case o:case d:return z;default:var Ye=z&&z.$$typeof;switch(Ye){case a:case l:case g:case m:case s:return Ye;default:return ve}}case n:return ve}}}var S=c,N=f,R=a,E=s,P=t,A=l,D=r,V=g,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.")),F(k)||I(k)===c}function F(k){return I(k)===f}function $(k){return I(k)===a}function J(k){return I(k)===s}function U(k){return typeof k=="object"&&k!==null&&k.$$typeof===t}function q(k){return I(k)===l}function K(k){return I(k)===r}function Q(k){return I(k)===g}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}_e.AsyncMode=S,_e.ConcurrentMode=N,_e.ContextConsumer=R,_e.ContextProvider=E,_e.Element=P,_e.ForwardRef=A,_e.Fragment=D,_e.Lazy=V,_e.Memo=j,_e.Portal=L,_e.Profiler=se,_e.StrictMode=re,_e.Suspense=ge,_e.isAsyncMode=be,_e.isConcurrentMode=F,_e.isContextConsumer=$,_e.isContextProvider=J,_e.isElement=U,_e.isForwardRef=q,_e.isFragment=K,_e.isLazy=Q,_e.isMemo=Z,_e.isPortal=Y,_e.isProfiler=ee,_e.isStrictMode=ne,_e.isSuspense=ce,_e.isValidElementType=v,_e.typeOf=I}()),_e}var cu;function qd(){return cu||(cu=1,process.env.NODE_ENV==="production"?fo.exports=HI():fo.exports=BI()),fo.exports}/*
|
|
25
25
|
object-assign
|
|
26
26
|
(c) Sindre Sorhus
|
|
27
27
|
@license MIT
|
|
28
|
-
*/var
|
|
29
|
-
Valid keys: `+JSON.stringify(Object.keys(F),null," "));var
|
|
28
|
+
*/var ws,uu;function JI(){if(uu)return ws;uu=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(l){return s[l]});if(c.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 ws=o()?Object.assign:function(i,s){for(var a,c=r(i),f,l=1;l<arguments.length;l++){a=Object(arguments[l]);for(var d in a)t.call(a,d)&&(c[d]=a[d]);if(e){f=e(a);for(var h=0;h<f.length;h++)n.call(a,f[h])&&(c[f[h]]=a[f[h]])}}return c},ws}var bs,lu;function Ka(){if(lu)return bs;lu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return bs=e,bs}var Is,du;function Hd(){return du||(du=1,Is=Function.call.bind(Object.prototype.hasOwnProperty)),Is}var Cs,fu;function WI(){if(fu)return Cs;fu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Ka(),n={},r=Hd();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 l in i)if(r(i,l)){var d;try{if(typeof i[l]!="function"){var h=Error((c||"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,c,a,null,t)}catch(g){d=g}if(d&&!(d instanceof Error)&&e((c||"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={})},Cs=o,Cs}var Ss,pu;function zI(){if(pu)return Ss;pu=1;var e=qd(),t=JI(),n=Ka(),r=Hd(),o=WI(),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 Ss=function(a,c){var f=typeof Symbol=="function"&&Symbol.iterator,l="@@iterator";function d(F){var $=F&&(f&&F[f]||F[l]);if(typeof $=="function")return $}var h="<<anonymous>>",m={array:x("array"),bigint:x("bigint"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:p(),arrayOf:v,element:I(),elementType:S(),instanceOf:N,node:A(),objectOf:E,oneOf:R,oneOfType:P,shape:V,exact:j};function g(F,$){return F===$?F!==0||1/F===1/$:F!==F&&$!==$}function w(F,$){this.message=F,this.data=$&&typeof $=="object"?$:{},this.stack=""}w.prototype=Error.prototype;function y(F){if(process.env.NODE_ENV!=="production")var $={},J=0;function U(K,Q,Z,Y,ee,ne,ce){if(Y=Y||h,ne=ne||Z,ce!==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+":"+Z;!$[ve]&&J<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,J++)}}return Q[Z]==null?K?Q[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:F(Q,Z,Y,ee,ne)}var q=U.bind(null,!1);return q.isRequired=U.bind(null,!0),q}function x(F){function $(J,U,q,K,Q,Z){var Y=J[U],ee=re(Y);if(ee!==F){var ne=ge(Y);return new w("Invalid "+K+" `"+Q+"` of type "+("`"+ne+"` supplied to `"+q+"`, expected ")+("`"+F+"`."),{expectedType:F})}return null}return y($)}function p(){return y(s)}function v(F){function $(J,U,q,K,Q){if(typeof F!="function")return new w("Property `"+Q+"` of component `"+q+"` has invalid PropType notation inside arrayOf.");var Z=J[U];if(!Array.isArray(Z)){var Y=re(Z);return new w("Invalid "+K+" `"+Q+"` of type "+("`"+Y+"` supplied to `"+q+"`, expected an array."))}for(var ee=0;ee<Z.length;ee++){var ne=F(Z,ee,q,K,Q+"["+ee+"]",n);if(ne instanceof Error)return ne}return null}return y($)}function I(){function F($,J,U,q,K){var Q=$[J];if(!a(Q)){var Z=re(Q);return new w("Invalid "+q+" `"+K+"` of type "+("`"+Z+"` supplied to `"+U+"`, expected a single ReactElement."))}return null}return y(F)}function S(){function F($,J,U,q,K){var Q=$[J];if(!e.isValidElementType(Q)){var Z=re(Q);return new w("Invalid "+q+" `"+K+"` of type "+("`"+Z+"` supplied to `"+U+"`, expected a single ReactElement type."))}return null}return y(F)}function N(F){function $(J,U,q,K,Q){if(!(J[U]instanceof F)){var Z=F.name||h,Y=be(J[U]);return new w("Invalid "+K+" `"+Q+"` of type "+("`"+Y+"` supplied to `"+q+"`, expected ")+("instance of `"+Z+"`."))}return null}return y($)}function R(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 $(J,U,q,K,Q){for(var Z=J[U],Y=0;Y<F.length;Y++)if(g(Z,F[Y]))return null;var ee=JSON.stringify(F,function(ce,k){var ve=ge(k);return ve==="symbol"?String(k):k});return new w("Invalid "+K+" `"+Q+"` of value `"+String(Z)+"` "+("supplied to `"+q+"`, expected one of "+ee+"."))}return y($)}function E(F){function $(J,U,q,K,Q){if(typeof F!="function")return new w("Property `"+Q+"` of component `"+q+"` has invalid PropType notation inside objectOf.");var Z=J[U],Y=re(Z);if(Y!=="object")return new w("Invalid "+K+" `"+Q+"` of type "+("`"+Y+"` supplied to `"+q+"`, expected an object."));for(var ee in Z)if(r(Z,ee)){var ne=F(Z,ee,q,K,Q+"."+ee,n);if(ne instanceof Error)return ne}return null}return y($)}function P(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 $=0;$<F.length;$++){var J=F[$];if(typeof J!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+de(J)+" at index "+$+"."),s}function U(q,K,Q,Z,Y){for(var ee=[],ne=0;ne<F.length;ne++){var ce=F[ne],k=ce(q,K,Q,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 "+("`"+Q+"`"+ve+"."))}return y(U)}function A(){function F($,J,U,q,K){return L($[J])?null:new w("Invalid "+q+" `"+K+"` supplied to "+("`"+U+"`, expected a ReactNode."))}return y(F)}function D(F,$,J,U,q){return new w((F||"React class")+": "+$+" type `"+J+"."+U+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+q+"`.")}function V(F){function $(J,U,q,K,Q){var Z=J[U],Y=re(Z);if(Y!=="object")return new w("Invalid "+K+" `"+Q+"` of type `"+Y+"` "+("supplied to `"+q+"`, expected `object`."));for(var ee in F){var ne=F[ee];if(typeof ne!="function")return D(q,K,Q,ee,ge(ne));var ce=ne(Z,ee,q,K,Q+"."+ee,n);if(ce)return ce}return null}return y($)}function j(F){function $(J,U,q,K,Q){var Z=J[U],Y=re(Z);if(Y!=="object")return new w("Invalid "+K+" `"+Q+"` of type `"+Y+"` "+("supplied to `"+q+"`, expected `object`."));var ee=t({},J[U],F);for(var ne in ee){var ce=F[ne];if(r(F,ne)&&typeof ce!="function")return D(q,K,Q,ne,ge(ce));if(!ce)return new w("Invalid "+K+" `"+Q+"` key `"+ne+"` supplied to `"+q+"`.\nBad object: "+JSON.stringify(J[U],null," ")+`
|
|
29
|
+
Valid keys: `+JSON.stringify(Object.keys(F),null," "));var k=ce(Z,ne,q,K,Q+"."+ne,n);if(k)return k}return null}return y($)}function L(F){switch(typeof F){case"number":case"string":case"undefined":return!0;case"boolean":return!F;case"object":if(Array.isArray(F))return F.every(L);if(F===null||a(F))return!0;var $=d(F);if($){var J=$.call(F),U;if($!==F.entries){for(;!(U=J.next()).done;)if(!L(U.value))return!1}else for(;!(U=J.next()).done;){var q=U.value;if(q&&!L(q[1]))return!1}}else return!1;return!0;default:return!1}}function se(F,$){return F==="symbol"?!0:$?$["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&$ instanceof Symbol:!1}function re(F){var $=typeof F;return Array.isArray(F)?"array":F instanceof RegExp?"object":se($,F)?"symbol":$}function ge(F){if(typeof F>"u"||F===null)return""+F;var $=re(F);if($==="object"){if(F instanceof Date)return"date";if(F instanceof RegExp)return"regexp"}return $}function de(F){var $=ge(F);switch($){case"array":case"object":return"an "+$;case"boolean":case"date":case"regexp":return"a "+$;default:return $}}function be(F){return!F.constructor||!F.constructor.name?h:F.constructor.name}return m.checkPropTypes=o,m.resetWarningCache=o.resetWarningCache,m.PropTypes=m,m},Ss}var xs,hu;function GI(){if(hu)return xs;hu=1;var e=Ka();function t(){}function n(){}return n.resetWarningCache=t,xs=function(){function r(s,a,c,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},xs}if(process.env.NODE_ENV!=="production"){var QI=qd(),XI=!0;ia.exports=zI()(QI.isElement,XI)}else ia.exports=GI()();var YI=ia.exports;const W=Jo(YI);var oa={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(Z,te,V,L,G+"."+
|
|
|
34
34
|
*
|
|
35
35
|
* This source code is licensed under the MIT license found in the
|
|
36
36
|
* LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/var
|
|
37
|
+
*/var mu;function ZI(){if(mu)return Ne;mu=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"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g;g=Symbol.for("react.module.reference");function w(y){if(typeof y=="object"&&y!==null){var x=y.$$typeof;switch(x){case e:switch(y=y.type,y){case n:case o:case r:case f:case l:return y;default:switch(y=y&&y.$$typeof,y){case a:case s:case c:case h:case d:case i:return y;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=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(y){return w(y)===s},Ne.isContextProvider=function(y){return w(y)===i},Ne.isElement=function(y){return typeof y=="object"&&y!==null&&y.$$typeof===e},Ne.isForwardRef=function(y){return w(y)===c},Ne.isFragment=function(y){return w(y)===n},Ne.isLazy=function(y){return w(y)===h},Ne.isMemo=function(y){return w(y)===d},Ne.isPortal=function(y){return w(y)===t},Ne.isProfiler=function(y){return w(y)===o},Ne.isStrictMode=function(y){return w(y)===r},Ne.isSuspense=function(y){return w(y)===f},Ne.isSuspenseList=function(y){return w(y)===l},Ne.isValidElementType=function(y){return typeof y=="string"||typeof y=="function"||y===n||y===o||y===r||y===f||y===l||y===m||typeof y=="object"&&y!==null&&(y.$$typeof===h||y.$$typeof===d||y.$$typeof===i||y.$$typeof===s||y.$$typeof===c||y.$$typeof===g||y.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(Z,te,V,L,G+"."+
|
|
|
42
42
|
*
|
|
43
43
|
* This source code is licensed under the MIT license found in the
|
|
44
44
|
* LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/var iu;function TI(){return iu||(iu=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),l=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g=!1,w=!1,v=!1,x=!1,p=!1,y;y=Symbol.for("react.module.reference");function I(W){return!!(typeof W=="string"||typeof W=="function"||W===n||W===o||p||W===r||W===f||W===d||x||W===m||g||w||v||typeof W=="object"&&W!==null&&(W.$$typeof===h||W.$$typeof===l||W.$$typeof===i||W.$$typeof===s||W.$$typeof===c||W.$$typeof===y||W.getModuleId!==void 0))}function S(W){if(typeof W=="object"&&W!==null){var ot=W.$$typeof;switch(ot){case e:var _e=W.type;switch(_e){case n:case o:case r:case f:case d:return _e;default:var mt=_e&&_e.$$typeof;switch(mt){case a:case s:case c:case h:case l:case i:return mt;default:return ot}}case t:return ot}}}var T=s,A=i,E=e,R=c,P=n,M=h,U=l,k=t,j=o,ae=r,re=f,ge=d,me=!1,Oe=!1;function F(W){return me||(me=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function q(W){return Oe||(Oe=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function J(W){return S(W)===s}function B(W){return S(W)===i}function V(W){return typeof W=="object"&&W!==null&&W.$$typeof===e}function L(W){return S(W)===c}function G(W){return S(W)===n}function Z(W){return S(W)===h}function Y(W){return S(W)===l}function ee(W){return S(W)===t}function te(W){return S(W)===o}function ue(W){return S(W)===r}function K(W){return S(W)===f}function we(W){return S(W)===d}Se.ContextConsumer=T,Se.ContextProvider=A,Se.Element=E,Se.ForwardRef=R,Se.Fragment=P,Se.Lazy=M,Se.Memo=U,Se.Portal=k,Se.Profiler=j,Se.StrictMode=ae,Se.Suspense=re,Se.SuspenseList=ge,Se.isAsyncMode=F,Se.isConcurrentMode=q,Se.isContextConsumer=J,Se.isContextProvider=B,Se.isElement=V,Se.isForwardRef=L,Se.isFragment=G,Se.isLazy=Z,Se.isMemo=Y,Se.isPortal=ee,Se.isProfiler=te,Se.isStrictMode=ue,Se.isSuspense=K,Se.isSuspenseList=we,Se.isValidElementType=I,Se.typeOf=S}()),Se}process.env.NODE_ENV==="production"?Ys.exports=NI():Ys.exports=TI();var ou=Ys.exports;const su=e=>typeof e=="object"&&e!=null&&e.nodeType===1,au=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",ws=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return au(n.overflowY,t)||au(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,AI=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},RI=(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(!su(e))throw new TypeError("Invalid target");const d=document.scrollingElement||document.documentElement,l=[];let h=e;for(;su(h)&&f(h);){if(h=AI(h),h===d){l.push(h);break}h!=null&&h===document.body&&ws(h)&&!ws(document.documentElement)||h!=null&&ws(h,c)&&l.push(h)}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:p,top:y,right:I,bottom:S,left:T}=e.getBoundingClientRect(),{top:A,right:E,left:R}=(k=>{const j=window.getComputedStyle(k);return{top:parseFloat(j.scrollMarginTop)||0,right:parseFloat(j.scrollMarginRight)||0,bottom:parseFloat(j.scrollMarginBottom)||0,left:parseFloat(j.scrollMarginLeft)||0}})(e);let P=y-A,M=s==="center"?T+p/2-R+E:s==="end"?I+E:T-R;const U=[];for(let k=0;k<l.length;k++){const j=l[k],{height:ae,width:re,top:ge,right:me,bottom:Oe,left:F}=j.getBoundingClientRect();if(y>=0&&T>=0&&S<=g&&I<=m&&y>=ge&&S<=Oe&&T>=F&&I<=me)return U;const q=getComputedStyle(j),J=parseInt(q.borderLeftWidth,10),B=parseInt(q.borderTopWidth,10),V=parseInt(q.borderRightWidth,10),L=parseInt(q.borderBottomWidth,10);let G=0,Z=0;const Y="offsetWidth"in j?j.offsetWidth-j.clientWidth-J-V:0,ee="offsetHeight"in j?j.offsetHeight-j.clientHeight-B-L:0,te="offsetWidth"in j?j.offsetWidth===0?0:re/j.offsetWidth:0,ue="offsetHeight"in j?j.offsetHeight===0?0:ae/j.offsetHeight:0;if(d===j)G=ao(v,v+g,g,B,L,v+P,v+P+x,x),Z=s==="start"?M:s==="center"?M-m/2:s==="end"?M-m:ao(w,w+m,m,J,V,w+M,w+M+p,p),G=Math.max(0,G+v),Z=Math.max(0,Z+w);else{G=ao(ge,Oe,ae,B,L+ee,P,P+x,x),Z=s==="start"?M-F-J:s==="center"?M-(F+re/2)+Y/2:s==="end"?M-me+V+Y:ao(F,me,re,J,V+Y,M,M+p,p);const{scrollLeft:K,scrollTop:we}=j;G=ue===0?0:Math.max(0,Math.min(we+G/ue,j.scrollHeight-ae/ue+ee)),Z=te===0?0:Math.max(0,Math.min(K+Z/te,j.scrollWidth-re/te+Y)),P+=we-G,M+=K-Z}U.push({el:j,top:G,left:Z})}return U};var ei=function(){return ei=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},ei.apply(this,arguments)};var PI=0;function cu(e){return typeof e=="function"?e:_t}function _t(){}function xd(e,t){if(e){var n=RI(e,{boundary:t});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function uu(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Ra(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return o.cancel=r,o}function We(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(i)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function Dr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(o){typeof o=="function"?o(r):o&&(o.current=r)})}}function Od(){return String(PI++)}function FI(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 lu(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Ed(e){return typeof e.type=="string"}function _d(e){return e.props}function DI(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var MI=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function co(e){e===void 0&&(e={});var t={};return MI.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function No(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=To(t,r)?t[r]:e[r],n},{})}function To(e,t){return e[t]!==void 0}function Zs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function kI(e){return Object.prototype.toString.call(e)==="[object Object]"}function dr(e,t,n,r,o){var i=n.length;if(i===0)return-1;var s=i-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var c=ti(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function ti(e,t,n,r,o){o===void 0&&(o=!1);var i=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<i;a++)if(!r(n[a],a))return a;return o?ti(t?i-1:0,t,n,r):-1}function Ao(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(uu(o,e,n)||r&&uu(o,n.document.activeElement,n))})}var Pa=_t;process.env.NODE_ENV!=="production"&&(Pa=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 jI=Ra(function(e){Nd(e).textContent=""},500);function Nd(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 Td(e,t){if(!(!e||!t)){var n=Nd(t);n.textContent=e,jI(t)}}function LI(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Ad=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Rd=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Pd=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,Fd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Dd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Md=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,kd=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,jd=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Ld=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Kd=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,$d=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,ea=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Ud=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,qd=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Vd=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,KI=Object.freeze({__proto__:null,blurButton:Ud,blurInput:Ld,changeInput:Kd,clickButton:ea,clickItem:jd,controlledPropUpdatedSelectedItem:qd,itemMouseEnter:Pd,keyDownArrowDown:go,keyDownArrowUp:mo,keyDownEnd:kd,keyDownEnter:Dd,keyDownEscape:Fd,keyDownHome:Md,keyDownSpaceButton:$d,mouseUp:Rd,touchEnd:Vd,unknown:Ad}),$I=["refKey","ref"],UI=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],qI=["onKeyDown","onBlur","onChange","onInput","onChangeText"],VI=["refKey","ref"],HI=["onMouseMove","onMouseDown","onClick","onPress","index","item"],BI=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+Od(),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(S){return S!==I}),p()},y);i.timeoutIds.push(I)},i.setItemCount=function(p){i.itemCount=p},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(p,y){var I=i.getItemNodeFromIndex(y);return I&&I.hasAttribute("disabled")},i.setHighlightedIndex=function(p,y){p===void 0&&(p=i.props.defaultHighlightedIndex),y===void 0&&(y={}),y=co(y),i.internalSetState(pe({highlightedIndex:p},y))},i.clearSelection=function(p){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},p)},i.selectItem=function(p,y,I){y=co(y),i.internalSetState(pe({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:p,inputValue:i.props.itemToString(p)},y),I)},i.selectItemAtIndex=function(p,y,I){var S=i.items[p];S!=null&&i.selectItem(S,y,I)},i.selectHighlightedItem=function(p,y){return i.selectItemAtIndex(i.getState().highlightedIndex,p,y)},i.internalSetState=function(p,y){var I,S,T={},A=typeof p=="function";return!A&&p.hasOwnProperty("inputValue")&&i.props.onInputValueChange(p.inputValue,pe({},i.getStateAndHelpers(),p)),i.setState(function(E){var R;E=i.getState(E);var P=A?p(E):p;P=i.props.stateReducer(E,P),I=P.hasOwnProperty("selectedItem");var M={};return I&&P.selectedItem!==E.selectedItem&&(S=P.selectedItem),(R=P).type||(R.type=Ad),Object.keys(P).forEach(function(U){E[U]!==P[U]&&(T[U]=P[U]),U!=="type"&&(P[U],To(i.props,U)||(M[U]=P[U]))}),A&&P.hasOwnProperty("inputValue")&&i.props.onInputValueChange(P.inputValue,pe({},i.getStateAndHelpers(),P)),M},function(){cu(y)();var E=Object.keys(T).length>1;E&&i.props.onStateChange(T,i.getStateAndHelpers()),I&&i.props.onSelect(p.selectedItem,i.getStateAndHelpers()),S!==void 0&&i.props.onChange(S,i.getStateAndHelpers()),i.props.onUserAction(T,i.getStateAndHelpers())})},i.rootRef=function(p){return i._rootNode=p},i.getRootProps=function(p,y){var I,S=p===void 0?{}:p,T=S.refKey,A=T===void 0?"ref":T,E=S.ref,R=Sn(S,$I),P=y===void 0?{}:y,M=P.suppressRefError,U=M===void 0?!1:M;i.getRootProps.called=!0,i.getRootProps.refKey=A,i.getRootProps.suppressRefError=U;var k=i.getState(),j=k.isOpen;return pe((I={},I[A]=Dr(E,i.rootRef),I.role="combobox",I["aria-expanded"]=j,I["aria-haspopup"]="listbox",I["aria-owns"]=j?i.menuId:void 0,I["aria-labelledby"]=i.labelId,I),R)},i.keyDownHandlers={ArrowDown:function(y){var I=this;if(y.preventDefault(),this.getState().isOpen){var S=y.shiftKey?5:1;this.moveHighlightedIndex(S,{type:go})}else this.internalSetState({isOpen:!0,type:go},function(){var T=I.getItemCount();if(T>0){var A=I.getState(),E=A.highlightedIndex,R=dr(E,1,{length:T},I.isItemDisabled,!0);I.setHighlightedIndex(R,{type:go})}})},ArrowUp:function(y){var I=this;if(y.preventDefault(),this.getState().isOpen){var S=y.shiftKey?-5:-1;this.moveHighlightedIndex(S,{type:mo})}else this.internalSetState({isOpen:!0,type:mo},function(){var T=I.getItemCount();if(T>0){var A=I.getState(),E=A.highlightedIndex,R=dr(E,-1,{length:T},I.isItemDisabled,!0);I.setHighlightedIndex(R,{type:mo})}})},Enter:function(y){if(y.which!==229){var I=this.getState(),S=I.isOpen,T=I.highlightedIndex;if(S&&T!=null){y.preventDefault();var A=this.items[T],E=this.getItemNodeFromIndex(T);if(A==null||E&&E.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Dd})}}},Escape:function(y){y.preventDefault(),this.reset(pe({type:Fd},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=pe({},i.keyDownHandlers,{" ":function(y){y.preventDefault(),this.toggleMenu({type:$d})}}),i.inputKeyDownHandlers=pe({},i.keyDownHandlers,{Home:function(y){var I=this.getState(),S=I.isOpen;if(S){y.preventDefault();var T=this.getItemCount();if(!(T<=0||!S)){var A=ti(0,!1,{length:T},this.isItemDisabled);this.setHighlightedIndex(A,{type:Md})}}},End:function(y){var I=this.getState(),S=I.isOpen;if(S){y.preventDefault();var T=this.getItemCount();if(!(T<=0||!S)){var A=ti(T-1,!0,{length:T},this.isItemDisabled);this.setHighlightedIndex(A,{type:kd})}}}}),i.getToggleButtonProps=function(p){var y=p===void 0?{}:p,I=y.onClick;y.onPress;var S=y.onKeyDown,T=y.onKeyUp,A=y.onBlur,E=Sn(y,UI),R=i.getState(),P=R.isOpen,M={onClick:We(I,i.buttonHandleClick),onKeyDown:We(S,i.buttonHandleKeyDown),onKeyUp:We(T,i.buttonHandleKeyUp),onBlur:We(A,i.buttonHandleBlur)},U=E.disabled?{}:M;return pe({type:"button",role:"button","aria-label":P?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},U,E)},i.buttonHandleKeyUp=function(p){p.preventDefault()},i.buttonHandleKeyDown=function(p){var y=Zs(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,S=y.activeElement;I&&I===S&&p.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:ea}):i.internalSetTimeout(function(){return i.toggleMenu({type:ea})})},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:Ud})}})},i.getLabelProps=function(p){return pe({htmlFor:i.inputId,id:i.labelId},p)},i.getInputProps=function(p){var y=p===void 0?{}:p,I=y.onKeyDown,S=y.onBlur,T=y.onChange,A=y.onInput;y.onChangeText;var E=Sn(y,qI),R,P={};R="onChange";var M=i.getState(),U=M.inputValue,k=M.isOpen,j=M.highlightedIndex;if(!E.disabled){var ae;P=(ae={},ae[R]=We(T,A,i.inputHandleChange),ae.onKeyDown=We(I,i.inputHandleKeyDown),ae.onBlur=We(S,i.inputHandleBlur),ae)}return pe({"aria-autocomplete":"list","aria-activedescendant":k&&typeof j=="number"&&j>=0?i.getItemId(j):void 0,"aria-controls":k?i.menuId:void 0,"aria-labelledby":E&&E["aria-label"]?void 0:i.labelId,autoComplete:"off",value:U,id:i.inputId},P,E)},i.inputHandleKeyDown=function(p){var y=Zs(p);y&&i.inputKeyDownHandlers[y]&&i.inputKeyDownHandlers[y].call(i,p)},i.inputHandleChange=function(p){i.internalSetState({type:Kd,isOpen:!0,inputValue:p.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var p;if(!(i.isMouseDown||!i.props.environment)){var y=i.props.environment.document.activeElement,I=(y==null||(p=y.dataset)==null?void 0:p.toggle)&&i._rootNode&&i._rootNode.contains(y);I||i.reset({type:Ld})}})},i.menuRef=function(p){i._menuNode=p},i.getMenuProps=function(p,y){var I,S=p===void 0?{}:p,T=S.refKey,A=T===void 0?"ref":T,E=S.ref,R=Sn(S,VI),P=y===void 0?{}:y,M=P.suppressRefError,U=M===void 0?!1:M;return i.getMenuProps.called=!0,i.getMenuProps.refKey=A,i.getMenuProps.suppressRefError=U,pe((I={},I[A]=Dr(E,i.menuRef),I.role="listbox",I["aria-labelledby"]=R&&R["aria-label"]?void 0:i.labelId,I.id=i.menuId,I),R)},i.getItemProps=function(p){var y,I=p===void 0?{}:p,S=I.onMouseMove,T=I.onMouseDown,A=I.onClick;I.onPress;var E=I.index,R=I.item,P=R===void 0?process.env.NODE_ENV==="production"?void 0:DI("getItemProps","item"):R,M=Sn(I,HI);E===void 0?(i.items.push(P),E=i.items.indexOf(P)):i.items[E]=P;var U="onClick",k=A,j=(y={onMouseMove:We(S,function(){E!==i.getState().highlightedIndex&&(i.setHighlightedIndex(E,{type:Pd}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:We(T,function(re){re.preventDefault()})},y[U]=We(k,function(){i.selectItemAtIndex(E,{type:jd})}),y),ae=M.disabled?{onMouseDown:j.onMouseDown}:j;return pe({id:i.getItemId(E),role:"option","aria-selected":i.getState().highlightedIndex===E},ae,M)},i.clearItems=function(){i.items=[]},i.reset=function(p,y){p===void 0&&(p={}),p=co(p),i.internalSetState(function(I){var S=I.selectedItem;return pe({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(S)},p)},y)},i.toggleMenu=function(p,y){p===void 0&&(p={}),p=co(p),i.internalSetState(function(I){var S=I.isOpen;return pe({isOpen:!S},S&&{highlightedIndex:i.props.defaultHighlightedIndex},p)},function(){var I=i.getState(),S=I.isOpen,T=I.highlightedIndex;S&&i.getItemCount()>0&&typeof T=="number"&&i.setHighlightedIndex(T,p),cu(y)()})},i.openMenu=function(p){i.internalSetState({isOpen:!0},p)},i.closeMenu=function(p){i.internalSetState({isOpen:!1},p)},i.updateStatus=Ra(function(){var p;if((p=i.props)!=null&&(p=p.environment)!=null&&p.document){var y=i.getState(),I=i.items[y.highlightedIndex],S=i.getItemCount(),T=i.props.getA11yStatusMessage(pe({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:S,highlightedItem:I},y));i.previousResultCount=S,Td(T,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,f=c===void 0?a:c,d=s.defaultIsOpen,l=s.initialIsOpen,h=l===void 0?d:l,m=s.initialInputValue,g=m===void 0?"":m,w=s.initialSelectedItem,v=w===void 0?null:w,x=i.getState({highlightedIndex:f,isOpen:h,inputValue:g,selectedItem:v});return x.selectedItem!=null&&i.props.initialInputValue===void 0&&(x.inputValue=i.props.itemToString(x.selectedItem)),i.state=x,i}vI(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(i){clearTimeout(i)}),this.timeoutIds=[]},r.getState=function(i){return i===void 0&&(i=this.state),No(i,this.props)},r.getItemCount=function(){var i=this.items.length;return this.itemCount!=null?i=this.itemCount:this.props.itemCount!==void 0&&(i=this.props.itemCount),i},r.getItemNodeFromIndex=function(i){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(i)):null},r.scrollHighlightedItemIntoView=function(){{var i=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(i,this._menuNode)}},r.moveHighlightedIndex=function(i,s){var a=this.getItemCount(),c=this.getState(),f=c.highlightedIndex;if(a>0){var d=dr(f,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,f=i.isOpen,d=this.props.itemToString,l=this.id,h=this.getRootProps,m=this.getToggleButtonProps,g=this.getLabelProps,w=this.getMenuProps,v=this.getInputProps,x=this.getItemProps,p=this.openMenu,y=this.closeMenu,I=this.toggleMenu,S=this.selectItem,T=this.selectItemAtIndex,A=this.selectHighlightedItem,E=this.setHighlightedIndex,R=this.clearSelection,P=this.clearItems,M=this.reset,U=this.setItemCount,k=this.unsetItemCount,j=this.internalSetState;return{getRootProps:h,getToggleButtonProps:m,getLabelProps:g,getMenuProps:w,getInputProps:v,getItemProps:x,reset:M,openMenu:p,closeMenu:y,toggleMenu:I,selectItem:S,selectItemAtIndex:T,selectHighlightedItem:A,setHighlightedIndex:E,clearSelection:R,clearItems:P,setItemCount:U,unsetItemCount:k,setState:j,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&&du(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=Ao(m.target,[i._rootNode,i._menuNode],i.props.environment);!g&&i.getState().isOpen&&i.reset({type:Rd},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},f=function(){i.isTouchMove=!0},d=function(m){var g=Ao(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!g&&i.getState().isOpen&&i.reset({type:Vd},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},l=this.props.environment;l.addEventListener("mousedown",s),l.addEventListener("mouseup",a),l.addEventListener("touchstart",c),l.addEventListener("touchmove",f),l.addEventListener("touchend",d),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),l.removeEventListener("mousedown",s),l.removeEventListener("mouseup",a),l.removeEventListener("touchstart",c),l.removeEventListener("touchmove",f),l.removeEventListener("touchend",d)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,f=s.highlightedIndex===void 0?i:s,d=f.highlightedIndex,l=c&&this.getState().isOpen&&!i.isOpen,h=c!==d;return l||h},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(Pa(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&du(this._menuNode,this.getMenuProps)),To(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:qd,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=lu(this.props.children,_t);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var s=lu(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&&JI(s,this.getRootProps),s;if(Ed(s))return b.cloneElement(s,this.getRootProps(_d(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:FI,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&kI(n)&&!n.hasOwnProperty("toString")&&console.warn("downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.","The object that was passed:",n),String(n))},onStateChange:_t,onInputValueChange:_t,onUserAction:_t,onChange:_t,onSelect:_t,onOuterClick:_t,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:xd},e.stateChangeTypes=KI,e}();process.env.NODE_ENV!=="production"&&(BI.propTypes={children:H.func,defaultHighlightedIndex:H.number,defaultIsOpen:H.bool,initialHighlightedIndex:H.number,initialSelectedItem:H.any,initialInputValue:H.string,initialIsOpen:H.bool,getA11yStatusMessage:H.func,itemToString:H.func,onChange:H.func,onSelect:H.func,onStateChange:H.func,onInputValueChange:H.func,onUserAction:H.func,onOuterClick:H.func,selectedItemChanged:H.func,stateReducer:H.func,itemCount:H.number,id:H.string,environment:H.shape({addEventListener:H.func.isRequired,removeEventListener:H.func.isRequired,document:H.shape({createElement:H.func.isRequired,getElementById:H.func.isRequired,activeElement:H.any.isRequired,body:H.any.isRequired}).isRequired,Node:H.func.isRequired}),suppressRefError:H.bool,scrollIntoView:H.func,selectedItem:H.any,isOpen:H.bool,inputValue:H.string,highlightedIndex:H.number,labelId:H.string,inputId:H.string,menuId:H.string,getItemId:H.func});function du(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 JI(e,t){var n=t.refKey,r=n!=="ref",o=!Ed(e);o&&!r&&!ou.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+'"'),!ou.isForwardRef(e)&&!_d(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Hd={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function WI(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){zI(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(pe({type:o},i))}function zI(e,t,n,r){var o=t.props,i=t.type,s="on"+Fa(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](pe({type:i},r))}function QI(e,t){return t.changes}var fu=Ra(function(e,t){Td(e,t)},200),GI=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?b.useLayoutEffect:b.useEffect,XI="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-"+Od():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 YI(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 Fa(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Bd(e){var t=b.useRef(e);return t.current=e,t}function ZI(e,t,n,r){var o=b.useRef(),i=b.useRef(),s=b.useCallback(function(m,g){i.current=g,m=No(m,g.props);var w=e(m,g),v=g.props.stateReducer(m,pe({},g,{changes:w}));return v},[e]),a=b.useReducer(s,t,n),c=a[0],f=a[1],d=Bd(t),l=b.useCallback(function(m){return f(pe({props:d.current},m))},[d]),h=i.current;return b.useEffect(function(){var m=No(o.current,h==null?void 0:h.props),g=h&&o.current&&!r(m,c);g&&WI(h,m,c),o.current=c},[c,h,r]),[c,l]}var Ii={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:QI,scrollIntoView:xd,environment:typeof window>"u"?void 0:window};function zn(e,t,n){n===void 0&&(n=Hd);var r=e["default"+Fa(t)];return r!==void 0?r:n[t]}function Ci(e,t,n){n===void 0&&(n=Hd);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Fa(t)];return o!==void 0?o:zn(e,t,n)}function eC(e){var t=Ci(e,"selectedItem"),n=Ci(e,"isOpen"),r=oC(e),o=Ci(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(i){return e.itemToKey(i)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:o}}function Si(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,f=t.highlightedIndex;return r.length===0?-1:o!==void 0&&f===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:c?r.findIndex(function(d){return a(c)===a(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function tC(e,t,n){var r=b.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return b.useEffect(function(){if(!e)return _t;var o=n.map(function(d){return d.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,Ao(d.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function f(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!Ao(d.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",f),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",f)}},[n,e,t]),r.current}var Jd=function(){return _t};process.env.NODE_ENV!=="production"&&(Jd=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 nC(e,t,n,r){r===void 0&&(r={});var o=r.document,i=Jo();b.useEffect(function(){if(!(!e||i||!o)){var s=e(t);fu(s,o)}},n),b.useEffect(function(){return function(){fu.cancel(),LI(o)}},[o])}function rC(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 GI(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Wd=_t;process.env.NODE_ENV!=="production"&&(Wd=function(t){var n=t.props,r=t.state,o=b.useRef(n),i=Jo();b.useEffect(function(){i||(Pa(r,o.current,n),o.current=n)},[r,n,i])});function pu(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return pe({isOpen:!1,highlightedIndex:-1},o&&pe({selectedItem:e.items[t],isOpen:zn(e,"isOpen"),highlightedIndex:zn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function iC(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Jo(){var e=b.useRef(!0);return b.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function ta(e){var t=zn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function oC(e){var t=Ci(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var yo={environment:H.shape({addEventListener:H.func.isRequired,removeEventListener:H.func.isRequired,document:H.shape({createElement:H.func.isRequired,getElementById:H.func.isRequired,activeElement:H.any.isRequired,body:H.any.isRequired}).isRequired,Node:H.func.isRequired}),itemToString:H.func,itemToKey:H.func,stateReducer:H.func},zd=pe({},yo,{getA11yStatusMessage:H.func,highlightedIndex:H.number,defaultHighlightedIndex:H.number,initialHighlightedIndex:H.number,isOpen:H.bool,defaultIsOpen:H.bool,initialIsOpen:H.bool,selectedItem:H.any,initialSelectedItem:H.any,defaultSelectedItem:H.any,id:H.string,labelId:H.string,menuId:H.string,getItemId:H.func,toggleButtonId:H.string,onSelectedItemChange:H.func,onHighlightedIndexChange:H.func,onStateChange:H.func,onIsOpenChange:H.func,scrollIntoView:H.func});function sC(e,t,n){var r=t.type,o=t.props,i;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Si(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:Si(o,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:o.isItemDisabled(o.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:ta(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 pe({},e,i)}ei(ei({},zd),{items:H.array.isRequired,isItemDisabled:H.func});ei(ei({},Ii),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var Da=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Ma=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,ka=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,ja=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,La=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Ka=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,$a=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Ua=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,qa=process.env.NODE_ENV!=="production"?"__input_change__":8,Ro=process.env.NODE_ENV!=="production"?"__input_blur__":9,Va=process.env.NODE_ENV!=="production"?"__input_click__":10,Qd=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Gd=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,Ha=process.env.NODE_ENV!=="production"?"__item_click__":13,Xd=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Yd=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Zd=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,ef=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,tf=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,Ba=process.env.NODE_ENV!=="production"?"__function_select_item__":19,nf=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,rf=process.env.NODE_ENV!=="production"?"__function_reset__":21,Ja=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,of=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:Ja,FunctionCloseMenu:ef,FunctionOpenMenu:Zd,FunctionReset:rf,FunctionSelectItem:Ba,FunctionSetHighlightedIndex:tf,FunctionSetInputValue:nf,FunctionToggleMenu:Yd,InputBlur:Ro,InputChange:qa,InputClick:Va,InputKeyDownArrowDown:Da,InputKeyDownArrowUp:Ma,InputKeyDownEnd:La,InputKeyDownEnter:Ua,InputKeyDownEscape:ka,InputKeyDownHome:ja,InputKeyDownPageDown:$a,InputKeyDownPageUp:Ka,ItemClick:Ha,ItemMouseMove:Gd,MenuMouseLeave:Qd,ToggleButtonClick:Xd});function aC(e){var t=eC(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)),pe({},t,{inputValue:r})}var cC=pe({},zd,{items:H.array.isRequired,isItemDisabled:H.func,inputValue:H.string,defaultInputValue:H.string,initialInputValue:H.string,inputId:H.string,onInputValueChange:H.func});function uC(e,t,n,r){var o=b.useRef(),i=ZI(e,t,n,r),s=i[0],a=i[1],c=Jo();return b.useEffect(function(){if(To(t,"selectedItem")){if(!c){var f=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);f&&a({type:Ja,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[No(s,t),a]}var sf=_t;process.env.NODE_ENV!=="production"&&(sf=function(t,n){H.checkPropTypes(cC,t,"prop",n.name)});var lC=pe({},Ii,{isItemDisabled:function(){return!1}});function dC(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case Ha:s={isOpen:zn(o,"isOpen"),highlightedIndex:ta(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Da:e.isOpen?s={highlightedIndex:dr(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:Si(o,e,1),isOpen:o.items.length>=0};break;case Ma:e.isOpen?i?s=pu(o,e.highlightedIndex):s={highlightedIndex:dr(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:Si(o,e,-1),isOpen:o.items.length>=0};break;case Ua:s=pu(o,e.highlightedIndex);break;case ka:s=pe({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Ka:s={highlightedIndex:dr(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case $a:s={highlightedIndex:dr(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case ja:s={highlightedIndex:ti(0,!1,o.items,o.isItemDisabled)};break;case La:s={highlightedIndex:ti(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case Ro:s=pe({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 qa:s={isOpen:!0,highlightedIndex:ta(o),inputValue:t.inputValue};break;case Va:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Si(o,e,0)};break;case Ba:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case Ja:s={inputValue:t.inputValue};break;default:return sC(e,t,of)}return pe({},e,s)}var fC=["onMouseLeave","refKey","ref"],pC=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],hC=["onClick","onPress","refKey","ref"],mC=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Wa.stateChangeTypes=of;function Wa(e){e===void 0&&(e={}),sf(e,Wa);var t=pe({},lC,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=uC(dC,t,aC,iC),a=s[0],c=s[1],f=a.isOpen,d=a.highlightedIndex,l=a.selectedItem,h=a.inputValue,m=b.useRef(null),g=b.useRef({}),w=b.useRef(null),v=b.useRef(null),x=Jo(),p=XI(t),y=b.useRef(),I=Bd({state:a,props:t}),S=b.useCallback(function(J){return g.current[p.getItemId(J)]},[p]);nC(i,a,[f,d,l,h],o);var T=rC({menuElement:m.current,highlightedIndex:d,isOpen:f,itemRefs:g,scrollIntoView:r,getItemNodeFromIndex:S});Wd({props:t,state:a}),b.useEffect(function(){var J=Ci(t,"isOpen");J&&w.current&&w.current.focus()},[]),b.useEffect(function(){x||(y.current=n.length)});var A=tC(o,b.useCallback(function(){I.current.state.isOpen&&c({type:Ro,selectItem:!1})},[c,I]),b.useMemo(function(){return[m,v,w]},[m.current,v.current,w.current])),E=Jd("getInputProps","getMenuProps");b.useEffect(function(){f||(g.current={})},[f]),b.useEffect(function(){var J;!f||!(o!=null&&o.document)||!(w!=null&&(J=w.current)!=null&&J.focus)||o.document.activeElement!==w.current&&w.current.focus()},[f,o]);var R=b.useMemo(function(){return{ArrowDown:function(B){B.preventDefault(),c({type:Da,altKey:B.altKey})},ArrowUp:function(B){B.preventDefault(),c({type:Ma,altKey:B.altKey})},Home:function(B){I.current.state.isOpen&&(B.preventDefault(),c({type:ja}))},End:function(B){I.current.state.isOpen&&(B.preventDefault(),c({type:La}))},Escape:function(B){var V=I.current.state;(V.isOpen||V.inputValue||V.selectedItem||V.highlightedIndex>-1)&&(B.preventDefault(),c({type:ka}))},Enter:function(B){var V=I.current.state;!V.isOpen||B.which===229||(B.preventDefault(),c({type:Ua}))},PageUp:function(B){I.current.state.isOpen&&(B.preventDefault(),c({type:Ka}))},PageDown:function(B){I.current.state.isOpen&&(B.preventDefault(),c({type:$a}))}}},[c,I]),P=b.useCallback(function(J){return pe({id:p.labelId,htmlFor:p.inputId},J)},[p]),M=b.useCallback(function(J,B){var V,L=J===void 0?{}:J,G=L.onMouseLeave,Z=L.refKey,Y=Z===void 0?"ref":Z,ee=L.ref,te=Sn(L,fC),ue=B===void 0?{}:B,K=ue.suppressRefError,we=K===void 0?!1:K;return E("getMenuProps",we,Y,m),pe((V={},V[Y]=Dr(ee,function(W){m.current=W}),V.id=p.menuId,V.role="listbox",V["aria-labelledby"]=te&&te["aria-label"]?void 0:""+p.labelId,V.onMouseLeave=We(G,function(){c({type:Qd})}),V),te)},[c,E,p]),U=b.useCallback(function(J){var B,V,L=J===void 0?{}:J,G=L.item,Z=L.index,Y=L.refKey,ee=Y===void 0?"ref":Y,te=L.ref,ue=L.onMouseMove,K=L.onMouseDown,we=L.onClick;L.onPress;var W=L.disabled,ot=Sn(L,pC);W!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var _e=I.current,mt=_e.props,Je=_e.state,gt=YI(G,Z,mt.items,"Pass either item or index to getItemProps!"),Ee=gt[0],Ze=gt[1],xt=mt.isItemDisabled(Ee,Ze),$t="onClick",Rt=we,lt=function(){A.isTouchEnd||Ze===Je.highlightedIndex||(T.current=!1,c({type:Gd,index:Ze,disabled:xt}))},st=function(){c({type:Ha,index:Ze})},Me=function(Pt){return Pt.preventDefault()};return pe((B={},B[ee]=Dr(te,function(Ue){Ue&&(g.current[p.getItemId(Ze)]=Ue)}),B["aria-disabled"]=xt,B["aria-selected"]=Ze===Je.highlightedIndex,B.id=p.getItemId(Ze),B.role="option",B),!xt&&(V={},V[$t]=We(Rt,st),V),{onMouseMove:We(ue,lt),onMouseDown:We(K,Me)},ot)},[c,p,I,A,T]),k=b.useCallback(function(J){var B,V=J===void 0?{}:J,L=V.onClick;V.onPress;var G=V.refKey,Z=G===void 0?"ref":G,Y=V.ref,ee=Sn(V,hC),te=I.current.state,ue=function(){c({type:Xd})};return pe((B={},B[Z]=Dr(Y,function(K){v.current=K}),B["aria-controls"]=p.menuId,B["aria-expanded"]=te.isOpen,B.id=p.toggleButtonId,B.tabIndex=-1,B),!ee.disabled&&pe({},{onClick:We(L,ue)}),ee)},[c,I,p]),j=b.useCallback(function(J,B){var V,L=J===void 0?{}:J,G=L.onKeyDown,Z=L.onChange,Y=L.onInput,ee=L.onBlur;L.onChangeText;var te=L.onClick,ue=L.refKey,K=ue===void 0?"ref":ue,we=L.ref,W=Sn(L,mC),ot=B===void 0?{}:B,_e=ot.suppressRefError,mt=_e===void 0?!1:_e;E("getInputProps",mt,K,w);var Je=I.current.state,gt=function(Me){var Ue=Zs(Me);Ue&&R[Ue]&&R[Ue](Me)},Ee=function(Me){c({type:qa,inputValue:Me.target.value})},Ze=function(Me){if(o!=null&&o.document&&Je.isOpen&&!A.isMouseDown){var Ue=Me.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:Ro,selectItem:!Ue})}},xt=function(){c({type:Va})},$t="onChange",Rt={};if(!W.disabled){var lt;Rt=(lt={},lt[$t]=We(Z,Y,Ee),lt.onKeyDown=We(G,gt),lt.onBlur=We(ee,Ze),lt.onClick=We(te,xt),lt)}return pe((V={},V[K]=Dr(we,function(st){w.current=st}),V["aria-activedescendant"]=Je.isOpen&&Je.highlightedIndex>-1?p.getItemId(Je.highlightedIndex):"",V["aria-autocomplete"]="list",V["aria-controls"]=p.menuId,V["aria-expanded"]=Je.isOpen,V["aria-labelledby"]=W&&W["aria-label"]?void 0:p.labelId,V.autoComplete="off",V.id=p.inputId,V.role="combobox",V.value=Je.inputValue,V),Rt,W)},[c,p,o,R,I,A,E]),ae=b.useCallback(function(){c({type:Yd})},[c]),re=b.useCallback(function(){c({type:ef})},[c]),ge=b.useCallback(function(){c({type:Zd})},[c]),me=b.useCallback(function(J){c({type:tf,highlightedIndex:J})},[c]),Oe=b.useCallback(function(J){c({type:Ba,selectedItem:J})},[c]),F=b.useCallback(function(J){c({type:nf,inputValue:J})},[c]),q=b.useCallback(function(){c({type:rf})},[c]);return{getItemProps:U,getLabelProps:P,getMenuProps:M,getInputProps:j,getToggleButtonProps:k,toggleMenu:ae,openMenu:ge,closeMenu:re,setHighlightedIndex:me,setInputValue:F,selectItem:Oe,reset:q,highlightedIndex:d,isOpen:f,selectedItem:l,inputValue:h}}yo.stateReducer,yo.itemToKey,yo.environment,H.array,H.array,H.array,H.func,H.number,H.number,H.number,H.func,H.func,H.string,H.string;Ii.itemToKey,Ii.stateReducer,Ii.environment;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;const gC="_comboboxContainer_1lcc8_1",yC="_inputContainer_1lcc8_12",vC="_input_1lcc8_12",wC="_toggleButton_1lcc8_33",bC="_menu_1lcc8_39",IC="_menuBottom_1lcc8_55",CC="_menuTop_1lcc8_61",SC="_menuItem_1lcc8_66",xC="_highlighted_1lcc8_73",OC="_selected_1lcc8_77",EC="_hidden_1lcc8_81",Ht={comboboxContainer:gC,inputContainer:yC,input:vC,toggleButton:wC,menu:bC,menuBottom:IC,menuTop:CC,menuItem:SC,highlighted:xC,selected:OC,hidden:EC};function _C(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function af({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,c]=b.useState(e),f=b.useRef(null);b.useEffect(()=>c(e),[e]);const d=b.useCallback(A=>{(A==null?void 0:A.length)>0?c(e.filter(_C(A))):c(e)},[e]),{isOpen:l,getToggleButtonProps:h,getMenuProps:m,getInputProps:g,highlightedIndex:w,getItemProps:v,setInputValue:x,selectedItem:p}=Wa({items:a,selectedItem:t?e.find(A=>A.value===t):null,itemToString:A=>(A==null?void 0:A.label)||"",onInputValueChange:({inputValue:A})=>d(A),onSelectedItemChange:({selectedItem:A})=>{var E;n(A),(E=f.current)==null||E.blur()}}),y=()=>{x(""),c(e)},I=()=>y(),S=b.useMemo(()=>{var A;return(A=e.find(E=>E.value===t))==null?void 0:A.label},[e,t]),T=()=>{t&&S&&t!==(p==null?void 0:p.value)&&x(S||"")};return u.jsxs("div",{style:{position:"relative",...i},children:[u.jsx("div",{className:Ht.comboboxContainer,children:u.jsxs("div",{className:Ht.inputContainer,children:[u.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:Ht.input,...g({onFocus:I,onBlur:T,ref:f})}),u.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:Ht.toggleButton,type:"button",...h(),children:l?u.jsx(u.Fragment,{children:"↑"}):u.jsx(u.Fragment,{children:"↓"})})]})}),u.jsx("ul",{className:`${Ht.menu} ${l&&e.length?"":Ht.hidden} ${s==="top"?Ht.menuTop:Ht.menuBottom}`,...m(),children:l&&a.map((A,E)=>u.jsx("li",{className:`${Ht.menuItem} ${w===E?Ht.highlighted:""} ${t===(A==null?void 0:A.value)?Ht.selected:""}`,...v({item:A,index:E}),children:u.jsx("span",{children:A.label})},A.id))})]})}const ni=Math.min,br=Math.max,Po=Math.round,uo=Math.floor,Gn=e=>({x:e,y:e}),NC={left:"right",right:"left",bottom:"top",top:"bottom"},TC={start:"end",end:"start"};function na(e,t,n){return br(e,ni(t,n))}function Ki(e,t){return typeof e=="function"?e(t):e}function Er(e){return e.split("-")[0]}function $i(e){return e.split("-")[1]}function cf(e){return e==="x"?"y":"x"}function za(e){return e==="y"?"height":"width"}function ri(e){return["top","bottom"].includes(Er(e))?"y":"x"}function Qa(e){return cf(ri(e))}function AC(e,t,n){n===void 0&&(n=!1);const r=$i(e),o=Qa(e),i=za(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Fo(s)),[s,Fo(s)]}function RC(e){const t=Fo(e);return[ra(e),t,ra(t)]}function ra(e){return e.replace(/start|end/g,t=>TC[t])}function PC(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 FC(e,t,n,r){const o=$i(e);let i=PC(Er(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(ra)))),i}function Fo(e){return e.replace(/left|right|bottom|top/g,t=>NC[t])}function DC(e){return{top:0,right:0,bottom:0,left:0,...e}}function uf(e){return typeof e!="number"?DC(e):{top:e,right:e,bottom:e,left:e}}function Do(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function hu(e,t,n){let{reference:r,floating:o}=e;const i=ri(t),s=Qa(t),a=za(s),c=Er(t),f=i==="y",d=r.x+r.width/2-o.width/2,l=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let 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($i(t)){case"start":m[s]-=h*(n&&f?-1:1);break;case"end":m[s]+=h*(n&&f?-1:1);break}return m}const MC=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}=hu(f,r,c),h=r,m={},g=0;for(let w=0;w<a.length;w++){const{name:v,fn:x}=a[w],{x:p,y,data:I,reset:S}=await x({x:d,y:l,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:f,platform:s,elements:{reference:e,floating:t}});d=p??d,l=y??l,m={...m,[v]:{...m[v],...I}},S&&g<=50&&(g++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(f=S.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:d,y:l}=hu(f,h,c)),w=-1)}return{x:d,y:l,placement:h,strategy:o,middlewareData:m}};async function lf(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:f="clippingAncestors",rootBoundary:d="viewport",elementContext:l="floating",altBoundary:h=!1,padding:m=0}=Ki(t,e),g=uf(m),v=a[h?l==="floating"?"reference":"floating":l],x=Do(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})),p=l==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),I=await(i.isElement==null?void 0:i.isElement(y))?await(i.getScale==null?void 0:i.getScale(y))||{x:1,y:1}:{x:1,y:1},S=Do(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:p,offsetParent:y,strategy:c}):p);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 kC=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:c}=t,{element:f,padding:d=0}=Ki(e,t)||{};if(f==null)return{};const l=uf(d),h={x:n,y:r},m=Qa(o),g=za(m),w=await s.getDimensions(f),v=m==="y",x=v?"top":"left",p=v?"bottom":"right",y=v?"clientHeight":"clientWidth",I=i.reference[g]+i.reference[m]-h[m]-i.floating[g],S=h[m]-i.reference[m],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let A=T?T[y]:0;(!A||!await(s.isElement==null?void 0:s.isElement(T)))&&(A=a.floating[y]||i.floating[g]);const E=I/2-S/2,R=A/2-w[g]/2-1,P=ni(l[x],R),M=ni(l[p],R),U=P,k=A-w[g]-M,j=A/2-w[g]/2+E,ae=na(U,j,k),re=!c.arrow&&$i(o)!=null&&j!==ae&&i.reference[g]/2-(j<U?P:M)-w[g]/2<0,ge=re?j<U?j-U:j-k:0;return{[m]:h[m]+ge,data:{[m]:ae,centerOffset:j-ae-ge,...re&&{alignmentOffset:ge}},reset:re}}}),jC=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:f}=t,{mainAxis:d=!0,crossAxis:l=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:w=!0,...v}=Ki(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=Er(o),p=ri(a),y=Er(a)===a,I=await(c.isRTL==null?void 0:c.isRTL(f.floating)),S=h||(y||!w?[Fo(a)]:RC(a)),T=g!=="none";!h&&T&&S.push(...FC(a,w,g,I));const A=[a,...S],E=await lf(t,v),R=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&R.push(E[x]),l){const j=AC(o,s,I);R.push(E[j[0]],E[j[1]])}if(P=[...P,{placement:o,overflows:R}],!R.every(j=>j<=0)){var M,U;const j=(((M=i.flip)==null?void 0:M.index)||0)+1,ae=A[j];if(ae)return{data:{index:j,overflows:P},reset:{placement:ae}};let re=(U=P.filter(ge=>ge.overflows[0]<=0).sort((ge,me)=>ge.overflows[1]-me.overflows[1])[0])==null?void 0:U.placement;if(!re)switch(m){case"bestFit":{var k;const ge=(k=P.filter(me=>{if(T){const Oe=ri(me.placement);return Oe===p||Oe==="y"}return!0}).map(me=>[me.placement,me.overflows.filter(Oe=>Oe>0).reduce((Oe,F)=>Oe+F,0)]).sort((me,Oe)=>me[1]-Oe[1])[0])==null?void 0:k[0];ge&&(re=ge);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}};async function LC(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Er(n),a=$i(n),c=ri(n)==="y",f=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,l=Ki(t,e);let{mainAxis:h,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:h*f}:{x:h*f,y:m*d}}const KC=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 LC(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}}}}},$C=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:p}=v;return{x,y:p}}},...c}=Ki(e,t),f={x:n,y:r},d=await lf(t,c),l=ri(Er(o)),h=cf(l);let m=f[h],g=f[l];if(i){const v=h==="y"?"top":"left",x=h==="y"?"bottom":"right",p=m+d[v],y=m-d[x];m=na(p,m,y)}if(s){const v=l==="y"?"top":"left",x=l==="y"?"bottom":"right",p=g+d[v],y=g-d[x];g=na(p,g,y)}const w=a.fn({...t,[h]:m,[l]:g});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:i,[l]:s}}}}}};function Wo(){return typeof window<"u"}function fi(e){return df(e)?(e.nodeName||"").toLowerCase():"#document"}function Nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dn(e){var t;return(t=(df(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function df(e){return Wo()?e instanceof Node||e instanceof Nt(e).Node:!1}function Gt(e){return Wo()?e instanceof Element||e instanceof Nt(e).Element:!1}function cn(e){return Wo()?e instanceof HTMLElement||e instanceof Nt(e).HTMLElement:!1}function mu(e){return!Wo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Nt(e).ShadowRoot}function Ui(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 UC(e){return["table","td","th"].includes(fi(e))}function zo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Ga(e){const t=Xa(),n=Gt(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=Xn(e);for(;cn(t)&&!ii(t);){if(Ga(t))return t;if(zo(t))return null;t=Xn(t)}return null}function Xa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ii(e){return["html","body","#document"].includes(fi(e))}function Xt(e){return Nt(e).getComputedStyle(e)}function Qo(e){return Gt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xn(e){if(fi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||mu(e)&&e.host||dn(e);return mu(t)?t.host:t}function ff(e){const t=Xn(e);return ii(t)?e.ownerDocument?e.ownerDocument.body:e.body:cn(t)&&Ui(t)?t:ff(t)}function Ti(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ff(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Nt(o);if(i){const a=ia(s);return t.concat(s,s.visualViewport||[],Ui(o)?o:[],a&&n?Ti(a):[])}return t.concat(o,Ti(o,[],n))}function ia(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function pf(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=Po(n)!==i||Po(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Ya(e){return Gt(e)?e:e.contextElement}function kr(e){const t=Ya(e);if(!cn(t))return Gn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=pf(t);let s=(i?Po(n.width):n.width)/r,a=(i?Po(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const VC=Gn(0);function hf(e){const t=Nt(e);return!Xa()||!t.visualViewport?VC:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function HC(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Nt(e)?!1:t}function _r(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Ya(e);let s=Gn(1);t&&(r?Gt(r)&&(s=kr(r)):s=kr(e));const a=HC(i,n,r)?hf(i):Gn(0);let c=(o.left+a.x)/s.x,f=(o.top+a.y)/s.y,d=o.width/s.x,l=o.height/s.y;if(i){const h=Nt(i),m=r&&Gt(r)?Nt(r):r;let g=h,w=ia(g);for(;w&&r&&m!==g;){const v=kr(w),x=w.getBoundingClientRect(),p=Xt(w),y=x.left+(w.clientLeft+parseFloat(p.paddingLeft))*v.x,I=x.top+(w.clientTop+parseFloat(p.paddingTop))*v.y;c*=v.x,f*=v.y,d*=v.x,l*=v.y,c+=y,f+=I,g=Nt(w),w=ia(g)}}return Do({width:d,height:l,x:c,y:f})}function BC(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=dn(r),a=t?zo(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},f=Gn(1);const d=Gn(0),l=cn(r);if((l||!l&&!i)&&((fi(r)!=="body"||Ui(s))&&(c=Qo(r)),cn(r))){const h=_r(r);f=kr(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+d.x,y:n.y*f.y-c.scrollTop*f.y+d.y}}function JC(e){return Array.from(e.getClientRects())}function oa(e,t){const n=Qo(e).scrollLeft;return t?t.left+n:_r(dn(e)).left+n}function WC(e){const t=dn(e),n=Qo(e),r=e.ownerDocument.body,o=br(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=br(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+oa(e);const a=-n.scrollTop;return Xt(r).direction==="rtl"&&(s+=br(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function zC(e,t){const n=Nt(e),r=dn(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const f=Xa();(!f||f&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function QC(e,t){const n=_r(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=cn(e)?kr(e):Gn(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 gu(e,t,n){let r;if(t==="viewport")r=zC(e,n);else if(t==="document")r=WC(dn(e));else if(Gt(t))r=QC(t,n);else{const o=hf(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Do(r)}function mf(e,t){const n=Xn(e);return n===t||!Gt(n)||ii(n)?!1:Xt(n).position==="fixed"||mf(n,t)}function GC(e,t){const n=t.get(e);if(n)return n;let r=Ti(e,[],!1).filter(a=>Gt(a)&&fi(a)!=="body"),o=null;const i=Xt(e).position==="fixed";let s=i?Xn(e):e;for(;Gt(s)&&!ii(s);){const a=Xt(s),c=Ga(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Ui(s)&&!c&&mf(e,s))?r=r.filter(d=>d!==s):o=a,s=Xn(s)}return t.set(e,r),r}function XC(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?zo(t)?[]:GC(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((f,d)=>{const l=gu(t,d,o);return f.top=br(l.top,f.top),f.right=ni(l.right,f.right),f.bottom=ni(l.bottom,f.bottom),f.left=br(l.left,f.left),f},gu(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function YC(e){const{width:t,height:n}=pf(e);return{width:t,height:n}}function ZC(e,t,n){const r=cn(t),o=dn(t),i=n==="fixed",s=_r(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Gn(0);if(r||!r&&!i)if((fi(t)!=="body"||Ui(o))&&(a=Qo(t)),r){const m=_r(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&(c.x=oa(o));let f=0,d=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();d=m.top+a.scrollTop,f=m.left+a.scrollLeft-oa(o,m)}const l=s.left+a.scrollLeft-c.x-f,h=s.top+a.scrollTop-c.y-d;return{x:l,y:h,width:s.width,height:s.height}}function bs(e){return Xt(e).position==="static"}function yu(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 gf(e,t){const n=Nt(e);if(zo(e))return n;if(!cn(e)){let o=Xn(e);for(;o&&!ii(o);){if(Gt(o)&&!bs(o))return o;o=Xn(o)}return n}let r=yu(e,t);for(;r&&UC(r)&&bs(r);)r=yu(r,t);return r&&ii(r)&&bs(r)&&!Ga(r)?n:r||qC(e)||n}const eS=async function(e){const t=this.getOffsetParent||gf,n=this.getDimensions,r=await n(e.floating);return{reference:ZC(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function tS(e){return Xt(e).direction==="rtl"}const nS={convertOffsetParentRelativeRectToViewportRelativeRect:BC,getDocumentElement:dn,getClippingRect:XC,getOffsetParent:gf,getElementRects:eS,getClientRects:JC,getDimensions:YC,getScale:kr,isElement:Gt,isRTL:tS};function rS(e,t){let n=null,r;const o=dn(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const{left:f,top:d,width:l,height:h}=e.getBoundingClientRect();if(a||t(),!l||!h)return;const m=uo(d),g=uo(o.clientWidth-(f+l)),w=uo(o.clientHeight-(d+h)),v=uo(f),p={rootMargin:-m+"px "+-g+"px "+-w+"px "+-v+"px",threshold:br(0,ni(1,c))||1};let y=!0;function I(S){const T=S[0].intersectionRatio;if(T!==c){if(!y)return s();T?s(!1,T):r=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{n=new IntersectionObserver(I,{...p,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,p)}n.observe(e)}return s(!0),i}function iS(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=Ya(e),d=o||i?[...f?Ti(f):[],...Ti(t)]:[];d.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const l=f&&a?rS(f,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(x=>{let[p]=x;p&&p.target===f&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=m)==null||y.observe(t)})),n()}),f&&!c&&m.observe(f),m.observe(t));let g,w=c?_r(e):null;c&&v();function v(){const x=_r(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(p=>{o&&p.removeEventListener("scroll",n),i&&p.removeEventListener("resize",n)}),l==null||l(),(x=m)==null||x.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const oS=KC,sS=$C,aS=jC,cS=kC,vu=(e,t,n)=>{const r=new Map,o={platform:nS,...n},i={...o.platform,_c:r};return MC(e,t,{...o,platform:i})};/*
|
|
45
|
+
*/var gu;function eC(){return gu||(gu=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"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g=!1,w=!1,y=!1,x=!1,p=!1,v;v=Symbol.for("react.module.reference");function I(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===o||p||z===r||z===f||z===l||x||z===m||g||w||y||typeof z=="object"&&z!==null&&(z.$$typeof===h||z.$$typeof===d||z.$$typeof===i||z.$$typeof===s||z.$$typeof===c||z.$$typeof===v||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 l:return Ce;default:var lt=Ce&&Ce.$$typeof;switch(lt){case a:case s:case c:case h:case d:case i:return lt;default:return Ye}}case t:return Ye}}}var N=s,R=i,E=e,P=c,A=n,D=h,V=d,j=t,L=o,se=r,re=f,ge=l,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 $(z){return be||(be=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function J(z){return S(z)===s}function U(z){return S(z)===i}function q(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function K(z){return S(z)===c}function Q(z){return S(z)===n}function Z(z){return S(z)===h}function Y(z){return S(z)===d}function ee(z){return S(z)===t}function ne(z){return S(z)===o}function ce(z){return S(z)===r}function k(z){return S(z)===f}function ve(z){return S(z)===l}Te.ContextConsumer=N,Te.ContextProvider=R,Te.Element=E,Te.ForwardRef=P,Te.Fragment=A,Te.Lazy=D,Te.Memo=V,Te.Portal=j,Te.Profiler=L,Te.StrictMode=se,Te.Suspense=re,Te.SuspenseList=ge,Te.isAsyncMode=F,Te.isConcurrentMode=$,Te.isContextConsumer=J,Te.isContextProvider=U,Te.isElement=q,Te.isForwardRef=K,Te.isFragment=Q,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=S}()),Te}process.env.NODE_ENV==="production"?oa.exports=ZI():oa.exports=eC();var yu=oa.exports;const vu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,wu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Os=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return wu(n.overflowY,t)||wu(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},po=(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,tC=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},nC=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{inline:s,boundary:a,skipOverflowHiddenElements:c}=t,f=typeof a=="function"?a:j=>j!==a;if(!vu(e))throw new TypeError("Invalid target");const l=document.scrollingElement||document.documentElement,d=[];let h=e;for(;vu(h)&&f(h);){if(h=tC(h),h===l){d.push(h);break}h!=null&&h===document.body&&Os(h)&&!Os(document.documentElement)||h!=null&&Os(h,c)&&d.push(h)}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:y}=window,{height:x,width:p,top:v,right:I,bottom:S,left:N}=e.getBoundingClientRect(),{top:R,right:E,left:P}=(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 A=v-R,D=s==="center"?N+p/2-P+E:s==="end"?I+E:N-P;const V=[];for(let j=0;j<d.length;j++){const L=d[j],{height:se,width:re,top:ge,right:de,bottom:be,left:F}=L.getBoundingClientRect();if(v>=0&&N>=0&&S<=g&&I<=m&&v>=ge&&S<=be&&N>=F&&I<=de)return V;const $=getComputedStyle(L),J=parseInt($.borderLeftWidth,10),U=parseInt($.borderTopWidth,10),q=parseInt($.borderRightWidth,10),K=parseInt($.borderBottomWidth,10);let Q=0,Z=0;const Y="offsetWidth"in L?L.offsetWidth-L.clientWidth-J-q:0,ee="offsetHeight"in L?L.offsetHeight-L.clientHeight-U-K: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)Q=po(y,y+g,g,U,K,y+A,y+A+x,x),Z=s==="start"?D:s==="center"?D-m/2:s==="end"?D-m:po(w,w+m,m,J,q,w+D,w+D+p,p),Q=Math.max(0,Q+y),Z=Math.max(0,Z+w);else{Q=po(ge,be,se,U,K+ee,A,A+x,x),Z=s==="start"?D-F-J:s==="center"?D-(F+re/2)+Y/2:s==="end"?D-de+q+Y:po(F,de,re,J,q+Y,D,D+p,p);const{scrollLeft:k,scrollTop:ve}=L;Q=ce===0?0:Math.max(0,Math.min(ve+Q/ce,L.scrollHeight-se/ce+ee)),Z=ne===0?0:Math.max(0,Math.min(k+Z/ne,L.scrollWidth-re/ne+Y)),A+=ve-Q,D+=k-Z}V.push({el:L,top:Q,left:Z})}return V};var ii=function(){return ii=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},ii.apply(this,arguments)};var rC=0;function bu(e){return typeof e=="function"?e:Tt}function Tt(){}function Bd(e,t){if(e){var n=nC(e,{boundary:t});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function Iu(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function $a(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 Lr(){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 Jd(){return String(rC++)}function iC(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(n===1?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function Cu(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Wd(e){return typeof e.type=="string"}function zd(e){return e.props}function oC(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var sC=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function ho(e){e===void 0&&(e={});var t={};return sC.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Do(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=Mo(t,r)?t[r]:e[r],n},{})}function Mo(e,t){return e[t]!==void 0}function sa(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function aC(e){return Object.prototype.toString.call(e)==="[object Object]"}function mr(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=oi(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function oi(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?oi(t?i-1:0,t,n,r):-1}function ko(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(Iu(o,e,n)||r&&Iu(o,n.document.activeElement,n))})}var Va=Tt;process.env.NODE_ENV!=="production"&&(Va=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 cC=$a(function(e){Gd(e).textContent=""},500);function Gd(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 Qd(e,t){if(!(!e||!t)){var n=Gd(t);n.textContent=e,cC(t)}}function uC(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Xd=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Yd=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Zd=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,bo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Io=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,ef=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,tf=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,nf=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,rf=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,of=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,sf=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,af=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,cf=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,aa=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,uf=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,lf=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,df=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,lC=Object.freeze({__proto__:null,blurButton:uf,blurInput:sf,changeInput:af,clickButton:aa,clickItem:of,controlledPropUpdatedSelectedItem:lf,itemMouseEnter:Zd,keyDownArrowDown:Io,keyDownArrowUp:bo,keyDownEnd:rf,keyDownEnter:tf,keyDownEscape:ef,keyDownHome:nf,keyDownSpaceButton:cf,mouseUp:Yd,touchEnd:df,unknown:Xd}),dC=["refKey","ref"],fC=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],pC=["onKeyDown","onBlur","onChange","onInput","onChangeText"],hC=["refKey","ref"],mC=["onMouseMove","onMouseDown","onClick","onPress","index","item"],gC=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+Jd(),i.menuId=i.props.menuId||i.id+"-menu",i.labelId=i.props.labelId||i.id+"-label",i.inputId=i.props.inputId||i.id+"-input",i.getItemId=i.props.getItemId||function(p){return i.id+"-item-"+p},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(p,v){var I=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(S){return S!==I}),p()},v);i.timeoutIds.push(I)},i.setItemCount=function(p){i.itemCount=p},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(p,v){var I=i.getItemNodeFromIndex(v);return I&&I.hasAttribute("disabled")},i.setHighlightedIndex=function(p,v){p===void 0&&(p=i.props.defaultHighlightedIndex),v===void 0&&(v={}),v=ho(v),i.internalSetState(ye({highlightedIndex:p},v))},i.clearSelection=function(p){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},p)},i.selectItem=function(p,v,I){v=ho(v),i.internalSetState(ye({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:p,inputValue:i.props.itemToString(p)},v),I)},i.selectItemAtIndex=function(p,v,I){var S=i.items[p];S!=null&&i.selectItem(S,v,I)},i.selectHighlightedItem=function(p,v){return i.selectItemAtIndex(i.getState().highlightedIndex,p,v)},i.internalSetState=function(p,v){var I,S,N={},R=typeof p=="function";return!R&&p.hasOwnProperty("inputValue")&&i.props.onInputValueChange(p.inputValue,ye({},i.getStateAndHelpers(),p)),i.setState(function(E){var P;E=i.getState(E);var A=R?p(E):p;A=i.props.stateReducer(E,A),I=A.hasOwnProperty("selectedItem");var D={};return I&&A.selectedItem!==E.selectedItem&&(S=A.selectedItem),(P=A).type||(P.type=Xd),Object.keys(A).forEach(function(V){E[V]!==A[V]&&(N[V]=A[V]),V!=="type"&&(A[V],Mo(i.props,V)||(D[V]=A[V]))}),R&&A.hasOwnProperty("inputValue")&&i.props.onInputValueChange(A.inputValue,ye({},i.getStateAndHelpers(),A)),D},function(){bu(v)();var E=Object.keys(N).length>1;E&&i.props.onStateChange(N,i.getStateAndHelpers()),I&&i.props.onSelect(p.selectedItem,i.getStateAndHelpers()),S!==void 0&&i.props.onChange(S,i.getStateAndHelpers()),i.props.onUserAction(N,i.getStateAndHelpers())})},i.rootRef=function(p){return i._rootNode=p},i.getRootProps=function(p,v){var I,S=p===void 0?{}:p,N=S.refKey,R=N===void 0?"ref":N,E=S.ref,P=En(S,dC),A=v===void 0?{}:v,D=A.suppressRefError,V=D===void 0?!1:D;i.getRootProps.called=!0,i.getRootProps.refKey=R,i.getRootProps.suppressRefError=V;var j=i.getState(),L=j.isOpen;return ye((I={},I[R]=Lr(E,i.rootRef),I.role="combobox",I["aria-expanded"]=L,I["aria-haspopup"]="listbox",I["aria-owns"]=L?i.menuId:void 0,I["aria-labelledby"]=i.labelId,I),P)},i.keyDownHandlers={ArrowDown:function(v){var I=this;if(v.preventDefault(),this.getState().isOpen){var S=v.shiftKey?5:1;this.moveHighlightedIndex(S,{type:Io})}else this.internalSetState({isOpen:!0,type:Io},function(){var N=I.getItemCount();if(N>0){var R=I.getState(),E=R.highlightedIndex,P=mr(E,1,{length:N},I.isItemDisabled,!0);I.setHighlightedIndex(P,{type:Io})}})},ArrowUp:function(v){var I=this;if(v.preventDefault(),this.getState().isOpen){var S=v.shiftKey?-5:-1;this.moveHighlightedIndex(S,{type:bo})}else this.internalSetState({isOpen:!0,type:bo},function(){var N=I.getItemCount();if(N>0){var R=I.getState(),E=R.highlightedIndex,P=mr(E,-1,{length:N},I.isItemDisabled,!0);I.setHighlightedIndex(P,{type:bo})}})},Enter:function(v){if(v.which!==229){var I=this.getState(),S=I.isOpen,N=I.highlightedIndex;if(S&&N!=null){v.preventDefault();var R=this.items[N],E=this.getItemNodeFromIndex(N);if(R==null||E&&E.hasAttribute("disabled"))return;this.selectHighlightedItem({type:tf})}}},Escape:function(v){v.preventDefault(),this.reset(ye({type:ef},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=ye({},i.keyDownHandlers,{" ":function(v){v.preventDefault(),this.toggleMenu({type:cf})}}),i.inputKeyDownHandlers=ye({},i.keyDownHandlers,{Home:function(v){var I=this.getState(),S=I.isOpen;if(S){v.preventDefault();var N=this.getItemCount();if(!(N<=0||!S)){var R=oi(0,!1,{length:N},this.isItemDisabled);this.setHighlightedIndex(R,{type:nf})}}},End:function(v){var I=this.getState(),S=I.isOpen;if(S){v.preventDefault();var N=this.getItemCount();if(!(N<=0||!S)){var R=oi(N-1,!0,{length:N},this.isItemDisabled);this.setHighlightedIndex(R,{type:rf})}}}}),i.getToggleButtonProps=function(p){var v=p===void 0?{}:p,I=v.onClick;v.onPress;var S=v.onKeyDown,N=v.onKeyUp,R=v.onBlur,E=En(v,fC),P=i.getState(),A=P.isOpen,D={onClick:Qe(I,i.buttonHandleClick),onKeyDown:Qe(S,i.buttonHandleKeyDown),onKeyUp:Qe(N,i.buttonHandleKeyUp),onBlur:Qe(R,i.buttonHandleBlur)},V=E.disabled?{}:D;return ye({type:"button",role:"button","aria-label":A?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},V,E)},i.buttonHandleKeyUp=function(p){p.preventDefault()},i.buttonHandleKeyDown=function(p){var v=sa(p);i.buttonKeyDownHandlers[v]&&i.buttonKeyDownHandlers[v].call(i,p)},i.buttonHandleClick=function(p){if(p.preventDefault(),i.props.environment){var v=i.props.environment.document,I=v.body,S=v.activeElement;I&&I===S&&p.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:aa}):i.internalSetTimeout(function(){return i.toggleMenu({type:aa})})},i.buttonHandleBlur=function(p){var v=p.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var I=i.props.environment.document.activeElement;(I==null||I.id!==i.inputId)&&I!==v&&i.reset({type:uf})}})},i.getLabelProps=function(p){return ye({htmlFor:i.inputId,id:i.labelId},p)},i.getInputProps=function(p){var v=p===void 0?{}:p,I=v.onKeyDown,S=v.onBlur,N=v.onChange,R=v.onInput;v.onChangeText;var E=En(v,pC),P,A={};P="onChange";var D=i.getState(),V=D.inputValue,j=D.isOpen,L=D.highlightedIndex;if(!E.disabled){var se;A=(se={},se[P]=Qe(N,R,i.inputHandleChange),se.onKeyDown=Qe(I,i.inputHandleKeyDown),se.onBlur=Qe(S,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":E&&E["aria-label"]?void 0:i.labelId,autoComplete:"off",value:V,id:i.inputId},A,E)},i.inputHandleKeyDown=function(p){var v=sa(p);v&&i.inputKeyDownHandlers[v]&&i.inputKeyDownHandlers[v].call(i,p)},i.inputHandleChange=function(p){i.internalSetState({type:af,isOpen:!0,inputValue:p.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var p;if(!(i.isMouseDown||!i.props.environment)){var v=i.props.environment.document.activeElement,I=(v==null||(p=v.dataset)==null?void 0:p.toggle)&&i._rootNode&&i._rootNode.contains(v);I||i.reset({type:sf})}})},i.menuRef=function(p){i._menuNode=p},i.getMenuProps=function(p,v){var I,S=p===void 0?{}:p,N=S.refKey,R=N===void 0?"ref":N,E=S.ref,P=En(S,hC),A=v===void 0?{}:v,D=A.suppressRefError,V=D===void 0?!1:D;return i.getMenuProps.called=!0,i.getMenuProps.refKey=R,i.getMenuProps.suppressRefError=V,ye((I={},I[R]=Lr(E,i.menuRef),I.role="listbox",I["aria-labelledby"]=P&&P["aria-label"]?void 0:i.labelId,I.id=i.menuId,I),P)},i.getItemProps=function(p){var v,I=p===void 0?{}:p,S=I.onMouseMove,N=I.onMouseDown,R=I.onClick;I.onPress;var E=I.index,P=I.item,A=P===void 0?process.env.NODE_ENV==="production"?void 0:oC("getItemProps","item"):P,D=En(I,mC);E===void 0?(i.items.push(A),E=i.items.indexOf(A)):i.items[E]=A;var V="onClick",j=R,L=(v={onMouseMove:Qe(S,function(){E!==i.getState().highlightedIndex&&(i.setHighlightedIndex(E,{type:Zd}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:Qe(N,function(re){re.preventDefault()})},v[V]=Qe(j,function(){i.selectItemAtIndex(E,{type:of})}),v),se=D.disabled?{onMouseDown:L.onMouseDown}:L;return ye({id:i.getItemId(E),role:"option","aria-selected":i.getState().highlightedIndex===E},se,D)},i.clearItems=function(){i.items=[]},i.reset=function(p,v){p===void 0&&(p={}),p=ho(p),i.internalSetState(function(I){var S=I.selectedItem;return ye({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(S)},p)},v)},i.toggleMenu=function(p,v){p===void 0&&(p={}),p=ho(p),i.internalSetState(function(I){var S=I.isOpen;return ye({isOpen:!S},S&&{highlightedIndex:i.props.defaultHighlightedIndex},p)},function(){var I=i.getState(),S=I.isOpen,N=I.highlightedIndex;S&&i.getItemCount()>0&&typeof N=="number"&&i.setHighlightedIndex(N,p),bu(v)()})},i.openMenu=function(p){i.internalSetState({isOpen:!0},p)},i.closeMenu=function(p){i.internalSetState({isOpen:!1},p)},i.updateStatus=$a(function(){var p;if((p=i.props)!=null&&(p=p.environment)!=null&&p.document){var v=i.getState(),I=i.items[v.highlightedIndex],S=i.getItemCount(),N=i.props.getA11yStatusMessage(ye({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:S,highlightedItem:I},v));i.previousResultCount=S,Qd(N,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,f=c===void 0?a:c,l=s.defaultIsOpen,d=s.initialIsOpen,h=d===void 0?l:d,m=s.initialInputValue,g=m===void 0?"":m,w=s.initialSelectedItem,y=w===void 0?null:w,x=i.getState({highlightedIndex:f,isOpen:h,inputValue:g,selectedItem:y});return x.selectedItem!=null&&i.props.initialInputValue===void 0&&(x.inputValue=i.props.itemToString(x.selectedItem)),i.state=x,i}qI(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),Do(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 l=mr(f,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(l,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,f=i.isOpen,l=this.props.itemToString,d=this.id,h=this.getRootProps,m=this.getToggleButtonProps,g=this.getLabelProps,w=this.getMenuProps,y=this.getInputProps,x=this.getItemProps,p=this.openMenu,v=this.closeMenu,I=this.toggleMenu,S=this.selectItem,N=this.selectItemAtIndex,R=this.selectHighlightedItem,E=this.setHighlightedIndex,P=this.clearSelection,A=this.clearItems,D=this.reset,V=this.setItemCount,j=this.unsetItemCount,L=this.internalSetState;return{getRootProps:h,getToggleButtonProps:m,getLabelProps:g,getMenuProps:w,getInputProps:y,getItemProps:x,reset:D,openMenu:p,closeMenu:v,toggleMenu:I,selectItem:S,selectItemAtIndex:N,selectHighlightedItem:R,setHighlightedIndex:E,clearSelection:P,clearItems:A,setItemCount:V,unsetItemCount:j,setState:L,itemToString:l,id:d,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&&Su(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=ko(m.target,[i._rootNode,i._menuNode],i.props.environment);!g&&i.getState().isOpen&&i.reset({type:Yd},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},f=function(){i.isTouchMove=!0},l=function(m){var g=ko(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!g&&i.getState().isOpen&&i.reset({type:df},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},d=this.props.environment;d.addEventListener("mousedown",s),d.addEventListener("mouseup",a),d.addEventListener("touchstart",c),d.addEventListener("touchmove",f),d.addEventListener("touchend",l),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),d.removeEventListener("mousedown",s),d.removeEventListener("mouseup",a),d.removeEventListener("touchstart",c),d.removeEventListener("touchmove",f),d.removeEventListener("touchend",l)}}},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,l=f.highlightedIndex,d=c&&this.getState().isOpen&&!i.isOpen,h=c!==l;return d||h},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(Va(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Su(this._menuNode,this.getMenuProps)),Mo(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:lf,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,i)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var i=Cu(this.props.children,Tt);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var s=Cu(i(this.getStateAndHelpers()));if(!s)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&yC(s,this.getRootProps),s;if(Wd(s))return b.cloneElement(s,this.getRootProps(zd(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:iC,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&aC(n)&&!n.hasOwnProperty("toString")&&console.warn("downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.","The object that was passed:",n),String(n))},onStateChange:Tt,onInputValueChange:Tt,onUserAction:Tt,onChange:Tt,onSelect:Tt,onOuterClick:Tt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Bd},e.stateChangeTypes=lC,e}();process.env.NODE_ENV!=="production"&&(gC.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 Su(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 yC(e,t){var n=t.refKey,r=n!=="ref",o=!Wd(e);o&&!r&&!yu.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+'"'),!yu.isForwardRef(e)&&!zd(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var ff={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function vC(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){wC(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 wC(e,t,n,r){var o=t.props,i=t.type,s="on"+Ua(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](ye({type:i},r))}function bC(e,t){return t.changes}var xu=$a(function(e,t){Qd(e,t)},200),IC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?b.useLayoutEffect:b.useEffect,CC="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(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-"+Jd():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(l){return r+"-item-"+l},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 Ua(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function pf(e){var t=b.useRef(e);return t.current=e,t}function xC(e,t,n,r){var o=b.useRef(),i=b.useRef(),s=b.useCallback(function(m,g){i.current=g,m=Do(m,g.props);var w=e(m,g),y=g.props.stateReducer(m,ye({},g,{changes:w}));return y},[e]),a=b.useReducer(s,t,n),c=a[0],f=a[1],l=pf(t),d=b.useCallback(function(m){return f(ye({props:l.current},m))},[l]),h=i.current;return b.useEffect(function(){var m=Do(o.current,h==null?void 0:h.props),g=h&&o.current&&!r(m,c);g&&vC(h,m,c),o.current=c},[c,h,r]),[c,d]}var Ei={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:bC,scrollIntoView:Bd,environment:typeof window>"u"?void 0:window};function Xn(e,t,n){n===void 0&&(n=ff);var r=e["default"+Ua(t)];return r!==void 0?r:n[t]}function _i(e,t,n){n===void 0&&(n=ff);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Ua(t)];return o!==void 0?o:Xn(e,t,n)}function OC(e){var t=_i(e,"selectedItem"),n=_i(e,"isOpen"),r=AC(e),o=_i(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 Ni(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(l){return a(c)===a(l)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function EC(e,t,n){var r=b.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return b.useEffect(function(){if(!e)return Tt;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,ko(l.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function f(l){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!ko(l.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 hf=function(){return Tt};process.env.NODE_ENV!=="production"&&(hf=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,l=a.elementRef;c||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,c,f){o.current[s]={suppressRefError:a,refKey:c,elementRef:f}},[]);return i});function _C(e,t,n,r){r===void 0&&(r={});var o=r.document,i=Yo();b.useEffect(function(){if(!(!e||i||!o)){var s=e(t);xu(s,o)}},n),b.useEffect(function(){return function(){xu.cancel(),uC(o)}},[o])}function NC(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 mf=Tt;process.env.NODE_ENV!=="production"&&(mf=function(t){var n=t.props,r=t.state,o=b.useRef(n),i=Yo();b.useEffect(function(){i||(Va(r,o.current,n),o.current=n)},[r,n,i])});function Ou(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:Xn(e,"isOpen"),highlightedIndex:Xn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function TC(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Yo(){var e=b.useRef(!0);return b.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function ca(e){var t=Xn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function AC(e){var t=_i(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Co={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},gf=ye({},Co,{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 RC(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:Ni(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:Ni(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:ca(o),isOpen:Xn(o,"isOpen"),selectedItem:Xn(o,"selectedItem"),inputValue:Xn(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return ye({},e,i)}ii(ii({},gf),{items:W.array.isRequired,isItemDisabled:W.func});ii(ii({},Ei),{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 qa=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Ha=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ba=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Ja=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Wa=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,za=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Ga=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Qa=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Xa=process.env.NODE_ENV!=="production"?"__input_change__":8,jo=process.env.NODE_ENV!=="production"?"__input_blur__":9,Ya=process.env.NODE_ENV!=="production"?"__input_click__":10,yf=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,vf=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,Za=process.env.NODE_ENV!=="production"?"__item_click__":13,wf=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,bf=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,If=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Cf=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Sf=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,ec=process.env.NODE_ENV!=="production"?"__function_select_item__":19,xf=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Of=process.env.NODE_ENV!=="production"?"__function_reset__":21,tc=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Ef=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:tc,FunctionCloseMenu:Cf,FunctionOpenMenu:If,FunctionReset:Of,FunctionSelectItem:ec,FunctionSetHighlightedIndex:Sf,FunctionSetInputValue:xf,FunctionToggleMenu:bf,InputBlur:jo,InputChange:Xa,InputClick:Ya,InputKeyDownArrowDown:qa,InputKeyDownArrowUp:Ha,InputKeyDownEnd:Wa,InputKeyDownEnter:Qa,InputKeyDownEscape:Ba,InputKeyDownHome:Ja,InputKeyDownPageDown:Ga,InputKeyDownPageUp:za,ItemClick:Za,ItemMouseMove:vf,MenuMouseLeave:yf,ToggleButtonClick:wf});function PC(e){var t=OC(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 FC=ye({},gf,{items:W.array.isRequired,isItemDisabled:W.func,inputValue:W.string,defaultInputValue:W.string,initialInputValue:W.string,inputId:W.string,onInputValueChange:W.func});function DC(e,t,n,r){var o=b.useRef(),i=xC(e,t,n,r),s=i[0],a=i[1],c=Yo();return b.useEffect(function(){if(Mo(t,"selectedItem")){if(!c){var f=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);f&&a({type:tc,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Do(s,t),a]}var _f=Tt;process.env.NODE_ENV!=="production"&&(_f=function(t,n){W.checkPropTypes(FC,t,"prop",n.name)});var MC=ye({},Ei,{isItemDisabled:function(){return!1}});function kC(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case Za:s={isOpen:Xn(o,"isOpen"),highlightedIndex:ca(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case qa:e.isOpen?s={highlightedIndex:mr(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:Ni(o,e,1),isOpen:o.items.length>=0};break;case Ha:e.isOpen?i?s=Ou(o,e.highlightedIndex):s={highlightedIndex:mr(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:Ni(o,e,-1),isOpen:o.items.length>=0};break;case Qa:s=Ou(o,e.highlightedIndex);break;case Ba:s=ye({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case za:s={highlightedIndex:mr(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Ga:s={highlightedIndex:mr(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case Ja:s={highlightedIndex:oi(0,!1,o.items,o.isItemDisabled)};break;case Wa:s={highlightedIndex:oi(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case jo: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 Xa:s={isOpen:!0,highlightedIndex:ca(o),inputValue:t.inputValue};break;case Ya:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ni(o,e,0)};break;case ec:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case tc:s={inputValue:t.inputValue};break;default:return RC(e,t,Ef)}return ye({},e,s)}var jC=["onMouseLeave","refKey","ref"],LC=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],KC=["onClick","onPress","refKey","ref"],$C=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];nc.stateChangeTypes=Ef;function nc(e){e===void 0&&(e={}),_f(e,nc);var t=ye({},MC,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=DC(kC,t,PC,TC),a=s[0],c=s[1],f=a.isOpen,l=a.highlightedIndex,d=a.selectedItem,h=a.inputValue,m=b.useRef(null),g=b.useRef({}),w=b.useRef(null),y=b.useRef(null),x=Yo(),p=CC(t),v=b.useRef(),I=pf({state:a,props:t}),S=b.useCallback(function(J){return g.current[p.getItemId(J)]},[p]);_C(i,a,[f,l,d,h],o);var N=NC({menuElement:m.current,highlightedIndex:l,isOpen:f,itemRefs:g,scrollIntoView:r,getItemNodeFromIndex:S});mf({props:t,state:a}),b.useEffect(function(){var J=_i(t,"isOpen");J&&w.current&&w.current.focus()},[]),b.useEffect(function(){x||(v.current=n.length)});var R=EC(o,b.useCallback(function(){I.current.state.isOpen&&c({type:jo,selectItem:!1})},[c,I]),b.useMemo(function(){return[m,y,w]},[m.current,y.current,w.current])),E=hf("getInputProps","getMenuProps");b.useEffect(function(){f||(g.current={})},[f]),b.useEffect(function(){var J;!f||!(o!=null&&o.document)||!(w!=null&&(J=w.current)!=null&&J.focus)||o.document.activeElement!==w.current&&w.current.focus()},[f,o]);var P=b.useMemo(function(){return{ArrowDown:function(U){U.preventDefault(),c({type:qa,altKey:U.altKey})},ArrowUp:function(U){U.preventDefault(),c({type:Ha,altKey:U.altKey})},Home:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:Ja}))},End:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:Wa}))},Escape:function(U){var q=I.current.state;(q.isOpen||q.inputValue||q.selectedItem||q.highlightedIndex>-1)&&(U.preventDefault(),c({type:Ba}))},Enter:function(U){var q=I.current.state;!q.isOpen||U.which===229||(U.preventDefault(),c({type:Qa}))},PageUp:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:za}))},PageDown:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:Ga}))}}},[c,I]),A=b.useCallback(function(J){return ye({id:p.labelId,htmlFor:p.inputId},J)},[p]),D=b.useCallback(function(J,U){var q,K=J===void 0?{}:J,Q=K.onMouseLeave,Z=K.refKey,Y=Z===void 0?"ref":Z,ee=K.ref,ne=En(K,jC),ce=U===void 0?{}:U,k=ce.suppressRefError,ve=k===void 0?!1:k;return E("getMenuProps",ve,Y,m),ye((q={},q[Y]=Lr(ee,function(z){m.current=z}),q.id=p.menuId,q.role="listbox",q["aria-labelledby"]=ne&&ne["aria-label"]?void 0:""+p.labelId,q.onMouseLeave=Qe(Q,function(){c({type:yf})}),q),ne)},[c,E,p]),V=b.useCallback(function(J){var U,q,K=J===void 0?{}:J,Q=K.item,Z=K.index,Y=K.refKey,ee=Y===void 0?"ref":Y,ne=K.ref,ce=K.onMouseMove,k=K.onMouseDown,ve=K.onClick;K.onPress;var z=K.disabled,Ye=En(K,LC);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,He=Ce.state,ot=SC(Q,Z,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(){R.isTouchEnd||Ge===He.highlightedIndex||(N.current=!1,c({type:vf,index:Ge,disabled:ht}))},et=function(){c({type:Za,index:Ge})},De=function(pe){return pe.preventDefault()};return ye((U={},U[ee]=Lr(ne,function(B){B&&(g.current[p.getItemId(Ge)]=B)}),U["aria-disabled"]=ht,U["aria-selected"]=Ge===He.highlightedIndex,U.id=p.getItemId(Ge),U.role="option",U),!ht&&(q={},q[wt]=Qe(bt,et),q),{onMouseMove:Qe(ce,Ze),onMouseDown:Qe(k,De)},Ye)},[c,p,I,R,N]),j=b.useCallback(function(J){var U,q=J===void 0?{}:J,K=q.onClick;q.onPress;var Q=q.refKey,Z=Q===void 0?"ref":Q,Y=q.ref,ee=En(q,KC),ne=I.current.state,ce=function(){c({type:wf})};return ye((U={},U[Z]=Lr(Y,function(k){y.current=k}),U["aria-controls"]=p.menuId,U["aria-expanded"]=ne.isOpen,U.id=p.toggleButtonId,U.tabIndex=-1,U),!ee.disabled&&ye({},{onClick:Qe(K,ce)}),ee)},[c,I,p]),L=b.useCallback(function(J,U){var q,K=J===void 0?{}:J,Q=K.onKeyDown,Z=K.onChange,Y=K.onInput,ee=K.onBlur;K.onChangeText;var ne=K.onClick,ce=K.refKey,k=ce===void 0?"ref":ce,ve=K.ref,z=En(K,$C),Ye=U===void 0?{}:U,Ce=Ye.suppressRefError,lt=Ce===void 0?!1:Ce;E("getInputProps",lt,k,w);var He=I.current.state,ot=function(De){var B=sa(De);B&&P[B]&&P[B](De)},Se=function(De){c({type:Xa,inputValue:De.target.value})},Ge=function(De){if(o!=null&&o.document&&He.isOpen&&!R.isMouseDown){var B=De.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:jo,selectItem:!B})}},ht=function(){c({type:Ya})},wt="onChange",bt={};if(!z.disabled){var Ze;bt=(Ze={},Ze[wt]=Qe(Z,Y,Se),Ze.onKeyDown=Qe(Q,ot),Ze.onBlur=Qe(ee,Ge),Ze.onClick=Qe(ne,ht),Ze)}return ye((q={},q[k]=Lr(ve,function(et){w.current=et}),q["aria-activedescendant"]=He.isOpen&&He.highlightedIndex>-1?p.getItemId(He.highlightedIndex):"",q["aria-autocomplete"]="list",q["aria-controls"]=p.menuId,q["aria-expanded"]=He.isOpen,q["aria-labelledby"]=z&&z["aria-label"]?void 0:p.labelId,q.autoComplete="off",q.id=p.inputId,q.role="combobox",q.value=He.inputValue,q),bt,z)},[c,p,o,P,I,R,E]),se=b.useCallback(function(){c({type:bf})},[c]),re=b.useCallback(function(){c({type:Cf})},[c]),ge=b.useCallback(function(){c({type:If})},[c]),de=b.useCallback(function(J){c({type:Sf,highlightedIndex:J})},[c]),be=b.useCallback(function(J){c({type:ec,selectedItem:J})},[c]),F=b.useCallback(function(J){c({type:xf,inputValue:J})},[c]),$=b.useCallback(function(){c({type:Of})},[c]);return{getItemProps:V,getLabelProps:A,getMenuProps:D,getInputProps:L,getToggleButtonProps:j,toggleMenu:se,openMenu:ge,closeMenu:re,setHighlightedIndex:de,setInputValue:F,selectItem:be,reset:$,highlightedIndex:l,isOpen:f,selectedItem:d,inputValue:h}}Co.stateReducer,Co.itemToKey,Co.environment,W.array,W.array,W.array,W.func,W.number,W.number,W.number,W.func,W.func,W.string,W.string;Ei.itemToKey,Ei.stateReducer,Ei.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 VC="_comboboxContainer_1lcc8_1",UC="_inputContainer_1lcc8_12",qC="_input_1lcc8_12",HC="_toggleButton_1lcc8_33",BC="_menu_1lcc8_39",JC="_menuBottom_1lcc8_55",WC="_menuTop_1lcc8_61",zC="_menuItem_1lcc8_66",GC="_highlighted_1lcc8_73",QC="_selected_1lcc8_77",XC="_hidden_1lcc8_81",Ht={comboboxContainer:VC,inputContainer:UC,input:qC,toggleButton:HC,menu:BC,menuBottom:JC,menuTop:WC,menuItem:zC,highlighted:GC,selected:QC,hidden:XC};function YC(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function Nf({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 l=b.useCallback(N=>{(N==null?void 0:N.length)>0?c(e.filter(YC(N))):c(e)},[e]),{isOpen:d,getToggleButtonProps:h,getMenuProps:m,getInputProps:g,highlightedIndex:w,getItemProps:y,setInputValue:x}=nc({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 R;n(N),(R=f.current)==null||R.blur()}}),p=()=>{x(""),c(e)},v=()=>p(),I=b.useMemo(()=>{var N;return(N=e.find(R=>R.value===t))==null?void 0:N.label},[e,t]),S=()=>{x(t&&I?I:"")};return u.jsxs("div",{style:{position:"relative",...i},children:[u.jsx("div",{className:Ht.comboboxContainer,children:u.jsxs("div",{className:Ht.inputContainer,children:[u.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:Ht.input,...g({onFocus:v,onBlur:S,ref:f})}),u.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:Ht.toggleButton,type:"button",...h(),children:d?u.jsx(u.Fragment,{children:"↑"}):u.jsx(u.Fragment,{children:"↓"})})]})}),u.jsx("ul",{className:`${Ht.menu} ${d&&e.length?"":Ht.hidden} ${s==="top"?Ht.menuTop:Ht.menuBottom}`,...m(),children:d&&a.map((N,R)=>u.jsx("li",{className:`${Ht.menuItem} ${w===R?Ht.highlighted:""} ${t===(N==null?void 0:N.value)?Ht.selected:""}`,...y({item:N,index:R}),children:u.jsx("span",{children:N.label})},N.id))})]})}const si=Math.min,Er=Math.max,Lo=Math.round,mo=Math.floor,Zn=e=>({x:e,y:e}),ZC={left:"right",right:"left",bottom:"top",top:"bottom"},e0={start:"end",end:"start"};function ua(e,t,n){return Er(e,si(t,n))}function Bi(e,t){return typeof e=="function"?e(t):e}function Rr(e){return e.split("-")[0]}function Ji(e){return e.split("-")[1]}function Tf(e){return e==="x"?"y":"x"}function rc(e){return e==="y"?"height":"width"}function ai(e){return["top","bottom"].includes(Rr(e))?"y":"x"}function ic(e){return Tf(ai(e))}function t0(e,t,n){n===void 0&&(n=!1);const r=Ji(e),o=ic(e),i=rc(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Ko(s)),[s,Ko(s)]}function n0(e){const t=Ko(e);return[la(e),t,la(t)]}function la(e){return e.replace(/start|end/g,t=>e0[t])}function r0(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function i0(e,t,n,r){const o=Ji(e);let i=r0(Rr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(la)))),i}function Ko(e){return e.replace(/left|right|bottom|top/g,t=>ZC[t])}function o0(e){return{top:0,right:0,bottom:0,left:0,...e}}function Af(e){return typeof e!="number"?o0(e):{top:e,right:e,bottom:e,left:e}}function $o(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 Eu(e,t,n){let{reference:r,floating:o}=e;const i=ai(t),s=ic(t),a=rc(s),c=Rr(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(c){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(Ji(t)){case"start":m[s]-=h*(n&&f?-1:1);break;case"end":m[s]+=h*(n&&f?-1:1);break}return m}const s0=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let f=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:d}=Eu(f,r,c),h=r,m={},g=0;for(let w=0;w<a.length;w++){const{name:y,fn:x}=a[w],{x:p,y:v,data:I,reset:S}=await x({x:l,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:f,platform:s,elements:{reference:e,floating:t}});l=p??l,d=v??d,m={...m,[y]:{...m[y],...I}},S&&g<=50&&(g++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(f=S.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:l,y:d}=Eu(f,h,c)),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:c}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:h=!1,padding:m=0}=Bi(t,e),g=Af(m),y=a[h?d==="floating"?"reference":"floating":d],x=$o(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:f,rootBoundary:l,strategy:c})),p=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),I=await(i.isElement==null?void 0:i.isElement(v))?await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1},S=$o(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:p,offsetParent:v,strategy:c}):p);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 a0=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:l=0}=Bi(e,t)||{};if(f==null)return{};const d=Af(l),h={x:n,y:r},m=ic(o),g=rc(m),w=await s.getDimensions(f),y=m==="y",x=y?"top":"left",p=y?"bottom":"right",v=y?"clientHeight":"clientWidth",I=i.reference[g]+i.reference[m]-h[m]-i.floating[g],S=h[m]-i.reference[m],N=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let R=N?N[v]:0;(!R||!await(s.isElement==null?void 0:s.isElement(N)))&&(R=a.floating[v]||i.floating[g]);const E=I/2-S/2,P=R/2-w[g]/2-1,A=si(d[x],P),D=si(d[p],P),V=A,j=R-w[g]-D,L=R/2-w[g]/2+E,se=ua(V,L,j),re=!c.arrow&&Ji(o)!=null&&L!==se&&i.reference[g]/2-(L<V?A:D)-w[g]/2<0,ge=re?L<V?L-V:L-j:0;return{[m]:h[m]+ge,data:{[m]:se,centerOffset:L-se-ge,...re&&{alignmentOffset:ge}},reset:re}}}),c0=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:f}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:w=!0,...y}=Bi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=Rr(o),p=ai(a),v=Rr(a)===a,I=await(c.isRTL==null?void 0:c.isRTL(f.floating)),S=h||(v||!w?[Ko(a)]:n0(a)),N=g!=="none";!h&&N&&S.push(...i0(a,w,g,I));const R=[a,...S],E=await Rf(t,y),P=[];let A=((r=i.flip)==null?void 0:r.overflows)||[];if(l&&P.push(E[x]),d){const L=t0(o,s,I);P.push(E[L[0]],E[L[1]])}if(A=[...A,{placement:o,overflows:P}],!P.every(L=>L<=0)){var D,V;const L=(((D=i.flip)==null?void 0:D.index)||0)+1,se=R[L];if(se)return{data:{index:L,overflows:A},reset:{placement:se}};let re=(V=A.filter(ge=>ge.overflows[0]<=0).sort((ge,de)=>ge.overflows[1]-de.overflows[1])[0])==null?void 0:V.placement;if(!re)switch(m){case"bestFit":{var j;const ge=(j=A.filter(de=>{if(N){const be=ai(de.placement);return be===p||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:j[0];ge&&(re=ge);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}};async function u0(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Rr(n),a=Ji(n),c=ai(n)==="y",f=["left","top"].includes(s)?-1:1,l=i&&c?-1:1,d=Bi(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof g=="number"&&(m=a==="end"?g*-1:g),c?{x:m*l,y:h*f}:{x:h*f,y:m*l}}const l0=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,c=await u0(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}}}}},d0=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:y=>{let{x,y:p}=y;return{x,y:p}}},...c}=Bi(e,t),f={x:n,y:r},l=await Rf(t,c),d=ai(Rr(o)),h=Tf(d);let m=f[h],g=f[d];if(i){const y=h==="y"?"top":"left",x=h==="y"?"bottom":"right",p=m+l[y],v=m-l[x];m=ua(p,m,v)}if(s){const y=d==="y"?"top":"left",x=d==="y"?"bottom":"right",p=g+l[y],v=g-l[x];g=ua(p,g,v)}const w=a.fn({...t,[h]:m,[d]:g});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:i,[d]:s}}}}}};function Zo(){return typeof window<"u"}function gi(e){return Pf(e)?(e.nodeName||"").toLowerCase():"#document"}function At(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fn(e){var t;return(t=(Pf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Pf(e){return Zo()?e instanceof Node||e instanceof At(e).Node:!1}function Qt(e){return Zo()?e instanceof Element||e instanceof At(e).Element:!1}function un(e){return Zo()?e instanceof HTMLElement||e instanceof At(e).HTMLElement:!1}function _u(e){return!Zo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof At(e).ShadowRoot}function Wi(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 f0(e){return["table","td","th"].includes(gi(e))}function es(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function oc(e){const t=sc(),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 p0(e){let t=er(e);for(;un(t)&&!ci(t);){if(oc(t))return t;if(es(t))return null;t=er(t)}return null}function sc(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ci(e){return["html","body","#document"].includes(gi(e))}function Xt(e){return At(e).getComputedStyle(e)}function ts(e){return Qt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function er(e){if(gi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||_u(e)&&e.host||fn(e);return _u(t)?t.host:t}function Ff(e){const t=er(e);return ci(t)?e.ownerDocument?e.ownerDocument.body:e.body:un(t)&&Wi(t)?t:Ff(t)}function Di(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ff(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=At(o);if(i){const a=da(s);return t.concat(s,s.visualViewport||[],Wi(o)?o:[],a&&n?Di(a):[])}return t.concat(o,Di(o,[],n))}function da(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Df(e){const t=Xt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=un(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Lo(n)!==i||Lo(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function ac(e){return Qt(e)?e:e.contextElement}function $r(e){const t=ac(e);if(!un(t))return Zn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Df(t);let s=(i?Lo(n.width):n.width)/r,a=(i?Lo(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const h0=Zn(0);function Mf(e){const t=At(e);return!sc()||!t.visualViewport?h0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function m0(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==At(e)?!1:t}function Pr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=ac(e);let s=Zn(1);t&&(r?Qt(r)&&(s=$r(r)):s=$r(e));const a=m0(i,n,r)?Mf(i):Zn(0);let c=(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=At(i),m=r&&Qt(r)?At(r):r;let g=h,w=da(g);for(;w&&r&&m!==g;){const y=$r(w),x=w.getBoundingClientRect(),p=Xt(w),v=x.left+(w.clientLeft+parseFloat(p.paddingLeft))*y.x,I=x.top+(w.clientTop+parseFloat(p.paddingTop))*y.y;c*=y.x,f*=y.y,l*=y.x,d*=y.y,c+=v,f+=I,g=At(w),w=da(g)}}return $o({width:l,height:d,x:c,y:f})}function g0(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=fn(r),a=t?es(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},f=Zn(1);const l=Zn(0),d=un(r);if((d||!d&&!i)&&((gi(r)!=="body"||Wi(s))&&(c=ts(r)),un(r))){const h=Pr(r);f=$r(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-c.scrollLeft*f.x+l.x,y:n.y*f.y-c.scrollTop*f.y+l.y}}function y0(e){return Array.from(e.getClientRects())}function fa(e,t){const n=ts(e).scrollLeft;return t?t.left+n:Pr(fn(e)).left+n}function v0(e){const t=fn(e),n=ts(e),r=e.ownerDocument.body,o=Er(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Er(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+fa(e);const a=-n.scrollTop;return Xt(r).direction==="rtl"&&(s+=Er(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function w0(e,t){const n=At(e),r=fn(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const f=sc();(!f||f&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function b0(e,t){const n=Pr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=un(e)?$r(e):Zn(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 Nu(e,t,n){let r;if(t==="viewport")r=w0(e,n);else if(t==="document")r=v0(fn(e));else if(Qt(t))r=b0(t,n);else{const o=Mf(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return $o(r)}function kf(e,t){const n=er(e);return n===t||!Qt(n)||ci(n)?!1:Xt(n).position==="fixed"||kf(n,t)}function I0(e,t){const n=t.get(e);if(n)return n;let r=Di(e,[],!1).filter(a=>Qt(a)&&gi(a)!=="body"),o=null;const i=Xt(e).position==="fixed";let s=i?er(e):e;for(;Qt(s)&&!ci(s);){const a=Xt(s),c=oc(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Wi(s)&&!c&&kf(e,s))?r=r.filter(l=>l!==s):o=a,s=er(s)}return t.set(e,r),r}function C0(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?es(t)?[]:I0(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((f,l)=>{const d=Nu(t,l,o);return f.top=Er(d.top,f.top),f.right=si(d.right,f.right),f.bottom=si(d.bottom,f.bottom),f.left=Er(d.left,f.left),f},Nu(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function S0(e){const{width:t,height:n}=Df(e);return{width:t,height:n}}function x0(e,t,n){const r=un(t),o=fn(t),i=n==="fixed",s=Pr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Zn(0);if(r||!r&&!i)if((gi(t)!=="body"||Wi(o))&&(a=ts(t)),r){const m=Pr(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&(c.x=fa(o));let f=0,l=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();l=m.top+a.scrollTop,f=m.left+a.scrollLeft-fa(o,m)}const d=s.left+a.scrollLeft-c.x-f,h=s.top+a.scrollTop-c.y-l;return{x:d,y:h,width:s.width,height:s.height}}function Es(e){return Xt(e).position==="static"}function Tu(e,t){if(!un(e)||Xt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return fn(e)===n&&(n=n.ownerDocument.body),n}function jf(e,t){const n=At(e);if(es(e))return n;if(!un(e)){let o=er(e);for(;o&&!ci(o);){if(Qt(o)&&!Es(o))return o;o=er(o)}return n}let r=Tu(e,t);for(;r&&f0(r)&&Es(r);)r=Tu(r,t);return r&&ci(r)&&Es(r)&&!oc(r)?n:r||p0(e)||n}const O0=async function(e){const t=this.getOffsetParent||jf,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 E0(e){return Xt(e).direction==="rtl"}const _0={convertOffsetParentRelativeRectToViewportRelativeRect:g0,getDocumentElement:fn,getClippingRect:C0,getOffsetParent:jf,getElementRects:O0,getClientRects:y0,getDimensions:S0,getScale:$r,isElement:Qt,isRTL:E0};function N0(e,t){let n=null,r;const o=fn(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const{left:f,top:l,width:d,height:h}=e.getBoundingClientRect();if(a||t(),!d||!h)return;const m=mo(l),g=mo(o.clientWidth-(f+d)),w=mo(o.clientHeight-(l+h)),y=mo(f),p={rootMargin:-m+"px "+-g+"px "+-w+"px "+-y+"px",threshold:Er(0,si(1,c))||1};let v=!0;function I(S){const N=S[0].intersectionRatio;if(N!==c){if(!v)return s();N?s(!1,N):r=setTimeout(()=>{s(!1,1e-7)},1e3)}v=!1}try{n=new IntersectionObserver(I,{...p,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,p)}n.observe(e)}return s(!0),i}function T0(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,f=ac(e),l=o||i?[...f?Di(f):[],...Di(t)]:[];l.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const d=f&&a?N0(f,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(x=>{let[p]=x;p&&p.target===f&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),f&&!c&&m.observe(f),m.observe(t));let g,w=c?Pr(e):null;c&&y();function y(){const x=Pr(e);w&&(x.x!==w.x||x.y!==w.y||x.width!==w.width||x.height!==w.height)&&n(),w=x,g=requestAnimationFrame(y)}return n(),()=>{var x;l.forEach(p=>{o&&p.removeEventListener("scroll",n),i&&p.removeEventListener("resize",n)}),d==null||d(),(x=m)==null||x.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const A0=l0,R0=d0,P0=c0,F0=a0,Au=(e,t,n)=>{const r=new Map,o={platform:_0,...n},i={...o.platform,_c:r};return s0(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 uS="react-tooltip-core-styles",lS="react-tooltip-base-styles",wu={core:!1,base:!1};function bu({css:e,id:t=lS,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||wu[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=uS),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)),wu[n]=!0}const Iu=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[oS(Number(o)),aS({fallbackAxisSideDirection:"start"}),sS({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(cS({element:n,padding:5})),vu(e,t,{placement:r,strategy:i,middleware:f}).then(({x:d,y:l,placement:h,middlewareData:m})=>{var g,w;const v={left:`${d}px`,top:`${l}px`,border:a},{x,y:p}=(g=m.arrow)!==null&&g!==void 0?g:{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 S=0;if(a){const T=`${a}`.match(/(\d+)px/);S=T!=null&&T[1]?Number(T[1]):1}return{tooltipStyles:v,tooltipArrowStyles:{left:x!=null?`${x}px`:"",top:p!=null?`${p}px`:"",right:"",bottom:"",...I,[y]:`-${c/2+S}px`},place:h}})):vu(e,t,{placement:"bottom",strategy:i,middleware:f}).then(({x:d,y:l,placement:h})=>({tooltipStyles:{left:`${d}px`,top:`${l}px`},tooltipArrowStyles:{},place:h}))},Cu=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Su=(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},xu=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",sa=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>sa(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!xu(e)||!xu(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>sa(e[o],t[o]))},dS=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"})},Ou=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(dS(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},fS=typeof window<"u"?b.useLayoutEffect:b.useEffect,kt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},pS="DEFAULT_TOOLTIP_ID",hS={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},mS=b.createContext({getTooltipData:()=>hS});function yf(e=pS){return b.useContext(mS).getTooltipData(e)}var Pr={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},Is={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 gS=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:c=10,events:f=["hover"],openOnClick:d=!1,positionStrategy:l="absolute",middlewares:h,wrapper:m,delayShow:g=0,delayHide:w=0,float:v=!1,hidden:x=!1,noArrow:p=!1,clickable:y=!1,closeOnEsc:I=!1,closeOnScroll:S=!1,closeOnResize:T=!1,openEvents:A,closeEvents:E,globalCloseEvents:R,imperativeModeOnly:P,style:M,position:U,afterShow:k,afterHide:j,disableTooltip:ae,content:re,contentWrapperRef:ge,isOpen:me,defaultIsOpen:Oe=!1,setIsOpen:F,activeAnchor:q,setActiveAnchor:J,border:B,opacity:V,arrowColor:L,arrowSize:G=8,role:Z="tooltip"})=>{var Y;const ee=b.useRef(null),te=b.useRef(null),ue=b.useRef(null),K=b.useRef(null),we=b.useRef(null),[W,ot]=b.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[_e,mt]=b.useState(!1),[Je,gt]=b.useState(!1),[Ee,Ze]=b.useState(null),xt=b.useRef(!1),$t=b.useRef(null),{anchorRefs:Rt,setActiveAnchor:lt}=yf(t),st=b.useRef(!1),[Me,Ue]=b.useState([]),Pt=b.useRef(!1),et=d||f.includes("click"),Ar=et||(A==null?void 0:A.click)||(A==null?void 0:A.dblclick)||(A==null?void 0:A.mousedown),fn=A?{...A}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!A&&et&&Object.assign(fn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const pn=E?{...E}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!E&&et&&Object.assign(pn,{mouseleave:!1,blur:!1,mouseout:!1});const yt=R?{...R}:{escape:I||!1,scroll:S||!1,resize:T||!1,clickOutsideAnchor:Ar||!1};P&&(Object.assign(fn,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(pn,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(yt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),fS(()=>(Pt.current=!0,()=>{Pt.current=!1}),[]);const Te=z=>{Pt.current&&(z&>(!0),setTimeout(()=>{Pt.current&&(F==null||F(z),me===void 0&&mt(z))},10))};b.useEffect(()=>{if(me===void 0)return()=>null;me&>(!0);const z=setTimeout(()=>{mt(me)},10);return()=>{clearTimeout(z)}},[me]),b.useEffect(()=>{if(_e!==xt.current)if(kt(we),xt.current=_e,_e)k==null||k();else{const z=(se=>{const ce=se.match(/^([\d.]+)(ms|s)$/);if(!ce)return 0;const[,je,Ve]=ce;return Number(je)*(Ve==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));we.current=setTimeout(()=>{gt(!1),Ze(null),j==null||j()},z+25)}},[_e]);const ir=z=>{ot(se=>sa(se,z)?se:z)},Nn=(z=g)=>{kt(ue),Je?Te(!0):ue.current=setTimeout(()=>{Te(!0)},z)},Tn=(z=w)=>{kt(K),K.current=setTimeout(()=>{st.current||Te(!1)},z)},Ot=z=>{var se;if(!z)return;const ce=(se=z.currentTarget)!==null&&se!==void 0?se:z.target;if(!(ce!=null&&ce.isConnected))return J(null),void lt({current:null});g?Nn():Te(!0),J(ce),lt({current:ce}),kt(K)},hn=()=>{y?Tn(w||100):w?Tn():Te(!1),kt(ue)},An=({x:z,y:se})=>{var ce;const je={getBoundingClientRect:()=>({x:z,y:se,width:0,height:0,top:se,left:z,right:z,bottom:se})};Iu({place:(ce=Ee==null?void 0:Ee.place)!==null&&ce!==void 0?ce:a,offset:c,elementReference:je,tooltipReference:ee.current,tooltipArrowReference:te.current,strategy:l,middlewares:h,border:B,arrowSize:G}).then(Ve=>{ir(Ve)})},Rn=z=>{if(!z)return;const se=z,ce={x:se.clientX,y:se.clientY};An(ce),$t.current=ce},mn=z=>{var se;if(!_e)return;const ce=z.target;ce.isConnected&&(!((se=ee.current)===null||se===void 0)&&se.contains(ce)||[document.querySelector(`[id='${i}']`),...Me].some(je=>je==null?void 0:je.contains(ce))||(Te(!1),kt(ue)))},en=Su(Ot,50),ke=Su(hn,50),at=z=>{ke.cancel(),en(z)},ie=()=>{en.cancel(),ke()},de=b.useCallback(()=>{var z,se;const ce=(z=Ee==null?void 0:Ee.position)!==null&&z!==void 0?z:U;ce?An(ce):v?$t.current&&An($t.current):q!=null&&q.isConnected&&Iu({place:(se=Ee==null?void 0:Ee.place)!==null&&se!==void 0?se:a,offset:c,elementReference:q,tooltipReference:ee.current,tooltipArrowReference:te.current,strategy:l,middlewares:h,border:B,arrowSize:G}).then(je=>{Pt.current&&ir(je)})},[_e,q,re,M,a,Ee==null?void 0:Ee.place,c,l,U,Ee==null?void 0:Ee.position,v,G]);b.useEffect(()=>{var z,se;const ce=new Set(Rt);Me.forEach(ve=>{ae!=null&&ae(ve)||ce.add({current:ve})});const je=document.querySelector(`[id='${i}']`);je&&!(ae!=null&&ae(je))&&ce.add({current:je});const Ve=()=>{Te(!1)},Qe=Ou(q),Ft=Ou(ee.current);yt.scroll&&(window.addEventListener("scroll",Ve),Qe==null||Qe.addEventListener("scroll",Ve),Ft==null||Ft.addEventListener("scroll",Ve));let tt=null;yt.resize?window.addEventListener("resize",Ve):q&&ee.current&&(tt=iS(q,ee.current,de,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const vt=ve=>{ve.key==="Escape"&&Te(!1)};yt.escape&&window.addEventListener("keydown",vt),yt.clickOutsideAnchor&&window.addEventListener("click",mn);const Ne=[],Pn=ve=>!!(ve!=null&&ve.target&&(q!=null&&q.contains(ve.target))),Ut=ve=>{_e&&Pn(ve)||Ot(ve)},es=ve=>{_e&&Pn(ve)&&hn()},Hi=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Bi=["click","dblclick","mousedown","mouseup"];Object.entries(fn).forEach(([ve,qt])=>{qt&&(Hi.includes(ve)?Ne.push({event:ve,listener:at}):Bi.includes(ve)&&Ne.push({event:ve,listener:Ut}))}),Object.entries(pn).forEach(([ve,qt])=>{qt&&(Hi.includes(ve)?Ne.push({event:ve,listener:ie}):Bi.includes(ve)&&Ne.push({event:ve,listener:es}))}),v&&Ne.push({event:"pointermove",listener:Rn});const Ji=()=>{st.current=!0},Wi=()=>{st.current=!1,hn()},tn=y&&(pn.mouseout||pn.mouseleave);return tn&&((z=ee.current)===null||z===void 0||z.addEventListener("mouseover",Ji),(se=ee.current)===null||se===void 0||se.addEventListener("mouseout",Wi)),Ne.forEach(({event:ve,listener:qt})=>{ce.forEach(pi=>{var or;(or=pi.current)===null||or===void 0||or.addEventListener(ve,qt)})}),()=>{var ve,qt;yt.scroll&&(window.removeEventListener("scroll",Ve),Qe==null||Qe.removeEventListener("scroll",Ve),Ft==null||Ft.removeEventListener("scroll",Ve)),yt.resize?window.removeEventListener("resize",Ve):tt==null||tt(),yt.clickOutsideAnchor&&window.removeEventListener("click",mn),yt.escape&&window.removeEventListener("keydown",vt),tn&&((ve=ee.current)===null||ve===void 0||ve.removeEventListener("mouseover",Ji),(qt=ee.current)===null||qt===void 0||qt.removeEventListener("mouseout",Wi)),Ne.forEach(({event:pi,listener:or})=>{ce.forEach(ts=>{var Fn;(Fn=ts.current)===null||Fn===void 0||Fn.removeEventListener(pi,or)})})}},[q,de,Je,Rt,Me,A,E,R,et,g,w]),b.useEffect(()=>{var z,se;let ce=(se=(z=Ee==null?void 0:Ee.anchorSelect)!==null&&z!==void 0?z:s)!==null&&se!==void 0?se:"";!ce&&t&&(ce=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const je=new MutationObserver(Ve=>{const Qe=[],Ft=[];Ve.forEach(tt=>{if(tt.type==="attributes"&&tt.attributeName==="data-tooltip-id"&&(tt.target.getAttribute("data-tooltip-id")===t?Qe.push(tt.target):tt.oldValue===t&&Ft.push(tt.target)),tt.type==="childList"){if(q){const vt=[...tt.removedNodes].filter(Ne=>Ne.nodeType===1);if(ce)try{Ft.push(...vt.filter(Ne=>Ne.matches(ce))),Ft.push(...vt.flatMap(Ne=>[...Ne.querySelectorAll(ce)]))}catch{}vt.some(Ne=>{var Pn;return!!(!((Pn=Ne==null?void 0:Ne.contains)===null||Pn===void 0)&&Pn.call(Ne,q))&&(gt(!1),Te(!1),J(null),kt(ue),kt(K),!0)})}if(ce)try{const vt=[...tt.addedNodes].filter(Ne=>Ne.nodeType===1);Qe.push(...vt.filter(Ne=>Ne.matches(ce))),Qe.push(...vt.flatMap(Ne=>[...Ne.querySelectorAll(ce)]))}catch{}}}),(Qe.length||Ft.length)&&Ue(tt=>[...tt.filter(vt=>!Ft.includes(vt)),...Qe])});return je.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{je.disconnect()}},[t,s,Ee==null?void 0:Ee.anchorSelect,q]),b.useEffect(()=>{de()},[de]),b.useEffect(()=>{if(!(ge!=null&&ge.current))return()=>null;const z=new ResizeObserver(()=>{setTimeout(()=>de())});return z.observe(ge.current),()=>{z.disconnect()}},[re,ge==null?void 0:ge.current]),b.useEffect(()=>{var z;const se=document.querySelector(`[id='${i}']`),ce=[...Me,se];q&&ce.includes(q)||J((z=Me[0])!==null&&z!==void 0?z:se)},[i,Me,q]),b.useEffect(()=>(Oe&&Te(!0),()=>{kt(ue),kt(K)}),[]),b.useEffect(()=>{var z;let se=(z=Ee==null?void 0:Ee.anchorSelect)!==null&&z!==void 0?z:s;if(!se&&t&&(se=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),se)try{const ce=Array.from(document.querySelectorAll(se));Ue(ce)}catch{Ue([])}},[t,s,Ee==null?void 0:Ee.anchorSelect]),b.useEffect(()=>{ue.current&&(kt(ue),Nn(g))},[g]);const dt=(Y=Ee==null?void 0:Ee.content)!==null&&Y!==void 0?Y:re,gn=_e&&Object.keys(W.tooltipStyles).length>0;return b.useImperativeHandle(e,()=>({open:z=>{if(z!=null&&z.anchorSelect)try{document.querySelector(z.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${z.anchorSelect}" is not a valid CSS selector`)}Ze(z??null),z!=null&&z.delay?Nn(z.delay):Te(!0)},close:z=>{z!=null&&z.delay?Tn(z.delay):Te(!1)},activeAnchor:q,place:W.place,isOpen:!!(Je&&!x&&dt&&gn)})),Je&&!x&&dt?b.createElement(m,{id:t,role:Z,className:Kt("react-tooltip",Pr.tooltip,Is.tooltip,Is[o],n,`react-tooltip__place-${W.place}`,Pr[gn?"show":"closing"],gn?"react-tooltip__show":"react-tooltip__closing",l==="fixed"&&Pr.fixed,y&&Pr.clickable),onTransitionEnd:z=>{kt(we),_e||z.propertyName!=="opacity"||(gt(!1),Ze(null),j==null||j())},style:{...M,...W.tooltipStyles,opacity:V!==void 0&&gn?V:void 0},ref:ee},dt,b.createElement(m,{className:Kt("react-tooltip-arrow",Pr.arrow,Is.arrow,r,p&&Pr.noArrow),style:{...W.tooltipArrowStyles,background:L?`linear-gradient(to right bottom, transparent 50%, ${L} 50%)`:void 0,"--rt-arrow-size":`${G}px`},ref:te})):null},yS=({content:e})=>b.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),vS=b.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:f="top",offset:d=10,wrapper:l="div",children:h=null,events:m=["hover"],openOnClick:g=!1,positionStrategy:w="absolute",middlewares:v,delayShow:x=0,delayHide:p=0,float:y=!1,hidden:I=!1,noArrow:S=!1,clickable:T=!1,closeOnEsc:A=!1,closeOnScroll:E=!1,closeOnResize:R=!1,openEvents:P,closeEvents:M,globalCloseEvents:U,imperativeModeOnly:k=!1,style:j,position:ae,isOpen:re,defaultIsOpen:ge=!1,disableStyleInjection:me=!1,border:Oe,opacity:F,arrowColor:q,arrowSize:J,setIsOpen:B,afterShow:V,afterHide:L,disableTooltip:G,role:Z="tooltip"},Y)=>{const[ee,te]=b.useState(r),[ue,K]=b.useState(o),[we,W]=b.useState(f),[ot,_e]=b.useState(c),[mt,Je]=b.useState(d),[gt,Ee]=b.useState(x),[Ze,xt]=b.useState(p),[$t,Rt]=b.useState(y),[lt,st]=b.useState(I),[Me,Ue]=b.useState(l),[Pt,et]=b.useState(m),[Ar,fn]=b.useState(w),[pn,yt]=b.useState(null),[Te,ir]=b.useState(null),Nn=b.useRef(me),{anchorRefs:Tn,activeAnchor:Ot}=yf(e),hn=ke=>ke==null?void 0:ke.getAttributeNames().reduce((at,ie)=>{var de;return ie.startsWith("data-tooltip-")&&(at[ie.replace(/^data-tooltip-/,"")]=(de=ke==null?void 0:ke.getAttribute(ie))!==null&&de!==void 0?de:null),at},{}),An=ke=>{const at={place:ie=>{var de;W((de=ie)!==null&&de!==void 0?de:f)},content:ie=>{te(ie??r)},html:ie=>{K(ie??o)},variant:ie=>{var de;_e((de=ie)!==null&&de!==void 0?de:c)},offset:ie=>{Je(ie===null?d:Number(ie))},wrapper:ie=>{var de;Ue((de=ie)!==null&&de!==void 0?de:l)},events:ie=>{const de=ie==null?void 0:ie.split(" ");et(de??m)},"position-strategy":ie=>{var de;fn((de=ie)!==null&&de!==void 0?de:w)},"delay-show":ie=>{Ee(ie===null?x:Number(ie))},"delay-hide":ie=>{xt(ie===null?p:Number(ie))},float:ie=>{Rt(ie===null?y:ie==="true")},hidden:ie=>{st(ie===null?I:ie==="true")},"class-name":ie=>{yt(ie)}};Object.values(at).forEach(ie=>ie(null)),Object.entries(ke).forEach(([ie,de])=>{var dt;(dt=at[ie])===null||dt===void 0||dt.call(at,de)})};b.useEffect(()=>{te(r)},[r]),b.useEffect(()=>{K(o)},[o]),b.useEffect(()=>{W(f)},[f]),b.useEffect(()=>{_e(c)},[c]),b.useEffect(()=>{Je(d)},[d]),b.useEffect(()=>{Ee(x)},[x]),b.useEffect(()=>{xt(p)},[p]),b.useEffect(()=>{Rt(y)},[y]),b.useEffect(()=>{st(I)},[I]),b.useEffect(()=>{fn(w)},[w]),b.useEffect(()=>{Nn.current!==me&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[me]),b.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:me==="core",disableBase:me}}))},[]),b.useEffect(()=>{var ke;const at=new Set(Tn);let ie=n;if(!ie&&e&&(ie=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ie)try{document.querySelectorAll(ie).forEach(se=>{at.add({current:se})})}catch{console.warn(`[react-tooltip] "${ie}" is not a valid CSS selector`)}const de=document.querySelector(`[id='${t}']`);if(de&&at.add({current:de}),!at.size)return()=>null;const dt=(ke=Te??de)!==null&&ke!==void 0?ke:Ot.current,gn=new MutationObserver(se=>{se.forEach(ce=>{var je;if(!dt||ce.type!=="attributes"||!(!((je=ce.attributeName)===null||je===void 0)&&je.startsWith("data-tooltip-")))return;const Ve=hn(dt);An(Ve)})}),z={attributes:!0,childList:!1,subtree:!1};if(dt){const se=hn(dt);An(se),gn.observe(dt,z)}return()=>{gn.disconnect()}},[Tn,Ot,Te,t,n]),b.useEffect(()=>{j!=null&&j.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),Oe&&!Cu("border",`${Oe}`)&&console.warn(`[react-tooltip] "${Oe}" is not a valid \`border\`.`),j!=null&&j.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),F&&!Cu("opacity",`${F}`)&&console.warn(`[react-tooltip] "${F}" is not a valid \`opacity\`.`)},[]);let Rn=h;const mn=b.useRef(null);if(i){const ke=i({content:(Te==null?void 0:Te.getAttribute("data-tooltip-content"))||ee||null,activeAnchor:Te});Rn=ke?b.createElement("div",{ref:mn,className:"react-tooltip-content-wrapper"},ke):null}else ee&&(Rn=ee);ue&&(Rn=b.createElement(yS,{content:ue}));const en={forwardRef:Y,id:e,anchorId:t,anchorSelect:n,className:Kt(s,pn),classNameArrow:a,content:Rn,contentWrapperRef:mn,place:we,variant:ot,offset:mt,wrapper:Me,events:Pt,openOnClick:g,positionStrategy:Ar,middlewares:v,delayShow:gt,delayHide:Ze,float:$t,hidden:lt,noArrow:S,clickable:T,closeOnEsc:A,closeOnScroll:E,closeOnResize:R,openEvents:P,closeEvents:M,globalCloseEvents:U,imperativeModeOnly:k,style:j,position:ae,isOpen:re,defaultIsOpen:ge,border:Oe,opacity:F,arrowColor:q,arrowSize:J,setIsOpen:B,afterShow:V,afterHide:L,disableTooltip:G,activeAnchor:Te,setActiveAnchor:ke=>ir(ke),role:Z};return b.createElement(gS,{...en})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||bu({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||bu({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 wS(){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 vf({id:e,tooltipText:t}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:wS()}),u.jsx(vS,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function bS(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};if(t.forEach(o=>{const{field:i,value:s}=o;s===null?delete n[i]:n[i]=s}),e!=null&&e.read){const o=e.read.savedConfig.requiredMapFields,s=!nd(o,n);e.read.isRequiredMapFieldsModified=s}}function Ai(e,t,n){t(e,r=>bS(r,n))}const IS="Each field must be mapped to a unique value";function Za({field:e,onSelectChange:t,allFields:n}){var p;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Zt(),[s,a]=b.useState(!0),{isError:c,removeError:f,getError:d}=un(),l=(p=r==null?void 0:r.read)==null?void 0:p.selectedFieldMappings,h=l==null?void 0:l[e.mapToName];b.useEffect(()=>{e._default&&!h&&o&&r&&Ai(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]),g=u.jsx(af,{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&&(Ai(o,i,[{field:e.mapToName,value:null}]),c(he.MAPPING,o)&&f(he.MAPPING,o))},[e.mapToName,o,i,c,f]),{hasDuplicationError:v,errorMessage:x}=b.useMemo(()=>{const y=d(he.MAPPING,o),I=Array.isArray(y)&&y.length>0&&y.includes(e.mapToName);return{hasDuplicationError:I,errorMessage:I?IS:""}},[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(vf,{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(Be,{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 CS="_formControl_9qd8d_1",SS="_formLabel_9qd8d_5",xS="_formLabelRequired_9qd8d_11",OS="_formInput_9qd8d_16",ES="_formInputInvalid_9qd8d_20",_S="_formError_9qd8d_24",NS="_disabled_9qd8d_30",cr={formControl:CS,formLabel:SS,formLabelRequired:xS,formInput:OS,formInputInvalid:ES,formError:_S,disabled:NS};function Go({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return u.jsxs("div",{className:Kt(cr.formControl,{[cr.disabled]:r}),children:[t&&u.jsx("label",{htmlFor:e,className:Kt(cr.formLabel,{[cr.formLabelRequired]:n}),children:t}),u.jsx("div",{id:e,className:Kt(cr.formInput,{[cr.formInputInvalid]:o}),children:s}),o&&i&&u.jsx("div",{className:cr.formError,role:"alert",children:i})]})}function wf({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(he.MAPPING,t,a),!0}return!1}function TS({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>u.jsx(Go,{id:r.mapToName,children:u.jsx(Za,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function AS(){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}=it(),c=(w=t==null?void 0:t.read)==null?void 0:w.selectedFieldMappings,f=v=>{const{value:x,name:p}=v.target;!x||wf({selectedFieldMappings:c,selectedObjectName:e,fieldName:p,fieldValue:x,setError:i})||(e&&Ai(e,n,[{field:p,value:x}]),r(he.MAPPING,p)&&o(he.MAPPING,p),e&&r(he.MAPPING,e)&&o(he.MAPPING,e))},d=b.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(v=>!v.fieldName),[a,e]),l=b.useMemo(()=>{var p;return(((p=t==null?void 0:t.read)==null?void 0:p.optionalMapFields)||[]).filter(y=>!d.some(I=>I.mapToName===y.mapToName))},[t,d]),h=d.length>0;return l.length>0||h?u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Map the following optional fields"}),u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[l==null?void 0:l.map(v=>u.jsx(Go,{id:v.mapToName,children:u.jsx(Za,{allFields:s,field:v,onSelectChange:f})},v.mapToName)),h&&u.jsx(TS,{dynamicFieldMappings:d,onSelectChange:f,allFields:s})]})]}):null}function RS(){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:h}=d.target;!l||wf({selectedFieldMappings:s,selectedObjectName:e,fieldName:h,fieldValue:l,setError:i})||(e&&Ai(e,n,[{field:h,value:l}]),r(he.MAPPING,h)&&o(he.MAPPING,h),e&&r(he.MAPPING,e)&&o(he.MAPPING,e))},c=b.useMemo(()=>{var d;return((d=t==null?void 0:t.read)==null?void 0:d.requiredMapFields)||[]},[t]);return c!=null&&c.length?u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Map the following fields"}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(d=>{var l;return u.jsx(Go,{id:d.mapToName,isInvalid:r(he.MAPPING,d.mapToName),errorMessage:"* required",children:u.jsx(Za,{allFields:((l=t==null?void 0:t.read)==null?void 0:l.allFields)||[],field:d,onSelectChange:a})},d.mapToName)})})]}):null}const PS=(e,t)=>e.filter(n=>!t.has(n));function FS(){var h,m,g;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Zt(),{fieldMapping:r}=it(),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=((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=PS(i,d);b.useEffect(()=>{e&&l.length&&Ai(e,n,l.map(w=>({field:w,value:null})))},[e,n,l])}const DS={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function MS({children:e,style:t}){return u.jsx(En,{style:{...DS,...t},children:e})}function kS(){var f,d,l;const{data:e}=er(),{hydratedRevision:t}=di(),{selectedObjectName:n}=Zt(),{providerName:r}=ut(),o=e==null?void 0:e.appName,i=(l=(d=(f=t==null?void 0:t.content)==null?void 0:f.read)==null?void 0:d.objects)==null?void 0:l.find(h=>h.objectName===n),s=(i==null?void 0:i.displayName)||n&&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(MS,{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 Eu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function bf(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Eu(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():Eu(e[o],null)}}}}function oi(...e){return $.useCallback(bf(...e),e)}function Xo(e,t=[]){let n=[];function r(i,s){const a=$.createContext(s),c=n.length;n=[...n,s];const f=l=>{var x;const{scope:h,children:m,...g}=l,w=((x=h==null?void 0:h[e])==null?void 0:x[c])||a,v=$.useMemo(()=>g,Object.values(g));return u.jsx(w.Provider,{value:v,children:m})};f.displayName=i+"Provider";function d(l,h){var w;const m=((w=h==null?void 0:h[e])==null?void 0:w[c])||a,g=$.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=>$.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return $.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,jS(o,...t)]}function jS(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:f})=>{const l=c(i)[`__scope${f}`];return{...a,...l}},{});return $.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Qt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var Ri=globalThis!=null&&globalThis.document?$.useLayoutEffect:()=>{},LS=$[" useInsertionEffect ".trim().toString()]||Ri;function ec({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=KS({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const d=$.useRef(e!==void 0);$.useEffect(()=>{const l=d.current;l!==a&&console.warn(`${r} is changing from ${l?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const f=$.useCallback(d=>{var l;if(a){const h=$S(d)?d(e):d;h!==e&&((l=s.current)==null||l.call(s,h))}else i(d)},[a,e,i,s]);return[c,f]}function KS({defaultProp:e,onChange:t}){const[n,r]=$.useState(e),o=$.useRef(n),i=$.useRef(t);return LS(()=>{i.current=t},[t]),$.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function $S(e){return typeof e=="function"}function US(e){const t=$.useRef({value:e,previous:e});return $.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function qS(e){const[t,n]=$.useState(void 0);return Ri(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const c=i.borderBoxSize,f=Array.isArray(c)?c[0]:c;s=f.inlineSize,a=f.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function VS(e,t){return $.useReducer((n,r)=>t[n][r]??n,e)}var tc=e=>{const{present:t,children:n}=e,r=HS(t),o=typeof n=="function"?n({present:r.isPresent}):$.Children.only(n),i=oi(r.ref,BS(o));return typeof n=="function"||r.isPresent?$.cloneElement(o,{ref:i}):null};tc.displayName="Presence";function HS(e){const[t,n]=$.useState(),r=$.useRef(null),o=$.useRef(e),i=$.useRef("none"),s=e?"mounted":"unmounted",[a,c]=VS(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return $.useEffect(()=>{const f=lo(r.current);i.current=a==="mounted"?f:"none"},[a]),Ri(()=>{const f=r.current,d=o.current;if(d!==e){const h=i.current,m=lo(f);e?c("MOUNT"):m==="none"||(f==null?void 0:f.display)==="none"?c("UNMOUNT"):c(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Ri(()=>{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)})}},h=m=>{m.target===t&&(i.current=lo(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{d.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:$.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function lo(e){return(e==null?void 0:e.animationName)||"none"}function BS(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 aa(e){const t=JS(e),n=$.forwardRef((r,o)=>{const{children:i,...s}=r,a=$.Children.toArray(i),c=a.find(zS);if(c){const f=c.props.children,d=a.map(l=>l===c?$.Children.count(f)>1?$.Children.only(null):$.isValidElement(f)?f.props.children:null:l);return u.jsx(t,{...s,ref:o,children:$.isValidElement(f)?$.cloneElement(f,void 0,d):null})}return u.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function JS(e){const t=$.forwardRef((n,r)=>{const{children:o,...i}=n;if($.isValidElement(o)){const s=GS(o),a=QS(i,o.props);return o.type!==$.Fragment&&(a.ref=r?bf(r,s):s),$.cloneElement(o,a)}return $.Children.count(o)>1?$.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var WS=Symbol("radix.slottable");function zS(e){return $.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WS}function QS(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 GS(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 XS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_n=XS.reduce((e,t)=>{const n=aa(`Primitive.${t}`),r=$.forwardRef((o,i)=>{const{asChild:s,...a}=o,c=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Yo="Checkbox",[YS,hO]=Xo(Yo),[ZS,nc]=YS(Yo);function e0(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:a,onCheckedChange:c,required:f,value:d="on",internal_do_not_use_render:l}=e,[h,m]=ec({prop:n,defaultProp:o??!1,onChange:c,caller:Yo}),[g,w]=$.useState(null),[v,x]=$.useState(null),p=$.useRef(!1),y=g?!!s||!!g.closest("form"):!0,I={checked:h,disabled:i,setChecked:m,control:g,setControl:w,name:a,form:s,value:d,hasConsumerStoppedPropagationRef:p,required:f,defaultChecked:Qn(o)?!1:o,isFormControl:y,bubbleInput:v,setBubbleInput:x};return u.jsx(ZS,{scope:t,...I,children:t0(l)?l(I):r})}var If="CheckboxTrigger",Cf=$.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:s,disabled:a,checked:c,required:f,setControl:d,setChecked:l,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:g}=nc(If,e),w=oi(o,d),v=$.useRef(c);return $.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const p=()=>l(v.current);return x.addEventListener("reset",p),()=>x.removeEventListener("reset",p)}},[i,l]),u.jsx(_n.button,{type:"button",role:"checkbox","aria-checked":Qn(c)?"mixed":c,"aria-required":f,"data-state":Ef(c),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:w,onKeyDown:Qt(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:Qt(n,x=>{l(p=>Qn(p)?!0:!p),g&&m&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})})});Cf.displayName=If;var rc=$.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(e0,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:a,required:s,onCheckedChange:f,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:h})=>u.jsxs(u.Fragment,{children:[u.jsx(Cf,{...l,ref:t,__scopeCheckbox:n}),h&&u.jsx(Of,{__scopeCheckbox:n})]})})});rc.displayName=Yo;var Sf="CheckboxIndicator",ic=$.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=nc(Sf,n);return u.jsx(tc,{present:r||Qn(i.checked)||i.checked===!0,children:u.jsx(_n.span,{"data-state":Ef(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});ic.displayName=Sf;var xf="CheckboxBubbleInput",Of=$.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:s,required:a,disabled:c,name:f,value:d,form:l,bubbleInput:h,setBubbleInput:m}=nc(xf,e),g=oi(n,m),w=US(i),v=qS(r);$.useEffect(()=>{const p=h;if(!p)return;const y=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(y,"checked").set,T=!o.current;if(w!==i&&S){const A=new Event("click",{bubbles:T});p.indeterminate=Qn(i),S.call(p,Qn(i)?!1:i),p.dispatchEvent(A)}},[h,w,i,o]);const x=$.useRef(Qn(i)?!1:i);return u.jsx(_n.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%)"}})});Of.displayName=xf;function t0(e){return typeof e=="function"}function Qn(e){return e==="indeterminate"}function Ef(e){return Qn(e)?"indeterminate":e?"checked":"unchecked"}function _f(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 n0=["color"],Nf=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=_f(e,n0);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"}))}),r0=["color"],i0=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=_f(e,r0);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 o0="_checkboxGroupContainer_hqfeu_1",s0="_stack_hqfeu_6",a0="_selectAllContainer_hqfeu_10",c0="_fieldContainer_hqfeu_17",u0="_checkbox_hqfeu_1",si={checkboxGroupContainer:o0,stack:s0,selectAllContainer:a0,fieldContainer:c0,checkbox:u0};function l0({id:e,isChecked:t,label:n,onCheckedChange:r}){return u.jsxs("div",{className:si.fieldContainer,children:[u.jsx(rc,{className:si.checkbox,id:e,onCheckedChange:r,checked:t,children:u.jsx(ic,{children:u.jsx(Nf,{})})}),u.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function d0({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return u.jsxs("div",{className:si.selectAllContainer,children:[u.jsx(rc,{className:si.checkbox,id:e,onCheckedChange:r,checked:o?"indeterminate":t,children:u.jsxs(ic,{children:[o&&u.jsx(i0,{}),t===!0&&u.jsx(Nf,{})]})}),u.jsx("label",{htmlFor:e,children:n})]})}function f0({children:e}){return u.jsx("div",{className:si.checkboxGroupContainer,children:e})}function p0({children:e}){return u.jsx("div",{className:si.stack,children:e})}const h0="_paginationContainer_1p51x_1",m0="_pageInfo_1p51x_7",g0="_searchContainer_1p51x_13",y0="_searchInput_1p51x_17",v0="_noResults_1p51x_21",vi={paginationContainer:h0,pageInfo:m0,searchContainer:g0,searchInput:y0,noResults:v0};function Tf({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:o=!0,searchPlaceholder:i="Search fields..."}){const[s,a]=b.useState(1),[c,f]=b.useState(""),d=e.filter(y=>y.label.toLowerCase().includes(c.toLowerCase())),l=Math.ceil(d.length/n),h=(s-1)*n,m=h+n,g=d.slice(h,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),p=d.some(y=>y.isChecked);return u.jsxs(f0,{children:[o&&u.jsx("div",{className:vi.searchContainer,children:u.jsx(dd,{id:"field-search",type:"text",placeholder:i,value:c,onChange:y=>w(y.target.value),className:vi.searchInput})}),r&&e.length>=2&&u.jsx(d0,{id:"select-all-fields",isChecked:x,label:`Select all ${d.length} ${c?"matching ":""}fields`,onCheckedChange:v,isIndeterminate:p&&!x}),u.jsx(p0,{children:g.map(y=>u.jsx(l0,{id:y.id,isChecked:y.isChecked,label:y.label,onCheckedChange:I=>t(y.id,I===!0)},y.id))}),l>1&&u.jsxs("div",{className:vi.paginationContainer,children:[u.jsx(Be,{type:"button",onClick:()=>a(y=>Math.max(1,y-1)),disabled:s===1,variant:"ghost",children:"<"}),u.jsxs("span",{className:vi.pageInfo,children:[s," of ",l]}),u.jsx(Be,{type:"button",onClick:()=>a(y=>Math.min(l,y+1)),disabled:s===l,variant:"ghost",children:">"})]}),d.length===0&&c&&u.jsxs("div",{className:vi.noResults,children:['No fields found matching "',c,'"']})]})}function w0(e,t,n){var o,i;const r=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(i=e.read)!=null&&i.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,c=!nd(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function b0(e,t,n,r){t(e,o=>w0(o,n,r))}function I0(){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,h)=>{r&&t&&b0(r,n,l,h)},a=b.useMemo(()=>(i==null?void 0:i.filter(l=>!tr(l)&&"fieldName"in l&&"displayName"in l).map(l=>({id:l.fieldName,label:l.displayName,isChecked:!!(o!=null&&o[l.fieldName])})).sort((l,h)=>l.label.localeCompare(h.label)))||[],[i,o]);return!!(i&&i.length>0)&&u.jsxs(u.Fragment,{children:[u.jsx(At,{string:`${e} reads the following optional fields`}),u.jsx(Tf,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${i==null?void 0:i.length}`)]})}function C0(){return u.jsx(I0,{})}const S0={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 x0({children:e,style:t,...n}){return u.jsx("span",{style:{...S0,...t},...n,children:e})}function O0(){var n,r,o;const{configureState:e}=Zt(),{appName:t}=er();return u.jsxs(u.Fragment,{children:[u.jsx(At,{string:`${t} reads the following fields`}),u.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(r=(n=e==null?void 0:e.read)==null?void 0:n.requiredFields)!=null&&r.length?(o=e.read)==null?void 0:o.requiredFields.map(i=>tr(i)?null:u.jsx(x0,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function E0(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 Af(e,t,n,r,o){t(e,i=>E0(i,e,n,r,o))}function Cs(e){return e.mapToDisplayName||e.mapToName||e.fieldName||""}function _0(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 Rf(e,t){const n=i=>{if(!i)return!0;const s=Object.keys(i);return s.length===0?!0:s.every(a=>{const c=i[a];return!c||Object.keys(c).length===0})},r=n(e),o=n(t);return r&&o?!0:r!==o?!1:$o(e,t)}function N0(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 T0({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(Bo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function A0({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(af,{items:f,selectedValue:c||null,onSelectedItemChange:d,placeholder:"Please select one",style:{borderRadius:"8px",width:"100%"}},c),[c,f,d]),h=b.useCallback(()=>{i&&Af(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(Be,{type:"button",variant:"ghost",onClick:h,children:"Clear"})]})]},e.mappedValue)}function R0(){var c,f;const{fieldMapping:e}=it(),{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:h}=d[l];o!=null&&o[h]&&(d[l].fieldName=o[h])}return d},[t,e,o]),a=b.useCallback(d=>{const{value:l,name:h,fieldName:m}=d.target;l&&t&&Af(t,r,h,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],h=_0(d,l);return h.isValid?u.jsxs(u.Fragment,{children:[u.jsx(T0,{string:"Map the values for ",fieldName:Cs(d)}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:u.jsx(Go,{id:Cs(d),children:(w=d==null?void 0:d.mappedValues)==null?void 0:w.map(v=>{const x=(l==null?void 0:l.values)||[],p=(i==null?void 0:i[d.fieldName])||{},y=N0(x,p,v.mappedValue);return u.jsx(A0,{allValueOptions:y,mappedValue:v,onSelectChange:a,fieldName:(d==null?void 0:d.fieldName)||""},`${v.mappedValue}-${d.fieldName}`)})},Cs(d))})]}):(console.error(h.errorMessage,d),null)})}):null}const P0=!1;function F0(){return FS(),u.jsxs(u.Fragment,{children:[u.jsx(kS,{}),u.jsx(O0,{}),u.jsx(RS,{}),u.jsx(AS,{}),u.jsx(R0,{}),u.jsx(C0,{}),P0]})}function D0(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=!Sb(a,s);e.write.isWriteModified=f}}}function M0(e,t,n,r){t(e,o=>{D0(o,n,r)})}function k0(){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,h)=>{t&&n&&M0(t,r,l,h)},a=!!i,c=(i==null?void 0:i.map(l=>({id:l.objectName,label:l.displayName,isChecked:!!(o!=null&&o[l.objectName])})))||[];return a&&u.jsxs(u.Fragment,{children:[u.jsx(At,{string:`Allow ${e} to write to these objects`}),u.jsx(Tf,{items:c,onItemChange:s,showSelectAll:i.length>=2})]})}function j0(){return u.jsx(u.Fragment,{children:u.jsx(k0,{})})}function Pf({resetComponent:e,onDisconnectSuccess:t}){return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[u.jsx(At,{string:"Remove connection"}),u.jsx("p",{children:"Click to disconnect your connection from the provider."}),u.jsx(gd,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const L0="_authenticationRow_1g2ms_1",K0="_field_1g2ms_8",$0="_value_1g2ms_12",Ss={authenticationRow:L0,field:K0,value:$0};function _u({label:e,value:t}){return u.jsxs("div",{className:Ss.authenticationRow,children:[u.jsx("div",{className:Ss.field,children:e}),u.jsx("div",{className:Ss.value,children:t})]})}function U0(){const{selectedConnection:e}=Yt(),{providerName:t}=ut(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Connection details"}),u.jsxs("div",{style:{paddingBottom:"1rem"},children:[u.jsx(_u,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),u.jsx(_u,{label:"Status",value:an((e==null?void 0:e.status)||"")})]})]})}const q0=()=>{const e=rt(),t=$e();return On({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:o})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:o}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),He(n)}})};function Ff({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=De(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=it(),[c,f]=b.useState(!1),d=!r||!o||!(i!=null&&i.id)||c,l=q0(),h=async()=>{d||(f(!0),console.warn("uninstalling installation",{projectIdOrName:r,integrationId:o,installationId:i.id}),l.mutate({projectIdOrName:r,integrationId:o,installationId:i.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",i.id),a==null||a(i==null?void 0:i.id),s()},onSettled:()=>f(!1)}))},m=c?"Uninstalling...":e,g=u.jsx(Be,{type:"button",onClick:h,disabled:d,variant:t,style:n,children:m});return i!=null&&i.id?g:null}function V0(){const{installation:e}=it(),{providerName:t}=ut();return e?u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Uninstall entire integration"}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall the entire ",t," ","integration. You will lose any configuration you've set up."]}):u.jsx("p",{children:"You've successfully uninstalled the integration."}),u.jsx(Ff,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function H0(){const{installation:e,resetComponent:t}=it();return u.jsxs(u.Fragment,{children:[u.jsx(U0,{}),u.jsx(Na,{}),e&&u.jsx(V0,{}),!e&&u.jsx(Pf,{resetComponent:t})]})}function Df({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var R,P,M,U,k,j,ae,re;const{installation:i}=Nr(),{hydratedRevision:s,loading:a}=di(),{configureState:c,selectedObjectName:f}=Zt(),d=i==null?void 0:i.config,l=d&&f&&!!Yl(d,f)||!1,h=f?(U=(M=(P=(R=d==null?void 0:d.content)==null?void 0:R.read)==null?void 0:P.objects)==null?void 0:M[f])==null?void 0:U.selectedValueMappings:void 0,m=(k=c==null?void 0:c.read)==null?void 0:k.selectedValueMappings,g=!Rf(h,m),w=((j=c==null?void 0:c.read)==null?void 0:j.isOptionalFieldsModified)||((ae=c==null?void 0:c.read)==null?void 0:ae.isRequiredMapFieldsModified)||g,v=(re=c==null?void 0:c.write)==null?void 0:re.isWriteModified,I=a||n||!c||!f||!(w||v||r||f!==Or&&!l),S=f===Or,T=f===Eo,A=u.jsx(Be,{type:"submit",disabled:I,children:r?"Install":"Save"}),E=u.jsx(Be,{type:"button",onClick:t,disabled:I,variant:"ghost",children:"Reset"});return n?u.jsx(Ni,{}):u.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[u.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!T&&u.jsxs(u.Fragment,{children:[A,E]})}),u.jsxs(En,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&u.jsx(Li,{children:typeof o=="string"?o:"Installation Failed."}),a&&u.jsx(Ni,{}),s&&!S&&!T&&u.jsx(F0,{}),s&&S&&!T&&u.jsx(j0,{}),!a&&T&&u.jsx(H0,{})]})]})}const Mf=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=it(),{hydratedRevision:s,loading:a}=di(),{selectedObjectName:c}=wd(),{selectedConnection:f}=Yt(),d=tl(),{projectIdOrName:l}=De(),{resetBoundary:h,setErrors:m,setError:g,getError:w}=un(),{resetConfigureState:v,objectConfigurationsState:x,resetPendingConfigurationState:p}=Ta(),y=cd(c||"",x),{onNextIncompleteTab:I}=mI(),S=b.useCallback(()=>{h(he.INSTALLATION_MUTATION)},[h]),T=b.useCallback(E=>E?R=>{g(he.INSTALLATION_MUTATION,E,R)}:R=>{console.error("objectName is required to set installation error: ",R)},[g]),A=b.useCallback(E=>E?w(he.INSTALLATION_MUTATION,E):"",[w]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:f,apiKey:d,projectIdOrName:l,resetBoundary:h,setErrors:m,setMutateInstallationError:T,getMutateInstallationError:A,resetMutateInstallationErrorState:S,resetConfigureState:v,objectConfigurationsState:x,resetPendingConfigurationState:p,configureState:y,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:I}},B0=void 0;function J0(){const{consumerRef:e,setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,selectedConnection:i,resetBoundary:s,setErrors:a,setMutateInstallationError:c,getMutateInstallationError:f,resetMutateInstallationErrorState:d,resetConfigureState:l,objectConfigurationsState:h,resetPendingConfigurationState:m,configureState:g,onInstallSuccess:w,onNextIncompleteTab:v}=Mf(),[x,p]=b.useState(!1),{createInstallation:y}=Ql(),I=o===Or,S=f(o),T=b.useCallback(()=>{s(he.MAPPING),n!=null&&n.content&&!r&&o&&id(n,B0,o,l)},[s,n,r,o,l]);b.useEffect(()=>{!g&&(n!=null&&n.content)&&!r&&T()},[g,h,n,r,T]);const A=()=>{d();const{requiredMapFields:P,selectedFieldMappings:M}=(g==null?void 0:g.read)||{},{errorList:U}=td(P,M,a);if(!(U.length>0))if(o&&(i!=null&&i.id)&&e&&n){p(!0);const k=Nb(g,o,n,e);if(!k){console.error("Error when generating createConfig from configureState"),p(!1);return}y({config:k.content,onSuccess:j=>{t(j),w==null||w(j.id,j.config),p(!1),m(o),v()},onError:j=>{c(o)(j.message),p(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},E=()=>{if(d(),o&&(i!=null&&i.id)&&e&&n){p(!0);const P=Ab(g,n,e);if(!P){console.error("Error when generating createConfig from configureState"),p(!1);return}y({config:P.content,onSuccess:M=>{t(M),w==null||w(M.id,M.config),p(!1),m(o),v()},onError:M=>{c(o)(M.message),p(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},R=P=>{P.preventDefault(),I?E():A()};return u.jsx(Df,{errorMsg:S,isCreateMode:!0,isLoading:x,onSave:R,onReset:T})}const W0=(e,t,n,r)=>{const o=od(e),i=sd(e),s=ad(e),a={content:{read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:r}}}}};return ji(n)&&(a.content||(a.content={}),a.content.proxy={enabled:!0}),a},z0=(e,t)=>{const r={content:{write:{objects:ud(e)}}};return ji(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r};function Q0({installation:e}){const{setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,resetBoundary:i,setErrors:s,setMutateInstallationError:a,getMutateInstallationError:c,resetConfigureState:f,resetPendingConfigurationState:d,configureState:l,onUpdateSuccess:h,onNextIncompleteTab:m}=Mf(),{updateInstallation:g}=Gl(),[w,v]=b.useState(!1),x=o===Or,p=c(o),{config:y}=e,I=b.useCallback(()=>{i(he.MAPPING),n!=null&&n.content&&!r&&o&&id(n,y,o,f)},[i,n,r,o,y,f]);b.useEffect(()=>{l||I()},[l,I]);const S=b.useMemo(()=>{var P,M,U;return(U=(M=(P=n==null?void 0:n.content)==null?void 0:P.read)==null?void 0:M.objects)==null?void 0:U.find(k=>(k==null?void 0:k.objectName)===o)},[n,o]),T=()=>{const{requiredMapFields:R,selectedFieldMappings:P}=(l==null?void 0:l.read)||{},{errorList:M}=td(R,P,s);if(!(M.length>0))if(n&&l&&o&&S){v(!0);const U=W0(l,o,n,S.backfill);if(!U){console.error("Error when generating updateConfig from configureState"),v(!1);return}g({config:U.content,onSuccess:k=>{t(k),h==null||h(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")},A=()=>{if(l&&n){v(!0);const R=z0(l,n);if(!R){console.error("Error when generating write updateConfig from configureState"),v(!1);return}g({config:R.content,onSuccess:P=>{t(P),h==null||h(P.id,P.config),v(!1),d(o),m()},onError:P=>{a(o)(P.message),v(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},E=R=>{R.preventDefault(),x?A():T()};return u.jsx(Df,{errorMsg:p,onSave:E,onReset:I,isLoading:w})}function G0(){const{integrationObj:e,installation:t}=it();return e?t&&e?u.jsx(Q0,{installation:t}):u.jsx(J0,{}):u.jsx(Vl,{message:"We can't load the integration"})}function X0(){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 oc({text:e,children:t}){return u.jsx(ui,{children:u.jsxs(En,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[u.jsx(X0,{}),u.jsx("p",{children:e}),t]})})}function Y0({provider:e}){const{providerName:t}=ut(e),n=`You have successfully installed your ${t} integration.`;return u.jsx(oc,{text:n,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(Ff,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Z0=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function ex({children:e}){var S;const t=b.useRef(!1),{projectIdOrName:n}=De(),{hydratedRevision:r,loading:o}=di(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,onInstallSuccess:f,isIntegrationDeleted:d}=it(),{mutate:l,isIdle:h,isPending:m,error:g,errorMsg:w}=zl(),{selectedConnection:v,isConnectionsLoading:x}=Yt(),p=o||m||x,y=(S=r==null?void 0:r.content)==null?void 0:S.provider,I=Z0(r);return b.useEffect(()=>{var T;if(!p&&!x&&r&&I&&!s&&v&&(i!=null&&i.id)&&!d&&y){const A={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:v==null?void 0:v.id,config:{content:{provider:y}}}};ji(r)===!0&&(A.installation.config.content.proxy=(T=r==null?void 0:r.content)==null?void 0:T.proxy),h&&!t.current&&(l(A,{onSuccess:E=>{f==null||f(E==null?void 0:E.id,E.config)}}),t.current=!0)}},[r,I,s,v,n,i==null?void 0:i.id,a,c,p,f,d,x,y,l,h]),I&&y&&s?u.jsx(Y0,{provider:y}):g?u.jsx(zt,{message:w??"Create installation failed"}):i?p?u.jsx(li,{}):u.jsx("div",{children:e}):u.jsx(zt,{message:"We can't load the integration"})}function qi(){const e=rt(),t=$e();return On({mutationKey:["createConnection"],mutationFn:async n=>(await e()).connectionApi.generateConnection(n),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error creating connection and loading provider info"),He(n)}})}function tx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=De(),f=qi(),d=b.useCallback(l=>{var w;const{apiKey:h,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:h,...m&&{providerMetadata:m}}};f.mutate(g)},[c,i,o,r,n,e,f]);return a===null?u.jsx(Qb,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function nx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=De(),f=qi(),d=b.useCallback(l=>{var v;const{user:h,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:h,password:m},...g&&{providerMetadata:g}}};f.mutate(w)},[c,i,o,r,n,e,f]);return a===null?u.jsx(eI,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function Nu({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(Ea,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:n})}):u.jsx("span",{children:n})," ",t&&u.jsx(vf,{id:`docs-helper-text-${cb(n||(t==null?void 0:t.slice(0,50)))}`,tooltipText:t})]})})}function rx({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=g=>{const{name:w,value:v}=g.currentTarget;i(x=>({...x,[w]:v.trim()}))},c=Zr(s,o),f=n||!c,d=((m=e.customOpts)==null?void 0:m.inputs)||[],l=()=>{const g=Vo(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(Nu,{url:g.docsURL,prompt:g.prompt,inputName:g.displayName}),u.jsx(St.PasswordInput,{id:g.name,name:g.name,onChange:a,placeholder:""})]},g.name)),s.map(g=>u.jsxs("div",{children:[g.docsURL&&u.jsx(Nu,{url:g.docsURL,prompt:g.displayName||g.name,inputName:g.displayName||an(g.name.toLowerCase())}),u.jsx(St.Input,{id:g.name,name:g.name,type:"text",placeholder:"",onChange:a})]},g.name)),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"submit",onClick:l,variant:r,children:"Next"})]})}function ix({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r}){return u.jsxs(nr,{children:[u.jsx(rr,{children:`Set up ${e.displayName} integration`}),u.jsx(ln,{error:n}),u.jsx(rx,{providerInfo:e,handleSubmit:t,isButtonDisabled:r})]})}function ox({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s}){const{projectIdOrName:a}=De(),c=qi(),[f,d]=b.useState(null),l=b.useCallback(h=>{var v;const{customAuth:m,providerMetadata:g}=h;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=>{He(x,d)},onSuccess:()=>{d(null)}})},[a,o,r,n,t,e.name,c]);return s===null?u.jsx(ix,{providerInfo:e,handleSubmit:l,error:f}):i}function sx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:o,title:i}){if(!i&&!r)throw new Error("Either title or providerName is required");return u.jsxs(nr,{children:[u.jsx(rr,{children:i||`Set up ${r} integration`}),u.jsx(ln,{error:t}),o,u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function ax({...e}){return u.jsx(sx,{...e})}function cx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=De(),f=qi(),d=b.useCallback(()=>{const l={projectIdOrName:c,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};f.mutate(l)},[c,o,r,n,t,e,f]);return s===null?u.jsx(ax,{handleSubmit:d,error:null,providerName:a}):i}const ux=()=>{const e=rt(),t=$e();return On({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function lx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs(nr,{children:[u.jsx(rr,{children:`Set up ${r} integration`}),u.jsx(Bb,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),u.jsx(ln,{error:t}),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const dx="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function fx({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return u.jsxs(nr,{children:[u.jsx(rr,{children:"Enter your Salesforce subdomain"}),u.jsx(Ea,{href:dx,newTab:!0,children:"What is my Salesforce subdomain?"}),u.jsx(ln,{error:n}),u.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[u.jsx(St.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),u.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function px({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return u.jsxs(nr,{children:[u.jsxs(rr,{children:["Enter your ",o," workspace"]}),u.jsx(ln,{error:n}),u.jsx("br",{}),i.map(s=>u.jsx(St.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),u.jsx("br",{}),u.jsx(Be,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Tu=600,Au=600,Ru="salesforce";function hx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var M;const{projectId:s}=er(),a=$e(),c=b.useRef(null),[f,d]=b.useState(null),[l,h]=b.useState(""),[m,g]=b.useState({}),[w,v]=b.useState({}),{data:x}=qo(e),p=((M=x==null?void 0:x.metadata)==null?void 0:M.input)||[],{mutateAsync:y,isPending:I}=ux(),{isFetching:S,refetch:T}=Oa({groupRef:r,provider:e});b.useEffect(()=>{const U=k=>{var j,ae,re;k.origin===$l&&(((j=k.data)==null?void 0:j.eventType)==="AUTHORIZATION_SUCCEEDED"?(d(null),console.debug("New connection:",k.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((ae=k.data)==null?void 0:ae.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",k.data.data.error),a.invalidateQueries({queryKey:["amp","connections"]}),d(k.data.data.error||"An error occurred. Please try again.")),(re=c.current)==null||re.close())};return window.addEventListener("message",U),()=>window.removeEventListener("message",U)},[a]);const A=U=>{h(U),g(k=>({...k,workspace:U})),v(k=>({...k,workspace:{value:U,source:"input"}}))},E=(U,k)=>{g(j=>({...j,[U]:k})),v(j=>({...j,[U]:{value:k,source:"input"}}))},R=async()=>{var U;d(null);try{const{data:k}=await T();if(k&&k.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(p.length>0&&!Zr(p,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===Ru?l:(U=w==null?void 0:w.workspace)==null?void 0:U.value,providerMetadata:w}});if(k){const j=window.screenX+(window.outerWidth-Tu)/2,ae=window.screenY+(window.outerHeight-Au)/2.5,re=`width=${Tu},height=${Au},left=${j},top=${ae}`;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.")}},P=e===Ru?u.jsx(fx,{handleSubmit:R,setWorkspace:A,error:f,isButtonDisabled:l.length===0||I||S}):p.length>0?u.jsx(px,{handleSubmit:R,setFormData:E,error:f,isButtonDisabled:!Zr(p,m)||I||S,providerName:i,metadataFields:p}):u.jsx(lx,{handleSubmit:R,error:f,providerName:i,isButtonDisabled:I||S});return u.jsx("div",{children:P})}function mx({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:c}=De(),f=qi(),[d,l]=b.useState(null),h=b.useCallback(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(nI,{provider:e,providerName:t,handleSubmit:h,error:d,explicitScopesRequired:s}):u.jsx(Ni,{})}function gx({...e}){return u.jsx(mx,{...e})}const yx="authorizationCode",vx="authorizationCodePKCE",wx="clientCredentials";function bx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=ut(e);if(t.oauth2Opts===void 0)return u.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:f,explicitScopesRequired:d}=t.oauth2Opts,l={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return f===yx||f===vx?u.jsx(hx,{...l}):f===wx?u.jsx(gx,{...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 Ix(e){const{selectedConnection:t}=Yt();b.useEffect(()=>{e&&t&&e(t)},[e,t])}function Cx({onSuccess:e}){Ix(e)}function kf({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:f,isLoading:d,isError:l,error:h,providerName:m,selectedProvider:g}=ut(e),{provider:w,isIntegrationDeleted:v}=it(),{selectedConnection:x,setSelectedConnection:p}=Yt();Cx({onSuccess:s});const y=$e(),I=f;b.useEffect(()=>{l&&(console.error("Error loading provider info."),He(h))},[l,h]);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(oc,{text:"Integration successfully uninstalled.",children:u.jsx(Be,{type:"button",onClick:S,style:{width:"100%"},children:"Reinstall Integration"})});if(x)return i;if(d)return u.jsx(li,{});if(I==null)return u.jsx(zt,{message:"Provider info was not found."});const T={provider:g,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:x,setSelectedConnection:p,providerName:m,providerInfo:I,onDisconnectSuccess:a};return I.authType==="none"?u.jsx(cx,{...T,children:i}):I.authType==="basic"?u.jsx(nx,{...T,children:i}):I.authType==="apiKey"?u.jsx(tx,{...T,children:i}):I.authType==="custom"?u.jsx(ox,{...T,children:i}):u.jsx(bx,{...T})}function Sx(e){const t=e+"CollectionProvider",[n,r]=Xo(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=w=>{const{scope:v,children:x}=w,p=b.useRef(null),y=b.useRef(new Map).current;return u.jsx(o,{scope:v,itemMap:y,collectionRef:p,children:x})};s.displayName=t;const a=e+"CollectionSlot",c=aa(a),f=b.forwardRef((w,v)=>{const{scope:x,children:p}=w,y=i(a,x),I=oi(v,y.collectionRef);return u.jsx(c,{ref:I,children:p})});f.displayName=a;const d=e+"CollectionItemSlot",l="data-radix-collection-item",h=aa(d),m=b.forwardRef((w,v)=>{const{scope:x,children:p,...y}=w,I=b.useRef(null),S=oi(v,I),T=i(d,x);return b.useEffect(()=>(T.itemMap.set(I,{ref:I,...y}),()=>void T.itemMap.delete(I))),u.jsx(h,{[l]:"",ref:S,children:p})});m.displayName=d;function g(w){const v=i(e+"CollectionConsumer",w);return b.useCallback(()=>{const p=v.collectionRef.current;if(!p)return[];const y=Array.from(p.querySelectorAll(`[${l}]`));return Array.from(v.itemMap.values()).sort((T,A)=>y.indexOf(T.ref.current)-y.indexOf(A.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:f,ItemSlot:m},g,r]}var xx=$[" useId ".trim().toString()]||(()=>{}),Ox=0;function jf(e){const[t,n]=$.useState(xx());return Ri(()=>{n(r=>r??String(Ox++))},[e]),e||(t?`radix-${t}`:"")}function Ex(e){const t=$.useRef(e);return $.useEffect(()=>{t.current=e}),$.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var _x=$.createContext(void 0);function Lf(e){const t=$.useContext(_x);return e||t||"ltr"}var xs="rovingFocusGroup.onEntryFocus",Nx={bubbles:!1,cancelable:!0},Vi="RovingFocusGroup",[ca,Kf,Tx]=Sx(Vi),[Ax,$f]=Xo(Vi,[Tx]),[Rx,Px]=Ax(Vi),Uf=$.forwardRef((e,t)=>u.jsx(ca.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(ca.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Fx,{...e,ref:t})})}));Uf.displayName=Vi;var Fx=$.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:d=!1,...l}=e,h=$.useRef(null),m=oi(t,h),g=Lf(i),[w,v]=ec({prop:s,defaultProp:a??null,onChange:c,caller:Vi}),[x,p]=$.useState(!1),y=Ex(f),I=Kf(n),S=$.useRef(!1),[T,A]=$.useState(0);return $.useEffect(()=>{const E=h.current;if(E)return E.addEventListener(xs,y),()=>E.removeEventListener(xs,y)},[y]),u.jsx(Rx,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:w,onItemFocus:$.useCallback(E=>v(E),[v]),onItemShiftTab:$.useCallback(()=>p(!0),[]),onFocusableItemAdd:$.useCallback(()=>A(E=>E+1),[]),onFocusableItemRemove:$.useCallback(()=>A(E=>E-1),[]),children:u.jsx(_n.div,{tabIndex:x||T===0?-1:0,"data-orientation":r,...l,ref:m,style:{outline:"none",...e.style},onMouseDown:Qt(e.onMouseDown,()=>{S.current=!0}),onFocus:Qt(e.onFocus,E=>{const R=!S.current;if(E.target===E.currentTarget&&R&&!x){const P=new CustomEvent(xs,Nx);if(E.currentTarget.dispatchEvent(P),!P.defaultPrevented){const M=I().filter(re=>re.focusable),U=M.find(re=>re.active),k=M.find(re=>re.id===w),ae=[U,k,...M].filter(Boolean).map(re=>re.ref.current);Hf(ae,d)}}S.current=!1}),onBlur:Qt(e.onBlur,()=>p(!1))})})}),qf="RovingFocusGroupItem",Vf=$.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=jf(),f=i||c,d=Px(qf,n),l=d.currentTabStopId===f,h=Kf(n),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:w}=d;return $.useEffect(()=>{if(r)return m(),()=>g()},[r,m,g]),u.jsx(ca.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:u.jsx(_n.span,{tabIndex:l?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:Qt(e.onMouseDown,v=>{r?d.onItemFocus(f):v.preventDefault()}),onFocus:Qt(e.onFocus,()=>d.onItemFocus(f)),onKeyDown:Qt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const x=kx(v,d.orientation,d.dir);if(x!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let y=h().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?jx(y,I+1):y.slice(I+1)}setTimeout(()=>Hf(y))}}),children:typeof s=="function"?s({isCurrentTabStop:l,hasTabStop:w!=null}):s})})});Vf.displayName=qf;var Dx={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Mx(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function kx(e,t,n){const r=Mx(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Dx[r]}function Hf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function jx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Lx=Uf,Kx=Vf,Zo="Tabs",[$x,mO]=Xo(Zo,[$f]),Bf=$f(),[Ux,sc]=$x(Zo),Jf=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...f}=e,d=Lf(a),[l,h]=ec({prop:r,onChange:o,defaultProp:i??"",caller:Zo});return u.jsx(Ux,{scope:n,baseId:jf(),value:l,onValueChange:h,orientation:s,dir:d,activationMode:c,children:u.jsx(_n.div,{dir:d,"data-orientation":s,...f,ref:t})})});Jf.displayName=Zo;var Wf="TabsList",zf=$.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=sc(Wf,n),s=Bf(n);return u.jsx(Lx,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:u.jsx(_n.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});zf.displayName=Wf;var Qf="TabsTrigger",Gf=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=sc(Qf,n),a=Bf(n),c=Yf(s.baseId,r),f=Zf(s.baseId,r),d=r===s.value;return u.jsx(Kx,{asChild:!0,...a,focusable:!o,active:d,children:u.jsx(_n.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":f,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:Qt(e.onMouseDown,l=>{!o&&l.button===0&&l.ctrlKey===!1?s.onValueChange(r):l.preventDefault()}),onKeyDown:Qt(e.onKeyDown,l=>{[" ","Enter"].includes(l.key)&&s.onValueChange(r)}),onFocus:Qt(e.onFocus,()=>{const l=s.activationMode!=="manual";!d&&!o&&l&&s.onValueChange(r)})})})});Gf.displayName=Qf;var Xf="TabsContent",qx=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=sc(Xf,n),c=Yf(a.baseId,r),f=Zf(a.baseId,r),d=r===a.value,l=$.useRef(d);return $.useEffect(()=>{const h=requestAnimationFrame(()=>l.current=!1);return()=>cancelAnimationFrame(h)},[]),u.jsx(tc,{present:o||d,children:({present:h})=>u.jsx(_n.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:f,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:l.current?"0s":void 0},children:h&&i})})});qx.displayName=Xf;function Yf(e,t){return`${e}-trigger-${t}`}function Zf(e,t){return`${e}-content-${t}`}var Vx=Jf,Hx=zf,ep=Gf;const Bx=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 Jx(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?Bx: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 Wx(){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 zx="_tabsRoot_ktpr0_1",Qx="_tabsList_ktpr0_6",Gx="_tabTrigger_ktpr0_12",Mo={tabsRoot:zx,tabsList:Qx,tabTrigger:Gx};function Xx(){return u.jsxs(u.Fragment,{children:[u.jsx(Bo,{style:{margin:"1rem 0"}}),u.jsx(ep,{value:Eo,className:Mo.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[u.jsx(Wx,{}),u.jsx("span",{children:"Manage"})]})})]})}function tp({objectName:e,completed:t,pending:n,displayName:r}){return u.jsx(ep,{value:e,className:Mo.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Jx(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 Yx({completed:e,pending:t,displayName:n}){return u.jsxs(u.Fragment,{children:[u.jsx(Bo,{style:{margin:"1rem 0"}}),u.jsx(tp,{objectName:Or,completed:e,pending:t,displayName:n},"other-write")]})}function Zx({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var a,c;const{installation:i}=Nr(),s=i==null?void 0:i.config;return u.jsx(Vx,{value:e,className:Mo.tabsRoot,onValueChange:n,children:u.jsxs(Hx,{className:Mo.tabsList,children:[t.map(f=>{var p,y,I,S,T,A;const d=(I=(y=(p=s==null?void 0:s.content)==null?void 0:p.read)==null?void 0:y.objects)==null?void 0:I[f.name],l=r==null?void 0:r[f.name],h=(S=l==null?void 0:l.read)==null?void 0:S.isOptionalFieldsModified,m=(T=l==null?void 0:l.read)==null?void 0:T.isRequiredMapFieldsModified,g=d==null?void 0:d.selectedValueMappings,w=(A=l==null?void 0:l.read)==null?void 0:A.selectedValueMappings,v=!Rf(g,w),x=h||m||v||!1;return u.jsx(tp,{objectName:f.name,displayName:f.displayName,completed:f.completed,pending:x},f.name)}),o&&u.jsx(Yx,{completed:o.completed,pending:((c=(a=r==null?void 0:r.other)==null?void 0:a.write)==null?void 0:c.isWriteModified)||!1,displayName:"Write"}),u.jsx(Xx,{})]})})}function eO(e,t){return t===Eo?{name:Eo,completed:!1}:e.find(n=>n.name===t)}function tO({children:e}){var x;const{data:t}=er(),{installation:n}=it(),{providerName:r}=ut(),{hydratedRevision:o}=di(),{objectConfigurationsState:i}=Ta(),[s,a]=b.useState(""),c=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,d=o&&Zl(f,o),l=d!==null,h=!!((x=o==null?void 0:o.content)!=null&&x.write),m=h?ed(f):void 0,g=b.useMemo(()=>{const p=[...d||[]];return m&&h&&p.push(m),p},[d,m,h]),w=eO(g,s),v=b.useCallback(()=>{const p=g.find(y=>w!==y&&!y.completed);p&&a(p.name)},[g,w]);return b.useEffect(()=>{!s&&g.length>0&&a(g[0].name)},[g,s,v]),u.jsx(bd.Provider,{value:v,children:u.jsx(vd.Provider,{value:w==null?void 0:w.name,children:u.jsxs(ui,{style:{maxWidth:"55rem"},children:[u.jsxs(En,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[u.jsxs("div",{style:{width:"20rem"},children:[u.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),u.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),l&&u.jsx(Zx,{value:s,readNavObjects:d,onValueChange:p=>a(p),objectConfigurationsState:i,writeNavObject:m})]}),e]}),u.jsx(fd,{})]})})})}function nO({...e}){return u.jsx(tO,{...e})}const rO="_resetContainer_lkwv9_4",np={resetContainer:rO},iO=({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}=er(),{isLoading:l}=Uo(),{isError:h,errorState:m}=un(),{seed:g,reset:w}=Xl();return d||l?u.jsx(li,{}):h(he.PROJECT,f)?u.jsx(zt,{message:`Error loading project ${f}`}):h(he.INTEGRATION_LIST,f)?u.jsx(zt,{message:"Error retrieving integrations for the project, double check the API key"}):(v=m[he.INTEGRATION_LIST])!=null&&v.apiError?u.jsx(zt,{message:"Something went wrong, couldn't find integration information"}):u.jsx("div",{className:np.resetContainer,children:u.jsx(lb,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,resetComponent:w,children:u.jsx(Wl,{children:u.jsx(kf,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:w,children:u.jsx(hI,{resetComponent:w,children:u.jsx(ex,{children:u.jsx(yI,{children:u.jsx(nO,{children:u.jsx(G0,{})})})})})})})},g)})};function oO({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(xa,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:u.jsx(iO,{...f})})}function sO(){return u.jsxs(ui,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[u.jsx(Ni,{}),u.jsx("p",{children:"Redirecting"})]})}function aO({redirectURL:e,children:t}){return b.useEffect(()=>{e&&window.location.replace(e)},[e]),e?u.jsx(sO,{}):t}function cO({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=b.useState(!1);return u.jsxs(u.Fragment,{children:[r===!1&&u.jsxs(u.Fragment,{children:[u.jsx(At,{string:"Manage connection"}),u.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[u.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),u.jsx(Be,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&u.jsxs(u.Fragment,{children:[u.jsx(Na,{provider:n}),u.jsx(Pf,{resetComponent:e,onDisconnectSuccess:t})]})]})}function uO({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=er(),{providerName:o}=ut(e),i=`You have successfully connected your ${o} account to ${r}.`;return u.jsx(oc,{text:i,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:u.jsx(cO,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function lO({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:f,reset:d}=Xl(),l=b.useCallback(h=>{s?s(h.id):c&&c(h)},[s,c]);return u.jsx("div",{className:np.resetContainer,children:u.jsx(xa,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:u.jsx(Wl,{groupRef:r,provider:e,children:u.jsx(kf,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:l,onDisconnectSuccess:a,children:u.jsx(aO,{redirectURL:i,children:u.jsx(uO,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})})},f)}const dO=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=Ia(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,c=n==null?void 0:n[0],f=c==null?void 0:c.config;return b.useEffect(()=>{o&&He(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:f}};exports.AmpersandContext=ma;exports.AmpersandProvider=Zh;exports.ConnectProvider=lO;exports.FieldSettingWriteOnCreateEnum=Km;exports.FieldSettingWriteOnUpdateEnum=$m;exports.InstallIntegration=oO;exports.InstallationProvider=xa;exports.useAmpersandProviderProps=De;exports.useConfig=Vw;exports.useConnection=Ca;exports.useCreateInstallation=Ql;exports.useDeleteInstallation=mb;exports.useInstallation=Nr;exports.useIsIntegrationInstalled=dO;exports.useLocalConfig=qw;exports.useManifest=kl;exports.useUpdateInstallation=Gl;
|
|
50
|
+
*/const D0="react-tooltip-core-styles",M0="react-tooltip-base-styles",Ru={core:!1,base:!1};function Pu({css:e,id:t=M0,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||Ru[n]||n==="core"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=D0),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],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)),Ru[n]=!0}const Fu=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[A0(Number(o)),P0({fallbackAxisSideDirection:"start"}),R0({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(F0({element:n,padding:5})),Au(e,t,{placement:r,strategy:i,middleware:f}).then(({x:l,y:d,placement:h,middlewareData:m})=>{var g,w;const y={left:`${l}px`,top:`${d}px`,border:a},{x,y:p}=(g=m.arrow)!==null&&g!==void 0?g:{x:0,y:0},v=(w={top:"bottom",right:"left",bottom:"top",left:"right"}[h.split("-")[0]])!==null&&w!==void 0?w:"bottom",I=a&&{borderBottom:a,borderRight:a};let S=0;if(a){const N=`${a}`.match(/(\d+)px/);S=N!=null&&N[1]?Number(N[1]):1}return{tooltipStyles:y,tooltipArrowStyles:{left:x!=null?`${x}px`:"",top:p!=null?`${p}px`:"",right:"",bottom:"",...I,[v]:`-${c/2+S}px`},place:h}})):Au(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}))},Du=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Mu=(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},ku=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",pa=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>pa(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!ku(e)||!ku(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>pa(e[o],t[o]))},k0=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some(n=>{const r=t.getPropertyValue(n);return r==="auto"||r==="scroll"})},ju=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(k0(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},j0=typeof window<"u"?b.useLayoutEffect:b.useEffect,kt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},L0="DEFAULT_TOOLTIP_ID",K0={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},$0=b.createContext({getTooltipData:()=>K0});function Lf(e=L0){return b.useContext($0).getTooltipData(e)}var kr={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"},_s={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 V0=({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:l=!1,positionStrategy:d="absolute",middlewares:h,wrapper:m,delayShow:g=0,delayHide:w=0,float:y=!1,hidden:x=!1,noArrow:p=!1,clickable:v=!1,closeOnEsc:I=!1,closeOnScroll:S=!1,closeOnResize:N=!1,openEvents:R,closeEvents:E,globalCloseEvents:P,imperativeModeOnly:A,style:D,position:V,afterShow:j,afterHide:L,disableTooltip:se,content:re,contentWrapperRef:ge,isOpen:de,defaultIsOpen:be=!1,setIsOpen:F,activeAnchor:$,setActiveAnchor:J,border:U,opacity:q,arrowColor:K,arrowSize:Q=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,Ye]=b.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ce,lt]=b.useState(!1),[He,ot]=b.useState(!1),[Se,Ge]=b.useState(null),ht=b.useRef(!1),wt=b.useRef(null),{anchorRefs:bt,setActiveAnchor:Ze}=Lf(t),et=b.useRef(!1),[De,B]=b.useState([]),pe=b.useRef(!1),Oe=l||f.includes("click"),pn=Oe||(R==null?void 0:R.click)||(R==null?void 0:R.dblclick)||(R==null?void 0:R.mousedown),hn=R?{...R}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!R&&Oe&&Object.assign(hn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const mn=E?{...E}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!E&&Oe&&Object.assign(mn,{mouseleave:!1,blur:!1,mouseout:!1});const It=P?{...P}:{escape:I||!1,scroll:S||!1,resize:N||!1,clickOutsideAnchor:pn||!1};A&&(Object.assign(hn,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(mn,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(It,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),j0(()=>(pe.current=!0,()=>{pe.current=!1}),[]);const Pe=X=>{pe.current&&(X&&ot(!0),setTimeout(()=>{pe.current&&(F==null||F(X),de===void 0&<(X))},10))};b.useEffect(()=>{if(de===void 0)return()=>null;de&&ot(!0);const X=setTimeout(()=>{lt(de)},10);return()=>{clearTimeout(X)}},[de]),b.useEffect(()=>{if(Ce!==ht.current)if(kt(ve),ht.current=Ce,Ce)j==null||j();else{const X=(ue=>{const le=ue.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),L==null||L()},X+25)}},[Ce]);const ar=X=>{Ye(ue=>pa(ue,X)?ue:X)},Rn=(X=g)=>{kt(ce),He?Pe(!0):ce.current=setTimeout(()=>{Pe(!0)},X)},Pn=(X=w)=>{kt(k),k.current=setTimeout(()=>{et.current||Pe(!1)},X)},_t=X=>{var ue;if(!X)return;const le=(ue=X.currentTarget)!==null&&ue!==void 0?ue:X.target;if(!(le!=null&&le.isConnected))return J(null),void Ze({current:null});g?Rn():Pe(!0),J(le),Ze({current:le}),kt(k)},gn=()=>{v?Pn(w||100):w?Pn():Pe(!1),kt(ce)},Fn=({x:X,y:ue})=>{var le;const $e={getBoundingClientRect:()=>({x:X,y:ue,width:0,height:0,top:ue,left:X,right:X,bottom:ue})};Fu({place:(le=Se==null?void 0:Se.place)!==null&&le!==void 0?le:a,offset:c,elementReference:$e,tooltipReference:ee.current,tooltipArrowReference:ne.current,strategy:d,middlewares:h,border:U,arrowSize:Q}).then(Je=>{ar(Je)})},Dn=X=>{if(!X)return;const ue=X,le={x:ue.clientX,y:ue.clientY};Fn(le),wt.current=le},yn=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($e=>$e==null?void 0:$e.contains(le))||(Pe(!1),kt(ce)))},en=Mu(_t,50),Ke=Mu(gn,50),dt=X=>{Ke.cancel(),en(X)},ae=()=>{en.cancel(),Ke()},he=b.useCallback(()=>{var X,ue;const le=(X=Se==null?void 0:Se.position)!==null&&X!==void 0?X:V;le?Fn(le):y?wt.current&&Fn(wt.current):$!=null&&$.isConnected&&Fu({place:(ue=Se==null?void 0:Se.place)!==null&&ue!==void 0?ue:a,offset:c,elementReference:$,tooltipReference:ee.current,tooltipArrowReference:ne.current,strategy:d,middlewares:h,border:U,arrowSize:Q}).then($e=>{pe.current&&ar($e)})},[Ce,$,re,D,a,Se==null?void 0:Se.place,c,d,V,Se==null?void 0:Se.position,y,Q]);b.useEffect(()=>{var X,ue;const le=new Set(bt);De.forEach(xe=>{se!=null&&se(xe)||le.add({current:xe})});const $e=document.querySelector(`[id='${i}']`);$e&&!(se!=null&&se($e))&&le.add({current:$e});const Je=()=>{Pe(!1)},tt=ju($),Ft=ju(ee.current);It.scroll&&(window.addEventListener("scroll",Je),tt==null||tt.addEventListener("scroll",Je),Ft==null||Ft.addEventListener("scroll",Je));let st=null;It.resize?window.addEventListener("resize",Je):$&&ee.current&&(st=T0($,ee.current,he,{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",yn);const Re=[],Mn=xe=>!!(xe!=null&&xe.target&&($!=null&&$.contains(xe.target))),Vt=xe=>{Ce&&Mn(xe)||_t(xe)},ss=xe=>{Ce&&Mn(xe)&&gn()},Qi=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Xi=["click","dblclick","mousedown","mouseup"];Object.entries(hn).forEach(([xe,Ut])=>{Ut&&(Qi.includes(xe)?Re.push({event:xe,listener:dt}):Xi.includes(xe)&&Re.push({event:xe,listener:Vt}))}),Object.entries(mn).forEach(([xe,Ut])=>{Ut&&(Qi.includes(xe)?Re.push({event:xe,listener:ae}):Xi.includes(xe)&&Re.push({event:xe,listener:ss}))}),y&&Re.push({event:"pointermove",listener:Dn});const Yi=()=>{et.current=!0},Zi=()=>{et.current=!1,gn()},tn=v&&(mn.mouseout||mn.mouseleave);return tn&&((X=ee.current)===null||X===void 0||X.addEventListener("mouseover",Yi),(ue=ee.current)===null||ue===void 0||ue.addEventListener("mouseout",Zi)),Re.forEach(({event:xe,listener:Ut})=>{le.forEach(yi=>{var cr;(cr=yi.current)===null||cr===void 0||cr.addEventListener(xe,Ut)})}),()=>{var xe,Ut;It.scroll&&(window.removeEventListener("scroll",Je),tt==null||tt.removeEventListener("scroll",Je),Ft==null||Ft.removeEventListener("scroll",Je)),It.resize?window.removeEventListener("resize",Je):st==null||st(),It.clickOutsideAnchor&&window.removeEventListener("click",yn),It.escape&&window.removeEventListener("keydown",Ct),tn&&((xe=ee.current)===null||xe===void 0||xe.removeEventListener("mouseover",Yi),(Ut=ee.current)===null||Ut===void 0||Ut.removeEventListener("mouseout",Zi)),Re.forEach(({event:yi,listener:cr})=>{le.forEach(as=>{var kn;(kn=as.current)===null||kn===void 0||kn.removeEventListener(yi,cr)})})}},[$,he,He,bt,De,R,E,P,Oe,g,w]),b.useEffect(()=>{var X,ue;let le=(ue=(X=Se==null?void 0:Se.anchorSelect)!==null&&X!==void 0?X:s)!==null&&ue!==void 0?ue:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const $e=new MutationObserver(Je=>{const tt=[],Ft=[];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&&Ft.push(st.target)),st.type==="childList"){if($){const Ct=[...st.removedNodes].filter(Re=>Re.nodeType===1);if(le)try{Ft.push(...Ct.filter(Re=>Re.matches(le))),Ft.push(...Ct.flatMap(Re=>[...Re.querySelectorAll(le)]))}catch{}Ct.some(Re=>{var Mn;return!!(!((Mn=Re==null?void 0:Re.contains)===null||Mn===void 0)&&Mn.call(Re,$))&&(ot(!1),Pe(!1),J(null),kt(ce),kt(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||Ft.length)&&B(st=>[...st.filter(Ct=>!Ft.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,$]),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($)||J((X=De[0])!==null&&X!==void 0?X:ue)},[i,De,$]),b.useEffect(()=>(be&&Pe(!0),()=>{kt(ce),kt(k)}),[]),b.useEffect(()=>{var X;let ue=(X=Se==null?void 0:Se.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));B(le)}catch{B([])}},[t,s,Se==null?void 0:Se.anchorSelect]),b.useEffect(()=>{ce.current&&(kt(ce),Rn(g))},[g]);const mt=(Y=Se==null?void 0:Se.content)!==null&&Y!==void 0?Y:re,vn=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`)}Ge(X??null),X!=null&&X.delay?Rn(X.delay):Pe(!0)},close:X=>{X!=null&&X.delay?Pn(X.delay):Pe(!1)},activeAnchor:$,place:z.place,isOpen:!!(He&&!x&&mt&&vn)})),He&&!x&&mt?b.createElement(m,{id:t,role:Z,className:$t("react-tooltip",kr.tooltip,_s.tooltip,_s[o],n,`react-tooltip__place-${z.place}`,kr[vn?"show":"closing"],vn?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&kr.fixed,v&&kr.clickable),onTransitionEnd:X=>{kt(ve),Ce||X.propertyName!=="opacity"||(ot(!1),Ge(null),L==null||L())},style:{...D,...z.tooltipStyles,opacity:q!==void 0&&vn?q:void 0},ref:ee},mt,b.createElement(m,{className:$t("react-tooltip-arrow",kr.arrow,_s.arrow,r,p&&kr.noArrow),style:{...z.tooltipArrowStyles,background:K?`linear-gradient(to right bottom, transparent 50%, ${K} 50%)`:void 0,"--rt-arrow-size":`${Q}px`},ref:ne})):null},U0=({content:e})=>b.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),q0=b.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:f="top",offset:l=10,wrapper:d="div",children:h=null,events:m=["hover"],openOnClick:g=!1,positionStrategy:w="absolute",middlewares:y,delayShow:x=0,delayHide:p=0,float:v=!1,hidden:I=!1,noArrow:S=!1,clickable:N=!1,closeOnEsc:R=!1,closeOnScroll:E=!1,closeOnResize:P=!1,openEvents:A,closeEvents:D,globalCloseEvents:V,imperativeModeOnly:j=!1,style:L,position:se,isOpen:re,defaultIsOpen:ge=!1,disableStyleInjection:de=!1,border:be,opacity:F,arrowColor:$,arrowSize:J,setIsOpen:U,afterShow:q,afterHide:K,disableTooltip:Q,role:Z="tooltip"},Y)=>{const[ee,ne]=b.useState(r),[ce,k]=b.useState(o),[ve,z]=b.useState(f),[Ye,Ce]=b.useState(c),[lt,He]=b.useState(l),[ot,Se]=b.useState(x),[Ge,ht]=b.useState(p),[wt,bt]=b.useState(v),[Ze,et]=b.useState(I),[De,B]=b.useState(d),[pe,Oe]=b.useState(m),[pn,hn]=b.useState(w),[mn,It]=b.useState(null),[Pe,ar]=b.useState(null),Rn=b.useRef(de),{anchorRefs:Pn,activeAnchor:_t}=Lf(e),gn=Ke=>Ke==null?void 0:Ke.getAttributeNames().reduce((dt,ae)=>{var he;return ae.startsWith("data-tooltip-")&&(dt[ae.replace(/^data-tooltip-/,"")]=(he=Ke==null?void 0:Ke.getAttribute(ae))!==null&&he!==void 0?he:null),dt},{}),Fn=Ke=>{const dt={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:c)},offset:ae=>{He(ae===null?l:Number(ae))},wrapper:ae=>{var he;B((he=ae)!==null&&he!==void 0?he:d)},events:ae=>{const he=ae==null?void 0:ae.split(" ");Oe(he??m)},"position-strategy":ae=>{var he;hn((he=ae)!==null&&he!==void 0?he:w)},"delay-show":ae=>{Se(ae===null?x:Number(ae))},"delay-hide":ae=>{ht(ae===null?p:Number(ae))},float:ae=>{bt(ae===null?v:ae==="true")},hidden:ae=>{et(ae===null?I:ae==="true")},"class-name":ae=>{It(ae)}};Object.values(dt).forEach(ae=>ae(null)),Object.entries(Ke).forEach(([ae,he])=>{var mt;(mt=dt[ae])===null||mt===void 0||mt.call(dt,he)})};b.useEffect(()=>{ne(r)},[r]),b.useEffect(()=>{k(o)},[o]),b.useEffect(()=>{z(f)},[f]),b.useEffect(()=>{Ce(c)},[c]),b.useEffect(()=>{He(l)},[l]),b.useEffect(()=>{Se(x)},[x]),b.useEffect(()=>{ht(p)},[p]),b.useEffect(()=>{bt(v)},[v]),b.useEffect(()=>{et(I)},[I]),b.useEffect(()=>{hn(w)},[w]),b.useEffect(()=>{Rn.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(Pn);let ae=n;if(!ae&&e&&(ae=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ae)try{document.querySelectorAll(ae).forEach(ue=>{dt.add({current:ue})})}catch{console.warn(`[react-tooltip] "${ae}" is not a valid CSS selector`)}const he=document.querySelector(`[id='${t}']`);if(he&&dt.add({current:he}),!dt.size)return()=>null;const mt=(Ke=Pe??he)!==null&&Ke!==void 0?Ke:_t.current,vn=new MutationObserver(ue=>{ue.forEach(le=>{var $e;if(!mt||le.type!=="attributes"||!(!(($e=le.attributeName)===null||$e===void 0)&&$e.startsWith("data-tooltip-")))return;const Je=gn(mt);Fn(Je)})}),X={attributes:!0,childList:!1,subtree:!1};if(mt){const ue=gn(mt);Fn(ue),vn.observe(mt,X)}return()=>{vn.disconnect()}},[Pn,_t,Pe,t,n]),b.useEffect(()=>{L!=null&&L.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),be&&!Du("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."),F&&!Du("opacity",`${F}`)&&console.warn(`[react-tooltip] "${F}" is not a valid \`opacity\`.`)},[]);let Dn=h;const yn=b.useRef(null);if(i){const Ke=i({content:(Pe==null?void 0:Pe.getAttribute("data-tooltip-content"))||ee||null,activeAnchor:Pe});Dn=Ke?b.createElement("div",{ref:yn,className:"react-tooltip-content-wrapper"},Ke):null}else ee&&(Dn=ee);ce&&(Dn=b.createElement(U0,{content:ce}));const en={forwardRef:Y,id:e,anchorId:t,anchorSelect:n,className:$t(s,mn),classNameArrow:a,content:Dn,contentWrapperRef:yn,place:ve,variant:Ye,offset:lt,wrapper:De,events:pe,openOnClick:g,positionStrategy:pn,middlewares:y,delayShow:ot,delayHide:Ge,float:wt,hidden:Ze,noArrow:S,clickable:N,closeOnEsc:R,closeOnScroll:E,closeOnResize:P,openEvents:A,closeEvents:D,globalCloseEvents:V,imperativeModeOnly:j,style:L,position:se,isOpen:re,defaultIsOpen:ge,border:be,opacity:F,arrowColor:$,arrowSize:J,setIsOpen:U,afterShow:q,afterHide:K,disableTooltip:Q,activeAnchor:Pe,setActiveAnchor:Ke=>ar(Ke),role:Z};return b.createElement(V0,{...en})});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 H0(){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 Kf({id:e,tooltipText:t}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:H0()}),u.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,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 Mi(e,t,n){t(e,r=>B0(r,n))}const J0="Each field must be mapped to a unique value";function cc({field:e,onSelectChange:t,allFields:n}){var p;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Zt(),[s,a]=b.useState(!0),{isError:c,removeError:f,getError:l}=ln(),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&&Mi(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,h,r]);const m=b.useMemo(()=>n.map(v=>({id:v.fieldName,label:v.displayName,value:v.fieldName})),[n]),g=u.jsx(Nf,{disabled:s,items:m,selectedValue:h||null,onSelectedItemChange:v=>{t({target:{name:e.mapToName,value:v==null?void 0:v.value}})},placeholder:"Please select one",style:{width:"100%"}}),w=b.useCallback(()=>{o&&(Mi(o,i,[{field:e.mapToName,value:null}]),c(we.MAPPING,o)&&f(we.MAPPING,o))},[e.mapToName,o,i,c,f]),{hasDuplicationError:y,errorMessage:x}=b.useMemo(()=>{const v=l(we.MAPPING,o),I=Array.isArray(v)&&v.length>0&&v.includes(e.mapToName);return{hasDuplicationError:I,errorMessage:I?J0:""}},[o,l,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(Kf,{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),y&&u.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",x," "]},e.mapToName)]})}const W0="_formControl_9qd8d_1",z0="_formLabel_9qd8d_5",G0="_formLabelRequired_9qd8d_11",Q0="_formInput_9qd8d_16",X0="_formInputInvalid_9qd8d_20",Y0="_formError_9qd8d_24",Z0="_disabled_9qd8d_30",dr={formControl:W0,formLabel:z0,formLabelRequired:G0,formInput:Q0,formInputInvalid:X0,formError:Y0,disabled:Z0};function ns({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return u.jsxs("div",{className:$t(dr.formControl,{[dr.disabled]:r}),children:[t&&u.jsx("label",{htmlFor:e,className:$t(dr.formLabel,{[dr.formLabelRequired]:n}),children:t}),u.jsx("div",{id:e,className:$t(dr.formInput,{[dr.formInputInvalid]:o}),children:s}),o&&i&&u.jsx("div",{className:dr.formError,role:"alert",children:i})]})}function $f({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 eS({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(ns,{id:r.mapToName,children:u.jsx(cc,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function tS(){var g,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Zt(),{isError:r,removeError:o,setError:i}=ln(),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=y=>{const{value:x,name:p}=y.target;!x||$f({selectedFieldMappings:c,selectedObjectName:e,fieldName:p,fieldValue:x,setError:i})||(e&&Mi(e,n,[{field:p,value:x}]),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(y=>!y.fieldName),[a,e]),d=b.useMemo(()=>{var p;return(((p=t==null?void 0:t.read)==null?void 0:p.optionalMapFields)||[]).filter(v=>!l.some(I=>I.mapToName===v.mapToName))},[t,l]),h=l.length>0;return d.length>0||h?u.jsxs(u.Fragment,{children:[u.jsx(Pt,{string:"Map the following optional fields"}),u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d==null?void 0:d.map(y=>u.jsx(ns,{id:y.mapToName,children:u.jsx(cc,{allFields:s,field:y,onSelectChange:f})},y.mapToName)),h&&u.jsx(eS,{dynamicFieldMappings:l,onSelectChange:f,allFields:s})]})]}):null}function nS(){var f;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Zt(),{isError:r,removeError:o,setError:i}=ln(),s=(f=t==null?void 0:t.read)==null?void 0:f.selectedFieldMappings,a=l=>{const{value:d,name:h}=l.target;!d||$f({selectedFieldMappings:s,selectedObjectName:e,fieldName:h,fieldValue:d,setError:i})||(e&&Mi(e,n,[{field:h,value:d}]),r(we.MAPPING,h)&&o(we.MAPPING,h),e&&r(we.MAPPING,e)&&o(we.MAPPING,e))},c=b.useMemo(()=>{var l;return((l=t==null?void 0:t.read)==null?void 0:l.requiredMapFields)||[]},[t]);return c!=null&&c.length?u.jsxs(u.Fragment,{children:[u.jsx(Pt,{string:"Map the following fields"}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(l=>{var d;return u.jsx(ns,{id:l.mapToName,isInvalid:r(we.MAPPING,l.mapToName),errorMessage:"* required",children:u.jsx(cc,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:l,onSelectChange:a})},l.mapToName)})})]}):null}const rS=(e,t)=>e.filter(n=>!t.has(n));function iS(){var h,m,g;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Zt(),{fieldMapping:r}=ut(),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=((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),l=new Set(f),d=rS(i,l);b.useEffect(()=>{e&&d.length&&Mi(e,n,d.map(w=>({field:w,value:null})))},[e,n,d])}const oS={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function sS({children:e,style:t}){return u.jsx(Tn,{style:{...oS,...t},children:e})}function aS(){var f,l,d;const{data:e}=rr(),{hydratedRevision:t}=mi(),{selectedObjectName:n}=Zt(),{providerName:r}=pt(),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&&cn(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&cn(a);return c&&o&&r?u.jsx(sS,{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 Lu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Vf(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Lu(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():Lu(e[o],null)}}}}function ui(...e){return H.useCallback(Vf(...e),e)}function rs(e,t=[]){let n=[];function r(i,s){const a=H.createContext(s),c=n.length;n=[...n,s];const f=d=>{var x;const{scope:h,children:m,...g}=d,w=((x=h==null?void 0:h[e])==null?void 0:x[c])||a,y=H.useMemo(()=>g,Object.values(g));return u.jsx(w.Provider,{value:y,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[c])||a,g=H.useContext(m);if(g)return g;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=>H.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return H.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,cS(o,...t)]}function cS(...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 d=c(i)[`__scope${f}`];return{...a,...d}},{});return H.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 ki=globalThis!=null&&globalThis.document?H.useLayoutEffect:()=>{},uS=H[" useInsertionEffect ".trim().toString()]||ki;function uc({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=lS({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const l=H.useRef(e!==void 0);H.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=H.useCallback(l=>{var d;if(a){const h=dS(l)?l(e):l;h!==e&&((d=s.current)==null||d.call(s,h))}else i(l)},[a,e,i,s]);return[c,f]}function lS({defaultProp:e,onChange:t}){const[n,r]=H.useState(e),o=H.useRef(n),i=H.useRef(t);return uS(()=>{i.current=t},[t]),H.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function dS(e){return typeof e=="function"}function fS(e){const t=H.useRef({value:e,previous:e});return H.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function pS(e){const[t,n]=H.useState(void 0);return ki(()=>{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 hS(e,t){return H.useReducer((n,r)=>t[n][r]??n,e)}var lc=e=>{const{present:t,children:n}=e,r=mS(t),o=typeof n=="function"?n({present:r.isPresent}):H.Children.only(n),i=ui(r.ref,gS(o));return typeof n=="function"||r.isPresent?H.cloneElement(o,{ref:i}):null};lc.displayName="Presence";function mS(e){const[t,n]=H.useState(),r=H.useRef(null),o=H.useRef(e),i=H.useRef("none"),s=e?"mounted":"unmounted",[a,c]=hS(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return H.useEffect(()=>{const f=go(r.current);i.current=a==="mounted"?f:"none"},[a]),ki(()=>{const f=r.current,l=o.current;if(l!==e){const h=i.current,m=go(f);e?c("MOUNT"):m==="none"||(f==null?void 0:f.display)==="none"?c("UNMOUNT"):c(l&&h!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),ki(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,d=m=>{const w=go(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&w&&(c("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},h=m=>{m.target===t&&(i.current=go(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 c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:H.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function go(e){return(e==null?void 0:e.animationName)||"none"}function gS(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 ha(e){const t=yS(e),n=H.forwardRef((r,o)=>{const{children:i,...s}=r,a=H.Children.toArray(i),c=a.find(wS);if(c){const f=c.props.children,l=a.map(d=>d===c?H.Children.count(f)>1?H.Children.only(null):H.isValidElement(f)?f.props.children:null:d);return u.jsx(t,{...s,ref:o,children:H.isValidElement(f)?H.cloneElement(f,void 0,l):null})}return u.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function yS(e){const t=H.forwardRef((n,r)=>{const{children:o,...i}=n;if(H.isValidElement(o)){const s=IS(o),a=bS(i,o.props);return o.type!==H.Fragment&&(a.ref=r?Vf(r,s):s),H.cloneElement(o,a)}return H.Children.count(o)>1?H.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vS=Symbol("radix.slottable");function wS(e){return H.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vS}function bS(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 IS(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 CS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],An=CS.reduce((e,t)=>{const n=ha(`Primitive.${t}`),r=H.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}},{}),is="Checkbox",[SS,WO]=rs(is),[xS,dc]=SS(is);function OS(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:a,onCheckedChange:c,required:f,value:l="on",internal_do_not_use_render:d}=e,[h,m]=uc({prop:n,defaultProp:o??!1,onChange:c,caller:is}),[g,w]=H.useState(null),[y,x]=H.useState(null),p=H.useRef(!1),v=g?!!s||!!g.closest("form"):!0,I={checked:h,disabled:i,setChecked:m,control:g,setControl:w,name:a,form:s,value:l,hasConsumerStoppedPropagationRef:p,required:f,defaultChecked:Yn(o)?!1:o,isFormControl:v,bubbleInput:y,setBubbleInput:x};return u.jsx(xS,{scope:t,...I,children:ES(d)?d(I):r})}var Uf="CheckboxTrigger",qf=H.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:s,disabled:a,checked:c,required:f,setControl:l,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:g}=dc(Uf,e),w=ui(o,l),y=H.useRef(c);return H.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const p=()=>d(y.current);return x.addEventListener("reset",p),()=>x.removeEventListener("reset",p)}},[i,d]),u.jsx(An.button,{type:"button",role:"checkbox","aria-checked":Yn(c)?"mixed":c,"aria-required":f,"data-state":Wf(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=>{d(p=>Yn(p)?!0:!p),g&&m&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})})});qf.displayName=Uf;var fc=H.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c,onCheckedChange:f,form:l,...d}=e;return u.jsx(OS,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:a,required:s,onCheckedChange:f,name:r,form:l,value:c,internal_do_not_use_render:({isFormControl:h})=>u.jsxs(u.Fragment,{children:[u.jsx(qf,{...d,ref:t,__scopeCheckbox:n}),h&&u.jsx(Jf,{__scopeCheckbox:n})]})})});fc.displayName=is;var Hf="CheckboxIndicator",pc=H.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=dc(Hf,n);return u.jsx(lc,{present:r||Yn(i.checked)||i.checked===!0,children:u.jsx(An.span,{"data-state":Wf(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});pc.displayName=Hf;var Bf="CheckboxBubbleInput",Jf=H.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:s,required:a,disabled:c,name:f,value:l,form:d,bubbleInput:h,setBubbleInput:m}=dc(Bf,e),g=ui(n,m),w=fS(i),y=pS(r);H.useEffect(()=>{const p=h;if(!p)return;const v=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(v,"checked").set,N=!o.current;if(w!==i&&S){const R=new Event("click",{bubbles:N});p.indeterminate=Yn(i),S.call(p,Yn(i)?!1:i),p.dispatchEvent(R)}},[h,w,i,o]);const x=H.useRef(Yn(i)?!1:i);return u.jsx(An.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??x.current,required:a,disabled:c,name:f,value:l,form:d,...t,tabIndex:-1,ref:g,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Jf.displayName=Bf;function ES(e){return typeof e=="function"}function Yn(e){return e==="indeterminate"}function Wf(e){return Yn(e)?"indeterminate":e?"checked":"unchecked"}function hc(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 _S=["color"],zf=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=hc(e,_S);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"}))}),NS=["color"],TS=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=hc(e,NS);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"}))}),AS=["color"],RS=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=hc(e,AS);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 PS="_checkboxGroupContainer_hqfeu_1",FS="_stack_hqfeu_6",DS="_selectAllContainer_hqfeu_10",MS="_fieldContainer_hqfeu_17",kS="_checkbox_hqfeu_1",li={checkboxGroupContainer:PS,stack:FS,selectAllContainer:DS,fieldContainer:MS,checkbox:kS};function jS({id:e,isChecked:t,label:n,onCheckedChange:r}){return u.jsxs("div",{className:li.fieldContainer,children:[u.jsx(fc,{className:li.checkbox,id:e,onCheckedChange:r,checked:t,children:u.jsx(pc,{children:u.jsx(zf,{})})}),u.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function LS({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return u.jsxs("div",{className:li.selectAllContainer,children:[u.jsx(fc,{className:li.checkbox,id:e,onCheckedChange:r,checked:o?"indeterminate":t,children:u.jsxs(pc,{children:[o&&u.jsx(TS,{}),t===!0&&u.jsx(zf,{})]})}),u.jsx("label",{htmlFor:e,children:n})]})}function KS({children:e}){return u.jsx("div",{className:li.checkboxGroupContainer,children:e})}function $S({children:e}){return u.jsx("div",{className:li.stack,children:e})}const VS="_paginationContainer_1p51x_1",US="_pageInfo_1p51x_7",qS="_searchContainer_1p51x_13",HS="_searchInput_1p51x_17",BS="_noResults_1p51x_21",Ci={paginationContainer:VS,pageInfo:US,searchContainer:qS,searchInput:HS,noResults:BS};function Gf({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(""),l=e.filter(v=>v.label.toLowerCase().includes(c.toLowerCase())),d=Math.ceil(l.length/n),h=(s-1)*n,m=h+n,g=l.slice(h,m),w=v=>{f(v),a(1)},y=v=>{l.forEach(I=>{t(I.id,v)})},x=l.length>0&&l.every(v=>v.isChecked),p=l.some(v=>v.isChecked);return u.jsxs(KS,{children:[o&&u.jsx("div",{className:Ci.searchContainer,children:u.jsx(Pd,{id:"field-search",type:"text",placeholder:i,value:c,onChange:v=>w(v.target.value),className:Ci.searchInput})}),r&&e.length>=2&&u.jsx(LS,{id:"select-all-fields",isChecked:x,label:`Select all ${l.length} ${c?"matching ":""}fields`,onCheckedChange:y,isIndeterminate:p&&!x}),u.jsx($S,{children:g.map(v=>u.jsx(jS,{id:v.id,isChecked:v.isChecked,label:v.label,onCheckedChange:I=>t(v.id,I===!0)},v.id))}),d>1&&u.jsxs("div",{className:Ci.paginationContainer,children:[u.jsx(ze,{type:"button",onClick:()=>a(v=>Math.max(1,v-1)),disabled:s===1,variant:"ghost",children:"<"}),u.jsxs("span",{className:Ci.pageInfo,children:[s," of ",d]}),u.jsx(ze,{type:"button",onClick:()=>a(v=>Math.min(d,v+1)),disabled:s===d,variant:"ghost",children:">"})]}),l.length===0&&c&&u.jsxs("div",{className:Ci.noResults,children:['No fields found matching "',c,'"']})]})}function JS(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 WS(e,t,n,r){t(e,o=>JS(o,n,r))}function zS(){var f,l;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Zt(),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&&WS(r,n,d,h)},a=b.useMemo(()=>(i==null?void 0:i.filter(d=>!ir(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)&&u.jsxs(u.Fragment,{children:[u.jsx(Pt,{string:`${e} reads the following optional fields`}),u.jsx(Gf,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${i==null?void 0:i.length}`)]})}function GS(){return u.jsx(zS,{})}const QS={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 XS({children:e,style:t,...n}){return u.jsx("span",{style:{...QS,...t},...n,children:e})}const YS="_errorAlert_1tcao_1",ZS="_errorHeader_1tcao_11",ex="_errorIcon_1tcao_17",tx="_errorTitle_1tcao_24",nx="_errorMessage_1tcao_30",Si={errorAlert:YS,errorHeader:ZS,errorIcon:ex,errorTitle:tx,errorMessage:nx};function rx({error:e}){return u.jsxs("div",{className:Si.errorAlert,children:[u.jsxs("div",{className:Si.errorHeader,children:[u.jsx(RS,{className:Si.errorIcon}),u.jsx("span",{className:Si.errorTitle,children:"Unable to load object"})]}),u.jsx("div",{className:Si.errorMessage,children:e})]})}function ix(){var s,a,c;const{data:e}=Ta(),{selectedObjectName:t}=Zt(),{appName:n}=rr(),r=(c=(a=(s=e==null?void 0:e.content)==null?void 0:s.read)==null?void 0:a.objects)==null?void 0:c.find(f=>f.objectName===t),o=r==null?void 0:r.error,i=r==null?void 0:r.requiredFields;return o?u.jsx(rx,{error:o}):u.jsxs(u.Fragment,{children:[u.jsx(Pt,{string:`${n} reads the following fields`}),u.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:i!=null&&i.length?i.map(f=>ir(f)?null:u.jsx(XS,{children:f.displayName},f.fieldName)):"There are no required fields."})]})}function ox(e,t,n,r,o){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[o]||(e.read.selectedValueMappings[o]={}),r===""&&e.read.selectedValueMappings[o][n]?delete e.read.selectedValueMappings[o][n]:e.read.selectedValueMappings[o][n]=r)}function Qf(e,t,n,r,o){t(e,i=>ox(i,e,n,r,o))}function Ns(e){return e.mapToDisplayName||e.mapToName||e.fieldName||""}function sx(e,t){if(!e.fieldName)return{isValid:!1,errorMessage:"Field name is missing"};const n=t==null?void 0:t.valueType;if(!["singleSelect","multiSelect"].includes(n||""))return{isValid:!1,errorMessage:"fieldName is not a singleSelect or multiSelect"};const r=t==null?void 0:t.values;if(!r)return{isValid:!1,errorMessage:"Field values array is missing"};const o=Object.keys(r).length,i=Object.keys((e==null?void 0:e.mappedValues)||[]).length;return o!==i?{isValid:!1,errorMessage:"field values and the values to be mapped are not of the same length"}:{isValid:!0}}function ax(e,t,n){const r=Object.values(t).filter(Boolean),o=t[n];return e.filter(i=>{const s=i.value===o,a=r.includes(i.value);return s||!a})}function cx({string:e,fieldName:t}){return 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(Xo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function ux({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]),l=b.useCallback(g=>{g&&t({target:{name:e.mappedValue,value:g.value,fieldName:n}})},[t,n,e.mappedValue]),d=b.useMemo(()=>u.jsx(Nf,{items:f,selectedValue:c||null,onSelectedItemChange:l,placeholder:"Please select one",style:{borderRadius:"8px",width:"100%"}},c),[c,f,l]),h=b.useCallback(()=>{i&&Qf(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:[d,u.jsx(ze,{type:"button",variant:"ghost",onClick:h,children:"Clear"})]})]},e.mappedValue)}function lx(){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 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&&Qf(t,r,h,d,m)},[t,r]);return s!=null&&s.length?u.jsx(u.Fragment,{children:s.map(l=>{var m,g,w;const d=(g=(m=n==null?void 0:n.read)==null?void 0:m.allFieldsMetadata)==null?void 0:g[l.fieldName],h=sx(l,d);return h.isValid?u.jsxs(u.Fragment,{children:[u.jsx(cx,{string:"Map the values for ",fieldName:Ns(l)}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:u.jsx(ns,{id:Ns(l),children:(w=l==null?void 0:l.mappedValues)==null?void 0:w.map(y=>{const x=(d==null?void 0:d.values)||[],p=(i==null?void 0:i[l.fieldName])||{},v=ax(x,p,y.mappedValue);return u.jsx(ux,{allValueOptions:v,mappedValue:y,onSelectChange:a,fieldName:(l==null?void 0:l.fieldName)||""},`${y.mappedValue}-${l.fieldName}`)})},Ns(l))})]}):(console.error(h.errorMessage,l),null)})}):null}const dx=!1;function fx(){return iS(),u.jsxs(u.Fragment,{children:[u.jsx(aS,{}),u.jsx(ix,{}),u.jsx(nS,{}),u.jsx(tS,{}),u.jsx(lx,{}),u.jsx(GS,{}),dx]})}function px(e,t,n){var r;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const o=e.write.selectedWriteObjects;n&&(o[t]={objectName:t}),n||delete o[t]}}function hx(e,t,n,r){t(e,o=>{px(o,n,r)})}function mx(){var f,l;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Zt(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(l=n==null?void 0:n.write)==null?void 0:l.writeObjects,s=(d,h)=>{t&&n&&hx(t,r,d,h)},a=!!i,c=(i==null?void 0:i.map(d=>({id:d.objectName,label:d.displayName,isChecked:!!(o!=null&&o[d.objectName])})))||[];return a&&u.jsxs(u.Fragment,{children:[u.jsx(Pt,{string:`Allow ${e} to write to these objects`}),u.jsx(Gf,{items:c,onItemChange:s,showSelectAll:i.length>=2})]})}function gx(){return u.jsx(u.Fragment,{children:u.jsx(mx,{})})}function Xf({resetComponent:e,onDisconnectSuccess:t}){return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[u.jsx(Pt,{string:"Remove connection"}),u.jsx("p",{children:"Click to disconnect your connection from the provider."}),u.jsx(jd,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const yx="_authenticationRow_1g2ms_1",vx="_field_1g2ms_8",wx="_value_1g2ms_12",Ts={authenticationRow:yx,field:vx,value:wx};function Ku({label:e,value:t}){return u.jsxs("div",{className:Ts.authenticationRow,children:[u.jsx("div",{className:Ts.field,children:e}),u.jsx("div",{className:Ts.value,children:t})]})}function bx(){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(Pt,{string:"Connection details"}),u.jsxs("div",{style:{paddingBottom:"1rem"},children:[u.jsx(Ku,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),u.jsx(Ku,{label:"Status",value:cn((e==null?void 0:e.status)||"")})]})]})}const Ix=()=>{const e=ct(),t=qe();return Nn({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 Yf({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),l=!r||!o||!(i!=null&&i.id)||c,d=Ix(),h=async()=>{l||(f(!0),console.warn("uninstalling installation",{projectIdOrName:r,integrationId:o,installationId:i.id}),d.mutate({projectIdOrName:r,integrationId:o,installationId:i.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",i.id),a==null||a(i==null?void 0:i.id),s()},onSettled:()=>f(!1)}))},m=c?"Uninstalling...":e,g=u.jsx(ze,{type:"button",onClick:h,disabled:l,variant:t,style:n,children:m});return i!=null&&i.id?g:null}function Cx(){const{installation:e}=ut(),{providerName:t}=pt();return e?u.jsxs(u.Fragment,{children:[u.jsx(Pt,{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(Yf,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function Sx(){const{installation:e,resetComponent:t}=ut();return u.jsxs(u.Fragment,{children:[u.jsx(bx,{}),u.jsx(ja,{}),e&&u.jsx(Cx,{}),!e&&u.jsx(Xf,{resetComponent:t})]})}function Zf({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var de,be,F,$,J,U,q,K,Q,Z,Y,ee,ne,ce;const{installation:i}=Fr(),{hydratedRevision:s,loading:a}=mi(),{configureState:c,selectedObjectName:f}=Zt(),l=i==null?void 0:i.config,d=l&&f&&!!hd(l,f)||!1,h=f?Nd(l,f):void 0,m=(de=c==null?void 0:c.read)==null?void 0:de.selectedFieldMappings,g=!wd(h,m),w=s&&f?Da(l,s,f):void 0,y=(be=c==null?void 0:c.read)==null?void 0:be.selectedOptionalFields,x=!vd(w,y),p=f?(U=(J=($=(F=l==null?void 0:l.content)==null?void 0:F.read)==null?void 0:$.objects)==null?void 0:J[f])==null?void 0:U.selectedValueMappings:void 0,v=(q=c==null?void 0:c.read)==null?void 0:q.selectedValueMappings,I=!bd(p,v),S=(Q=(K=l==null?void 0:l.content)==null?void 0:K.write)==null?void 0:Q.objects,N=(Z=c==null?void 0:c.write)==null?void 0:Z.selectedWriteObjects,R=!Id(S||{},N||{}),D=x||g||I||R||r||f!==ni&&!d,V=!!((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||!c||!f||!D||V,L=f===ni,se=f===Po,re=u.jsx(ze,{type:"submit",disabled:j,children:r?"Install":"Save"}),ge=u.jsx(ze,{type:"button",onClick:t,disabled:j,variant:"ghost",children:"Reset"});return n?u.jsx(Fi,{}):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:!se&&u.jsxs(u.Fragment,{children:[re,ge]})}),u.jsxs(Tn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&u.jsx(Hi,{children:typeof o=="string"?o:"Installation Failed."}),a&&u.jsx(Fi,{}),s&&!L&&!se&&u.jsx(fx,{}),s&&L&&!se&&u.jsx(gx,{}),!a&&se&&u.jsx(Sx,{})]})]})}const ep=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i,fieldMapping:s}=ut(),{hydratedRevision:a,loading:c}=mi(),{selectedObjectName:f}=$d(),{selectedConnection:l}=Yt(),d=pl(),{projectIdOrName:h}=Le(),{resetBoundary:m,setErrors:g,setError:w,getError:y}=ln(),{resetConfigureState:x,objectConfigurationsState:p}=La(),v=Td(f||"",p),{onNextIncompleteTab:I}=$I(),S=b.useCallback(()=>{m(we.INSTALLATION_MUTATION)},[m]),N=b.useCallback(E=>E?P=>{w(we.INSTALLATION_MUTATION,E,P)}:P=>{console.error("objectName is required to set installation error: ",P)},[w]),R=b.useCallback(E=>E?y(we.INSTALLATION_MUTATION,E):"",[y]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:a,loading:c,selectedObjectName:f,selectedConnection:l,apiKey:d,projectIdOrName:h,resetBoundary:m,setErrors:g,setMutateInstallationError:N,getMutateInstallationError:R,resetMutateInstallationErrorState:S,resetConfigureState:x,objectConfigurationsState:p,configureState:v,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:c,getMutateInstallationError:f,resetMutateInstallationErrorState:l,resetConfigureState:d,objectConfigurationsState:h,configureState:m,onInstallSuccess:g,onNextIncompleteTab:w,fieldMapping:y}=ep(),[x,p]=b.useState(!1),{createInstallation:v}=ud(),I=o===ni,S=f(o),N=b.useCallback(()=>{s(we.MAPPING),n!=null&&n.content&&!r&&o&&Sd(n,xx,o,d)},[s,n,r,o,d]);b.useEffect(()=>{!m&&(n!=null&&n.content)&&!r&&N()},[m,h,n,r,N]);const R=()=>{l();const{requiredMapFields:A,selectedFieldMappings:D}=(m==null?void 0:m.read)||{},{errorList:V}=yd(A,D,a);if(!(V.length>0))if(o&&(i!=null&&i.id)&&e&&n){p(!0);const j=Zb(m,o,n,e,y);if(!j){console.error("Error when generating createConfig from configureState"),p(!1);return}v({config:j.content,onSuccess:L=>{t(L),g==null||g(L.id,L.config),p(!1),w()},onError:L=>{c(o)(L.message),p(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},E=()=>{if(l(),o&&(i!=null&&i.id)&&e&&n){p(!0);const A=tI(m,n,e);if(!A){console.error("Error when generating createConfig from configureState"),p(!1);return}v({config:A.content,onSuccess:D=>{t(D),g==null||g(D.id,D.config),p(!1),w()},onError:D=>{c(o)(D.message),p(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},P=A=>{A.preventDefault(),I?E():R()};return u.jsx(Zf,{errorMsg:S,isCreateMode:!0,isLoading:x,onSave:P,onReset:N})}const Ex=(e,t,n,r,o)=>{const i=xd(e),s=Od(e),a=Ed(t,o),c=_d(e),f={content:{read:{objects:{[t]:{objectName:t,selectedFields:i,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:c||{},backfill:r}}}}};return qi(n)&&(f.content||(f.content={}),f.content.proxy={enabled:!0}),f},_x=(e,t)=>{const r={content:{write:{objects:Ad(e)}}};return qi(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r};function Nx({installation:e}){const{setInstallation:t,hydratedRevision:n,loading:r,selectedObjectName:o,resetBoundary:i,setErrors:s,setMutateInstallationError:a,getMutateInstallationError:c,resetConfigureState:f,configureState:l,onUpdateSuccess:d,onNextIncompleteTab:h,fieldMapping:m}=ep(),{updateInstallation:g}=ld(),[w,y]=b.useState(!1),x=o===ni,p=c(o),{config:v}=e,I=b.useCallback(()=>{i(we.MAPPING),n!=null&&n.content&&!r&&o&&Sd(n,v,o,f)},[i,n,r,o,v,f]);b.useEffect(()=>{l||I()},[l,I]);const S=b.useMemo(()=>{var A,D,V;return(V=(D=(A=n==null?void 0:n.content)==null?void 0:A.read)==null?void 0:D.objects)==null?void 0:V.find(j=>(j==null?void 0:j.objectName)===o)},[n,o]),N=()=>{const{requiredMapFields:P,selectedFieldMappings:A}=(l==null?void 0:l.read)||{},{errorList:D}=yd(P,A,s);if(!(D.length>0))if(n&&l&&o&&S){y(!0);const V=Ex(l,o,n,S.backfill,m);if(!V){console.error("Error when generating updateConfig from configureState"),y(!1);return}g({config:V.content,onSuccess:j=>{t(j),d==null||d(j.id,j.config),y(!1),h()},onError:j=>{a(o)(j.message),y(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},R=()=>{if(l&&n){y(!0);const P=_x(l,n);if(!P){console.error("Error when generating write updateConfig from configureState"),y(!1);return}g({config:P.content,onSuccess:A=>{t(A),d==null||d(A.id,A.config),y(!1),h()},onError:A=>{a(o)(A.message),y(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},E=P=>{P.preventDefault(),x?R():N()};return u.jsx(Zf,{errorMsg:p,onSave:E,onReset:I,isLoading:w})}function Tx(){const{integrationObj:e,installation:t}=ut();return e?t&&e?u.jsx(Nx,{installation:t}):u.jsx(Ox,{}):u.jsx(rd,{message:"We can't load the integration"})}function Ax(){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 mc({text:e,children:t}){return u.jsx(pi,{children:u.jsxs(Tn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[u.jsx(Ax,{}),u.jsx("p",{children:e}),t]})})}function Rx({provider:e}){const{providerName:t}=pt(e),n=`You have successfully installed your ${t} integration.`;return u.jsx(mc,{text:n,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(Yf,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Px=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function Fx({children:e}){var S;const t=b.useRef(!1),{projectIdOrName:n}=Le(),{hydratedRevision:r,loading:o}=mi(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,onInstallSuccess:f,isIntegrationDeleted:l}=ut(),{mutate:d,isIdle:h,isPending:m,error:g,errorMsg:w}=cd(),{selectedConnection:y,isConnectionsLoading:x}=Yt(),p=o||m||x,v=(S=r==null?void 0:r.content)==null?void 0:S.provider,I=Px(r);return b.useEffect(()=>{var N;if(!p&&!x&&r&&I&&!s&&y&&(i!=null&&i.id)&&!l&&v){const R={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:y==null?void 0:y.id,config:{content:{provider:v}}}};qi(r)===!0&&(R.installation.config.content.proxy=(N=r==null?void 0:r.content)==null?void 0:N.proxy),h&&!t.current&&(d(R,{onSuccess:E=>{f==null||f(E==null?void 0:E.id,E.config)}}),t.current=!0)}},[r,I,s,y,n,i==null?void 0:i.id,a,c,p,f,l,x,v,d,h]),I&&v&&s?u.jsx(Rx,{provider:v}):g?u.jsx(zt,{message:w??"Create installation failed"}):i?p?u.jsx(hi,{}):u.jsx("div",{children:e}):u.jsx(zt,{message:"We can't load the integration"})}function zi(){const e=ct(),t=qe();return Nn({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 Dx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Le(),f=zi(),l=b.useCallback(d=>{var w;const{apiKey:h,providerMetadata:m}=d,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:h,...m&&{providerMetadata:m}}};f.mutate(g)},[c,i,o,r,n,e,f]);return a===null?u.jsx(bI,{provider:e,providerInfo:t,handleSubmit:l,error:null}):s}function Mx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Le(),f=zi(),l=b.useCallback(d=>{var y;const{user:h,pass:m,providerMetadata:g}=d,w={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(y=g==null?void 0:g.workspace)==null?void 0:y.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:h,password:m},...g&&{providerMetadata:g}}};f.mutate(w)},[c,i,o,r,n,e,f]);return a===null?u.jsx(OI,{provider:e,providerInfo:t,handleSubmit:l,error:null}):s}function $u({url:e,prompt:t,inputName:n}){return u.jsx("p",{style:{color:"var(--amp-colors-text-muted)",display:"flex",justifyContent:"space-between"},children:u.jsxs("span",{children:[e?u.jsx(Ma,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:n})}):u.jsx("span",{children:n})," ",t&&u.jsx(Kf,{id:`docs-helper-text-${Db(n||(t==null?void 0:t.slice(0,50)))}`,tooltipText:t})]})})}function kx({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r}){var h,m;const[o,i]=b.useState({}),s=((h=e.metadata)==null?void 0:h.input)||[],a=g=>{const{name:w,value:y}=g.currentTarget;i(x=>({...x,[w]:y.trim()}))},c=ri(s,o),f=n||!c,l=((m=e.customOpts)==null?void 0:m.inputs)||[],d=()=>{const g=Go(s,o),w=Object.fromEntries(l.map(y=>[y.name,o[y.name]]));t({customAuth:w,providerMetadata:g})};return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[l.map(g=>u.jsxs("div",{children:[u.jsx($u,{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($u,{url:g.docsURL,prompt:g.displayName||g.name,inputName:g.displayName||cn(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:d,variant:r,children:"Next"})]})}function jx({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r}){return u.jsxs(or,{children:[u.jsx(sr,{children:`Set up ${e.displayName} integration`}),u.jsx(dn,{error:n}),u.jsx(kx,{providerInfo:e,handleSubmit:t,isButtonDisabled:r})]})}function Lx({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s}){const{projectIdOrName:a}=Le(),c=zi(),[f,l]=b.useState(null),d=b.useCallback(h=>{var y;const{customAuth:m,providerMetadata:g}=h;l(null);const w={projectIdOrName:a,generateConnectionParams:{providerWorkspaceRef:(y=g==null?void 0:g.workspace)==null?void 0:y.value,groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:m,...g&&{providerMetadata:g}}};c.mutate(w,{onError:x=>{We(x,l)},onSuccess:()=>{l(null)}})},[a,o,r,n,t,e.name,c]);return s===null?u.jsx(jx,{providerInfo:e,handleSubmit:d,error:f}):i}function Kx({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(or,{children:[u.jsx(sr,{children:i||`Set up ${r} integration`}),u.jsx(dn,{error:t}),o,u.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function $x({...e}){return u.jsx(Kx,{...e})}function Vx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=Le(),f=zi(),l=b.useCallback(()=>{const d={projectIdOrName:c,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};f.mutate(d)},[c,o,r,n,t,e,f]);return s===null?u.jsx($x,{handleSubmit:l,error:null,providerName:a}):i}const Ux=()=>{const e=ct(),t=qe();return Nn({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 u.jsxs(or,{children:[u.jsx(sr,{children:`Set up ${r} integration`}),u.jsx(gI,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),u.jsx(dn,{error:t}),u.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const Hx="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 u.jsxs(or,{children:[u.jsx(sr,{children:"Enter your Salesforce subdomain"}),u.jsx(Ma,{href:Hx,newTab:!0,children:"What is my Salesforce subdomain?"}),u.jsx(dn,{error:n}),u.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[u.jsx(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 Jx({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return u.jsxs(or,{children:[u.jsxs(sr,{children:["Enter your ",o," workspace"]}),u.jsx(dn,{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 Vu=600,Uu=600,qu="salesforce";function Wx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var D;const{projectId:s}=rr(),a=qe(),c=b.useRef(null),[f,l]=b.useState(null),[d,h]=b.useState(""),[m,g]=b.useState({}),[w,y]=b.useState({}),{data:x}=zo(e),p=((D=x==null?void 0:x.metadata)==null?void 0:D.input)||[],{mutateAsync:v,isPending:I}=Ux(),{isFetching:S,refetch:N}=Pa({groupRef:r,provider:e});b.useEffect(()=>{const V=j=>{var L,se,re;j.origin===ed&&(((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=c.current)==null||re.close())};return window.addEventListener("message",V),()=>window.removeEventListener("message",V)},[a]);const R=V=>{h(V),g(j=>({...j,workspace:V})),y(j=>({...j,workspace:{value:V,source:"input"}}))},E=(V,j)=>{g(L=>({...L,[V]:j})),y(L=>({...L,[V]:{value:j,source:"input"}}))},P=async()=>{var V;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&&!ri(p,m)){l("Please fill in all required fields");return}try{const j=await v({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s||"",consumerName:n,groupName:o,providerWorkspaceRef:e===qu?d:(V=w==null?void 0:w.workspace)==null?void 0:V.value,providerMetadata:w}});if(j){const L=window.screenX+(window.outerWidth-Vu)/2,se=window.screenY+(window.outerHeight-Uu)/2.5,re=`width=${Vu},height=${Uu},left=${L},top=${se}`;c.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.")}},A=e===qu?u.jsx(Bx,{handleSubmit:P,setWorkspace:R,error:f,isButtonDisabled:d.length===0||I||S}):p.length>0?u.jsx(Jx,{handleSubmit:P,setFormData:E,error:f,isButtonDisabled:!ri(p,m)||I||S,providerName:i,metadataFields:p}):u.jsx(qx,{handleSubmit:P,error:f,providerName:i,isButtonDisabled:I||S});return u.jsx("div",{children:A})}function zx({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:c}=Le(),f=zi(),[l,d]=b.useState(null),h=b.useCallback(m=>{var w,y;d(null);const g={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(y=(w=m.providerMetadata)==null?void 0:w.workspace)==null?void 0:y.value,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes},...m.providerMetadata&&{providerMetadata:m.providerMetadata}}};f.mutate(g,{onError:()=>d("Error loading provider info")})},[c,i,o,r,n,e,f]);return a===null?u.jsx(_I,{provider:e,providerName:t,handleSubmit:h,error:l,explicitScopesRequired:s}):u.jsx(Fi,{})}function Gx({...e}){return u.jsx(zx,{...e})}const Qx="authorizationCode",Xx="authorizationCodePKCE",Yx="clientCredentials";function Zx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=pt(e);if(t.oauth2Opts===void 0)return u.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:c};return f===Qx||f===Xx?u.jsx(Wx,{...d}):f===Yx?u.jsx(Gx,{...d,explicitScopesRequired:l,selectedConnection:s,setSelectedConnection:a}):f==="password"?u.jsx("em",{children:"Password flow not supported yet"}):u.jsxs("em",{children:["Unsupported grant type: ",f]})}function eO(e){const{selectedConnection:t}=Yt();b.useEffect(()=>{e&&t&&e(t)},[e,t])}function tO({onSuccess:e}){eO(e)}function tp({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:f,isLoading:l,isError:d,error:h,providerName:m,selectedProvider:g}=pt(e),{provider:w,isIntegrationDeleted:y}=ut(),{selectedConnection:x,setSelectedConnection:p}=Yt();tO({onSuccess:s});const v=qe(),I=f;b.useEffect(()=>{d&&(console.error("Error loading provider info."),We(h))},[d,h]);const S=b.useCallback(()=>{v.clear(),c()},[c,v]);if(!e&&!w)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(y)return u.jsx(mc,{text:"Integration successfully uninstalled.",children:u.jsx(ze,{type:"button",onClick:S,style:{width:"100%"},children:"Reinstall Integration"})});if(x)return i;if(l)return u.jsx(hi,{});if(I==null)return u.jsx(zt,{message:"Provider info was not found."});const N={provider:g,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:x,setSelectedConnection:p,providerName:m,providerInfo:I,onDisconnectSuccess:a};return I.authType==="none"?u.jsx(Vx,{...N,children:i}):I.authType==="basic"?u.jsx(Mx,{...N,children:i}):I.authType==="apiKey"?u.jsx(Dx,{...N,children:i}):I.authType==="custom"?u.jsx(Lx,{...N,children:i}):u.jsx(Zx,{...N})}function nO(e){const t=e+"CollectionProvider",[n,r]=rs(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=w=>{const{scope:y,children:x}=w,p=b.useRef(null),v=b.useRef(new Map).current;return u.jsx(o,{scope:y,itemMap:v,collectionRef:p,children:x})};s.displayName=t;const a=e+"CollectionSlot",c=ha(a),f=b.forwardRef((w,y)=>{const{scope:x,children:p}=w,v=i(a,x),I=ui(y,v.collectionRef);return u.jsx(c,{ref:I,children:p})});f.displayName=a;const l=e+"CollectionItemSlot",d="data-radix-collection-item",h=ha(l),m=b.forwardRef((w,y)=>{const{scope:x,children:p,...v}=w,I=b.useRef(null),S=ui(y,I),N=i(l,x);return b.useEffect(()=>(N.itemMap.set(I,{ref:I,...v}),()=>void N.itemMap.delete(I))),u.jsx(h,{[d]:"",ref:S,children:p})});m.displayName=l;function g(w){const y=i(e+"CollectionConsumer",w);return b.useCallback(()=>{const p=y.collectionRef.current;if(!p)return[];const v=Array.from(p.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((N,R)=>v.indexOf(N.ref.current)-v.indexOf(R.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:f,ItemSlot:m},g,r]}var rO=H[" useId ".trim().toString()]||(()=>{}),iO=0;function np(e){const[t,n]=H.useState(rO());return ki(()=>{n(r=>r??String(iO++))},[e]),e||(t?`radix-${t}`:"")}function oO(e){const t=H.useRef(e);return H.useEffect(()=>{t.current=e}),H.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var sO=H.createContext(void 0);function rp(e){const t=H.useContext(sO);return e||t||"ltr"}var As="rovingFocusGroup.onEntryFocus",aO={bubbles:!1,cancelable:!0},Gi="RovingFocusGroup",[ma,ip,cO]=nO(Gi),[uO,op]=rs(Gi,[cO]),[lO,dO]=uO(Gi),sp=H.forwardRef((e,t)=>u.jsx(ma.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(ma.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(fO,{...e,ref:t})})}));sp.displayName=Gi;var fO=H.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...d}=e,h=H.useRef(null),m=ui(t,h),g=rp(i),[w,y]=uc({prop:s,defaultProp:a??null,onChange:c,caller:Gi}),[x,p]=H.useState(!1),v=oO(f),I=ip(n),S=H.useRef(!1),[N,R]=H.useState(0);return H.useEffect(()=>{const E=h.current;if(E)return E.addEventListener(As,v),()=>E.removeEventListener(As,v)},[v]),u.jsx(lO,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:w,onItemFocus:H.useCallback(E=>y(E),[y]),onItemShiftTab:H.useCallback(()=>p(!0),[]),onFocusableItemAdd:H.useCallback(()=>R(E=>E+1),[]),onFocusableItemRemove:H.useCallback(()=>R(E=>E-1),[]),children:u.jsx(An.div,{tabIndex:x||N===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:Gt(e.onMouseDown,()=>{S.current=!0}),onFocus:Gt(e.onFocus,E=>{const P=!S.current;if(E.target===E.currentTarget&&P&&!x){const A=new CustomEvent(As,aO);if(E.currentTarget.dispatchEvent(A),!A.defaultPrevented){const D=I().filter(re=>re.focusable),V=D.find(re=>re.active),j=D.find(re=>re.id===w),se=[V,j,...D].filter(Boolean).map(re=>re.ref.current);up(se,l)}}S.current=!1}),onBlur:Gt(e.onBlur,()=>p(!1))})})}),ap="RovingFocusGroupItem",cp=H.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=np(),f=i||c,l=dO(ap,n),d=l.currentTabStopId===f,h=ip(n),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:w}=l;return H.useEffect(()=>{if(r)return m(),()=>g()},[r,m,g]),u.jsx(ma.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:u.jsx(An.span,{tabIndex:d?0:-1,"data-orientation":l.orientation,...a,ref:t,onMouseDown:Gt(e.onMouseDown,y=>{r?l.onItemFocus(f):y.preventDefault()}),onFocus:Gt(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:Gt(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){l.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=mO(y,l.orientation,l.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let v=h().filter(I=>I.focusable).map(I=>I.ref.current);if(x==="last")v.reverse();else if(x==="prev"||x==="next"){x==="prev"&&v.reverse();const I=v.indexOf(y.currentTarget);v=l.loop?gO(v,I+1):v.slice(I+1)}setTimeout(()=>up(v))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:w!=null}):s})})});cp.displayName=ap;var pO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mO(e,t,n){const r=hO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return pO[r]}function up(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function gO(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var yO=sp,vO=cp,os="Tabs",[wO,zO]=rs(os,[op]),lp=op(),[bO,gc]=wO(os),dp=H.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...f}=e,l=rp(a),[d,h]=uc({prop:r,onChange:o,defaultProp:i??"",caller:os});return u.jsx(bO,{scope:n,baseId:np(),value:d,onValueChange:h,orientation:s,dir:l,activationMode:c,children:u.jsx(An.div,{dir:l,"data-orientation":s,...f,ref:t})})});dp.displayName=os;var fp="TabsList",pp=H.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=gc(fp,n),s=lp(n);return u.jsx(yO,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:u.jsx(An.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});pp.displayName=fp;var hp="TabsTrigger",mp=H.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=gc(hp,n),a=lp(n),c=yp(s.baseId,r),f=vp(s.baseId,r),l=r===s.value;return u.jsx(vO,{asChild:!0,...a,focusable:!o,active:l,children:u.jsx(An.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":f,"data-state":l?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:Gt(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Gt(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Gt(e.onFocus,()=>{const d=s.activationMode!=="manual";!l&&!o&&d&&s.onValueChange(r)})})})});mp.displayName=hp;var gp="TabsContent",IO=H.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=gc(gp,n),c=yp(a.baseId,r),f=vp(a.baseId,r),l=r===a.value,d=H.useRef(l);return H.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),u.jsx(lc,{present:o||l,children:({present:h})=>u.jsx(An.div,{"data-state":l?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:f,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&i})})});IO.displayName=gp;function yp(e,t){return`${e}-trigger-${t}`}function vp(e,t){return`${e}-content-${t}`}var CO=dp,SO=pp,wp=mp;const xO=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 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: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 EO(){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 _O="_tabsRoot_ktpr0_1",NO="_tabsList_ktpr0_6",TO="_tabTrigger_ktpr0_12",Vo={tabsRoot:_O,tabsList:NO,tabTrigger:TO};function AO(){return u.jsxs(u.Fragment,{children:[u.jsx(Xo,{style:{margin:"1rem 0"}}),u.jsx(wp,{value:Po,className:Vo.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[u.jsx(EO,{}),u.jsx("span",{children:"Manage"})]})})]})}function bp({objectName:e,completed:t,pending:n,displayName:r}){return u.jsx(wp,{value:e,className:Vo.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[OO(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 RO({completed:e,pending:t,displayName:n}){return u.jsxs(u.Fragment,{children:[u.jsx(Xo,{style:{margin:"1rem 0"}}),u.jsx(bp,{objectName:ni,completed:e,pending:t,displayName:n},"other-write")]})}function PO({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var l,d,h,m;const{data:i}=Ql(),{installation:s}=Fr(),a=s==null?void 0:s.config,c=(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 u.jsx(CO,{value:e,className:Vo.tabsRoot,onValueChange:n,children:u.jsxs(SO,{className:Vo.tabsList,children:[t.map(g=>{var D,V,j,L,se,re;const w=(j=(V=(D=a==null?void 0:a.content)==null?void 0:D.read)==null?void 0:V.objects)==null?void 0:j[g.name],y=r==null?void 0:r[g.name],x=Nd(a,g.name),p=(L=y==null?void 0:y.read)==null?void 0:L.selectedFieldMappings,v=!wd(x,p),I=i?Da(a,i,g.name):void 0,S=(se=y==null?void 0:y.read)==null?void 0:se.selectedOptionalFields,N=!vd(I,S),R=w==null?void 0:w.selectedValueMappings,E=(re=y==null?void 0:y.read)==null?void 0:re.selectedValueMappings,P=!bd(R,E),A=N||v||P||!1;return u.jsx(bp,{objectName:g.name,displayName:g.displayName,completed:g.completed,pending:A},g.name)}),o&&(()=>{const g=!Id(c||{},f||{});return u.jsx(RO,{completed:o.completed,pending:g,displayName:"Write"})})(),u.jsx(AO,{})]})})}function FO(e,t){return t===Po?{name:Po,completed:!1}:e.find(n=>n.name===t)}function DO({children:e}){var x;const{data:t}=rr(),{installation:n}=ut(),{providerName:r}=pt(),{hydratedRevision:o}=mi(),{objectConfigurationsState:i}=La(),[s,a]=b.useState(""),c=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,l=o&&md(f,o),d=l!==null,h=!!((x=o==null?void 0:o.content)!=null&&x.write),m=h?gd(f):void 0,g=b.useMemo(()=>{const p=[...l||[]];return m&&h&&p.push(m),p},[l,m,h]),w=FO(g,s),y=b.useCallback(()=>{const p=g.find(v=>w!==v&&!v.completed);p&&a(p.name)},[g,w]);return b.useEffect(()=>{!s&&g.length>0&&a(g[0].name)},[g,s,y]),u.jsx(Vd.Provider,{value:y,children:u.jsx(Kd.Provider,{value:w==null?void 0:w.name,children:u.jsxs(pi,{style:{maxWidth:"55rem"},children:[u.jsxs(Tn,{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}),d&&u.jsx(PO,{value:s,readNavObjects:l,onValueChange:p=>a(p),objectConfigurationsState:i,writeNavObject:m})]}),e]}),u.jsx(Fd,{})]})})})}function MO({...e}){return u.jsx(DO,{...e})}const kO="_resetContainer_lkwv9_4",Ip={resetContainer:kO},jO=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c})=>{var y;const{projectIdOrName:f,isLoading:l}=rr(),{isLoading:d}=Wo(),{isError:h,errorState:m}=ln(),{seed:g,reset:w}=dd();return l||d?u.jsx(hi,{}):h(we.PROJECT,f)?u.jsx(zt,{message:`Error loading project ${f}`}):h(we.INTEGRATION_LIST,f)?u.jsx(zt,{message:"Error retrieving integrations for the project, double check the API key"}):(y=m[we.INTEGRATION_LIST])!=null&&y.apiError?u.jsx(zt,{message:"Something went wrong, couldn't find integration information"}):u.jsx("div",{className:Ip.resetContainer,children:u.jsx(kb,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,resetComponent:w,children:u.jsx(ad,{children:u.jsx(tp,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:w,children:u.jsx(KI,{resetComponent:w,children:u.jsx(Fx,{children:u.jsx(UI,{children:u.jsx(MO,{children:u.jsx(Tx,{})})})})})})})},g)})};function LO({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(Ra,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:u.jsx(jO,{...f})})}function KO(){return u.jsxs(pi,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[u.jsx(Fi,{}),u.jsx("p",{children:"Redirecting"})]})}function $O({redirectURL:e,children:t}){return b.useEffect(()=>{e&&window.location.replace(e)},[e]),e?u.jsx(KO,{}):t}function VO({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(Pt,{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(ja,{provider:n}),u.jsx(Xf,{resetComponent:e,onDisconnectSuccess:t})]})]})}function UO({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=rr(),{providerName:o}=pt(e),i=`You have successfully connected your ${o} account to ${r}.`;return u.jsx(mc,{text:i,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:u.jsx(VO,{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:c}){const{seed:f,reset:l}=dd(),d=b.useCallback(h=>{s?s(h.id):c&&c(h)},[s,c]);return u.jsx("div",{className:Ip.resetContainer,children:u.jsx(Ra,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:u.jsx(ad,{groupRef:r,provider:e,children:u.jsx(tp,{resetComponent:l,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:d,onDisconnectSuccess:a,children:u.jsx($O,{redirectURL:i,children:u.jsx(UO,{resetComponent:l,provider:e,onDisconnectSuccess:a})})})})})},f)}const HO=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=_a(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=Ca;exports.AmpersandProvider=Im;exports.ConnectProvider=qO;exports.FieldSettingWriteOnCreateEnum=fg;exports.FieldSettingWriteOnUpdateEnum=pg;exports.InstallIntegration=LO;exports.InstallationProvider=Ra;exports.useAmpersandProviderProps=Le;exports.useConfig=mb;exports.useConnection=Na;exports.useCreateInstallation=ud;exports.useDeleteInstallation=Vb;exports.useInstallation=Fr;exports.useIsIntegrationInstalled=HO;exports.useLocalConfig=hb;exports.useManifest=Ta;exports.useUpdateInstallation=ld;
|
|
52
52
|
//# sourceMappingURL=amp-react.cjs.js.map
|